mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Move UI-only waypoint number out of the model.
This isn't needed by the backend, so just handle it in the front end.
This commit is contained in:
parent
4c3509a455
commit
5cd9af32fa
@ -68,8 +68,8 @@ class FlightJs(QObject):
|
|||||||
)
|
)
|
||||||
departure.alt_type = "RADIO"
|
departure.alt_type = "RADIO"
|
||||||
waypoints = []
|
waypoints = []
|
||||||
for idx, point in enumerate([departure] + self.flight.points):
|
for point in [departure] + self.flight.points:
|
||||||
waypoint = WaypointJs(point, idx, self, self.theater, self.ato_model)
|
waypoint = WaypointJs(point, self, self.theater, self.ato_model)
|
||||||
waypoint.positionChanged.connect(self.update_waypoints)
|
waypoint.positionChanged.connect(self.update_waypoints)
|
||||||
waypoints.append(waypoint)
|
waypoints.append(waypoint)
|
||||||
return waypoints
|
return waypoints
|
||||||
|
|||||||
@ -17,7 +17,6 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
|
|
||||||
class WaypointJs(QObject):
|
class WaypointJs(QObject):
|
||||||
numberChanged = Signal()
|
|
||||||
positionChanged = Signal()
|
positionChanged = Signal()
|
||||||
altitudeFtChanged = Signal()
|
altitudeFtChanged = Signal()
|
||||||
altitudeReferenceChanged = Signal()
|
altitudeReferenceChanged = Signal()
|
||||||
@ -32,14 +31,12 @@ class WaypointJs(QObject):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
waypoint: FlightWaypoint,
|
waypoint: FlightWaypoint,
|
||||||
number: int,
|
|
||||||
flight_model: FlightJs,
|
flight_model: FlightJs,
|
||||||
theater: ConflictTheater,
|
theater: ConflictTheater,
|
||||||
ato_model: AtoModel,
|
ato_model: AtoModel,
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.waypoint = waypoint
|
self.waypoint = waypoint
|
||||||
self._number = number
|
|
||||||
self.flight_model = flight_model
|
self.flight_model = flight_model
|
||||||
self.theater = theater
|
self.theater = theater
|
||||||
self.ato_model = ato_model
|
self.ato_model = ato_model
|
||||||
@ -52,10 +49,6 @@ class WaypointJs(QObject):
|
|||||||
def flight_plan(self) -> FlightPlan:
|
def flight_plan(self) -> FlightPlan:
|
||||||
return self.flight.flight_plan
|
return self.flight.flight_plan
|
||||||
|
|
||||||
@Property(int, notify=numberChanged)
|
|
||||||
def number(self) -> int:
|
|
||||||
return self._number
|
|
||||||
|
|
||||||
@Property(list, notify=positionChanged)
|
@Property(list, notify=positionChanged)
|
||||||
def position(self) -> LeafletLatLon:
|
def position(self) -> LeafletLatLon:
|
||||||
ll = self.theater.point_to_ll(self.waypoint.position)
|
ll = self.theater.point_to_ll(self.waypoint.position)
|
||||||
|
|||||||
@ -747,8 +747,9 @@ function drawFrontLines() {
|
|||||||
const SHOW_WAYPOINT_INFO_AT_ZOOM = 9;
|
const SHOW_WAYPOINT_INFO_AT_ZOOM = 9;
|
||||||
|
|
||||||
class Waypoint {
|
class Waypoint {
|
||||||
constructor(waypoint, flight) {
|
constructor(waypoint, number, flight) {
|
||||||
this.waypoint = waypoint;
|
this.waypoint = waypoint;
|
||||||
|
this.number = number;
|
||||||
this.flight = flight;
|
this.flight = flight;
|
||||||
this.marker = this.makeMarker();
|
this.marker = this.makeMarker();
|
||||||
this.waypoint.positionChanged.connect(() => this.relocate());
|
this.waypoint.positionChanged.connect(() => this.relocate());
|
||||||
@ -804,7 +805,7 @@ class Waypoint {
|
|||||||
? "Waiting to recompute TOT..."
|
? "Waiting to recompute TOT..."
|
||||||
: this.waypoint.timing;
|
: this.waypoint.timing;
|
||||||
return (
|
return (
|
||||||
`${this.waypoint.number} ${this.waypoint.name}<br />` +
|
`${this.number} ${this.waypoint.name}<br />` +
|
||||||
`${this.waypoint.altitudeFt} ft ${this.waypoint.altitudeReference}<br />` +
|
`${this.waypoint.altitudeFt} ft ${this.waypoint.altitudeReference}<br />` +
|
||||||
`${timing}`
|
`${timing}`
|
||||||
);
|
);
|
||||||
@ -830,7 +831,7 @@ class Waypoint {
|
|||||||
.on("drag", (e) => {
|
.on("drag", (e) => {
|
||||||
const marker = e.target;
|
const marker = e.target;
|
||||||
const destination = marker.getLatLng();
|
const destination = marker.getLatLng();
|
||||||
this.flight.updatePath(this.waypoint.number, destination);
|
this.flight.updatePath(this.number, destination);
|
||||||
})
|
})
|
||||||
.on("dragend", (e) => {
|
.on("dragend", (e) => {
|
||||||
const marker = e.target;
|
const marker = e.target;
|
||||||
@ -857,7 +858,9 @@ class Flight {
|
|||||||
constructor(flight) {
|
constructor(flight) {
|
||||||
this.flight = flight;
|
this.flight = flight;
|
||||||
this.id = flight.id;
|
this.id = flight.id;
|
||||||
this.flightPlan = this.flight.flightPlan.map((p) => new Waypoint(p, this));
|
this.flightPlan = this.flight.flightPlan.map(
|
||||||
|
(p, idx) => new Waypoint(p, idx, this)
|
||||||
|
);
|
||||||
this.aircraft = null;
|
this.aircraft = null;
|
||||||
this.path = null;
|
this.path = null;
|
||||||
this.markers = [];
|
this.markers = [];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user