diff --git a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_DsplMenuPage.js b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_DsplMenuPage.js index fe8892492c..d717ed0b37 100644 --- a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_DsplMenuPage.js +++ b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/FMC/CJ4_FMC_DsplMenuPage.js @@ -7,6 +7,7 @@ class CJ4_FMC_DsplMenuPage { const intersectionsActive = fmc._templateRenderer.renderSwitch(["INTERS"], (CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.INTERSECTS) - 1)); const airportsActive = fmc._templateRenderer.renderSwitch(["APTS"], (CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.AIRPORTS) - 1)); const altitudeActive = fmc._templateRenderer.renderSwitch(["ALTITUDE"], (CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.CONSTRAINTS) - 1)); + //console.log("altitudeActive " + CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.CONSTRAINTS)); const termWptsActive = fmc._templateRenderer.renderSwitch(["TERM WPTS"], (CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.TERMWPTS) - 1)); const vnavWindowSwitch = fmc._templateRenderer.renderSwitch(["OFF", "ON", "VNAV"], WTDataStore.get("WT_CJ4_MFD_DATA_WINDOW", 1)); const missedActive = fmc._templateRenderer.renderSwitch(["MISSEDAPPR"], (CJ4_MapSymbols.hasSymbol(CJ4_MapSymbol.MISSEDAPPR) - 1)); @@ -30,11 +31,11 @@ class CJ4_FMC_DsplMenuPage { }; // TODO: disabled because of errors with mapinstrument - // fmc.onRightInput[2] = () => { - // this.toggleSymbol(CJ4_MapSymbol.CONSTRAINTS).then(() => { - // CJ4_FMC_DsplMenuPage.ShowPage1(fmc); - // }); - // }; + fmc.onRightInput[2] = () => { + CJ4_MapSymbols.toggleSymbol(CJ4_MapSymbol.CONSTRAINTS).then(() => { + CJ4_FMC_DsplMenuPage.ShowPage1(fmc); + }); + }; fmc.onRightInput[3] = () => { CJ4_MapSymbols.toggleSymbol(CJ4_MapSymbol.AIRPORTS).then(() => { @@ -65,7 +66,7 @@ class CJ4_FMC_DsplMenuPage { [""], ["HI NAVAIDS[s-text disabled]", "SPEED[s-text disabled]"], [""], - [loNavaidsActive, altitudeActive + "[disabled s-text]"], + [loNavaidsActive, altitudeActive], [""], [intersectionsActive, airportsActive], [""], diff --git a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/CJ4_Shared.js b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/CJ4_Shared.js index c85903f3d6..6482b0ba41 100644 --- a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/CJ4_Shared.js +++ b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/Shared/CJ4_Shared.js @@ -4905,7 +4905,7 @@ class CJ4_PopupMenu_LOWER extends CJ4_PopupMenu_Handler { this.endSection(); this.beginSection(); { - //this.addCheckbox("CONSTRAINTS", this.textSize, [CJ4_PopupMenu_Key.MAP_SYMBOL_CONSTRAINTS]); + this.addCheckbox("CONSTRAINTS", this.textSize, [CJ4_PopupMenu_Key.MAP_SYMBOL_CONSTRAINTS]); this.addCheckbox("GEO-POL", this.textSize, null); this.addCheckbox("AIRSPACE", this.textSize, [CJ4_PopupMenu_Key.MAP_SYMBOL_AIRSPACES]); this.addCheckbox("AIRWAYS", this.textSize, [CJ4_PopupMenu_Key.MAP_SYMBOL_AIRWAYS]); diff --git a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/MapInstrument.js b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/MapInstrument.js index 38c66a73a0..d718d88b7b 100644 --- a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/MapInstrument.js +++ b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/MapInstrument.js @@ -566,6 +566,7 @@ class MapInstrument extends ISvgMapRootElement { this.flightPlanManager.updateFlightPlan(); if (!this.showConstraints && this.constraints && this.constraints.length > 0) { + console.log("this.showConstraints " + this.showConstraints); this.constraints = []; } if (this.drawCounter === 45 || (this.showConstraints && (!this.constraints || this.constraints.length === 0))) { diff --git a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/Svg/SvgConstraintElement.js b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/Svg/SvgConstraintElement.js index 10e5d539ab..9fda831634 100644 --- a/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/Svg/SvgConstraintElement.js +++ b/src/workingtitle-vcockpits-instruments-cj4/html_ui/Pages/VCockpit/Instruments/Airliners/CJ4/WTLibs/Svg/SvgConstraintElement.js @@ -43,7 +43,10 @@ class SvgConstraintElement extends SvgMapElement { let text = "CSTR"; let speedText = ""; if (this.source) { - text = (this.source.legAltitude1 / 10).toFixed(0) + "0"; + text = this.parseConstraints(this.source); + console.log(this.source.ident + " " + text); + + //text = (this.source.legAltitude1 / 10).toFixed(0) + "0"; } if (this.source.speedConstraint > 10) { speedText = this.source.speedConstraint.toFixed(0) + "KT"; @@ -75,7 +78,7 @@ class SvgConstraintElement extends SvgMapElement { context.fillStyle = "black"; context.fillRect(0, 0, this._textWidth + map.config.waypointLabelBackgroundPaddingLeft + map.config.waypointLabelBackgroundPaddingRight, this._textHeight + map.config.waypointLabelBackgroundPaddingTop + map.config.waypointLabelBackgroundPaddingBottom); } - context.fillStyle = "magenta"; + context.fillStyle = "#11d011"; context.font = fontSize + "px " + map.config.waypointLabelFontFamily; context.fillText(text, map.config.waypointLabelBackgroundPaddingLeft, this._textHeight + map.config.waypointLabelBackgroundPaddingTop); if (this.source.speedConstraint > 0) { @@ -144,7 +147,32 @@ class SvgConstraintElement extends SvgMapElement { } } } -} + parseConstraints(waypoint) { + let constraintText = ""; + const formatConstraints = (value) => { + if (value >= 18000) { + return "FL" + (value / 100).toFixed(0); + } else { + return value.toFixed(0); + } + }; + console.log(waypoint.ident + " " + waypoint.legAltitudeDescription); + switch (waypoint.legAltitudeDescription) { + case 1: + constraintText = "/" + formatConstraints(Math.floor(waypoint.legAltitude1)) + ""; + break; + case 2: + constraintText = "/" + formatConstraints(Math.floor(waypoint.legAltitude1)) + "A"; + break; + case 3: + constraintText = "/" + formatConstraints(Math.floor(waypoint.legAltitude1)) + "B"; + break; + case 4: + constraintText = "/" + formatConstraints(Math.floor(waypoint.legAltitude2)) + "A" + formatConstraints(Math.floor(waypoint.legAltitude1)) + "B"; + break; + } + return constraintText; + }} SvgConstraintElement._ID = 0; class SvgTopOfXElement extends SvgMapElement { constructor(name, imageName) { diff --git a/src/wtsdk/src/flightplanning/FlightPlanManager.ts b/src/wtsdk/src/flightplanning/FlightPlanManager.ts index e8edde5d40..a25ae68344 100644 --- a/src/wtsdk/src/flightplanning/FlightPlanManager.ts +++ b/src/wtsdk/src/flightplanning/FlightPlanManager.ts @@ -551,7 +551,16 @@ export class FlightPlanManager { * Gets the waypoints for the current flight plan with altitude constraints. */ public getWaypointsWithAltitudeConstraints(): WayPoint[] { - return this._flightPlans[this._currentFlightPlanIndex].waypoints; + const waypointsWithConstraints = []; + const activeWaypointIndex = this.getActiveWaypointIndex(); + + for (let i = activeWaypointIndex - 1; i < this._flightPlans[this._currentFlightPlanIndex].waypoints.length; i++) { + if (this._flightPlans[this._currentFlightPlanIndex].waypoints[i].legAltitudeDescription > 0) { + waypointsWithConstraints.push(this._flightPlans[this._currentFlightPlanIndex].waypoints[i]); + } + + } + return waypointsWithConstraints; } /**