Fix CAS commit range display.

CAS commits around the target, not its flight plan.
This commit is contained in:
Dan Albert 2021-06-09 21:51:26 -07:00
parent 0594e1148e
commit 40aa7734e1

View File

@ -11,7 +11,6 @@ from dcs.vehicles import vehicle_map
from shapely.geometry import LineString, Point as ShapelyPoint, Polygon, MultiPolygon
from game import Game, db
from game.factions.faction import Faction
from game.navmesh import NavMesh
from game.profiling import logged_duration
from game.theater import (
@ -27,7 +26,7 @@ from game.transfers import MultiGroupTransport, TransportMap
from game.utils import meters, nautical_miles
from gen.ato import AirTaskingOrder
from gen.flights.flight import Flight, FlightWaypoint, FlightWaypointType
from gen.flights.flightplan import FlightPlan, PatrollingFlightPlan
from gen.flights.flightplan import FlightPlan, PatrollingFlightPlan, CasFlightPlan
from qt_ui.dialogs import Dialog
from qt_ui.models import GameModel, AtoModel
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
@ -554,13 +553,19 @@ class FlightJs(QObject):
return []
start = self.flight.flight_plan.patrol_start
end = self.flight.flight_plan.patrol_end
line = LineString(
[
ShapelyPoint(start.x, start.y),
ShapelyPoint(end.x, end.y),
]
if isinstance(self.flight.flight_plan, CasFlightPlan):
center = self.flight.flight_plan.target.position
commit_center = ShapelyPoint(center.x, center.y)
else:
commit_center = LineString(
[
ShapelyPoint(start.x, start.y),
ShapelyPoint(end.x, end.y),
]
)
bubble = commit_center.buffer(
self.flight.flight_plan.engagement_distance.meters
)
bubble = line.buffer(self.flight.flight_plan.engagement_distance.meters)
return shapely_poly_to_leaflet_points(bubble, self.theater)