diff --git a/dist/Aerofly/Mission.js b/dist/Aerofly/Mission.js index bcad985..7239637 100644 --- a/dist/Aerofly/Mission.js +++ b/dist/Aerofly/Mission.js @@ -303,11 +303,16 @@ export class Mission { break; } this.conditions.fromMainMcf(mainMcf); + let lastPosition = null; this.checkpoints = mainMcf.navigation.Route.Ways.filter((w) => { + // Please not that procedure waypoints cannot be restored as of now return [ MissionCheckpoint.TYPE_ORIGIN, MissionCheckpoint.TYPE_DEPARTURE_RUNWAY, + //MissionCheckpoint.TYPE_DEPARTURE, MissionCheckpoint.TYPE_WAYPOINT, + //MissionCheckpoint.TYPE_ARRIVAL, + //MissionCheckpoint.TYPE_APPROACH, MissionCheckpoint.TYPE_DESTINATION_RUNWAY, MissionCheckpoint.TYPE_DESTINATION, ].includes(w.type); @@ -315,6 +320,11 @@ export class Mission { }).map((w) => { let cp = new MissionCheckpoint(); cp.fromMainMcf(w); + if (lastPosition && (isNaN(cp.lon_lat.lon) || isNaN(cp.lon_lat.lat))) { + cp.lon_lat = lastPosition.getRelativeCoordinates(3, 45); + console.log(cp.lon_lat); + } + lastPosition = cp.lon_lat; return cp; }); const flight_category = this.conditions.getFlightCategory(this.origin_country !== "US"); diff --git a/dist/Aerofly/MissionCheckpoint.js b/dist/Aerofly/MissionCheckpoint.js index 60e5039..6e17ab0 100644 --- a/dist/Aerofly/MissionCheckpoint.js +++ b/dist/Aerofly/MissionCheckpoint.js @@ -222,7 +222,10 @@ export class MissionCheckpoint { } MissionCheckpoint.TYPE_ORIGIN = "origin"; MissionCheckpoint.TYPE_DEPARTURE_RUNWAY = "departure_runway"; +MissionCheckpoint.TYPE_DEPARTURE = "departure"; MissionCheckpoint.TYPE_WAYPOINT = "waypoint"; +MissionCheckpoint.TYPE_ARRIVAL = "arrival"; +MissionCheckpoint.TYPE_APPROACH = "approach"; MissionCheckpoint.TYPE_DESTINATION_RUNWAY = "destination_runway"; MissionCheckpoint.TYPE_DESTINATION = "destination"; MissionCheckpoint.TYPE_VOR = "vor"; diff --git a/src/Aerofly/Mission.ts b/src/Aerofly/Mission.ts index ede4ca6..ba5b48a 100644 --- a/src/Aerofly/Mission.ts +++ b/src/Aerofly/Mission.ts @@ -346,11 +346,17 @@ export class Mission { break; } this.conditions.fromMainMcf(mainMcf); + + let lastPosition: LonLat | null = null; this.checkpoints = mainMcf.navigation.Route.Ways.filter((w) => { + // Please not that procedure waypoints cannot be restored as of now return [ MissionCheckpoint.TYPE_ORIGIN, MissionCheckpoint.TYPE_DEPARTURE_RUNWAY, + //MissionCheckpoint.TYPE_DEPARTURE, MissionCheckpoint.TYPE_WAYPOINT, + //MissionCheckpoint.TYPE_ARRIVAL, + //MissionCheckpoint.TYPE_APPROACH, MissionCheckpoint.TYPE_DESTINATION_RUNWAY, MissionCheckpoint.TYPE_DESTINATION, ].includes(w.type); @@ -358,6 +364,13 @@ export class Mission { }).map((w) => { let cp = new MissionCheckpoint(); cp.fromMainMcf(w); + + if (lastPosition && (isNaN(cp.lon_lat.lon) || isNaN(cp.lon_lat.lat))) { + cp.lon_lat = lastPosition.getRelativeCoordinates(3, 45); + console.log(cp.lon_lat); + } + + lastPosition = cp.lon_lat; return cp; }); diff --git a/src/Aerofly/MissionCheckpoint.ts b/src/Aerofly/MissionCheckpoint.ts index 6d791d1..320491f 100644 --- a/src/Aerofly/MissionCheckpoint.ts +++ b/src/Aerofly/MissionCheckpoint.ts @@ -58,7 +58,10 @@ export class MissionCheckpoint { static TYPE_ORIGIN: MissionCheckpointType = "origin"; static TYPE_DEPARTURE_RUNWAY: MissionCheckpointType = "departure_runway"; + static TYPE_DEPARTURE: MissionCheckpointType = "departure"; static TYPE_WAYPOINT: MissionCheckpointType = "waypoint"; + static TYPE_ARRIVAL: MissionCheckpointType = "arrival"; + static TYPE_APPROACH: MissionCheckpointType = "approach"; static TYPE_DESTINATION_RUNWAY: MissionCheckpointType = "destination_runway"; static TYPE_DESTINATION: MissionCheckpointType = "destination"; static TYPE_VOR: MissionCheckpointTypeExtended = "vor";