diff --git a/salty-747/SimObjects/Airplanes/Asobo_B747_8i/model/747_8I.xml b/salty-747/SimObjects/Airplanes/Asobo_B747_8i/model/747_8I.xml index 9f1143789..bc8a115b2 100644 --- a/salty-747/SimObjects/Airplanes/Asobo_B747_8i/model/747_8I.xml +++ b/salty-747/SimObjects/Airplanes/Asobo_B747_8i/model/747_8I.xml @@ -1,4 +1,4 @@ - + @@ -32,224 +32,274 @@ - WING_BONE_LEFT_01 - WING_BONE_LEFT_02 - WING_BONE_LEFT_03 - WING_BONE_LEFT_04 - WING_BONE_RIGHT_01 - WING_BONE_RIGHT_02 - WING_BONE_RIGHT_03 - WING_BONE_RIGHT_04 - Engine_PIVOT_LEFT_1 - Engine_PIVOT_LEFT_2 - Engine_PIVOT_RIGHT_1 - Engine_PIVOT_RIGHT_2 + WING_BONE_LEFT_01 + + WING_BONE_LEFT_02 + + WING_BONE_LEFT_03 + + WING_BONE_LEFT_04 + + WING_BONE_RIGHT_01 + + WING_BONE_RIGHT_02 + + WING_BONE_RIGHT_03 + + WING_BONE_RIGHT_04 + + Engine_PIVOT_LEFT_1 + + Engine_PIVOT_LEFT_2 + + Engine_PIVOT_RIGHT_1 + + Engine_PIVOT_RIGHT_2 + - - - c_gear - - - b_gear - 1 - - - l_gear - - - r_gear - - CAM_LANDINGGEARS - 0.5 - Both - - - c_tire_key - LANDINGGEAR_Front_Wheel_Still_Center - LANDINGGEAR_Front_Wheel_Blurred_Center - - - b_tire_key - LANDINGGEAR_Back_Wheel1_Still_Right - LANDINGGEAR_Back_Wheel2_Still_Right - LANDINGGEAR_Back_Wheel1_Still_Left - LANDINGGEAR_Back_Wheel2_Still_Left - LANDINGGEAR_Back_Wheel1_Blurred_Right - LANDINGGEAR_Back_Wheel2_Blurred_Right - LANDINGGEAR_Back_Wheel1_Blurred_Left - LANDINGGEAR_Back_Wheel2_Blurred_Left - - - l_tire_key - LANDINGGEAR_Wing_Wheel1_Still_Left - LANDINGGEAR_Wing_Wheel2_Still_Left - LANDINGGEAR_Wing_Wheel1_Blurred_Left - LANDINGGEAR_Wing_Wheel2_Blurred_Left - - - r_tire_key - LANDINGGEAR_Wing_Wheel1_Still_Right - LANDINGGEAR_Wing_Wheel2_Still_Right - LANDINGGEAR_Wing_Wheel1_Blurred_Right - LANDINGGEAR_Wing_Wheel2_Blurred_Right - - - c_wheel - - - l_wheel - 1 - - - r_wheel - 2 - - - - - elevator_percent_key - - - True - trimtab_elevator_key_pct - - - l_aileron_percent_key - r_aileron_percent_key - - - rudder_percent_key - True - - - CAM_SPOILERS - 0.5 - Both - GROUND_ONLY - spoiler_ground_l - spoiler_ground_1_l - spoiler_ground_r - spoiler_ground_1_r - l_spoiler_key - r_spoiler_key - 25 - 45 - - - l_flap_percent_key - r_flap_percent_key - - CAM_FLAPS01 - 0.01 - Both - CAM_FLAPS02 - 0.15 - Both - CAM_FLAPS03 - 0.29 - Both - CAM_FLAPS04 - 0.43 - Both - CAM_FLAPS05 - 0.58 - Both - - - l_flaperon_percent_key - r_flaperon_percent_key - - - l_slats - r_slats - - - 111 - - - - - 2 - - - 2 - N1_1_anim - N1_1_anim - PROP_1_STILL_LEFT - PROP_1_STILL_FROST - PROP_1_SLOW_LEFT - PROP_1_BLURRED_LEFT - - - 1 - N1_2_anim - N1_2_anim - PROP_2_STILL_LEFT - PROP_2_STILL_FROST - PROP_2_SLOW_LEFT - PROP_2_BLURRED_LEFT - - - 3 - N1_3_anim - N1_3_anim - PROP_3_STILL_RIGHT - PROP_3_STILL_FROST - PROP_3_SLOW_RIGHT - PROP_3_BLURRED_RIGHT - - - 4 - N1_4_anim - N1_4_anim - PROP_4_STILL_RIGHT - PROP_4_STILL_FROST - PROP_4_SLOW_RIGHT - PROP_4_BLURRED_RIGHT - - - 1 - thrust_rev_1 - - - 2 - thrust_rev_2 - - - 3 - thrust_rev_3 - - - 4 - thrust_rev_4 - - - - - 12 - door_cargo - - - 10 - door_passenger - - - 1 - door_rear - - - 14 - GROUND_FUELPIPE - - - 15 - GROUND_GPUPIPE - - + + + c_gear + + + b_gear + 1 + + + l_gear + + + r_gear + + CAM_LANDINGGEARS + 0.5 + Both + + + c_tire_key + LANDINGGEAR_Front_Wheel_Still_Center + LANDINGGEAR_Front_Wheel_Blurred_Center + + + b_tire_key + LANDINGGEAR_Back_Wheel1_Still_Right + LANDINGGEAR_Back_Wheel2_Still_Right + LANDINGGEAR_Back_Wheel1_Still_Left + LANDINGGEAR_Back_Wheel2_Still_Left + LANDINGGEAR_Back_Wheel1_Blurred_Right + LANDINGGEAR_Back_Wheel2_Blurred_Right + LANDINGGEAR_Back_Wheel1_Blurred_Left + LANDINGGEAR_Back_Wheel2_Blurred_Left + + + l_tire_key + LANDINGGEAR_Wing_Wheel1_Still_Left + LANDINGGEAR_Wing_Wheel2_Still_Left + LANDINGGEAR_Wing_Wheel1_Blurred_Left + LANDINGGEAR_Wing_Wheel2_Blurred_Left + + + r_tire_key + LANDINGGEAR_Wing_Wheel1_Still_Right + LANDINGGEAR_Wing_Wheel2_Still_Right + LANDINGGEAR_Wing_Wheel1_Blurred_Right + LANDINGGEAR_Wing_Wheel2_Blurred_Right + + + c_wheel + + + l_wheel + 1 + + + r_wheel + 2 + + + + + elevator_percent_key + + + True + trimtab_elevator_key_pct + + + l_aileron_percent_key + r_aileron_percent_key + + + rudder_percent_key + True + + + CAM_SPOILERS + 0.5 + Both + GROUND_ONLY + spoiler_ground_l + spoiler_ground_1_l + spoiler_ground_r + spoiler_ground_1_r + l_spoiler_key + r_spoiler_key + 25 + 45 + + + l_flap_percent_key + r_flap_percent_key + + CAM_FLAPS01 + 0.01 + Both + CAM_FLAPS02 + 0.15 + Both + CAM_FLAPS03 + 0.29 + Both + CAM_FLAPS04 + 0.43 + Both + CAM_FLAPS05 + 0.58 + Both + + + l_flaperon_percent_key + r_flaperon_percent_key + + + l_slats + r_slats + + + 111 + + + + + 2 + + + 2 + N1_1_anim + N1_1_anim + PROP_1_STILL_LEFT + PROP_1_STILL_FROST + PROP_1_SLOW_LEFT + PROP_1_BLURRED_LEFT + + + 1 + N1_2_anim + N1_2_anim + PROP_2_STILL_LEFT + PROP_2_STILL_FROST + PROP_2_SLOW_LEFT + PROP_2_BLURRED_LEFT + + + 3 + N1_3_anim + N1_3_anim + PROP_3_STILL_RIGHT + PROP_3_STILL_FROST + PROP_3_SLOW_RIGHT + PROP_3_BLURRED_RIGHT + + + 4 + N1_4_anim + N1_4_anim + PROP_4_STILL_RIGHT + PROP_4_STILL_FROST + PROP_4_SLOW_RIGHT + PROP_4_BLURRED_RIGHT + + + 1 + thrust_rev_1 + + + 2 + thrust_rev_2 + + + 3 + thrust_rev_3 + + + 4 + thrust_rev_4 + + + + + 12 + door_cargo + + + 10 + door_passenger + + + 1 + door_rear + + + 14 + GROUND_FUELPIPE + + + 15 + GROUND_GPUPIPE + + + + + (A:CONTRAILS CONDITIONS MET:1, Keyframe) 0 > + 0 + 0 + 0 + {F42CE638-11EB-4FC8-B9B0-111A220D681F} + FX_CONTRAILS + + + + + + + + + + + + + + + + + (A:CONTRAILS CONDITIONS MET:1, Keyframe) 0 > + 0 + 0 + 0 + {904EC2CE-F8DD-4480-99E7-B33F7CF6E114} + FX_CONTRAILS_RIBBON + + + + + + + + 5 @@ -258,76 +308,43 @@ 0 {7E68323C-E75D-4F5B-988E-65DD4956F6BA} SMOKE_ON_TIRE_CONTACT + CONCRETE + ASPHALT + BITUMINUS + MACADAM + TARMAC - (A:GEAR IS SKIDDING:1, Keyframe) 0 > + (A:GEAR SKIDDING FACTOR:1, Keyframe) 0 > - (A:GEAR IS SKIDDING:2, Keyframe) 0 > + (A:GEAR SKIDDING FACTOR:2, Keyframe) 0 > - (A:GEAR IS SKIDDING:3, Keyframe) 0 > + (A:GEAR SKIDDING FACTOR:3, Keyframe) 0 > - (A:GEAR IS SKIDDING:3, Keyframe) 0 > + (A:GEAR SKIDDING FACTOR:3, Keyframe) 0 > - (A:GEAR IS SKIDDING:0, Keyframe) 0 > + (A:GEAR SKIDDING FACTOR:0, Keyframe) 0 > - - - (A:CONTRAILS CONDITIONS MET:1, Keyframe) 0 > - 0 - 0 - 0 - {F42CE638-11EB-4FC8-B9B0-111A220D681F} - FX_CONTRAILS - - - - - - - - - - - - - - - - - + + - - - (A:CONTRAILS CONDITIONS MET:1, Keyframe) 0 > - 0 - 0 - 0 - {904EC2CE-F8DD-4480-99E7-B33F7CF6E114} - FX_CONTRAILS_RIBBON - - - - - - - - - + + diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_MainDisplay.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_MainDisplay.js index 92b994d46..575fcf088 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_MainDisplay.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_MainDisplay.js @@ -1056,24 +1056,26 @@ class B747_8_FMC_MainDisplay extends Boeing_FMC { Coherent.call("HEADING_BUG_SET", 2, this._headingHoldValue); } if (!this.flightPlanManager.isActiveApproach() && this.currentFlightPhase != FlightPhase.FLIGHT_PHASE_APPROACH) { - let activeWaypoint = this.flightPlanManager.getActiveWaypoint(); - let nextActiveWaypoint = this.flightPlanManager.getNextActiveWaypoint(); - if (activeWaypoint && nextActiveWaypoint) { - let pathAngle = nextActiveWaypoint.bearingInFP - activeWaypoint.bearingInFP; - while (pathAngle < 180) { - pathAngle += 360; - } - while (pathAngle > 180) { - pathAngle -= 360; - } - let absPathAngle = 180 - Math.abs(pathAngle); - let airspeed = Simplane.getIndicatedSpeed(); - if (airspeed < 400) { - let turnRadius = airspeed * 360 / (1091 * 0.36 / airspeed) / 3600 / 2 / Math.PI; - let activateDistance = Math.pow(90 / absPathAngle, 1.6) * turnRadius * 1.2; - let distanceToActive = Avionics.Utils.computeGreatCircleDistance(planeCoordinates, activeWaypoint.infos.coordinates); - if (distanceToActive < activateDistance) { - this.flightPlanManager.setActiveWaypointIndex(this.flightPlanManager.getActiveWaypointIndex() + 1); + if (this.flightPlanManager.getWaypointsCount() > 3) { + let activeWaypoint = this.flightPlanManager.getActiveWaypoint(); + let nextActiveWaypoint = this.flightPlanManager.getNextActiveWaypoint(); + if (activeWaypoint && nextActiveWaypoint) { + let pathAngle = nextActiveWaypoint.bearingInFP - activeWaypoint.bearingInFP; + while (pathAngle < 180) { + pathAngle += 360; + } + while (pathAngle > 180) { + pathAngle -= 360; + } + let absPathAngle = 180 - Math.abs(pathAngle); + let airspeed = Simplane.getIndicatedSpeed(); + if (airspeed < 400) { + let turnRadius = airspeed * 360 / (1091 * 0.36 / airspeed) / 3600 / 2 / Math.PI; + let activateDistance = Math.pow(90 / absPathAngle, 1.6) * turnRadius * 1.2; + let distanceToActive = Avionics.Utils.computeGreatCircleDistance(planeCoordinates, activeWaypoint.infos.coordinates); + if (distanceToActive < activateDistance) { + this.flightPlanManager.setActiveWaypointIndex(this.flightPlanManager.getActiveWaypointIndex() + 1); + } } } } diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_NavRadioPage.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_NavRadioPage.js index accccf2b6..4c679b4c5 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_NavRadioPage.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/B747_8_FMC_NavRadioPage.js @@ -207,7 +207,7 @@ class B747_8_FMC_NavRadioPage { ilsFrequencyCell = "[]/ "; ilsCourseCell = "[]"; let approach = fmc.flightPlanManager.getApproach(); - if (approach && approach.name && approach.name.indexOf("ILS") !== -1) { + if (approach && approach.name && approach.isLocalizer()) { ilsFrequencyCell = Avionics.Utils.formatRunway(approach.name, true) + "/ "; let runway = fmc.flightPlanManager.getApproachRunway(); if (runway) { diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/FMCMainDisplay.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/FMCMainDisplay.js index a7dd04c6f..ebd2dd3bd 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/FMCMainDisplay.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/FMC/FMCMainDisplay.js @@ -86,6 +86,7 @@ class FMCMainDisplay extends BaseAirliners { this._pre2Frequency = 0; this._atc1Frequency = 0; this._radioNavOn = false; + this._approachInitialized = false; this._fuelVarsUpdatedGrossWeight = 0; this._fuelVarsUpdatedTripCons = 0; this._debug = 0; @@ -687,7 +688,7 @@ class FMCMainDisplay extends BaseAirliners { if (isFinite(frequency)) { let freq = Math.round(frequency * 100) / 100; let approach = this.flightPlanManager.getApproach(); - if (approach && approach.name && approach.name.indexOf("ILS") !== -1) { + if (approach && approach.name && approach.isLocalizer()) { if (this.connectIlsFrequency(freq)) { SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq); let runway = this.flightPlanManager.getApproachRunway(); @@ -2150,23 +2151,7 @@ class FMCMainDisplay extends BaseAirliners { this.flightPlanManager.onCurrentGameFlightLoaded(() => { this.flightPlanManager.updateFlightPlan(() => { this.flightPlanManager.updateCurrentApproach(() => { - let frequency = this.flightPlanManager.getApproachNavFrequency(); - if (isFinite(frequency)) { - let freq = Math.round(frequency * 100) / 100; - let approach = this.flightPlanManager.getApproach(); - if (approach && approach.name && approach.name.indexOf("ILS") !== -1) { - if (this.connectIlsFrequency(freq)) { - SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq); - let runway = this.flightPlanManager.getApproachRunway(); - if (runway) { - SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_COURSE", "number", runway.direction); - } - } - } - else { - this.vor1Frequency = freq; - } - } + this.onApproachUpdated(); if (Simplane.getAltitude() > 1000) { if (this.flightPlanManager.getWaypoints().length === 2) { Coherent.call("GET_RUNWAY_ARRIVAL").then((runwayArrivalIndex) => { @@ -2175,8 +2160,7 @@ class FMCMainDisplay extends BaseAirliners { let runwayArrival = destination.infos.unsortedOneWayRunways[runwayArrivalIndex]; if (runwayArrival) { let ilsApproachIndex = destination.infos.approaches.findIndex(approach => { - return approach.name.indexOf("ILS") != -1 && approach.name.indexOf(runwayArrival.designation) != -1; - }); + return approach.isLocalizer() && approach.name.indexOf(runwayArrival.designation) != -1; }); if (ilsApproachIndex) { this.setApproachIndex(ilsApproachIndex, () => { this.insertTemporaryFlightPlan(); @@ -2211,6 +2195,30 @@ class FMCMainDisplay extends BaseAirliners { }); this.recalculateTHRRedAccTransAlt(); } + onApproachUpdated() { + if (this._approachInitialized) { + return; + } + let frequency = this.flightPlanManager.getApproachNavFrequency(); + if (isFinite(frequency)) { + let freq = Math.round(frequency * 100) / 100; + let approach = this.flightPlanManager.getApproach(); + if (approach && approach.name && approach.name.indexOf("ILS") != -1) { + if (this.connectIlsFrequency(freq)) { + SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_ILS", "number", freq); + let runway = this.flightPlanManager.getApproachRunway(); + if (runway) { + SimVar.SetSimVarValue("L:FLIGHTPLAN_APPROACH_COURSE", "number", runway.direction); + } + } + } + else { + console.log("FMCMainDisplay - Frequency is a VOR FREQUENCY"); + this.vor1Frequency = freq; + } + this._approachInitialized = true; + } + } onFMCFlightPlanLoaded() { } recalculateTHRRedAccTransAlt() { @@ -2319,7 +2327,9 @@ class FMCMainDisplay extends BaseAirliners { if (this._checkFlightPlan <= 0) { this._checkFlightPlan = 60; this.flightPlanManager.updateFlightPlan(); - this.flightPlanManager.updateCurrentApproach(); + this.flightPlanManager.updateCurrentApproach(() => { + this.onApproachUpdated(); + }); } this._checkUpdateFuel -= _deltaTime / 1000; if (this._checkUpdateFuel <= 0) { diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/MapInstrument.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/MapInstrument.js index 99282fc91..333b76e8d 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/MapInstrument.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/MapInstrument.js @@ -591,7 +591,7 @@ class MapInstrument extends ISvgMapRootElement { this.scrollDisp.y = 0; if (this.bingMap) { if (this.isDisplayingWeather()) { - this.navMap.setRange(this.getWeatherRange()); + this.navMap.setRange(this.getWeatherRange() * this.overdrawFactor); } else { this.navMap.setRange(this.getDisplayRange() * this.overdrawFactor); diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/NDInfo.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/NDInfo.js index d72c5b9bb..4469286ed 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/NDInfo.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/NDInfo.js @@ -223,9 +223,17 @@ class Jet_MFD_NDInfo extends HTMLElement { this.waypointDistance.textContent = this.currentWaypointDistance.toFixed(0); } } - if ((_eta != this.currentWaypointTimeETA) || _force) { + let groundSpeed = Simplane.getGroundSpeed(); + if (groundSpeed < 10) { + if (this.waypointTime != null) { + this.waypointTime.textContent = "--:--"; + } + } + else if ((_eta != this.currentWaypointTimeETA) || _force) { this.currentWaypointTimeETA = _eta; let localETA = _eta; + let timeZoneOffset = Simplane.getCurrentTimeDeviation(); + localETA += timeZoneOffset; if (this.waypointTime != null) { var hours = Math.floor(localETA / 3600); var minutes = Math.floor((localETA - (hours * 3600)) / 60); diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgFlightPlanElement.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgFlightPlanElement.js index 6d0e2c614..b81d95b61 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgFlightPlanElement.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgFlightPlanElement.js @@ -11,6 +11,9 @@ class SvgFlightPlanElement extends SvgMapElement { this.hideReachedWaypoints = true; this._highlightedLegIndex = -1; this._isDashed = false; + this._lastAcknowledgedWaypoint = 0; + this._lastAcknowledgedWaypointTimer = 0; + this._isInApproach = false; } id(map) { return "flight-plan-" + this.flightPlanIndex + "-map-" + map.index; @@ -137,8 +140,13 @@ class SvgFlightPlanElement extends SvgMapElement { let departureRunwayCase; let activeWaypointIndex = -1; if (this.source) { + if (this._lastAcknowledgedWaypointTimer > 0) { + this._lastAcknowledgedWaypointTimer -= this.source.instrument.deltaTime; + if (this._lastAcknowledgedWaypointTimer < 0) + this._lastAcknowledgedWaypointTimer = 0; + } if (SimVar.GetSimVarValue("GPS OBS ACTIVE", "boolean")) { - activeWaypointIndex = this.source.getActiveWaypointIndex(false, true); + activeWaypointIndex = this.source.getActiveWaypointIndex(true); let waypoint = this.source.getActiveWaypoint(); let magvar = SimVar.GetSimVarValue("MAGVAR", "degrees"); let dir = SimVar.GetSimVarValue("GPS OBS VALUE", "degree") + magvar; @@ -160,10 +168,19 @@ class SvgFlightPlanElement extends SvgMapElement { this.points.push(next); } else { - let l = this.source.getWaypointsCount(); - activeWaypointIndex = this.source.getActiveWaypointIndex(false, true); + let nbWaypoints = this.source.getWaypointsCount(); + activeWaypointIndex = this.source.getActiveWaypointIndex(true); + let isInApproach = false; + let approach = this.source.getApproach(); + if (approach) { + isInApproach = this.source.isActiveApproach(); + } + if (isInApproach != this._isInApproach) { + this._isInApproach = isInApproach; + this._lastAcknowledgedWaypoint = 0; + } let doLastLeg = true; - if (this.source.getApproach() && this.source.getApproach().transitions.length > 0) { + if (approach && approach.transitions.length > 0) { doLastLeg = false; } if (!this.source.getIsDirectTo() && this.source.getWaypoint(0, this.flightPlanIndex)) { @@ -172,7 +189,19 @@ class SvgFlightPlanElement extends SvgMapElement { departureRunwayCase = this.source.getDepartureRunway(); } } - let pIndex = 0; + let last = nbWaypoints - (doLastLeg ? 0 : 1); + let lastApproach = 0; + if (approach) { + let lastIndex = this.source.getLastIndexBeforeApproach(); + if (lastIndex != -1) { + last = lastIndex + 1; + lastApproach = last; + if (isInApproach) { + last--; + lastApproach = 0; + } + } + } let first = 0; let firstApproach = 0; if (this.source.getIsDirectTo()) { @@ -188,22 +217,24 @@ class SvgFlightPlanElement extends SvgMapElement { } } else if (this.hideReachedWaypoints) { - first = Math.max(0, activeWaypointIndex - 1); + if (isInApproach) { + first = Infinity; + firstApproach = this.getFirstWaypointToDraw(map, activeWaypointIndex, this.source.getApproachWaypoints().length); + } + else { + first = this.getFirstWaypointToDraw(map, activeWaypointIndex, last); + } } - let approach = this.source.getApproach(); - let approachLast = (this.source.isActiveApproach() && approach) ? 0 : this.source.getLastIndexBeforeApproach(); - let last = first; - if (approachLast != -1) - last = approachLast + 1; - else - last = l - (doLastLeg ? 0 : 1); + let pIndex = 0; for (let i = first; i < last; i++) { let waypoint = this.source.getWaypoint(i, this.flightPlanIndex); if (waypoint) { let wpPoints = []; if (waypoint.transitionLLas) { - for (let j = 0; j < waypoint.transitionLLas.length; j++) { - wpPoints.push(waypoint.transitionLLas[i].toLatLong()); + if (i == 0 || i > first) { + for (let j = 0; j < waypoint.transitionLLas.length; j++) { + wpPoints.push(waypoint.transitionLLas[i].toLatLong()); + } } } wpPoints.push(waypoint.infos.coordinates.toLatLong()); @@ -292,24 +323,23 @@ class SvgFlightPlanElement extends SvgMapElement { let waypoint = waypoints[i]; if (waypoint) { let wpPoints = []; - if (i > firstApproach || !this.source.getIsDirectTo()) { - if (waypoints[i].transitionLLas) { - for (let j = 0; j < waypoints[i].transitionLLas.length; j++) { - wpPoints.push(waypoints[i].transitionLLas[j]); + if (waypoint.transitionLLas) { + if (i > firstApproach || (!this.source.getIsDirectTo() && i == 0)) { + for (let j = 0; j < waypoint.transitionLLas.length; j++) { + wpPoints.push(waypoint.transitionLLas[j]); } } } - wpPoints.push(new LatLongAlt(waypoints[i].latitudeFP, waypoints[i].longitudeFP, waypoints[i].altitudeinFP)); - for (let j = 0; j < wpPoints.length; j++) { + wpPoints.push(new LatLongAlt(waypoint.latitudeFP, waypoint.longitudeFP, waypoint.altitudeinFP)); for (let j = 0; j < wpPoints.length; j++) { if (this.points[pIndex]) { map.coordinatesToXYToRef(wpPoints[j], this.points[pIndex]); - this.points[pIndex].refWP = waypoints[i]; - this.points[pIndex].refWPIndex = approachLast + i; + this.points[pIndex].refWP = waypoint; + this.points[pIndex].refWPIndex = lastApproach + i; } else { let p = map.coordinatesToXY(wpPoints[j]); - p.refWP = waypoints[i]; - p.refWPIndex = approachLast + i; + p.refWP = waypoint; + p.refWPIndex = lastApproach + i; this.points.push(p); } pIndex++; @@ -350,6 +380,10 @@ class SvgFlightPlanElement extends SvgMapElement { xNext /= dNext; yNext /= dNext; let b = Math.min(dPrev / 3, dNext / 3, bevelAmount); + let dot = Math.abs(xPrev * xNext + yPrev * yNext) / (dPrev / dNext); + if (Math.abs(dot) > 0.99) { + b = 10; + } let refWPIndex = p.refWPIndex + (((bevels === 1) && (i % 2 === 0)) ? 1 : 0); let refWP = (((bevels === 1) && (i % 2 === 0)) ? pNext.refWP : p.refWP); beveledPoints.push({ @@ -399,6 +433,7 @@ class SvgFlightPlanElement extends SvgMapElement { let s2 = new Vec2(); let p1 = null; let p2 = null; + let indexToHighlight = activeWaypointIndex; for (let i = 0; i < this.points.length; i++) { let p = this.points[i]; if (!p || isNaN(p.x) || isNaN(p.y)) { @@ -417,13 +452,9 @@ class SvgFlightPlanElement extends SvgMapElement { } } else if (!this._isDashed && this.highlightActiveLeg) { - if (this.source.getActiveWaypoint(false, true)) { - if (p2.refWP === this.source.getActiveWaypoint(false, true)) { - isHighlit = true; - } - } - else if (activeWaypointIndex <= 1 && p2.refWPIndex <= activeWaypointIndex) { + if (p2.refWPIndex == indexToHighlight || (indexToHighlight == 0 && p1.refWPIndex == indexToHighlight)) { isHighlit = true; + indexToHighlight = p2.refWPIndex; } } if (map.segmentVsFrame(p1, p2, s1, s2)) { @@ -538,6 +569,61 @@ class SvgFlightPlanElement extends SvgMapElement { } } } + getFirstWaypointToDraw(_map, _active, _last) { + let first = Math.max(0, _active - 1); + if (first < this._lastAcknowledgedWaypoint) { + this._lastAcknowledgedWaypoint = first; + } + if (first >= _last) { + first = _last - 1; + } + let min = this._lastAcknowledgedWaypoint + 1; + while (first >= min) { + let firstWpt; + let nextWpt; + if (this.source.getApproach() && this.source.isActiveApproach()) { + firstWpt = this.source.getApproachWaypoints()[first]; + nextWpt = this.source.getApproachWaypoints()[first + 1]; + } + else { + firstWpt = this.source.getWaypoint(first, this.flightPlanIndex); + if ((first + 1) < _last) { + nextWpt = this.source.getWaypoint(first + 1, this.flightPlanIndex); + } + else if (this.source.getApproach()) { + nextWpt = this.source.getApproachWaypoints()[0]; + } + } + if (!nextWpt) { + first--; + continue; + } + if (firstWpt.latitudeFP !== undefined && firstWpt.longitudeFP !== undefined) { + let p1 = _map.coordinatesToXY(new LatLong(firstWpt.latitudeFP, firstWpt.longitudeFP)); + let p2 = _map.coordinatesToXY(new LatLong(nextWpt.latitudeFP, nextWpt.longitudeFP)); + let ll = _map.coordinatesToXY(this.source.planeCoordinates); + let v1 = Vec2.Delta(ll, p1); + let v2 = Vec2.Delta(p2, p1); + if (v1.GetNorm() < v2.GetNorm() * 0.1) { + first--; + continue; + } + v1.Normalize(); + v2.Normalize(); + let dot = v1.Dot(v2); + if (dot < 0.5) { + first--; + continue; + } + if (this._lastAcknowledgedWaypointTimer <= 0) { + this._lastAcknowledgedWaypoint++; + this._lastAcknowledgedWaypointTimer = 10000; + } + break; + } + } + return this._lastAcknowledgedWaypoint; + } updateTrackLineAndArc() { /*Update Track Line*/ let isInCTRmode = SimVar.GetSimVarValue("L:BTN_CTR_ACTIVE", "bool"); diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgWaypointElement.js b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgWaypointElement.js index 4b31b8adf..ef8239373 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgWaypointElement.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/Airliners/B747_8/MFD/Svg/SvgWaypointElement.js @@ -106,7 +106,7 @@ class SvgWaypointElement extends SvgMapElement { this._textWidth = ctx.measureText(text).width; this._textHeight = fontSize * 0.675; let ident; - let activeWaypoint = FlightPlanManager.DEBUG_INSTANCE.getActiveWaypoint(false, true); + let activeWaypoint = FlightPlanManager.DEBUG_INSTANCE.getActiveWaypoint(true); if (activeWaypoint) { ident = activeWaypoint.ident; } @@ -248,7 +248,10 @@ class SvgWaypointElement extends SvgMapElement { this.x = pos.x; this.y = pos.y; } - let wp = FlightPlanManager.DEBUG_INSTANCE.getActiveWaypoint(false, true); + let wp; + if (this.source && this.source.instrument && this.source.instrument.flightPlanManager) { + this.source.instrument.flightPlanManager.getActiveWaypoint(true); + } let isActiveWaypoint = this.source === wp || (wp && wp.icao === this.source.icao); if (isActiveWaypoint != this._lastIsActiveWaypoint) { this._refreshLabel(map, isActiveWaypoint); diff --git a/salty-747/html_ui/Pages/VCockpit/Instruments/NavSystems/Shared/Salty_NavSystem.js b/salty-747/html_ui/Pages/VCockpit/Instruments/NavSystems/Shared/Salty_NavSystem.js index 6ae78b725..12dec3697 100644 --- a/salty-747/html_ui/Pages/VCockpit/Instruments/NavSystems/Shared/Salty_NavSystem.js +++ b/salty-747/html_ui/Pages/VCockpit/Instruments/NavSystems/Shared/Salty_NavSystem.js @@ -333,8 +333,7 @@ class NavSystem extends BaseInstrument { this.updateAspectRatio(); if (this.currFlightPlanManager) { this.currFlightPlanManager.update(this.deltaTime); - if (this.currFlightPlanManager.isLoadedApproach() && !this.currFlightPlanManager.isActiveApproach() && (this.currFlightPlanManager.getActiveWaypointIndex() == -1 || (this.currFlightPlanManager.getActiveWaypointIndex() > this.currFlightPlanManager.getLastIndexBeforeApproach()))) { - if (SimVar.GetSimVarValue("L:FMC_FLIGHT_PLAN_IS_TEMPORARY", "number") != 1) { + if (this.currFlightPlanManager.isLoadedApproach() && !this.currFlightPlanManager.isActiveApproach() && !this.currFlightPlanManager.getIsDirectTo() && (this.currFlightPlanManager.getActiveWaypointIndex() == -1 || (this.currFlightPlanManager.getActiveWaypointIndex() > this.currFlightPlanManager.getLastIndexBeforeApproach()))) { if (SimVar.GetSimVarValue("L:FMC_FLIGHT_PLAN_IS_TEMPORARY", "number") != 1) { this.currFlightPlanManager.tryAutoActivateApproach(); } }