├── ContentInfo └── pms50-gns530 │ ├── info.json │ └── Thumbnail.jpg ├── .gitignore ├── html_ui ├── Pages │ └── VCockpit │ │ └── Instruments │ │ ├── NavSystems │ │ └── GPS │ │ │ ├── AS430 │ │ │ └── AS430.html │ │ │ └── AS530 │ │ │ └── AS530.html │ │ └── Shared │ │ └── Map │ │ └── Images │ │ └── Outlined │ │ ├── ICON_MAP_TCAS_TA_530.svg │ │ ├── ICON_MAP_TCAS_RA_530.svg │ │ ├── ICON_MAP_TCAS_OTHER_530.svg │ │ ├── ICON_MAP_TCAS_PROX_530.svg │ │ └── ICON_MAP_PLANE_GNS530.svg └── Pms50 │ └── Pages │ └── VCockpit │ └── Instruments │ ├── NavSystems │ ├── Shared │ │ ├── Images │ │ │ └── GPS │ │ │ │ ├── Dme.png │ │ │ │ ├── Ndb.png │ │ │ │ ├── Tacan.png │ │ │ │ ├── Vor.png │ │ │ │ ├── brg.png │ │ │ │ ├── glogo.png │ │ │ │ ├── north.png │ │ │ │ ├── Anchor.png │ │ │ │ ├── Helipad.png │ │ │ │ ├── Marker.png │ │ │ │ ├── compass.png │ │ │ │ ├── repere.png │ │ │ │ ├── Localizer.png │ │ │ │ ├── arc_left.png │ │ │ │ ├── arc_right.png │ │ │ │ ├── cdi_arrow.png │ │ │ │ ├── cdi_tofrom.png │ │ │ │ ├── compass2.png │ │ │ │ ├── course_to.png │ │ │ │ ├── direct_to.png │ │ │ │ ├── left_hand.png │ │ │ │ ├── left_turn.png │ │ │ │ ├── right_hand.png │ │ │ │ ├── right_turn.png │ │ │ │ ├── Airport_Soft.png │ │ │ │ ├── Intersection.png │ │ │ │ ├── Airport_Hard_EW.png │ │ │ │ ├── Airport_Hard_NS.png │ │ │ │ ├── Private_Airfield.png │ │ │ │ ├── vectors_to_final.png │ │ │ │ ├── Airport_Hard_NE_SW.png │ │ │ │ └── Airport_Hard_NW_SE.png │ │ └── LogicElements │ │ │ ├── Messages.js │ │ │ ├── ContextualMenu.js │ │ │ ├── CustomValue.js │ │ │ └── SelectableElement.js │ └── GPS │ │ ├── AS430 │ │ ├── mapConfig.json │ │ └── AS430.js │ │ ├── AS530 │ │ ├── mapConfig.json │ │ └── AS530.js │ │ └── Shared │ │ ├── Vnav.js │ │ ├── DirectTo.js │ │ ├── AuxPages.js │ │ ├── Message.js │ │ └── NearestPages.js │ └── Shared │ ├── FlightElements │ └── Approach.js │ └── Map │ ├── Svg │ ├── SvgNearestIntersectionElement.js │ ├── SvgNearestNDBElement.js │ ├── SvgNearestVORElement.js │ └── SvgWaypointElement.js │ ├── MapInstrument.css │ └── MapInstrument.html ├── Config └── pms50-gns530 │ └── example_config.json ├── manifest.json └── layout.json /ContentInfo/pms50-gns530/info.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0.53", 3 | "author": "PMS50" 4 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pln 2 | .vscode/launch.json 3 | Config/pms50-gns530/config.json 4 | html_ui/Official/* 5 | -------------------------------------------------------------------------------- /ContentInfo/pms50-gns530/Thumbnail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/ContentInfo/pms50-gns530/Thumbnail.jpg -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Dme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Dme.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Ndb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Ndb.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Tacan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Tacan.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Vor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Vor.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/brg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/brg.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/glogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/glogo.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/north.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/north.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Anchor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Anchor.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Helipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Helipad.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Marker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Marker.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/repere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/repere.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Localizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Localizer.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_left.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_right.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_arrow.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_tofrom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_tofrom.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass2.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/course_to.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/course_to.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/direct_to.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/direct_to.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_hand.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_turn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_turn.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_hand.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_hand.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_turn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_turn.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Soft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Soft.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Intersection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Intersection.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_EW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_EW.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NS.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Private_Airfield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Private_Airfield.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/vectors_to_final.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/vectors_to_final.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NE_SW.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NE_SW.png -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NW_SE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimarc/pms50-gns530/HEAD/html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NW_SE.png -------------------------------------------------------------------------------- /Config/pms50-gns530/example_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "weather_radar": "off", 3 | "weather_legend": "on", 4 | "metar_avwx_token": "", 5 | "metar_decode": "off", 6 | "wa_uturn_bug": "off", 7 | "wa_add_waypoint_bug": "on", 8 | "disable_messaging": "off", 9 | "disable_airspace_messages": "on", 10 | "disable_traffic": "off" 11 | } -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": [], 3 | "content_type": "CUSTOM", 4 | "title": "PMS50 GNS530 Mod", 5 | "manufacturer": "", 6 | "creator": "PMS50", 7 | "package_version": "1.0.53", 8 | "minimum_game_version": "1.21.12", 9 | "release_notes": { 10 | "neutral": { 11 | "LastUpdate": "", 12 | "OlderHistory": "" 13 | } 14 | }, 15 | "total_package_size": "00000000000001571724" 16 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/FlightElements/Approach.js: -------------------------------------------------------------------------------- 1 | class Approach { 2 | constructor() { 3 | this.transitions = []; 4 | this.wayPoints = []; 5 | this.transitions = []; 6 | } 7 | isLocalizer() { 8 | let type = Simplane.getAutoPilotApproachType(); 9 | if (type == ApproachType.APPROACH_TYPE_ILS || type == ApproachType.APPROACH_TYPE_LOCALIZER || type == ApproachType.APPROACH_TYPE_LOCALIZER_BACK_COURSE) 10 | return true; 11 | return false; 12 | } 13 | } 14 | class ApproachWayPoint extends WayPoint { 15 | } 16 | class Transition { 17 | constructor() { 18 | this.waypoints = []; 19 | } 20 | } 21 | //# sourceMappingURL=Approach.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestIntersectionElement.js: -------------------------------------------------------------------------------- 1 | class SvgNearestIntersectionElement extends SvgWaypointElement { 2 | id(map) { 3 | return "nrst-intersection-" + this.icaoNoSpace + "-map-" + map.index; 4 | } 5 | class() { 6 | return "map-nrst-intersection"; 7 | } 8 | imageFileName() { 9 | let fName = ""; 10 | if (this.source) { 11 | fName = this.source.imageFileName(); 12 | } 13 | if (!fName) { 14 | fName = "ICON_MAP_INTERSECTION.svg"; 15 | } 16 | if (BaseInstrument.useSvgImages) { 17 | return fName; 18 | } 19 | return fName.replace(".svg", ".png"); 20 | } 21 | isMinized(map) { 22 | if (map.instrument) { 23 | let r = map.instrument.getDeclutteredRange(); 24 | return r > map.instrument.intersectionMaxRange && r < map.instrument.minimizedIntersectionMaxRange; 25 | } 26 | } 27 | } 28 | //# sourceMappingURL=SvgNearestIntersectionElement.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestNDBElement.js: -------------------------------------------------------------------------------- 1 | class SvgNearestNDBElement extends SvgWaypointElement { 2 | constructor(source) { 3 | super(source); 4 | this.textOffsetRatio = 0; 5 | this.sortIndex = 1; 6 | } 7 | get ndbType() { 8 | if (this._ndbType) { 9 | return this._ndbType; 10 | } 11 | if (this.source) { 12 | return this.source.ndbType; 13 | } 14 | } 15 | set ndbType(v) { 16 | this._ndbType = v; 17 | } 18 | id(map) { 19 | return "nrst-ndb-" + this.ident + "-map-" + map.index; 20 | } 21 | class() { 22 | return "map-nrst-ndb"; 23 | } 24 | imageFileName() { 25 | let fName = ""; 26 | if (this.source && this.source.imageFileName) { 27 | fName = this.source.imageFileName(); 28 | } 29 | else { 30 | if (this.ndbType === 1) { 31 | fName = "ICON_MAP_NDB_WAYPOINT.svg"; 32 | } 33 | else { 34 | fName = "ICON_MAP_NDB_WAYPOINT.svg"; 35 | } 36 | } 37 | if (BaseInstrument.useSvgImages) { 38 | return fName; 39 | } 40 | return fName.replace(".svg", ".png"); 41 | } 42 | isMinized(map) { 43 | if (map.instrument) { 44 | let r = map.instrument.getDeclutteredRange(); 45 | return r > map.instrument.ndbMaxRange && r < map.instrument.minimizedNdbMaxRange; 46 | } 47 | } 48 | } 49 | //# sourceMappingURL=SvgNearestNDBElement.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestVORElement.js: -------------------------------------------------------------------------------- 1 | class SvgNearestVORElement extends SvgWaypointElement { 2 | constructor(source) { 3 | super(source); 4 | this.sortIndex = 2; 5 | } 6 | get vorType() { 7 | if (this._vorType) { 8 | return this._vorType; 9 | } 10 | if (this.source) { 11 | return this.source.vorType; 12 | } 13 | } 14 | set vorType(v) { 15 | this._vorType = v; 16 | } 17 | id(map) { 18 | return "nrst-vor-" + this.ident + "-map-" + map.index; 19 | } 20 | class() { 21 | return "map-nrst-vor"; 22 | } 23 | imageFileName() { 24 | let fName = ""; 25 | if (this.source) { 26 | fName = this.source.imageFileName(); 27 | } 28 | else { 29 | switch (this.vorType) { 30 | case 1: 31 | fName = "ICON_MAP_VOR.svg"; 32 | case 2: 33 | fName = "ICON_MAP_VOR_DME.svg"; 34 | case 3: 35 | fName = "ICON_MAP_VOR_DME.svg"; 36 | case 4: 37 | fName = "ICON_MAP_VOR_TACAN.svg"; 38 | case 5: 39 | fName = "ICON_MAP_VOR_VORTAC.svg"; 40 | case 6: 41 | fName = "ICON_MAP_VOR.svg"; 42 | } 43 | } 44 | if (BaseInstrument.useSvgImages) { 45 | return fName; 46 | } 47 | return fName.replace(".svg", ".png"); 48 | } 49 | isMinized(map) { 50 | if (map.instrument) { 51 | let r = map.instrument.getDeclutteredRange(); 52 | return r > map.instrument.vorMaxRange && r < map.instrument.minimizedVorMaxRange; 53 | } 54 | } 55 | } 56 | //# sourceMappingURL=SvgNearestVORElement.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/Messages.js: -------------------------------------------------------------------------------- 1 | class Message { 2 | SetAirspaceMessageType(_airspaceMsgType) { 3 | this.airspaceMessageType = _airspaceMsgType; 4 | switch (this.airspaceMessageType) { 5 | case 0: 6 | this.message = ""; 7 | break; 8 | case 1: 9 | this.message = "Near airspace less than 2nm"; 10 | break; 11 | case 2: 12 | this.message = "Airpsace ahead -- less than 10 minutes"; 13 | break; 14 | case 3: 15 | this.message = "Airspace near and ahead"; 16 | break; 17 | case 4: 18 | this.message = "Inside airspace"; 19 | break; 20 | } 21 | } 22 | } 23 | class MessageList { 24 | constructor(_instrument) { 25 | this.messages = []; 26 | this.instrument = _instrument; 27 | this.haveNewMessages = false; 28 | this.batch = new SimVar.SimVarBatch("C:fs9gps:MessageItemsNumber", "C:fs9gps:MessageCurrentLine"); 29 | this.batch.add("C:fs9gps:MessageCurrentType", "number", "number"); 30 | } 31 | Update() { 32 | if (MessageList.readManager.AddToQueue(this.instrument, this)) { 33 | this.loadState = 0; 34 | } 35 | this.haveNewMessages = (SimVar.GetSimVarValue("C:fs9gps:NewMessagesNumber", "number") > 0); 36 | } 37 | SetNewMessagesRead() { 38 | SimVar.SetSimVarValue("C:fs9gps:NewMessagesConfirm", "number", 0); 39 | } 40 | LoadData() { 41 | switch (this.loadState) { 42 | case 0: 43 | SimVar.GetSimVarArrayValues(this.batch, function (_values) { 44 | for (var i = 0; i < _values.length; i++) { 45 | var message = new Message(); 46 | message.SetAirspaceMessageType(_values[i][0]); 47 | this.loadState++; 48 | } 49 | }.bind(this)); 50 | this.loadState++; 51 | break; 52 | } 53 | } 54 | IsUpToDate() { 55 | return this.loadState == 2; 56 | } 57 | EndLoad() { 58 | } 59 | } 60 | MessageList.readManager = new InstrumentDataReadManager(); 61 | //# sourceMappingURL=Messages.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --bodyHeightScale: 1; 3 | } 4 | 5 | @keyframes TemporaryShow { 6 | 0%, 100% { 7 | visibility: visible; 8 | } 9 | } 10 | @keyframes TemporaryHide { 11 | 0%, 100% { 12 | visibility: hidden; 13 | } 14 | } 15 | html { 16 | height: 100%; 17 | width: 100%; 18 | overflow: hidden; 19 | } 20 | html body { 21 | -webkit-user-select: none; 22 | font-family: var(--font); 23 | font-size: calc(var(--viewportHeightRatio) * (36px / 21.6) * var(--currentPageHeight) / 100 ); 24 | color: white; 25 | height: 100%; 26 | width: 100%; 27 | margin: 0; 28 | padding: 0; 29 | } 30 | 31 | #highlight { 32 | position: absolute; 33 | height: 100%; 34 | width: 100%; 35 | z-index: 10; 36 | } 37 | 38 | #Electricity { 39 | width: 100%; 40 | height: 100%; 41 | } 42 | #Electricity[state=off] { 43 | display: none; 44 | } 45 | map-instrument { 46 | position: absolute; 47 | width: 100%; 48 | height: 100%; 49 | top: 0%; 50 | left: 0%; 51 | display: block; 52 | overflow: hidden; 53 | /* Map position (left and top) is set in mapConfig.json file (see SvgMapConfig.ts) (makes it editable at runtime) */ 54 | /* Map position (left and top) is set in mapConfig.json file (see SvgMapConfig.ts) (makes it editable at runtime) */ 55 | } 56 | map-instrument #MapOrientation { 57 | position: absolute; 58 | top: 0%; 59 | right: 0%; 60 | width: 13%; 61 | height: calc( 2.5 * 1vh * var(--bodyHeightScale)); 62 | background-color: #1a1d21; 63 | color: white; 64 | } 65 | map-instrument #MapRange { 66 | position: absolute; 67 | bottom: 0%; 68 | right: 0%; 69 | width: 5%; 70 | height: calc( 6 * 1vh * var(--bodyHeightScale)); 71 | background-color: #1a1d21; 72 | color: aquamarine; 73 | text-align: center; 74 | } 75 | map-instrument #MapSVG, map-instrument #road-network-canvas { 76 | position: absolute; 77 | } 78 | map-instrument bing-map { 79 | position: absolute; 80 | } 81 | map-instrument #MapCursor { 82 | position: absolute; 83 | left: 50%; 84 | top: 50%; 85 | } 86 | @keyframes cursorblink { 87 | 0%, 40% { 88 | fill: white; 89 | stroke: black; 90 | } 91 | 60%, 100% { 92 | fill: black; 93 | stroke: white; 94 | } 95 | } 96 | map-instrument #MapCursor polygon { 97 | animation: cursorblink 1s infinite; 98 | } 99 | map-instrument #WeatherSVG { 100 | position: absolute; 101 | top: 0%; 102 | left: 0%; 103 | width: 100%; 104 | height: 100%; 105 | } 106 | 107 | /*# sourceMappingURL=MapInstrument.css.map */ 108 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_TA_530.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 46 | 48 | 49 | 51 | image/svg+xml 52 | 54 | 55 | 56 | 57 | 58 | 63 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_RA_530.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 46 | 48 | 49 | 51 | image/svg+xml 52 | 54 | 55 | 56 | 57 | 58 | 63 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_OTHER_530.svg: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 45 | 47 | 48 | 50 | image/svg+xml 51 | 53 | 54 | 55 | 56 | 57 | 62 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_PROX_530.svg: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 45 | 47 | 48 | 50 | image/svg+xml 51 | 53 | 54 | 55 | 56 | 57 | 62 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/ContextualMenu.js: -------------------------------------------------------------------------------- 1 | class ContextualMenu { 2 | constructor(_title, _elements) { 3 | this.title = _title; 4 | this.elements = _elements; 5 | } 6 | Update(_gps, _maxElems = 6) { 7 | diffAndSetHTML(_gps.contextualMenuTitle, this.title); 8 | var elementsHTML = ""; 9 | _gps.UpdateSlider(_gps.menuSlider, _gps.menuSliderCursor, _gps.contextualMenuDisplayBeginIndex, _gps.currentContextualMenu.elements.length, _maxElems); 10 | for (var i = _gps.contextualMenuDisplayBeginIndex; i < Math.min(this.elements.length, _gps.contextualMenuDisplayBeginIndex + _maxElems); i++) { 11 | if (this.elements[i].isInactive()) { 12 | elementsHTML += '
' + this.elements[i].name + '
'; 13 | } 14 | else { 15 | if (i == _gps.cursorIndex) { 16 | elementsHTML += '
' + this.elements[i].name + '
'; 17 | } 18 | else { 19 | elementsHTML += '
' + this.elements[i].name + '
'; 20 | } 21 | } 22 | } 23 | diffAndSetHTML(_gps.contextualMenuElements, elementsHTML); 24 | } 25 | // PM Modif: Check all inactive 26 | isAllInactive() { 27 | for (var i = 0; i < this.elements.length; i++) { 28 | if(!this.elements[i].isInactive()) { 29 | return false; 30 | } 31 | } 32 | return true; 33 | } 34 | // PM Modif: End Check all inactive 35 | } 36 | class ContextualMenuConfirmation extends ContextualMenu { 37 | constructor(_title, _elements, _message) { 38 | super(_title, _elements); 39 | this.message = _message; 40 | } 41 | Update(_gps) { 42 | diffAndSetHTML(_gps.contextualMenuTitle, this.title); 43 | var ElementsHTML = ""; 44 | diffAndSetAttribute(_gps.menuSlider, "state", "Inactive"); 45 | ElementsHTML += '
' + this.message + '
'; 46 | ElementsHTML += '
'; 47 | ElementsHTML += '
' + this.elements[0].name + '
'; 48 | ElementsHTML += '
 or 
'; 49 | ElementsHTML += '
' + this.elements[1].name + '
'; 50 | diffAndSetHTML(_gps.contextualMenuElements, ElementsHTML); 51 | } 52 | } 53 | class ContextualMenuElement { 54 | constructor(_name, _callBack, _isInactive = false) { 55 | this.name = _name; 56 | this.callBack = _callBack; 57 | this.inactiveCallback = _isInactive; 58 | } 59 | SendEvent() { 60 | return this.callBack(); 61 | } 62 | isInactive() { 63 | if (this.inactiveCallback instanceof Function) { 64 | return this.inactiveCallback(); 65 | } 66 | else { 67 | return this.inactiveCallback; 68 | } 69 | } 70 | } 71 | //# sourceMappingURL=ContextualMenu.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/mapConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "waypointLabelFontSize": 50, 3 | "waypointLabelFontFamily": "Consolas", 4 | "waypointLabelColor": "#3f4851", 5 | "waypointLabelStrokeColor": "#3f3f3f", 6 | "waypointLabelStrokeWidth": 0, 7 | "waypointLabelUseBackground": true, 8 | "waypointLabelBackgroundColor": "#ffffff", 9 | "waypointLabelBackgroundStrokeColor": "black", 10 | "waypointLabelBackgroundStrokeWidth": 0, 11 | "waypointLabelBackgroundPadding": "5 5 5 5", 12 | "waypointLabelDistance": -10, 13 | "waypointIconSize": 120, 14 | 15 | "cityLabelFontSize": 24, 16 | "cityLabelFontFamily": "Consolas", 17 | "cityLabelColor": "#black", 18 | "cityLabelStrokeColor": "#3f3f3f", 19 | "cityLabelStrokeWidth": 0, 20 | "cityLabelUseBackground": false, 21 | "cityLabelBackgroundColor": "white", 22 | "cityLabelBackgroundStrokeColor": "red", 23 | "cityLabelBackgroundStrokeWidth": 10, 24 | "cityLabelBackgroundPadding": "7 12 0 12", 25 | "cityLabelDistance": 0.45, 26 | "cityIconSize": 90, 27 | 28 | "airplaneIconSize": 80, 29 | "airplaneIcon1": "ICON_MAP_PLANE_GNS530", 30 | "airplaneIcon2": "ICON_MAP_PLANE_GNS530", 31 | 32 | "imagesDir": "/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/", 33 | 34 | "runwayFillColor": "white", 35 | "runwayStrokeColor": "gray", 36 | "runwayStrokeWidth": 3, 37 | "runwayCornerRadius": 8, 38 | "runwayMinimalWidth": 16, 39 | 40 | "latLonStrokeColor": "gray", 41 | "latLonStrokeWidth": 1, 42 | "latLonLabelFontFamily": "Consolas", 43 | "latLonLabelFontSize": 14, 44 | "latLonLabelColor": "white", 45 | "latLonLabelStrokeColor": "none", 46 | "latLonLabelStrokeWidth": 0, 47 | 48 | "flightPlanActiveLegColor": "#ed008c", 49 | "flightPlanActiveLegWidth": 6, 50 | "flightPlanActiveLegStrokeColor": "#3f3f3f", 51 | "flightPlanActiveLegStrokeWidth": 7, 52 | "flightPlanNonActiveLegColor": "#ffffff", 53 | "flightPlanNonActiveLegWidth": 6, 54 | "flightPlanNonActiveLegStrokeColor": "#3f3f3f", 55 | "flightPlanNonActiveLegStrokeWidth": 7, 56 | "flightPlanDirectLegColor": "MediumOrchid", 57 | "flightPlanDirectLegWidth": 7, 58 | 59 | "roadMotorWayColor": "#7a7a7a", 60 | "roadMotorWayWidth": 2, 61 | "roadTrunkColor": "#7a7a7a", 62 | "roadTrunkWidth": 1.5, 63 | "roadPrimaryColor": "#7a7a7a", 64 | "roadPrimaryWidth": 1, 65 | 66 | "railwayStrokeColor": "gray", 67 | "railwayWidth": 2, 68 | "railwayDashLength": 6, 69 | 70 | "netBingMapTextureResolution": 1024, 71 | "netBingAltitudeColors1": [], 72 | "netBingWaterColor1": "#1c28c0", 73 | "netBingHeightColor1": [ 74 | { 75 | "alt": 0, 76 | "color": "#000000" 77 | }, 78 | { 79 | "alt": 9000, 80 | "color": "#000000" 81 | } 82 | ], 83 | 84 | "netBingAltitudeColors2": [], 85 | "netBingWaterColor2": "#1c28c0", 86 | "netBingHeightColor2": [ 87 | { 88 | "alt": 0, 89 | "color": "#dc0f1c" 90 | }, 91 | { 92 | "alt": 500, 93 | "color": "#a29a0f" 94 | }, 95 | { 96 | "alt": 1000, 97 | "color": "#4c9d24" 98 | }, 99 | { 100 | "alt": 1500, 101 | "color": "#000000" 102 | } 103 | ], 104 | 105 | "netBingAltitudeColors3": [], 106 | "netBingWaterColor3": "#000000", 107 | "netBingHeightColor3": [ 108 | { 109 | "alt": 0, 110 | "color": "#000000" 111 | }, 112 | { 113 | "alt": 9000, 114 | "color": "#000000" 115 | } 116 | ] 117 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/mapConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "waypointLabelFontSize": 50, 3 | "waypointLabelFontFamily": "Consolas", 4 | "waypointLabelColor": "#3f4851", 5 | "waypointLabelStrokeColor": "#3f3f3f", 6 | "waypointLabelStrokeWidth": 0, 7 | "waypointLabelUseBackground": true, 8 | "waypointLabelBackgroundColor": "#ffffff", 9 | "waypointLabelBackgroundStrokeColor": "black", 10 | "waypointLabelBackgroundStrokeWidth": 0, 11 | "waypointLabelBackgroundPadding": "5 5 5 5", 12 | "waypointLabelDistance": -10, 13 | "waypointIconSize": 120, 14 | 15 | "cityLabelFontSize": 24, 16 | "cityLabelFontFamily": "Consolas", 17 | "cityLabelColor": "#black", 18 | "cityLabelStrokeColor": "#3f3f3f", 19 | "cityLabelStrokeWidth": 0, 20 | "cityLabelUseBackground": false, 21 | "cityLabelBackgroundColor": "white", 22 | "cityLabelBackgroundStrokeColor": "red", 23 | "cityLabelBackgroundStrokeWidth": 10, 24 | "cityLabelBackgroundPadding": "7 12 0 12", 25 | "cityLabelDistance": 0.45, 26 | "cityIconSize": 90, 27 | 28 | "airplaneIconSize": 80, 29 | "airplaneIcon1": "ICON_MAP_PLANE_GNS530", 30 | "airplaneIcon2": "ICON_MAP_PLANE_GNS530", 31 | 32 | "imagesDir": "/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/", 33 | 34 | "runwayFillColor": "white", 35 | "runwayStrokeColor": "gray", 36 | "runwayStrokeWidth": 3, 37 | "runwayCornerRadius": 8, 38 | "runwayMinimalWidth": 16, 39 | 40 | "latLonStrokeColor": "gray", 41 | "latLonStrokeWidth": 1, 42 | "latLonLabelFontFamily": "Consolas", 43 | "latLonLabelFontSize": 14, 44 | "latLonLabelColor": "white", 45 | "latLonLabelStrokeColor": "none", 46 | "latLonLabelStrokeWidth": 0, 47 | 48 | "flightPlanActiveLegColor": "#ed008c", 49 | "flightPlanActiveLegWidth": 6, 50 | "flightPlanActiveLegStrokeColor": "#3f3f3f", 51 | "flightPlanActiveLegStrokeWidth": 7, 52 | "flightPlanNonActiveLegColor": "#ffffff", 53 | "flightPlanNonActiveLegWidth": 6, 54 | "flightPlanNonActiveLegStrokeColor": "#3f3f3f", 55 | "flightPlanNonActiveLegStrokeWidth": 7, 56 | "flightPlanDirectLegColor": "MediumOrchid", 57 | "flightPlanDirectLegWidth": 7, 58 | 59 | 60 | "roadMotorWayColor": "#7a7a7a", 61 | "roadMotorWayWidth": 1, 62 | "roadTrunkColor": "#7a7a7a", 63 | "roadTrunkWidth": 1, 64 | "roadPrimaryColor": "#7a7a7a", 65 | "roadPrimaryWidth": 1, 66 | 67 | "railwayStrokeColor": "gray", 68 | "railwayWidth": 2, 69 | "railwayDashLength": 6, 70 | 71 | "netBingTextureResolution": 1024, 72 | "netBingAltitudeColors1": [], 73 | "netBingWaterColor1": "#1c28c0", 74 | "netBingHeightColor1": [ 75 | { 76 | "alt": 0, 77 | "color": "#000000" 78 | }, 79 | { 80 | "alt": 9000, 81 | "color": "#000000" 82 | } 83 | ], 84 | 85 | "netBingAltitudeColors2": [], 86 | "netBingWaterColor2": "#1c28c0", 87 | "netBingHeightColor2": [ 88 | { 89 | "alt": 0, 90 | "color": "#dc0f1c" 91 | }, 92 | { 93 | "alt": 500, 94 | "color": "#a29a0f" 95 | }, 96 | { 97 | "alt": 1000, 98 | "color": "#4c9d24" 99 | }, 100 | { 101 | "alt": 1500, 102 | "color": "#000000" 103 | } 104 | ], 105 | 106 | "netBingAltitudeColors3": [], 107 | "netBingWaterColor3": "#000000", 108 | "netBingHeightColor3": [ 109 | { 110 | "alt": 0, 111 | "color": "#000000" 112 | }, 113 | { 114 | "alt": 9000, 115 | "color": "#000000" 116 | } 117 | ] 118 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_PLANE_GNS530.svg: -------------------------------------------------------------------------------- 1 | 2 | 21 | 23 | 26 | 30 | 34 | 35 | 44 | 53 | 62 | 71 | 72 | 99 | 105 | 106 | 108 | 109 | 111 | image/svg+xml 112 | 114 | 115 | 116 | 117 | 118 | 124 | 131 | 139 | 147 | 153 | 157 | 158 | 164 | 165 | -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/CustomValue.js: -------------------------------------------------------------------------------- 1 | class CustomValue { 2 | constructor(_gps, _nameID, _valueID, _unitID) { 3 | this.valueIndex = 0; 4 | this.nameDisplay = _gps.getChildById(_nameID); 5 | this.valueDisplay = _gps.getChildById(_valueID); 6 | this.unitDisplay = _gps.getChildById(_unitID); 7 | //PM Modif: keep GPS 8 | this.gps = _gps; 9 | //PM Modif: End keep GPS 10 | } 11 | Update() { 12 | let flightPlanActive = SimVar.GetSimVarValue("GPS IS ACTIVE FLIGHT PLAN", "boolean"); 13 | let value = ""; 14 | switch (this.valueIndex) { 15 | case 0: 16 | this.nameDisplay.textContent = "BRG"; 17 | this.unitDisplay.innerHTML = "o
M"; 18 | if(flightPlanActive) 19 | this.valueDisplay.textContent = Utils.leadingZeros(fastToFixed(SimVar.GetSimVarValue("GPS WP BEARING", "degree"), 0), 3); 20 | else 21 | this.valueDisplay.textContent = "___"; 22 | break; 23 | case 1: 24 | this.nameDisplay.textContent = "CTS"; 25 | this.unitDisplay.innerHTML = "o
M"; 26 | if(flightPlanActive) 27 | this.valueDisplay.textContent = Utils.leadingZeros(fastToFixed(SimVar.GetSimVarValue("GPS COURSE TO STEER", "degree"), 0), 3); 28 | else 29 | this.valueDisplay.textContent = "___"; 30 | break; 31 | case 2: 32 | this.nameDisplay.textContent = "XTK"; 33 | this.unitDisplay.innerHTML = "n
m"; 34 | this.valueDisplay.textContent = !flightPlanActive ? "___._" : (Math.round((SimVar.GetSimVarValue("GPS WP CROSS TRK", "Nautical Miles")*10))/10).toFixed(1); 35 | break; 36 | case 3: 37 | this.nameDisplay.textContent = "DTK"; 38 | this.unitDisplay.innerHTML = "o
M"; 39 | if(flightPlanActive) 40 | this.valueDisplay.textContent = Utils.leadingZeros(fastToFixed(SimVar.GetSimVarValue("GPS WP DESIRED TRACK", "degree"), 0), 3); 41 | else 42 | this.valueDisplay.textContent = "___"; 43 | break; 44 | case 4: 45 | this.nameDisplay.textContent = "DIS"; 46 | this.unitDisplay.innerHTML = "n
m"; 47 | this.valueDisplay.textContent = !flightPlanActive ? "___._" : (Math.round((SimVar.GetSimVarValue("GPS WP DISTANCE", "Nautical Miles")*10))/10).toFixed(1); 48 | break; 49 | case 5: 50 | this.nameDisplay.textContent = "ESA"; 51 | this.unitDisplay.innerHTML = "f
t"; 52 | this.valueDisplay.textContent = "___"; 53 | break; 54 | case 6: 55 | this.nameDisplay.textContent = "ETA"; 56 | this.unitDisplay.innerHTML = ""; 57 | var ETA = SimVar.GetSimVarValue("GPS ETA", "minutes"); 58 | //PM Modif: Ajust ETA minutes on 2 digits 59 | // this.valueDisplay.textContent = !flightPlanActive ? "__:__" : Math.floor(ETA / 60) + ":" + Math.floor(ETA % 60); 60 | this.valueDisplay.textContent = !flightPlanActive ? "__:__" : Math.floor(ETA / 60) + ":" + Math.floor(ETA % 60).toString().padStart(2, "0"); 61 | //PM Modif: Ajust ETA minutes on 2 digits 62 | break; 63 | case 7: 64 | this.nameDisplay.textContent = "ETE"; 65 | this.unitDisplay.innerHTML = ""; 66 | //PM Modif: Display ETE to next waypoint instead of ETE to destination 67 | // var ETE = SimVar.GetSimVarValue("GPS ETE", "seconds"); 68 | var ETE = SimVar.GetSimVarValue("GPS WP ETE", "seconds"); 69 | //PM Modif: End Display ETE to next waypoint instead of ETE to destination 70 | this.valueDisplay.textContent = !flightPlanActive ? "__:__" : ETE >= 3600 ? Math.floor(ETE / 3600) + "+" + Math.floor((ETE % 3600) / 60).toString().padStart(2, "0") : Math.floor(ETE / 60) + ":" + Math.floor(ETE % 60).toString().padStart(2, "0"); 71 | break; 72 | case 8: 73 | this.nameDisplay.textContent = "FLOW"; 74 | this.unitDisplay.innerHTML = "lb
/h"; 75 | this.valueDisplay.textContent = fastToFixed(SimVar.GetSimVarValue("ESTIMATED FUEL FLOW", "pound per hour"), 0); 76 | break; 77 | case 9: 78 | this.nameDisplay.textContent = "GS"; 79 | this.unitDisplay.innerHTML = "k
t"; 80 | this.valueDisplay.textContent = fastToFixed(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots"), 0); 81 | break; 82 | case 10: 83 | this.nameDisplay.textContent = "TRK"; 84 | this.unitDisplay.innerHTML = "o
M"; 85 | this.valueDisplay.textContent = Utils.leadingZeros(fastToFixed(SimVar.GetSimVarValue("GPS GROUND MAGNETIC TRACK", "degree"), 0), 3); 86 | break; 87 | case 11: 88 | this.nameDisplay.textContent = "MSA"; 89 | this.unitDisplay.innerHTML = "f
t"; 90 | this.valueDisplay.textContent = "___"; 91 | break; 92 | case 12: 93 | this.nameDisplay.textContent = "TKE"; 94 | this.unitDisplay.innerHTML = "o
M"; 95 | if(flightPlanActive) 96 | this.valueDisplay.textContent = Utils.leadingZeros(fastToFixed(SimVar.GetSimVarValue("GPS WP TRACK ANGLE ERROR", "degree"), 0), 3); 97 | else 98 | this.valueDisplay.textContent = "___"; 99 | break; 100 | //PM Modif: Added VSR is Vertical Speed Required to Target following VCALC (VSR is at GPS unit level) 101 | case 13: 102 | this.nameDisplay.textContent = "VSR"; 103 | this.unitDisplay.innerHTML = "ft
/m"; 104 | value = this.gps.vsr != 0 ? fastToFixed(this.gps.vsr, 0) : "___"; 105 | this.valueDisplay.textContent = !flightPlanActive ? "___" : value; 106 | break; 107 | //PM Modif: End Added VSR is Vertical Speed Required to Target following VCALC 108 | case 14: 109 | this.nameDisplay.textContent = "ALT"; 110 | this.unitDisplay.innerHTML = "f
t"; 111 | this.valueDisplay.textContent = fastToFixed(SimVar.GetSimVarValue("GPS POSITION ALT", "feet"), 0); 112 | break; 113 | case 15: 114 | this.nameDisplay.textContent = "BARO"; 115 | this.unitDisplay.innerHTML = "m
b"; 116 | this.valueDisplay.textContent = fastToFixed(SimVar.GetSimVarValue("BAROMETER PRESSURE", "Millibars"), 0); 117 | break; 118 | case 16: 119 | this.nameDisplay.textContent = "WPT"; 120 | this.unitDisplay.innerHTML = ""; 121 | this.valueDisplay.textContent = SimVar.GetSimVarValue("GPS WP NEXT ID", "string"); 122 | break; 123 | //PM Modif: Added VS 124 | case 17: 125 | this.nameDisplay.textContent = "VS"; 126 | this.unitDisplay.innerHTML = "ft
/s"; 127 | this.valueDisplay.textContent = !flightPlanActive ? "___" : fastToFixed(SimVar.GetSimVarValue("GPS WP VERTICAL SPEED", "feet per second"), 0); 128 | break; 129 | //PM Modif: End Added VS 130 | } 131 | } 132 | } 133 | //# sourceMappingURL=CustomValue.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.js: -------------------------------------------------------------------------------- 1 | class AS430 extends BaseGPS { 2 | get templateID() { return "AS430"; } 3 | connectedCallback() { 4 | this.gpsType = "430"; 5 | this.cnt = 0; 6 | this.superCnt = 0; 7 | this.toInit = true; 8 | this.initDone = false; 9 | this.hotStart = false; 10 | super.connectedCallback(); 11 | this.initScreen = this.getChildById("InitScreen"); 12 | this.initScreenBottomInfo = this.getChildById("InitScreenBottomInfo"); 13 | this.NbLoopInitScreen = 150; 14 | this.initScreen.setAttribute("style", "display: none"); 15 | this.pageGroups = [ 16 | new NavSystemPageGroup("AUX", this, [ 17 | new NavSystemPage("COMSetup", "COMSetup", new GPS_COMSetup()), 18 | ]) 19 | ]; 20 | this.messageList = new GPS_Messages(); 21 | this.messageList.setGPS(this); 22 | // We delay the init of the GNS430 in order to check if there is a GNS530 23 | // Because at this time we must disable the GNS430 maps since 24 | // the simulator cannot accept more than 4 maps for an airplane (crash if more) 25 | } 26 | onUpdate(_deltaTime) { 27 | // Normal start 28 | if(!this.isStarted){ 29 | this.initScreen.setAttribute("style", "display: none"); 30 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 0); 31 | } 32 | if(this.isStarted && this.toInit) { 33 | if(this.debug) { 34 | this.NbLoopInitScreen = 50; 35 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 0); 36 | } 37 | this.initScreen.setAttribute("style", "display: flex"); 38 | this.initScreenBottomInfo.innerHTML = "GPS SW Version " + this.version + "
Initializing..."; 39 | this.cnt++; 40 | // Init delayed after 50 updates 41 | if(this.cnt > this.NbLoopInitScreen){ 42 | this.toInit = false; 43 | this.hotStart = false; 44 | this.doInit(); 45 | this.initScreen.setAttribute("style", "display: none"); 46 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 1); 47 | } 48 | } 49 | // Hot restart 50 | if(this.initDone) { 51 | if(!this.isStarted) { 52 | this.hotStart = true; 53 | this.cnt = 0; 54 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 0); 55 | } 56 | if(this.hotStart && this.isStarted) { 57 | if(this.cnt == 0) { 58 | this.initScreen.setAttribute("style", "display: flex"); 59 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 0); 60 | } 61 | this.cnt++; 62 | if(this.cnt > this.NbLoopInitScreen) { 63 | this.hotStart = false; 64 | this.initScreen.setAttribute("style", "display: none"); 65 | SimVar.SetSimVarValue("L:GNS430BootComplete", "Boolean", 1); 66 | } 67 | } 68 | } 69 | super.onUpdate(_deltaTime); 70 | } 71 | doInit(){ 72 | this.menuMaxElems = 11; 73 | var defaultNav = new GPS_DefaultNavPage(6, [4, 3, 0, 9, 10, 7], "430"); 74 | defaultNav.element.addElement(new GPS_Map()); 75 | var mapNav = new GPS_MapNavPage(4, [16, 3, 4, 9]); 76 | mapNav.element.addElement(new GPS_Map()); 77 | var terrainNav = new GPS_TerrainNavPage(0, []); 78 | terrainNav.element.addElement(new GPS_Map()); 79 | var trafficNav = new GPS_TrafficNavPage(0, []); 80 | trafficNav.element.addElement(new GPS_Map()); 81 | this.VnavPage = new GPS_Vnav(); 82 | this.pageGroups = [ 83 | new NavSystemPageGroup("NAV", this, [ 84 | defaultNav, 85 | mapNav, 86 | terrainNav, 87 | trafficNav, 88 | new NavSystemPage("ComNav", "ComNav", new GPS_ComNav()), 89 | new NavSystemPage("Position", "Position", new GPS_Position()), 90 | new NavSystemPage("VNAV", "Vnav", this.VnavPage) 91 | ]), 92 | new NavSystemPageGroup("WPT", this, [ 93 | new NavSystemPage("AirportLocation", "AirportLocation", new GPS_AirportWaypointLocation(this.airportWaypointsIcaoSearchField)), 94 | new NavSystemPage("AirportRunway", "AirportRunway", new GPS_AirportWaypointRunways(this.airportWaypointsIcaoSearchField)), 95 | new NavSystemPage("AirportFrequency", "AirportFrequency", new GPS_AirportWaypointFrequencies(this.airportWaypointsIcaoSearchField, 6)), 96 | new NavSystemPage("AirportApproach", "AirportApproach", new GPS_AirportWaypointApproaches(this.airportWaypointsIcaoSearchField)), 97 | new NavSystemPage("AirportArrival", "AirportArrival", new GPS_AirportWaypointArrivals(this.airportWaypointsIcaoSearchField)), 98 | new NavSystemPage("AirportDeparture", "AirportDeparture", new GPS_AirportWaypointDepartures(this.airportWaypointsIcaoSearchField)), 99 | new NavSystemPage("Intersection", "Intersection", new GPS_IntersectionWaypoint()), 100 | new NavSystemPage("NDB", "NDB", new GPS_NDBWaypoint()), 101 | new NavSystemPage("VOR", "VOR", new GPS_VORWaypoint()) 102 | ]), 103 | new NavSystemPageGroup("AUX", this, [ 104 | new NavSystemPage("COMSetup", "COMSetup", new GPS_COMSetup()), 105 | new NavSystemPage("METAR", "METAR", new GPS_METAR(this.airportWaypointsIcaoSearchField, 6)) 106 | ]), 107 | new NavSystemPageGroup("NRST", this, [ 108 | new NavSystemPage("NRSTAirport", "NRSTAirport", new GPS_NearestAirports()), 109 | new NavSystemPage("NRSTIntersection", "NRSTIntersection", new GPS_NearestIntersection()), 110 | new NavSystemPage("NRSTNDB", "NRSTNDB", new GPS_NearestNDB()), 111 | new NavSystemPage("NRSTVOR", "NRSTVOR", new GPS_NearestVOR()), 112 | new NavSystemPage("NRSTAirspace", "NRSTAirspace", new GPS_NearestAirpaces()), 113 | ]) 114 | ]; 115 | this.addEventLinkedPageGroup("DirectTo_Push", new NavSystemPageGroup("DRCT", this, [new NavSystemPage("DRCT", "DRCT", new GPS_DirectTo())])); 116 | this.addEventLinkedPageGroup("FPL_Push", new NavSystemPageGroup("FPL", this, [ 117 | new NavSystemPage("ActiveFPL", "FlightPlanEdit", new GPS_ActiveFPL("430")), 118 | new NavSystemPage("FPLCatalog", "FPLCatalog", new GPS_FPLCatalog("430")) 119 | ])); 120 | this.addEventLinkedPageGroup("PROC_Push", new NavSystemPageGroup("PROC", this, [new NavSystemPage("Procedures", "Procedures", new GPS_Procedures())])); 121 | this.addEventLinkedPageGroup("MSG_Push", new NavSystemPageGroup("MSG", this, [new NavSystemPage("MSG", "MSG", this.messageList)])); 122 | this.addIndependentElementContainer(new NavSystemElementContainer("WaypointMap", "WaypointMap", new GPS_WaypointMap())); 123 | this.addIndependentElementContainer(new NavSystemElementContainer("MSG", "MSG", new AS530_InitMessageList())); 124 | this.initDone = true; 125 | } 126 | } 127 | 128 | // Just to be able to initialize the message list (needed for checking if we have messages before displaying them) 129 | // I didn't find another way to proceed. It works like this. 130 | class AS530_InitMessageList extends NavSystemElement { 131 | init(root) { 132 | this.gps.messageList.init(root); 133 | } 134 | onUpdate(_deltaTime) { 135 | } 136 | onEnter() { 137 | } 138 | onExit() { 139 | } 140 | onEvent(_event) { 141 | } 142 | } 143 | 144 | 145 | registerInstrument("as430-element", AS430); 146 | //# sourceMappingURL=AS430.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/Vnav.js: -------------------------------------------------------------------------------- 1 | class GPS_Vnav extends NavSystemElement { 2 | constructor() { 3 | super(); 4 | this.name = "VNAV"; 5 | this.menuname = ""; 6 | } 7 | init() { 8 | this.altitude = this.gps.getChildById("VnavTargetAltitudeValue"); 9 | this.posdis = this.gps.getChildById("VnavTargetDistanceValue"); 10 | this.posref = this.gps.getChildById("VnavTargetReferenceValue"); 11 | this.poswp = this.gps.getChildById("VnavTargetWaypoint"); 12 | this.profile = this.gps.getChildById("VnavProfileValue"); 13 | this.vsr = this.gps.getChildById("VnavVsrValue"); 14 | this.status = this.gps.getChildById("VnavStatusValue"); 15 | this.defaultSelectables = [ 16 | new SelectableElement(this.gps, this.altitude, this.Altitude_SelectionCallback.bind(this)), 17 | new SelectableElement(this.gps, this.posdis, this.PosDistance_SelectionCallback.bind(this)), 18 | new SelectableElement(this.gps, this.posref, this.PosReference_SelectionCallback.bind(this)), 19 | new SelectableElement(this.gps, this.poswp, this.PosWaypoint_SelectionCallback.bind(this)), 20 | new SelectableElement(this.gps, this.profile, this.Profile_SelectionCallback.bind(this)) 21 | ]; 22 | this.targetWaypoint = null; 23 | } 24 | onEnter() { 25 | this.gps.closeConfirmWindow(); 26 | this.gps.closeAlertWindow(); 27 | } 28 | onUpdate(_deltaTime) { 29 | var targetInfo = this.GetTargetInfo(); 30 | let msgApproaching = false; 31 | let msgArriving = false; 32 | if(targetInfo && targetInfo.length) { 33 | this.vsr.textContent = targetInfo[0]; 34 | var timeToDescent = targetInfo[1]; 35 | var hours = parseInt( timeToDescent / 3600 ) % 24; 36 | var minutes = parseInt( timeToDescent / 60 ) % 60; 37 | var seconds = timeToDescent % 60; 38 | var result = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds); 39 | 40 | hours = Math.floor(timeToDescent / 3600); 41 | timeToDescent %= 3600; 42 | minutes = Math.floor(timeToDescent / 60); 43 | seconds = timeToDescent % 60; 44 | this.status.textContent = timeToDescent > 20 ? "Begin Descent in " + result : "Descend to target"; 45 | 46 | // Update local variable for messaging 47 | if(timeToDescent < 60 && timeToDescent > 5) 48 | msgApproaching = true; 49 | let currentAltitude = SimVar.GetSimVarValue("GPS POSITION ALT", "feet"); 50 | if(this.targetAltitude > currentAltitude - 500 && this.targetAltitude < currentAltitude + 500) 51 | msgArriving = true; 52 | } 53 | else { 54 | this.vsr.textContent = "_____"; 55 | this.status.textContent = ""; 56 | } 57 | // Update local variable for messaging 58 | SimVar.SetSimVarValue("L:PMS50_GNS530_MSG_VCALC_APPR", "bool", msgApproaching); 59 | SimVar.SetSimVarValue("L:PMS50_GNS530_MSG_VCALC_ARR", "bool", msgArriving); 60 | } 61 | onExit() { 62 | this.gps.closeConfirmWindow(); 63 | this.gps.closeAlertWindow(); 64 | } 65 | onEvent(_event) { 66 | if (_event == "CLR_Push") { 67 | this.gps.ActiveSelection(this.defaultSelectables); 68 | if (this.gps.popUpElement || this.gps.currentContextualMenu) { 69 | this.gps.closePopUpElement(); 70 | this.gps.SwitchToInteractionState(1); 71 | this.gps.cursorIndex = 3; 72 | this.menuname = ""; 73 | this.gps.currentContextualMenu = null; 74 | } 75 | else { 76 | this.menuname = ""; 77 | this.gps.SwitchToInteractionState(0); 78 | this.gps.SwitchToPageName("NAV", "DefaultNav"); 79 | this.gps.currentEventLinkedPageGroup = null; 80 | } 81 | } 82 | } 83 | Altitude_SelectionCallback(_event) { 84 | if (_event == "RightSmallKnob_Right"){ 85 | var value = parseInt(this.altitude.textContent); 86 | if(value < 5000) 87 | value += 100; 88 | else 89 | value += 500; 90 | this.altitude.textContent = value; 91 | } 92 | if (_event == "RightSmallKnob_Left"){ 93 | var value = parseInt(this.altitude.textContent); 94 | if(value <= 5000) 95 | value -= 100; 96 | else 97 | value -= 500; 98 | if(value < 0) 99 | value = 0; 100 | this.altitude.textContent = value; 101 | } 102 | } 103 | PosDistance_SelectionCallback(_event) { 104 | if (_event == "RightSmallKnob_Right"){ 105 | var value = parseFloat(this.posdis.textContent); 106 | if(value < 5) 107 | value += 0.2; 108 | else if(value < 10) 109 | value += 0.5; 110 | else 111 | value += 1; 112 | this.posdis.textContent = value.toFixed(1); 113 | } 114 | if (_event == "RightSmallKnob_Left"){ 115 | var value = parseFloat(this.posdis.textContent); 116 | if(value <= 5) 117 | value -= 0.2; 118 | else if(value <= 10) 119 | value -= 0.5; 120 | else 121 | value -= 1; 122 | if(value < 0) 123 | value = 0; 124 | this.posdis.textContent = value.toFixed(1); 125 | } 126 | } 127 | PosReference_SelectionCallback(_event) { 128 | if (_event == "RightSmallKnob_Right" || _event == "RightSmallKnob_Left") 129 | this.posref.textContent = this.posref.textContent == "Before" ? "After" : "Before"; 130 | } 131 | PosWaypoint_SelectionCallback(_event) { 132 | if (_event == "RightSmallKnob_Right" || _event == "RightSmallKnob_Left") { 133 | var elements = []; 134 | var i = 0; 135 | 136 | var wayPointList = this.gps.currFlightPlanManager.getWaypoints(); 137 | wayPointList = wayPointList.concat(this.gps.currFlightPlanManager.getApproachWaypoints()); 138 | for (; i < wayPointList.length; i++) { 139 | // We add only valid waypoints (not the ones of "user" type) 140 | if(wayPointList[i].icao.substr(0,2) != 'U '){ 141 | elements.push(new ContextualMenuElement(wayPointList[i].GetInfos().ident, function (_index) { 142 | this.targetWaypoint = wayPointList[_index]; 143 | this.poswp.textContent = this.targetWaypoint.ident; 144 | this.gps.SwitchToInteractionState(1); 145 | this.gps.cursorIndex = 3; 146 | }.bind(this, i))); 147 | } 148 | } 149 | if (wayPointList.length > 0) { 150 | this.gps.ShowContextualMenu(new ContextualMenu("FPL", elements)); 151 | this.menuname = "fpl"; 152 | } 153 | } 154 | } 155 | Profile_SelectionCallback(_event) { 156 | if (_event == "RightSmallKnob_Right"){ 157 | var value = parseInt(this.profile.textContent); 158 | value += 100; 159 | this.profile.textContent = value; 160 | } 161 | if (_event == "RightSmallKnob_Left"){ 162 | var value = parseInt(this.profile.textContent); 163 | value -= 100; 164 | if(value < 0) 165 | value = 0; 166 | this.profile.textContent = value; 167 | } 168 | } 169 | GetTargetInfo(){ 170 | var targetInfos = []; 171 | if(this.targetWaypoint == null) 172 | return targetInfos; 173 | var groundSpeed = fastToFixed(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots"), 0); 174 | // Do nothing if ground speed too slow 175 | if(groundSpeed < 35) 176 | return targetInfos; 177 | var currentAltitude = SimVar.GetSimVarValue("GPS POSITION ALT", "feet"); 178 | var targetAltitude = parseInt(this.altitude.textContent); 179 | 180 | // Don't calculate anything if near the target altitude 181 | if(targetAltitude > currentAltitude - 100 && targetAltitude < currentAltitude + 100) 182 | return targetInfos; 183 | // Don't use vnav to climb 184 | if(targetAltitude > currentAltitude) 185 | return targetInfos; 186 | 187 | var nextWpIdent = SimVar.GetSimVarValue("GPS WP NEXT ID", "string"); 188 | if(nextWpIdent == "") 189 | return targetInfos; 190 | 191 | // Search target in current flight plan 192 | var DistanceToTarget = 0; 193 | var wayPointList = this.gps.currFlightPlanManager.getWaypoints(); 194 | wayPointList = wayPointList.concat(this.gps.currFlightPlanManager.getApproachWaypoints()); 195 | var index = -1; 196 | var tinfo = this.targetWaypoint.GetInfos(); 197 | var cumDistanceNext = 0; 198 | var nextBeforeTarget = false; // Used to check that the target WP is the next wp or after it 199 | for (var i=0; i < wayPointList.length; i++) { 200 | let info = wayPointList[i].GetInfos(); 201 | let waypoint = wayPointList[i]; 202 | if(waypoint.ident == nextWpIdent){ 203 | var nextBeforeTarget = true; 204 | cumDistanceNext = waypoint.cumulativeDistanceInFP; 205 | } 206 | if((info.ident == tinfo.ident) && (info.icao == tinfo.icao) && (info.coordinates == tinfo.coordinates)){ 207 | index = i; 208 | DistanceToTarget = waypoint.cumulativeDistanceInFP - cumDistanceNext; 209 | break; 210 | } 211 | } 212 | if(index == -1 || !nextBeforeTarget){ 213 | // Target not found or target is before next point (possible with a direct to) 214 | this.targetWaypoint = null; 215 | return targetInfos; 216 | } 217 | // Add the distance to next WP 218 | DistanceToTarget += SimVar.GetSimVarValue("GPS WP DISTANCE", "Nautical Miles"); 219 | // Add or substract the offset distance to have the complete distance to target 220 | if(this.posref.textContent == "Before") 221 | DistanceToTarget -= parseFloat(this.posdis.textContent); 222 | else 223 | DistanceToTarget += parseFloat(this.posdis.textContent); 224 | 225 | // We are ok here. 226 | var difAltitude = currentAltitude- targetAltitude; 227 | var desrate = (Math.atan(difAltitude / (DistanceToTarget * 6076.115486)) * 180 / Math.PI) / 0.6; 228 | var vsr = fastToFixed(-desrate * groundSpeed, 0); 229 | 230 | var profileVs = parseInt(this.profile.textContent); 231 | var profiledesangle = (profileVs / groundSpeed) * 0.6; 232 | var profileDistanceToTarget = (difAltitude / 100) / profiledesangle; 233 | var profileDistanceToDescent = DistanceToTarget - profileDistanceToTarget; 234 | if(profileDistanceToDescent <0) 235 | profileDistanceToDescent = 0; 236 | var timeToDescent = fastToFixed((profileDistanceToDescent / groundSpeed) * 3600, 0); 237 | if(timeToDescent < 0) 238 | timeToDescent = 0; 239 | targetInfos = [vsr, timeToDescent]; 240 | return targetInfos; 241 | } 242 | GetVsr(){ 243 | var targetInfo = this.GetTargetInfo(); 244 | return targetInfo && targetInfo.length ? parseInt(targetInfo[0]) : 0; 245 | } 246 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.js: -------------------------------------------------------------------------------- 1 | class AS530 extends BaseGPS { 2 | get templateID() { return "AS530"; } 3 | connectedCallback() { 4 | this.gpsType = "530"; 5 | this.cnt = 0; 6 | this.toInit = true; 7 | this.initDone = false; 8 | this.hotStart = false; 9 | super.connectedCallback(); 10 | this.initScreen = this.getChildById("InitScreen"); 11 | this.initScreenBottomInfo = this.getChildById("InitScreenBottomInfo"); 12 | this.NbLoopInitScreen = 150; 13 | this.initScreen.setAttribute("style", "display: none"); 14 | this.pageGroups = [ 15 | new NavSystemPageGroup("AUX", this, [ 16 | new NavSystemPage("COMSetup", "COMSetup", new GPS_COMSetup()), 17 | ]) 18 | ]; 19 | this.messageList = new GPS_Messages(); 20 | this.messageList.setGPS(this); 21 | this.doInit(); 22 | } 23 | 24 | onUpdate(_deltaTime) { 25 | // Normal start 26 | if(!this.isStarted){ 27 | this.initScreen.setAttribute("style", "display: none"); 28 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 0); 29 | } 30 | if(this.isStarted && this.toInit) { 31 | if(this.debug) { 32 | this.NbLoopInitScreen = 50; 33 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 0); 34 | } 35 | this.initScreen.setAttribute("style", "display: flex"); 36 | this.initScreenBottomInfo.innerHTML = "GPS SW Version " + this.version + "
Initializing..."; 37 | this.cnt++; 38 | // Init delayed after 50 updates 39 | if(this.cnt > this.NbLoopInitScreen){ 40 | this.toInit = false; 41 | this.hotStart = false; 42 | // this.doInit(); 43 | this.initScreen.setAttribute("style", "display: none"); 44 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 1); 45 | } 46 | } 47 | // Hot restart 48 | if(this.initDone) { 49 | if(!this.isStarted) { 50 | this.hotStart = true; 51 | this.cnt = 0; 52 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 0); 53 | } 54 | if(this.hotStart && this.isStarted) { 55 | if(this.cnt == 0) { 56 | this.initScreen.setAttribute("style", "display: flex"); 57 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 0); 58 | } 59 | this.cnt++; 60 | if(this.cnt > this.NbLoopInitScreen) { 61 | this.hotStart = false; 62 | this.initScreen.setAttribute("style", "display: none"); 63 | SimVar.SetSimVarValue("L:GNS530BootComplete", "Boolean", 1); 64 | } 65 | } 66 | } 67 | super.onUpdate(_deltaTime); 68 | } 69 | 70 | doInit(){ 71 | this.defaultNav = new GPS_DefaultNavPage(5, [3, 4, 9, 7, 10], "530"); 72 | this.defaultNav.element.addElement(new GPS_Map()); 73 | this.mapNav = new GPS_MapNavPage(5, [16, 3, 10, 4, 9]); 74 | this.mapNav.element.addElement(new GPS_Map()); 75 | this.terrainNav = new GPS_TerrainNavPage(0, []); 76 | this.terrainNav.element.addElement(new GPS_Map()); 77 | this.trafficNav = new GPS_TrafficNavPage(0, []); 78 | this.trafficNav.element.addElement(new GPS_Map()); 79 | this.pageGroups = [ 80 | new NavSystemPageGroup("NAV", this, [ 81 | this.defaultNav, 82 | this.mapNav, 83 | this.terrainNav, 84 | this.trafficNav, 85 | new NavSystemPage("ComNav", "ComNav", new GPS_ComNav(10)) 86 | ]), 87 | new NavSystemPageGroup("WPT", this, [ 88 | new NavSystemPage("AirportLocation", "AirportLocation", new GPS_AirportWaypointLocation(this.airportWaypointsIcaoSearchField)), 89 | new NavSystemPage("AirportRunway", "AirportRunway", new GPS_AirportWaypointRunways(this.airportWaypointsIcaoSearchField)), 90 | new NavSystemPage("AirportFrequency", "AirportFrequency", new GPS_AirportWaypointFrequencies(this.airportWaypointsIcaoSearchField, 9)), 91 | new NavSystemPage("AirportApproach", "AirportApproach", new GPS_AirportWaypointApproaches(this.airportWaypointsIcaoSearchField)), 92 | new NavSystemPage("AirportArrival", "AirportArrival", new GPS_AirportWaypointArrivals(this.airportWaypointsIcaoSearchField)), 93 | new NavSystemPage("AirportDeparture", "AirportDeparture", new GPS_AirportWaypointDepartures(this.airportWaypointsIcaoSearchField)), 94 | new NavSystemPage("Intersection", "Intersection", new GPS_IntersectionWaypoint()), 95 | new NavSystemPage("NDB", "NDB", new GPS_NDBWaypoint()), 96 | new NavSystemPage("VOR", "VOR", new GPS_VORWaypoint()) 97 | ]), 98 | new NavSystemPageGroup("AUX", this, [ 99 | new NavSystemPage("COMSetup", "COMSetup", new GPS_COMSetup()), 100 | new NavSystemPage("METAR", "METAR", new GPS_METAR(this.airportWaypointsIcaoSearchField)) 101 | ]), 102 | new NavSystemPageGroup("NRST", this, [ 103 | new NavSystemPage("NRSTAirport", "NRSTAirport", new GPS_NearestAirports(4)), 104 | new NavSystemPage("NRSTIntersection", "NRSTIntersection", new GPS_NearestIntersection(8)), 105 | new NavSystemPage("NRSTNDB", "NRSTNDB", new GPS_NearestNDB(8)), 106 | new NavSystemPage("NRSTVOR", "NRSTVOR", new GPS_NearestVOR(8)), 107 | new NavSystemPage("NRSTAirspace", "NRSTAirspace", new GPS_NearestAirpaces()) 108 | ]) 109 | ]; 110 | this.addEventLinkedPageGroup("DirectTo_Push", new NavSystemPageGroup("DRCT", this, [new NavSystemPage("DRCT", "DRCT", new GPS_DirectTo())])); 111 | this.addEventLinkedPageGroup("FPL_Push", new NavSystemPageGroup("FPL", this, [ 112 | new NavSystemPage("ActiveFPL", "FlightPlanEdit", new GPS_ActiveFPL("530")), 113 | new NavSystemPage("FPLCatalog", "FPLCatalog", new GPS_FPLCatalog("530")) 114 | ])); 115 | this.addEventLinkedPageGroup("PROC_Push", new NavSystemPageGroup("PROC", this, [new NavSystemPage("Procedures", "Procedures", new GPS_Procedures())])); 116 | this.addEventLinkedPageGroup("MSG_Push", new NavSystemPageGroup("MSG", this, [new NavSystemPage("MSG", "MSG", this.messageList)])); 117 | this.VnavPage = new GPS_Vnav(); 118 | this.addEventLinkedPageGroup("VNAV_Push", new NavSystemPageGroup("VNAV", this, [new NavSystemPage("VNAV", "Vnav", this.VnavPage)])); 119 | this.addIndependentElementContainer(new NavSystemElementContainer("VorInfos", "RadioPart", new AS530_VorInfos())); 120 | this.addIndependentElementContainer(new NavSystemElementContainer("WaypointMap", "WaypointMap", new GPS_WaypointMap())); 121 | this.addIndependentElementContainer(new NavSystemElementContainer("MSG", "MSG", new AS530_InitMessageList())); 122 | this.initDone = true; 123 | } 124 | } 125 | 126 | // Just to be able to initialize the message list (needed for checking if we have messages before displaying them) 127 | // I didn't find another way to proceed. It works like this. 128 | class AS530_InitMessageList extends NavSystemElement { 129 | init(root) { 130 | this.gps.messageList.init(root); 131 | } 132 | onUpdate(_deltaTime) { 133 | } 134 | onEnter() { 135 | } 136 | onExit() { 137 | } 138 | onEvent(_event) { 139 | } 140 | } 141 | 142 | 143 | class AS530_VorInfos extends NavSystemElement { 144 | init(root) { 145 | this.vor = this.gps.getChildById("vorValue"); 146 | this.rad = this.gps.getChildById("radValue"); 147 | this.radTitle = this.gps.getChildById("radTitle"); 148 | this.dis = this.gps.getChildById("disValue"); 149 | //PM Modif: check for LOC or VOR 150 | this.typ = this.gps.getChildById("vorTitle"); 151 | //PM Modif: End check for LOC or VOR 152 | } 153 | onEnter() { 154 | } 155 | onExit() { 156 | } 157 | onEvent(_event) { 158 | } 159 | onUpdate(_deltaTime) { 160 | //PM Modif: World4Fly Mod integration (Wrong radial and Rounded DME) and check for LOC or VOR 161 | let radial = "___"; 162 | let radialtitle = "RAD"; 163 | let ident = "____"; 164 | let distance = "__._"; 165 | // VOR by default 166 | let type = "VOR"; 167 | if (SimVar.GetSimVarValue("NAV HAS NAV:1", "bool")) { 168 | let radnum = Math.round(SimVar.GetSimVarValue("NAV RADIAL:1", "degrees")); 169 | // radnum is from -179 to 180 degrees ... 170 | radnum = radnum < 0 ? 360 + radnum : radnum; 171 | radial = radnum.toString() + "°"; 172 | // Add leading 0s 173 | radial = radnum < 100 ? "0" + radial : radial; 174 | radial = radnum < 10 ? "0" + radial : radial; 175 | ident = SimVar.GetSimVarValue("NAV IDENT:1", "string") != "" ? SimVar.GetSimVarValue("NAV IDENT:1", "string"):"____"; 176 | //PM Modif: Change rounded DME distance 177 | distance = (SimVar.GetSimVarValue("NAV HAS DME:1", "bool") ? (Math.round((SimVar.GetSimVarValue("NAV DME:1", "Nautical Miles")*10))/10).toFixed(1) : "__._"); 178 | //PM Modif: End Change rounded DME distance 179 | ident = SimVar.GetSimVarValue("NAV IDENT:1", "string") != "" ? SimVar.GetSimVarValue("NAV IDENT:1", "string"):"____"; 180 | // LOC frequency is < 112Mhz and first decimal digit is odd 181 | let frequency = SimVar.GetSimVarValue("NAV ACTIVE FREQUENCY:1", "MHz"); 182 | let islocfrequency = frequency && frequency < 112 && Math.trunc(frequency*10)%2 ? true : false; 183 | this.radTitle.setAttribute("style", "display: block;"); 184 | if(islocfrequency){ 185 | type = "LOC"; 186 | // Hide rad title if LOC and display LOC name 187 | this.radTitle.setAttribute("style", "display: none"); 188 | radial = SimVar.GetSimVarValue("NAV NAME:1", "string") != "" ? SimVar.GetSimVarValue("NAV NAME:1", "string"):"____"; 189 | // Get only last word 190 | // radial = radial.substring(radial.lastIndexOf(" ")); 191 | // Limit to 8 chars 192 | // radial = radial.slice(0,8); 193 | 194 | // 6/26/2021 GSD: - SU4 added more text before the ILS Runway number 195 | // Format to match the Garmin GNS530 Trainer 196 | // LDA RW19 ----> LDA 19 197 | // ILS/GS CAT II RW01 ----> ILS 01 198 | // LOC RW15 ----> LOC 15 199 | // ILS/GS CAT I RW33 ----> ILS 33 200 | // (1) Change "/" to " " 201 | // (2) Change " RW" to "" 202 | // Return 1st-word nbsp nbsp Last-word 203 | radial = radial.replace("/", " "); 204 | radial = radial.replace(" RW", " "); 205 | radial = radial.split(" ")[0] + " - " + radial.substring(radial.lastIndexOf(" ")); 206 | // end 6/26.2021 GSD 207 | // Limit to 10 chars Max is "ILS space - space 19C" Note the 19C word has a leading space 208 | radial = radial.slice(0, 10); 209 | } 210 | } 211 | else if(SimVar.GetSimVarValue("NAV HAS DME:1", "bool")) { 212 | type = "DME"; 213 | ident = SimVar.GetSimVarValue("NAV IDENT:1", "string") != "" ? SimVar.GetSimVarValue("NAV IDENT:1", "string"):"____"; 214 | distance = (Math.round((SimVar.GetSimVarValue("NAV DME:1", "Nautical Miles")*10))/10).toFixed(1); 215 | } 216 | diffAndSetText(this.vor, ident); 217 | diffAndSetText(this.typ, type); 218 | diffAndSetText(this.rad, radial); 219 | if(distance > 99.9) 220 | distance = Math.trunc(distance); 221 | diffAndSetText(this.dis, distance); 222 | //PM Modif: End World4Fly Mod integration (Wrong radial and Rounded DME) and check for LOC or VOR 223 | } 224 | } 225 | 226 | registerInstrument("as530-element", AS530); 227 | //# sourceMappingURL=AS530.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/DirectTo.js: -------------------------------------------------------------------------------- 1 | class GPS_DirectTo extends NavSystemElement { 2 | constructor() { 3 | super(); 4 | this.name = "DRCT"; 5 | this.menuname = ""; 6 | } 7 | init() { 8 | this.icao = this.gps.getChildById("DRCTIcao"); 9 | this.airportPrivateLogo = this.gps.getChildById("DRCTAirportPrivateLogoImg"); 10 | this.region = this.gps.getChildById("DRCTRegion"); 11 | this.facilityName = this.gps.getChildById("DRCTFacilityName"); 12 | this.city = this.gps.getChildById("DRCTCity"); 13 | this.fpl = this.gps.getChildById("DRCTFpl"); 14 | this.nrst = this.gps.getChildById("DRCTNrst"); 15 | this.posNS = this.gps.getChildById("DRCTPosNS"); 16 | this.posEW = this.gps.getChildById("DRCTPosEW"); 17 | this.crs = this.gps.getChildById("DRCTCrs"); 18 | this.activate = this.gps.getChildById("DRCTActivate"); 19 | this.icaoSearchField = new SearchFieldWaypointICAO(this.gps, [this.icao], this.gps, 'WANV'); 20 | this.icaoSearchField.init(); 21 | this.currentFPLWpSelected = 0; 22 | this.geoCalc = new GeoCalcInfo(this.gps); 23 | this.container.defaultMenu = new ContextualMenu("PAGE MENU", [ 24 | new ContextualMenuElement("Cancel DirectTo ?", this.cancelDirectTo.bind(this), this.DirectToCheck.bind(this)) 25 | ]); 26 | this.defaultSelectables = [ 27 | new SelectableElement(this.gps, this.icao, this.searchField_SelectionCallback.bind(this)), 28 | new SelectableElement(this.gps, this.fpl, this.flightPlan_SelectionCallback.bind(this)), 29 | new SelectableElement(this.gps, this.activate, this.activateButton_SelectionCallback.bind(this)) 30 | ]; 31 | this.duplicateWaypoints = new NavSystemElementContainer("Duplicate Waypoints", "DuplicateWaypointWindow", new MFD_DuplicateWaypoint()); 32 | this.duplicateWaypoints.setGPS(this.gps); 33 | this.duplicateWaypoints.element.icaoSearchField = this.icaoSearchField; 34 | this.initialUpdate = true; 35 | } 36 | onEnter() { 37 | this.gps.closeConfirmWindow(); 38 | this.gps.closeAlertWindow(); 39 | this.currentFPLWpSelected = 0; 40 | this.gps.currFlightPlan.FillWithCurrentFP(); 41 | if (this.gps.lastRelevantICAO) { 42 | this.icaoSearchField.SetWaypoint(this.gps.lastRelevantICAOType, this.gps.lastRelevantICAO); 43 | } 44 | else if (this.gps.icaoFromMap) { 45 | this.icaoSearchField.SetWaypoint(this.gps.icaoFromMap[0], this.gps.icaoFromMap); 46 | } 47 | else if(this.gps.currFlightPlanManager.getIsDirectTo() && this.gps.currFlightPlanManager.getDirectToTarget()) { 48 | var infos = this.gps.currFlightPlanManager.getDirectToTarget().GetInfos(); 49 | if(infos) 50 | this.icaoSearchField.SetWaypoint(infos.getWaypointType(), infos.icao); 51 | } 52 | } 53 | onUpdate(_deltaTime) { 54 | if(this.initialUpdate){ 55 | this.gps.ActiveSelection(this.defaultSelectables); 56 | this.gps.cursorIndex = 0; 57 | this.initialUpdate = false; 58 | } 59 | var infos = this.icaoSearchField.getWaypoint() ? this.icaoSearchField.getWaypoint().infos : new WayPointInfo(this.gps); 60 | if (infos && infos.icao != '') { 61 | this.icao.textContent = infos.icao; 62 | var logo = infos.imageFileName(); 63 | if (logo != "") { 64 | diffAndSetAttribute(this.airportPrivateLogo, "src", "/Pages/VCockpit/Instruments/Shared/Map/Images/" + logo); 65 | } 66 | else { 67 | diffAndSetAttribute(this.airportPrivateLogo, "src", ""); 68 | } 69 | this.region.textContent = infos.region; 70 | this.facilityName.textContent = infos.name; 71 | this.city.textContent = infos.city; 72 | this.posNS.textContent = this.gps.latitudeFormat(infos.coordinates.lat); 73 | this.posEW.textContent = this.gps.longitudeFormat(infos.coordinates.long); 74 | this.geoCalc.SetParams(SimVar.GetSimVarValue("GPS POSITION LAT", "degree latitude"), SimVar.GetSimVarValue("GPS POSITION LON", "degree longitude"), infos.coordinates.lat, infos.coordinates.long, true); 75 | this.geoCalc.Compute(function () { 76 | if (this.drctCrs) { 77 | this.drctCrs.textContent = fastToFixed(this.geoCalc.bearing, 0); 78 | } 79 | }.bind(this)); 80 | } 81 | else { 82 | this.icao.textContent = "_____"; 83 | diffAndSetAttribute(this.airportPrivateLogo, "src", ""); 84 | this.region.textContent = "__________"; 85 | this.facilityName.textContent = "______________________"; 86 | this.city.textContent = "______________________"; 87 | this.posNS.textContent = "_ __°__.__'"; 88 | this.posEW.textContent = "____°__.__'"; 89 | this.crs.textContent = "___"; 90 | } 91 | this.icaoSearchField.Update(); 92 | if (this.currentFPLWpSelected < this.gps.currFlightPlan.wayPoints.length) { 93 | this.fpl.textContent = this.gps.currFlightPlan.wayPoints[this.currentFPLWpSelected].GetInfos().ident; 94 | } 95 | } 96 | onExit() { 97 | this.gps.closeConfirmWindow(); 98 | this.gps.closeAlertWindow(); 99 | this.initialUpdate = true; 100 | } 101 | onEvent(_event) { 102 | if (_event == "CLR_Push") { 103 | this.gps.ActiveSelection(this.defaultSelectables); 104 | if(this.icaoSearchField.isActive){ 105 | this.icaoSearchField.isActive = false; 106 | this.gps.SwitchToInteractionState(1); 107 | this.gps.cursorIndex = 0; 108 | } 109 | else { 110 | if (this.gps.popUpElement || this.gps.currentContextualMenu) { 111 | this.gps.closePopUpElement(); 112 | this.gps.SwitchToInteractionState(1); 113 | this.gps.cursorIndex = 0; 114 | if(this.menuname == "fpl"){ 115 | this.gps.cursorIndex = 1; 116 | } 117 | if(this.menuname == "search"){ 118 | this.gps.cursorIndex = 2; 119 | } 120 | this.menuname = ""; 121 | this.gps.currentContextualMenu = null; 122 | } 123 | else { 124 | this.menuname = ""; 125 | this.gps.SwitchToInteractionState(0); 126 | this.gps.leaveEventPage(); 127 | } 128 | } 129 | } 130 | if (_event == "ENT_Push") { 131 | if((this.gps.currentInteractionState == 0) && (this.gps.cursorIndex == 0) && (this.icaoSearchField.getWaypoint().infos.icao != '')){ 132 | this.gps.cursorIndex = 2; 133 | this.gps.SwitchToInteractionState(1); 134 | } 135 | } 136 | if (_event == "NavigationPush") { 137 | // Stay in selection state 138 | this.gps.requestCall(() => { 139 | this.gps.ActiveSelection(this.defaultSelectables); 140 | this.gps.SwitchToInteractionState(1); 141 | this.gps.cursorIndex = 0; 142 | }); 143 | } 144 | } 145 | searchField_SelectionCallback(_event) { 146 | if (_event == "ENT_Push") { 147 | let infos = this.icaoSearchField.getWaypoint() ? this.icaoSearchField.getWaypoint().infos : new WayPointInfo(this.gps); 148 | if(infos && infos.icao != ''){ 149 | this.gps.lastRelevantICAO = infos.icao; 150 | } 151 | if (this.gps.lastRelevantICAO && infos && infos.icao != '') { 152 | this.icaoSearchField.getWaypoint().SetICAO(this.gps.lastRelevantICAO); 153 | this.gps.ActiveSelection(this.defaultSelectables); 154 | this.gps.cursorIndex = 2; 155 | this.menuname = "" 156 | } 157 | } 158 | if (_event == "RightSmallKnob_Right" || _event == "RightSmallKnob_Left") { 159 | this.gps.currentSearchFieldWaypoint = this.icaoSearchField; 160 | let infos = this.icaoSearchField.getWaypoint() ? this.icaoSearchField.getWaypoint().infos : new WayPointInfo(this.gps); 161 | if (infos && infos.icao != '') { 162 | this.gps.lastRelevantICAO = infos.icao; 163 | } 164 | var entryType = -1; 165 | if(_event == "RightSmallKnob_Left") 166 | entryType = 1; 167 | this.icaoSearchField.StartSearch(this.onSearchEnd.bind(this), entryType); 168 | this.gps.SwitchToInteractionState(3); 169 | this.menuname = "search"; 170 | } 171 | } 172 | onSearchEnd() { 173 | if (this.icaoSearchField.duplicates.length > 0) { 174 | this.gps.switchToPopUpPage(this.duplicateWaypoints, () => { 175 | if(this.gps.lastRelevantICAO) { 176 | this.icaoSearchField.getWaypoint().SetICAO(this.gps.lastRelevantICAO); 177 | this.gps.ActiveSelection(this.defaultSelectables); 178 | this.gps.cursorIndex = 2; 179 | this.menuname = "" 180 | } 181 | }); 182 | } 183 | else { 184 | this.gps.ActiveSelection(this.defaultSelectables); 185 | this.gps.cursorIndex = 2; 186 | this.menuname = "" 187 | } 188 | } 189 | flightPlan_SelectionCallback(_event) { 190 | if (_event == "ENT_Push" || _event == "RightSmallKnob_Right" || _event == "RightSmallKnob_Left") { 191 | var elements = []; 192 | var i = 0; 193 | var wayPointList = this.gps.currFlightPlan.wayPoints; 194 | wayPointList = wayPointList.concat(this.gps.currFlightPlanManager.getApproachWaypoints()); 195 | for (; i < wayPointList.length; i++) { 196 | // We add only valid waypoints (not the ones of "user" type) 197 | if(wayPointList[i].icao.substr(0,2) != 'U '){ 198 | elements.push(new ContextualMenuElement(wayPointList[i].GetInfos().ident, function (_index) { 199 | this.currentFPLWpSelected = _index; 200 | this.icaoSearchField.SetWaypoint(wayPointList[_index].type, wayPointList[_index].GetInfos().icao); 201 | this.gps.SwitchToInteractionState(1); 202 | this.gps.cursorIndex = 2; 203 | }.bind(this, i))); 204 | } 205 | } 206 | if (this.gps.currFlightPlan.wayPoints.length > 0) { 207 | this.gps.ShowContextualMenu(new ContextualMenu("FPL", elements)); 208 | this.menuname = "fpl"; 209 | } 210 | } 211 | } 212 | activateButton_SelectionCallback(_event) { 213 | if (_event == "ENT_Push") { 214 | 215 | // DirecTO bug correction when direct to an airport 216 | // FS2020 removes the origin airport (first flight plan index) 217 | // The direct then works but its not possible any more to select an approach for the new destination airport 218 | // The correction consists of re-inserting the origin airport at the start of the flight plan 219 | this.gps.cancelDirectTo(() => { 220 | let waypoint_origin = this.gps.currFlightPlanManager.getWaypoint(0); 221 | this.gps.enableCheckAfterDirectTo = this.icaoSearchField.getWaypoint(); 222 | this.gps.currFlightPlanManager.activateDirectTo(this.icaoSearchField.getWaypoint().infos.icao, () => { 223 | if(waypoint_origin && this.icaoSearchField.getWaypoint().infos instanceof AirportInfo){ 224 | this.gps.currFlightPlanManager.addWaypoint(waypoint_origin.icao, 0); 225 | } 226 | this.gps.SwitchToInteractionState(0); 227 | this.gps.leaveEventPage(); 228 | }); 229 | }); 230 | } 231 | } 232 | DirectToCheck() { 233 | return !this.gps.currFlightPlanManager.getIsDirectTo(); 234 | } 235 | cancelDirectTo(){ 236 | this.gps.confirmWindow.element.setTexts("Confirm cancel direct to ?"); 237 | this.gps.switchToPopUpPage(this.gps.confirmWindow, () => { 238 | if (this.gps.confirmWindow.element.Result == 1) { 239 | // Remove any directTo before activating leg 240 | if(this.gps.currFlightPlanManager.getIsDirectTo()){ 241 | this.gps.cancelDirectTo(); 242 | this.gps.SwitchToInteractionState(0); 243 | this.gps.leaveEventPage(); 244 | } 245 | } 246 | }); 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgWaypointElement.js: -------------------------------------------------------------------------------- 1 | class SvgWaypointElement extends SvgMapElement { 2 | constructor(source) { 3 | super(); 4 | this.textOffsetRatio = 0.25; 5 | this.showText = true; 6 | this.minimize = false; 7 | this._alpha = NaN; 8 | this._textWidth = NaN; 9 | this._textHeight = NaN; 10 | this.needRepaint = false; 11 | this._lastX = 0; 12 | this._lastY = 0; 13 | this._lastMinimize = false; 14 | this._lastIsActiveWaypoint = false; 15 | this.source = source; 16 | //PM Modif: Map waypoint selection 17 | this.selected = false; 18 | //PM Modif: End Map waypoint selection 19 | } 20 | get ident() { 21 | if (this._ident) { 22 | return this._ident; 23 | } 24 | if (this.source) { 25 | return this.source.ident; 26 | } 27 | } 28 | set ident(v) { 29 | this._ident = v; 30 | } 31 | get icao() { 32 | if (this._icao) { 33 | return this._icao; 34 | } 35 | if (this.source) { 36 | return this.source.icao; 37 | } 38 | } 39 | get icaoNoSpace() { 40 | if (this.source instanceof WayPoint) { 41 | return this.source.icaoNoSpace; 42 | } 43 | if (!this._icaoNoSpace) { 44 | if (this.icao) { 45 | this._icaoNoSpace = this.icao; 46 | while (this._icaoNoSpace.indexOf(" ") != -1) { 47 | this._icaoNoSpace = this._icaoNoSpace.replace(" ", "_"); 48 | } 49 | } 50 | } 51 | if (this._icaoNoSpace) { 52 | return this._icaoNoSpace; 53 | } 54 | } 55 | set icao(v) { 56 | this._icao = v; 57 | this._icaoNoSpace = this._icao; 58 | while (this._icaoNoSpace.indexOf(" ") != -1) { 59 | this._icaoNoSpace.replace(" ", "_"); 60 | } 61 | } 62 | get coordinates() { 63 | if (this._coordinates) { 64 | return this._coordinates; 65 | } 66 | if (this.source && this.source.coordinates) { 67 | return this.source.coordinates; 68 | } 69 | } 70 | set coordinates(v) { 71 | this._coordinates = v; 72 | } 73 | get bearing() { 74 | if (this._bearing) { 75 | return this._bearing; 76 | } 77 | if (this.source) { 78 | return this.source.bearing; 79 | } 80 | } 81 | set bearing(v) { 82 | this._bearing = v; 83 | } 84 | get distance() { 85 | if (this._distance) { 86 | return this._distance; 87 | } 88 | if (this.source) { 89 | return this.source.distance; 90 | } 91 | } 92 | set distance(v) { 93 | this._distance = v; 94 | } 95 | imageFileName() { 96 | if (this.source) { 97 | return this.source.imageFileName(); 98 | } 99 | } 100 | isMinized(map) { 101 | return false; 102 | } 103 | createDraw(map) { 104 | let fontSize = map.config.waypointLabelFontSize / map.overdrawFactor; 105 | let text = this.ident; 106 | let c = document.createElement("canvas"); 107 | let ctx = c.getContext("2d"); 108 | ctx.font = fontSize + "px " + map.config.waypointLabelFontFamily; 109 | this._textWidth = ctx.measureText(text).width; 110 | this._textHeight = fontSize * 0.675; 111 | let isActiveWaypoint = false; 112 | if (map.instrument && map.instrument.flightPlanManager) { 113 | let ident = map.instrument.flightPlanManager.getActiveWaypointIdent(); 114 | isActiveWaypoint = this.source.ident === ident; 115 | } 116 | this._refreshLabel(map, isActiveWaypoint); 117 | this._image = document.createElementNS(Avionics.SVG.NS, "image"); 118 | this._image.id = this.id(map); 119 | this._image.classList.add(this.class() + "-icon"); 120 | diffAndSetAttribute(this._image, "hasTextBox", "true"); 121 | diffAndSetAttribute(this._image, "width", "100%"); 122 | diffAndSetAttribute(this._image, "height", "100%"); 123 | //PM Modif: Map waypoint image correct also for active WP 124 | // if (!isActiveWaypoint) { 125 | this._image.setAttributeNS("http://www.w3.org/1999/xlink", "href", map.config.imagesDir + this.imageFileName()); 126 | // } 127 | // else { 128 | // this._image.setAttributeNS("http://www.w3.org/1999/xlink", "href", map.config.imagesDir + "ICON_MAP_INTERSECTION_ACTIVE.png"); 129 | // } 130 | //PM Modif: End Map waypoint image correct also for active WP 131 | this._lastIsActiveWaypoint = isActiveWaypoint; 132 | diffAndSetAttribute(this._image, "width", fastToFixed(map.config.waypointIconSize / map.overdrawFactor, 0)); 133 | diffAndSetAttribute(this._image, "height", fastToFixed(map.config.waypointIconSize / map.overdrawFactor, 0)); 134 | this._lastMinimize = undefined; 135 | return this._image; 136 | } 137 | _refreshLabel(map, isActiveWaypoint) { 138 | let labelId = this.id(map) + "-text-" + map.index; 139 | let label = document.getElementById(labelId); 140 | if (label instanceof SVGForeignObjectElement) { 141 | this._label = label; 142 | this.needRepaint = true; 143 | } 144 | let fontSize = map.config.waypointLabelFontSize / map.overdrawFactor; 145 | let text = this.ident; 146 | let canvas; 147 | if (!this._label) { 148 | this._label = document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"); 149 | this._label.id = labelId; 150 | diffAndSetAttribute(this._label, "width", fastToFixed((this._textWidth + map.config.waypointLabelBackgroundPaddingLeft / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingRight / map.overdrawFactor), 0) + "px"); 151 | diffAndSetAttribute(this._label, "height", fastToFixed((this._textHeight + map.config.waypointLabelBackgroundPaddingTop / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingBottom / map.overdrawFactor), 0) + "px"); 152 | canvas = document.createElement("canvas"); 153 | diffAndSetAttribute(canvas, "width", fastToFixed((this._textWidth + map.config.waypointLabelBackgroundPaddingLeft / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingRight / map.overdrawFactor), 0) + "px"); 154 | diffAndSetAttribute(canvas, "height", fastToFixed((this._textHeight + map.config.waypointLabelBackgroundPaddingTop / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingBottom / map.overdrawFactor), 0) + "px"); 155 | this._label.appendChild(canvas); 156 | map.textLayer.appendChild(this._label); 157 | } 158 | else { 159 | canvas = this._label.querySelector("canvas"); 160 | } 161 | if (!canvas) { 162 | return; 163 | } 164 | let context = canvas.getContext("2d"); 165 | //PM Modif: Map waypoint selection 166 | if (map.config.waypointLabelUseBackground || this.selected) { 167 | context.fillStyle = "black"; 168 | context.fillRect(0, 0, this._textWidth + map.config.waypointLabelBackgroundPaddingLeft / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingRight / map.overdrawFactor, this._textHeight + map.config.waypointLabelBackgroundPaddingTop / map.overdrawFactor + map.config.waypointLabelBackgroundPaddingBottom / map.overdrawFactor); 169 | } 170 | //PM Modif: End Map waypoint selection 171 | if (!isActiveWaypoint) { 172 | if (this.source instanceof IntersectionInfo) { 173 | context.fillStyle = map.config.intersectionLabelColor; 174 | } 175 | else if (this.source instanceof VORInfo) { 176 | context.fillStyle = map.config.vorLabelColor; 177 | } 178 | else if (this.source instanceof NDBInfo) { 179 | context.fillStyle = map.config.ndbLabelColor; 180 | } 181 | else if (this.source instanceof AirportInfo) { 182 | context.fillStyle = map.config.airportLabelColor; 183 | } 184 | else { 185 | context.fillStyle = map.config.waypointLabelColor; 186 | } 187 | } 188 | else { 189 | context.fillStyle = "white"; 190 | } 191 | //PM Modif: Map waypoint selection 192 | if(this.selected) 193 | context.fillStyle = "yellow"; 194 | //PM Modif: End Map waypoint selection 195 | context.font = fontSize + "px " + map.config.waypointLabelFontFamily; 196 | context.fillText(text, map.config.waypointLabelBackgroundPaddingLeft / map.overdrawFactor, this._textHeight + map.config.waypointLabelBackgroundPaddingTop / map.overdrawFactor); 197 | } 198 | updateDraw(map) { 199 | if (this.coordinates) { 200 | map.coordinatesToXYToRef(this.coordinates, this); 201 | } 202 | else if (isFinite(this.source.latitudeFP) && isFinite(this.source.longitudeFP)) { 203 | map.coordinatesToXYToRef(new LatLongAlt(this.source.latitudeFP, this.source.longitudeFP), this); 204 | } 205 | else { 206 | let pos = map.bearingDistanceToXY(this.bearing, this.distance); 207 | this.x = pos.x; 208 | this.y = pos.y; 209 | } 210 | // PM Modif: No correction in get active waypoint index so the active waypoint is correctly displayed 211 | let wp = FlightPlanManager.DEBUG_INSTANCE.getActiveWaypoint(false); 212 | if (this.source && this.source.instrument && this.source.instrument.flightPlanManager) { 213 | wp = this.source.instrument.flightPlanManager.getActiveWaypoint(false); 214 | } 215 | // PM Modif: End No correction in get active waypoint index so the active waypoint is correctly displayed 216 | 217 | //PM Modif: Check also ident 218 | let isActiveWaypoint = this.source === wp || (wp && wp.icao === this.source.icao) || (wp && wp.ident === this.source.ident); 219 | //PM Modif: End Check also ident 220 | if (isActiveWaypoint != this._lastIsActiveWaypoint) { 221 | this._refreshLabel(map, isActiveWaypoint); 222 | if (this._image) { 223 | // if (!isActiveWaypoint) { 224 | this._image.setAttributeNS("http://www.w3.org/1999/xlink", "href", map.config.imagesDir + this.imageFileName()); 225 | // } 226 | // else { 227 | // this._image.setAttributeNS("http://www.w3.org/1999/xlink", "href", map.config.imagesDir + "ICON_MAP_INTERSECTION_ACTIVE.png"); 228 | // } 229 | } 230 | this._lastIsActiveWaypoint = isActiveWaypoint; 231 | } 232 | if (isFinite(this.x) && isFinite(this.y)) { 233 | //PM Modif: No Minimize for GTN750 234 | // this.minimize = this.isMinized(map); 235 | //PM Modif: End No Minimize 236 | if (this._image && this._lastMinimize !== this.minimize) { 237 | if (this.minimize) { 238 | diffAndSetAttribute(this._image, "width", fastToFixed(map.config.waypointIconSize / map.overdrawFactor * 0.5, 0)); 239 | diffAndSetAttribute(this._image, "height", fastToFixed(map.config.waypointIconSize / map.overdrawFactor * 0.5, 0)); 240 | } 241 | else { 242 | diffAndSetAttribute(this._image, "width", fastToFixed(map.config.waypointIconSize / map.overdrawFactor, 0)); 243 | diffAndSetAttribute(this._image, "height", fastToFixed(map.config.waypointIconSize / map.overdrawFactor, 0)); 244 | } 245 | this._lastMinimize = this.minimize; 246 | this.needRepaint = true; 247 | } 248 | if (this.needRepaint || Math.abs(this._lastX - this.x) > 0.1 || Math.abs(this._lastY - this.y) > 0.1) { 249 | this._lastX = this.x; 250 | this._lastY = this.y; 251 | let x = (this.x - map.config.waypointIconSize / map.overdrawFactor * 0.5 * (this.minimize ? 0.5 : 1)); 252 | let y = (this.y - map.config.waypointIconSize / map.overdrawFactor * 0.5 * (this.minimize ? 0.5 : 1)); 253 | diffAndSetAttribute(this.svgElement, "x", x + ""); 254 | diffAndSetAttribute(this.svgElement, "y", y + ""); 255 | if (this.source instanceof AirportInfo) { 256 | let a = this.source.longestRunwayDirection; 257 | if (isNaN(a) && this.source.runways[0]) { 258 | a = this.source.runways[0].direction; 259 | } 260 | if (isFinite(a)) { 261 | this._alpha = a - 45; 262 | } 263 | } 264 | if (isFinite(this._alpha)) { 265 | //PM Modif: Correct angle for track up 266 | if (map.rotationMode != EMapRotationMode.NorthUp) { 267 | this._alpha -= map.mapUpDirection; 268 | } 269 | //PM Modif: End Correct angle for track up 270 | diffAndSetAttribute(this.svgElement, "transform", "rotate(" + fastToFixed(this._alpha, 0) + " " + fastToFixed(this.x, 0) + " " + fastToFixed(this.y, 0) + ")"); 271 | } 272 | if (!this._label) { 273 | let labelId = this.id(map) + "-text-" + map.index; 274 | let label = document.getElementById(labelId); 275 | if (label instanceof SVGForeignObjectElement) { 276 | let c = document.createElement("canvas"); 277 | let ctx = c.getContext("2d"); 278 | let fontSize = map.config.waypointLabelFontSize / map.overdrawFactor; 279 | let text = this.ident; 280 | ctx.font = fontSize + "px " + map.config.waypointLabelFontFamily; 281 | this._textWidth = ctx.measureText(text).width; 282 | this._textHeight = fontSize * 0.675; 283 | this._label = label; 284 | this.needRepaint = true; 285 | } 286 | } 287 | if (this._label) { 288 | if (!isFinite(this._textWidth)) { 289 | let c = document.createElement("canvas"); 290 | let ctx = c.getContext("2d"); 291 | let fontSize = map.config.waypointLabelFontSize / map.overdrawFactor; 292 | let text = this.ident; 293 | ctx.font = fontSize + "px " + map.config.waypointLabelFontFamily; 294 | this._textWidth = ctx.measureText(text).width; 295 | } 296 | if (!isFinite(this._textHeight)) { 297 | let fontSize = map.config.waypointLabelFontSize / map.overdrawFactor; 298 | this._textHeight = fontSize * 0.675; 299 | } 300 | let textX = (x + map.config.waypointIconSize / map.overdrawFactor * 0.5 - this._textWidth * 0.5 + map.config.waypointLabelDistanceX / map.overdrawFactor); 301 | let textY = y + map.config.waypointLabelDistance / map.overdrawFactor; 302 | diffAndSetAttribute(this._label, "x", textX + ""); 303 | diffAndSetAttribute(this._label, "y", textY + ""); 304 | this.needRepaint = false; 305 | } 306 | else { 307 | this.needRepaint = true; 308 | } 309 | } 310 | } 311 | } 312 | } 313 | //# sourceMappingURL=SvgWaypointElement.js.map -------------------------------------------------------------------------------- /layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "content": [ 3 | { 4 | "path": "readme.md", 5 | "size": 24113, 6 | "date": 132716700314270267 7 | }, 8 | { 9 | "path": "Config/pms50-gns530/config.json", 10 | "size": 340, 11 | "date": 132453631615266162 12 | }, 13 | { 14 | "path": "Config/pms50-gns530/example_config.json", 15 | "size": 265, 16 | "date": 132658905917459951 17 | }, 18 | { 19 | "path": "ContentInfo/pms50-gns530/info.json", 20 | "size": 49, 21 | "date": 132716704366516853 22 | }, 23 | { 24 | "path": "ContentInfo/pms50-gns530/Thumbnail.jpg", 25 | "size": 58203, 26 | "date": 132509141450220984 27 | }, 28 | { 29 | "path": "fpl530/fpl1.pln", 30 | "size": 4000, 31 | "date": 132453631615266162 32 | }, 33 | { 34 | "path": "fpl530/fpl2.pln", 35 | "size": 4000, 36 | "date": 132453631615266162 37 | }, 38 | { 39 | "path": "fpl530/fpl3.pln", 40 | "size": 4000, 41 | "date": 132453631615266162 42 | }, 43 | { 44 | "path": "fpl530/fpl4.pln", 45 | "size": 4000, 46 | "date": 132453631615266162 47 | }, 48 | { 49 | "path": "fpl530/fpl5.pln", 50 | "size": 4000, 51 | "date": 132453631615266162 52 | }, 53 | { 54 | "path": "fpl530/fpl6.pln", 55 | "size": 4000, 56 | "date": 132453631615266162 57 | }, 58 | { 59 | "path": "fpl530/fpl7.pln", 60 | "size": 4000, 61 | "date": 132453631615266162 62 | }, 63 | { 64 | "path": "fpl530/fpl8.pln", 65 | "size": 4000, 66 | "date": 132453631615266162 67 | }, 68 | { 69 | "path": "fpl530/fpl9.pln", 70 | "size": 4000, 71 | "date": 132453631615266162 72 | }, 73 | { 74 | "path": "fpl530/fpl10.pln", 75 | "size": 4000, 76 | "date": 132453631615266162 77 | }, 78 | { 79 | "path": "fpl530/fpl11.pln", 80 | "size": 4000, 81 | "date": 132453631615266162 82 | }, 83 | { 84 | "path": "fpl530/fpl12.pln", 85 | "size": 4000, 86 | "date": 132453631615266162 87 | }, 88 | { 89 | "path": "fpl530/fpl13.pln", 90 | "size": 4000, 91 | "date": 132453631615266162 92 | }, 93 | { 94 | "path": "fpl530/fpl14.pln", 95 | "size": 4000, 96 | "date": 132453631615266162 97 | }, 98 | { 99 | "path": "fpl530/fpl15.pln", 100 | "size": 4000, 101 | "date": 132453631615266162 102 | }, 103 | { 104 | "path": "fpl530/fpl16.pln", 105 | "size": 4000, 106 | "date": 132453631615266162 107 | }, 108 | { 109 | "path": "fpl530/fpl17.pln", 110 | "size": 4000, 111 | "date": 132453631615266162 112 | }, 113 | { 114 | "path": "fpl530/fpl18.pln", 115 | "size": 4000, 116 | "date": 132453631615266162 117 | }, 118 | { 119 | "path": "fpl530/fpl19.pln", 120 | "size": 4000, 121 | "date": 132453631615266162 122 | }, 123 | { 124 | "path": "html_ui/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.html", 125 | "size": 123, 126 | "date": 132471765595998547 127 | }, 128 | { 129 | "path": "html_ui/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.html", 130 | "size": 123, 131 | "date": 132467184715345525 132 | }, 133 | { 134 | "path": "html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_PLANE_GNS530.svg", 135 | "size": 5149, 136 | "date": 132481162143142986 137 | }, 138 | { 139 | "path": "html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_OTHER_530.svg", 140 | "size": 2392, 141 | "date": 132544292721893852 142 | }, 143 | { 144 | "path": "html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_PROX_530.svg", 145 | "size": 2394, 146 | "date": 132544292083578442 147 | }, 148 | { 149 | "path": "html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_RA_530.svg", 150 | "size": 2442, 151 | "date": 132424757337675932 152 | }, 153 | { 154 | "path": "html_ui/Pages/VCockpit/Instruments/Shared/Map/Images/Outlined/ICON_MAP_TCAS_TA_530.svg", 155 | "size": 2424, 156 | "date": 132424757337715971 157 | }, 158 | { 159 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.css", 160 | "size": 89992, 161 | "date": 132687317608496674 162 | }, 163 | { 164 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.html", 165 | "size": 76429, 166 | "date": 132703893677036854 167 | }, 168 | { 169 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/AS430.js", 170 | "size": 7034, 171 | "date": 132687296873399628 172 | }, 173 | { 174 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS430/mapConfig.json", 175 | "size": 3007, 176 | "date": 132703890629593931 177 | }, 178 | { 179 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.css", 180 | "size": 105354, 181 | "date": 132617628695734021 182 | }, 183 | { 184 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.html", 185 | "size": 84872, 186 | "date": 132703854988023262 187 | }, 188 | { 189 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/AS530.js", 190 | "size": 11231, 191 | "date": 132716703120481106 192 | }, 193 | { 194 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/AS530/mapConfig.json", 195 | "size": 3002, 196 | "date": 132703861080799768 197 | }, 198 | { 199 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/AuxPages.js", 200 | "size": 17839, 201 | "date": 132703150961390159 202 | }, 203 | { 204 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/BaseGPS.js", 205 | "size": 27655, 206 | "date": 132716713865553977 207 | }, 208 | { 209 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/DirectTo.js", 210 | "size": 12702, 211 | "date": 132703130822666564 212 | }, 213 | { 214 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/FlightPlan.js", 215 | "size": 89641, 216 | "date": 132716916862274754 217 | }, 218 | { 219 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/Message.js", 220 | "size": 18400, 221 | "date": 132687328979410474 222 | }, 223 | { 224 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/NavPages.js", 225 | "size": 110221, 226 | "date": 132704071863507137 227 | }, 228 | { 229 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/NearestPages.js", 230 | "size": 17596, 231 | "date": 132643309524272446 232 | }, 233 | { 234 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/Procedures.js", 235 | "size": 41670, 236 | "date": 132542381316353003 237 | }, 238 | { 239 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/Vnav.js", 240 | "size": 10959, 241 | "date": 132687328823242201 242 | }, 243 | { 244 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/WaypointPages.js", 245 | "size": 99525, 246 | "date": 132710693082501603 247 | }, 248 | { 249 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/CommonPFD_MFD.js", 250 | "size": 199001, 251 | "date": 132710703945238236 252 | }, 253 | { 254 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/NavSystem.js", 255 | "size": 127474, 256 | "date": 132703370160931465 257 | }, 258 | { 259 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_EW.png", 260 | "size": 170, 261 | "date": 132467233160881898 262 | }, 263 | { 264 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NE_SW.png", 265 | "size": 180, 266 | "date": 132467234216910398 267 | }, 268 | { 269 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NS.png", 270 | "size": 172, 271 | "date": 132467234436165493 272 | }, 273 | { 274 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Hard_NW_SE.png", 275 | "size": 182, 276 | "date": 132467234626143907 277 | }, 278 | { 279 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Airport_Soft.png", 280 | "size": 169, 281 | "date": 132467234820401227 282 | }, 283 | { 284 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Anchor.png", 285 | "size": 183, 286 | "date": 132467234968866927 287 | }, 288 | { 289 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_left.png", 290 | "size": 203, 291 | "date": 132467235124163780 292 | }, 293 | { 294 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/arc_right.png", 295 | "size": 205, 296 | "date": 132467235309137689 297 | }, 298 | { 299 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/brg.png", 300 | "size": 953, 301 | "date": 132482820036594943 302 | }, 303 | { 304 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_arrow.png", 305 | "size": 406, 306 | "date": 132481901260290496 307 | }, 308 | { 309 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/cdi_tofrom.png", 310 | "size": 347, 311 | "date": 132482187006982527 312 | }, 313 | { 314 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass.png", 315 | "size": 9229, 316 | "date": 132476860857035485 317 | }, 318 | { 319 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/compass2.png", 320 | "size": 6479, 321 | "date": 132482679608429184 322 | }, 323 | { 324 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/course_to.png", 325 | "size": 190, 326 | "date": 132467235476966092 327 | }, 328 | { 329 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/direct_to.png", 330 | "size": 209, 331 | "date": 132467235648482816 332 | }, 333 | { 334 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Dme.png", 335 | "size": 165, 336 | "date": 132467235858929875 337 | }, 338 | { 339 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/glogo.png", 340 | "size": 10324, 341 | "date": 132510397701766768 342 | }, 343 | { 344 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Helipad.png", 345 | "size": 173, 346 | "date": 132467236008346373 347 | }, 348 | { 349 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Intersection.png", 350 | "size": 165, 351 | "date": 132467206421079373 352 | }, 353 | { 354 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_hand.png", 355 | "size": 219, 356 | "date": 132467236157677759 357 | }, 358 | { 359 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/left_turn.png", 360 | "size": 224, 361 | "date": 132467236325476020 362 | }, 363 | { 364 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Localizer.png", 365 | "size": 172, 366 | "date": 132467236453938317 367 | }, 368 | { 369 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Marker.png", 370 | "size": 180, 371 | "date": 132467236579372822 372 | }, 373 | { 374 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Ndb.png", 375 | "size": 185, 376 | "date": 132467236718154525 377 | }, 378 | { 379 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/north.png", 380 | "size": 1038, 381 | "date": 132480571911361569 382 | }, 383 | { 384 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Private_Airfield.png", 385 | "size": 180, 386 | "date": 132467236871689868 387 | }, 388 | { 389 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/repere.png", 390 | "size": 255, 391 | "date": 132477500602100638 392 | }, 393 | { 394 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_hand.png", 395 | "size": 219, 396 | "date": 132467236993826362 397 | }, 398 | { 399 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/right_turn.png", 400 | "size": 216, 401 | "date": 132467237164847552 402 | }, 403 | { 404 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Tacan.png", 405 | "size": 174, 406 | "date": 132467237315965688 407 | }, 408 | { 409 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/vectors_to_final.png", 410 | "size": 196, 411 | "date": 132467237562060405 412 | }, 413 | { 414 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/Images/GPS/Vor.png", 415 | "size": 173, 416 | "date": 132467237738501682 417 | }, 418 | { 419 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/ContextualMenu.js", 420 | "size": 3151, 421 | "date": 132703292098886958 422 | }, 423 | { 424 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/CustomValue.js", 425 | "size": 7237, 426 | "date": 132664351446957571 427 | }, 428 | { 429 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/Messages.js", 430 | "size": 2102, 431 | "date": 132511455735839594 432 | }, 433 | { 434 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/SearchField.js", 435 | "size": 25352, 436 | "date": 132704041496122991 437 | }, 438 | { 439 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/SelectableElement.js", 440 | "size": 16330, 441 | "date": 132704043713153642 442 | }, 443 | { 444 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/FlightElements/Waypoint.js", 445 | "size": 38079, 446 | "date": 132709836431026863 447 | }, 448 | { 449 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/FlightElements/Approach.js", 450 | "size": 38079, 451 | "date": 132709836431026863 452 | }, 453 | { 454 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/FlightElements/FlightPlanManager.js", 455 | "size": 38079, 456 | "date": 132709836431026863 457 | }, 458 | { 459 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/FlightElements/WaypointLoader.js", 460 | "size": 38079, 461 | "date": 132709836431026863 462 | }, 463 | { 464 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.css", 465 | "size": 2010, 466 | "date": 132698121072334061 467 | }, 468 | { 469 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html", 470 | "size": 5225, 471 | "date": 132703401125398704 472 | }, 473 | { 474 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.js", 475 | "size": 72204, 476 | "date": 132703954879904415 477 | }, 478 | { 479 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgAirplaneElement.js", 480 | "size": 23350, 481 | "date": 132704050867785017 482 | }, 483 | { 484 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgFlightPlanElement.js", 485 | "size": 41480, 486 | "date": 132709838727410351 487 | }, 488 | { 489 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgRoadNetworkElement.js", 490 | "size": 23431, 491 | "date": 132704062047738613 492 | }, 493 | { 494 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgWaypointElement.js", 495 | "size": 14345, 496 | "date": 132704063703012547 497 | }, 498 | { 499 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestIntersectionElement.js", 500 | "size": 14345, 501 | "date": 132704063703012547 502 | }, 503 | { 504 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestNDBElement.js", 505 | "size": 14345, 506 | "date": 132704063703012547 507 | }, 508 | { 509 | "path": "html_ui/Pms50/Pages/VCockpit/Instruments/Shared/Map/Svg/SvgNearestVORElement.js", 510 | "size": 14345, 511 | "date": 132704063703012547 512 | } 513 | ] 514 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/Shared/LogicElements/SelectableElement.js: -------------------------------------------------------------------------------- 1 | class SelectableElement { 2 | constructor(_gps, _element, _callBack) { 3 | this.isActive = true; 4 | this.gps = _gps; 5 | this.element = _element; 6 | this.callBack = _callBack; 7 | } 8 | SendEvent(_event = null, _index = -1) { 9 | if (_index == -1) { 10 | return this.callBack(_event); 11 | } 12 | else { 13 | return this.callBack(_event, _index); 14 | } 15 | } 16 | GetElement() { 17 | return this.element; 18 | } 19 | GetLineElement() { 20 | return this.element; 21 | } 22 | updateSelection(_selected) { 23 | if (!this.isActive) { 24 | diffAndSetAttribute(this.element, "state", "Greyed"); 25 | } 26 | else if (_selected) { 27 | diffAndSetAttribute(this.element, "state", "Selected"); 28 | } 29 | else { 30 | diffAndSetAttribute(this.element, "state", "Unselected"); 31 | } 32 | } 33 | onSelection(_event) { 34 | return this.isActive; 35 | } 36 | setActive(_active) { 37 | this.isActive = _active; 38 | if (_active) { 39 | diffAndSetAttribute(this.element, "state", "Unselected"); 40 | } 41 | else { 42 | if (this.gps.currentSelectableArray && this.gps.currentSelectableArray[this.gps.cursorIndex] == this) { 43 | let begin = this.gps.cursorIndex; 44 | this.gps.cursorIndex = (this.gps.cursorIndex + 1) % this.gps.currentSelectableArray.length; 45 | while (!this.gps.currentSelectableArray[this.gps.cursorIndex].isActive) { 46 | this.gps.cursorIndex = (this.gps.cursorIndex + 1) % this.gps.currentSelectableArray.length; 47 | if (this.gps.cursorIndex == begin) { 48 | this.gps.SwitchToInteractionState(0); 49 | return; 50 | } 51 | } 52 | } 53 | diffAndSetAttribute(this.element, "state", "Greyed"); 54 | } 55 | } 56 | } 57 | class DynamicSelectableElement extends SelectableElement { 58 | constructor(_gps, _elementName, _callback) { 59 | super(_gps, null, _callback); 60 | this.elementName = _elementName; 61 | } 62 | GetElement() { 63 | return this.gps.getChildById(this.elementName); 64 | } 65 | updateSelection(_selected) { 66 | if (_selected) { 67 | diffAndSetAttribute(this.GetElement(), "state", "Selected"); 68 | } 69 | else { 70 | diffAndSetAttribute(this.GetElement(), "state", "Unselected"); 71 | } 72 | } 73 | } 74 | class SelectableElementGroup extends SelectableElement { 75 | constructor(_gps, _element, _callbacks) { 76 | super(_gps, _element, null); 77 | this.callBack = this.onEvent.bind(this); 78 | this.callbacks = _callbacks; 79 | this.index = 0; 80 | } 81 | onEvent(_event, _index = -1) { 82 | var result; 83 | if (this.callbacks[this.index]) { 84 | if (_index == -1) { 85 | result = this.callbacks[this.index](_event); 86 | } 87 | else { 88 | result = this.callbacks[this.index](_event, _index); 89 | } 90 | } 91 | if (!result) { 92 | switch (_event) { 93 | case "NavigationLargeInc": 94 | if (this.index < this.callbacks.length - 1) { 95 | this.index++; 96 | result = this.skipInexistantElements(true); 97 | } 98 | else { 99 | result = false; 100 | } 101 | break; 102 | case "NavigationLargeDec": 103 | if (this.index > 0) { 104 | this.index--; 105 | result = this.skipInexistantElements(false); 106 | } 107 | else { 108 | result = false; 109 | } 110 | break; 111 | } 112 | } 113 | return result; 114 | } 115 | onSelection(_event) { 116 | if (_event == "NavigationLargeInc") { 117 | this.index = 0; 118 | return this.skipInexistantElements(true); 119 | } 120 | else if (_event == "NavigationLargeDec") { 121 | this.index = this.callbacks.length - 1; 122 | return this.skipInexistantElements(false); 123 | } 124 | return true; 125 | } 126 | skipInexistantElements(_up = true) { 127 | let elem; 128 | do { 129 | elem = this.element.getElementsByClassName("Select" + this.index)[0]; 130 | if (!elem) { 131 | this.index += (_up ? 1 : -1); 132 | } 133 | } while (!elem && this.index >= 0 && this.index < this.callbacks.length); 134 | if (this.index == this.callbacks.length || this.index < 0) { 135 | return false; 136 | } 137 | return true; 138 | } 139 | updateSelection(_selected) { 140 | for (let i = 0; i < this.callbacks.length; i++) { 141 | var element = this.element.getElementsByClassName("Select" + i)[0]; 142 | if (element) { 143 | if (_selected && i == this.index) { 144 | diffAndSetAttribute(element, "state", "Selected"); 145 | } 146 | else { 147 | diffAndSetAttribute(element, "state", "Unselected"); 148 | } 149 | } 150 | if (i == this.index && !element) { 151 | if (!this.skipInexistantElements(true)) { 152 | this.skipInexistantElements(false); 153 | } 154 | } 155 | } 156 | } 157 | GetElement() { 158 | return this.element.getElementsByClassName("Select" + this.index)[0]; 159 | } 160 | } 161 | class SelectableElementSliderGroup extends SelectableElement { 162 | constructor(_gps, _elements, _slider, _cursor, _step = 1, _emptyLine = "") { 163 | super(_gps, null, null); 164 | this.stringElements = []; 165 | this.dataElements = []; 166 | this.isDisplayLocked = false; 167 | this.callBack = this.onEvent.bind(this); 168 | this.elements = _elements; 169 | this.slider = _slider; 170 | this.sliderCursor = _cursor; 171 | this.index = 0; 172 | this.offset = 0; 173 | this.step = _step; 174 | this.emptyLine = _emptyLine; 175 | } 176 | onEvent(_event) { 177 | var result; 178 | let l = Math.max(this.stringElements.length, this.dataElements.length); 179 | if (l > 0) { 180 | result = this.elements[this.index].SendEvent(_event, this.offset + this.index); 181 | if (!result) { 182 | switch (_event) { 183 | case "NavigationLargeInc": 184 | do { 185 | if (this.index == this.elements.length - 1) { 186 | if ((this.index + this.offset) < l - 1) { 187 | this.offset += this.step; 188 | this.index -= (this.step - 1); 189 | result = true; 190 | } 191 | else { 192 | result = false; 193 | } 194 | } 195 | else { 196 | if (this.index < Math.min(this.elements.length, l) - 1) { 197 | this.index++; 198 | result = true; 199 | } 200 | } 201 | } while (result && !this.elements[this.index].onSelection(_event)); 202 | break; 203 | case "NavigationLargeDec": 204 | do { 205 | if (this.index == 0) { 206 | if (this.offset > 0) { 207 | this.offset -= this.step; 208 | this.index += (this.step - 1); 209 | result = true; 210 | } 211 | else { 212 | result = false; 213 | } 214 | } 215 | else { 216 | this.index--; 217 | result = true; 218 | } 219 | } while (result && !this.elements[this.index].onSelection(_event)); 220 | break; 221 | } 222 | } 223 | } 224 | if (this.dataElements.length > this.stringElements.length) { 225 | this.updateDisplayWithData(); 226 | } 227 | else { 228 | this.updateDisplay(); 229 | } 230 | return result; 231 | } 232 | GetElement() { 233 | return this.elements[this.index].GetElement(); 234 | } 235 | GetLineElement() { 236 | return this.elements[this.index].GetLineElement(); 237 | } 238 | getIndex() { 239 | return this.offset + this.index; 240 | } 241 | getOffset() { 242 | return this.offset; 243 | } 244 | updateSelection(_selected) { 245 | for (let i = 0; i < this.elements.length; i++) { 246 | if (_selected && i == this.index) { 247 | this.elements[i].updateSelection(true); 248 | } 249 | else { 250 | this.elements[i].updateSelection(false); 251 | } 252 | } 253 | } 254 | getStringElements() { 255 | return this.stringElements; 256 | } 257 | setDataElements(_dataElements) { 258 | this.dataElements = _dataElements; 259 | if (this.index < 0) { 260 | this.index = 0; 261 | } 262 | if (this.offset + this.index >= this.dataElements.length) { 263 | this.offset = Math.max(0, this.dataElements.length - this.elements.length); 264 | this.index = Math.min(this.dataElements.length, this.elements.length) - 1; 265 | } 266 | this.updateDisplayWithData(); 267 | } 268 | setStringElements(_sElements) { 269 | if (!this.stringElements) { 270 | this.stringElements = []; 271 | } 272 | for (let i = 0; i < _sElements.length; i++) { 273 | if (this.stringElements[i] != _sElements[i]) { 274 | this.stringElements[i] = _sElements[i]; 275 | } 276 | } 277 | while (this.stringElements.length > _sElements.length && this.stringElements.length > 0) { 278 | this.stringElements.pop(); 279 | } 280 | if (this.index < 0) { 281 | this.index = 0; 282 | } 283 | if (this.offset + this.index >= this.stringElements.length) { 284 | this.offset = Math.max(0, this.stringElements.length - this.elements.length); 285 | this.index = Math.min(this.stringElements.length, this.elements.length) - 1; 286 | } 287 | this.updateDisplay(); 288 | } 289 | incrementIndex(_up = true) { 290 | let result; 291 | let l = Math.max(this.stringElements.length, this.dataElements.length); 292 | if (_up) { 293 | do { 294 | if (this.index == this.elements.length - 1) { 295 | if ((this.index + this.offset) < l - 1) { 296 | this.offset += this.step; 297 | this.index -= (this.step - 1); 298 | result = true; 299 | } 300 | else { 301 | result = false; 302 | } 303 | } 304 | else { 305 | if (this.index < Math.min(this.elements.length, l) - 1) { 306 | this.index++; 307 | result = true; 308 | } 309 | } 310 | } while (result && !this.elements[this.index].onSelection("NavigationLargeInc")); 311 | } 312 | else { 313 | do { 314 | if (this.index == 0) { 315 | if (this.offset > 0) { 316 | this.offset -= this.step; 317 | this.index += (this.step - 1); 318 | result = true; 319 | } 320 | else { 321 | result = false; 322 | } 323 | } 324 | else { 325 | this.index--; 326 | result = true; 327 | } 328 | } while (result && !this.elements[this.index].onSelection("NavigationLargeDec")); 329 | } 330 | } 331 | onSelection(_event) { 332 | let l = Math.max(this.stringElements.length, this.dataElements.length); 333 | if (l === 0) { 334 | return false; 335 | } 336 | if (_event == "NavigationLargeInc") { 337 | this.offset = 0; 338 | this.index = 0; 339 | } 340 | else if (_event == "NavigationLargeDec") { 341 | this.offset = Math.max(0, l - this.elements.length); 342 | this.index = Math.min(l, this.elements.length) - 1; 343 | } 344 | if (this.dataElements.length > this.stringElements.length) { 345 | this.updateDisplayWithData(); 346 | } 347 | else { 348 | this.updateDisplay(); 349 | } 350 | if (!this.elements[this.index].onSelection(_event)) { 351 | this.onEvent(_event); 352 | } 353 | return true; 354 | } 355 | updateDisplay() { 356 | if (this.isDisplayLocked) { 357 | return; 358 | } 359 | var nbElements = this.stringElements.length; 360 | var maxDisplayedElements = this.elements.length; 361 | if (nbElements > maxDisplayedElements) { 362 | diffAndSetAttribute(this.slider, "state", "Active"); 363 | diffAndSetAttribute(this.sliderCursor, "style", "height:" + (maxDisplayedElements * 100 / nbElements) + 364 | "%;top:" + (this.offset * 100 / nbElements) + "%"); 365 | } 366 | else { 367 | diffAndSetAttribute(this.slider, "state", "Inactive"); 368 | } 369 | for (let i = 0; i < Math.min(this.elements.length, this.stringElements.length); i++) { 370 | diffAndSetHTML(this.elements[i].GetLineElement(), this.stringElements[this.offset + i]); 371 | } 372 | for (let i = this.stringElements.length; i < this.elements.length; i++) { 373 | diffAndSetHTML(this.elements[i].GetLineElement(), this.emptyLine); 374 | } 375 | } 376 | updateDisplayWithData() { 377 | if (this.isDisplayLocked) { 378 | return; 379 | } 380 | var nbElements = this.dataElements.length; 381 | var maxDisplayedElements = this.elements.length; 382 | if (nbElements > maxDisplayedElements) { 383 | this.slider.setAttribute("state", "Active"); 384 | this.sliderCursor.setAttribute("style", "height:" + (maxDisplayedElements * 100 / nbElements) + 385 | "%;top:" + (this.offset * 100 / nbElements) + "%"); 386 | } 387 | else { 388 | this.slider.setAttribute("state", "Inactive"); 389 | } 390 | for (let i = 0; i < Math.min(this.elements.length, this.dataElements.length); i++) { 391 | let data = this.dataElements[this.offset + i]; 392 | let line = this.elements[i].GetLineElement(); 393 | let cells = line.children; 394 | for (let j = 0; j < 5; j++) { 395 | let cell = cells.item(j); 396 | if (!cell) { 397 | cell = document.createElement("td"); 398 | if (j === 1) { 399 | cell.classList.add("SelectableElement"); 400 | } 401 | line.appendChild(cell); 402 | } 403 | if (cell instanceof HTMLElement) { 404 | if (j === 0) { 405 | if (data[j]) { 406 | if (cell.innerHTML != data[j]) { 407 | cell.innerHTML = data[j]; 408 | } 409 | cell.style.visibility = "visible"; 410 | } 411 | else if (data[j] === "") { 412 | cell.style.visibility = "hidden"; 413 | } 414 | } 415 | else if (cell.innerHTML != data[j]) { 416 | cell.innerHTML = data[j]; 417 | } 418 | } 419 | } 420 | } 421 | for (let i = this.dataElements.length; i < this.elements.length; i++) { 422 | if (this.elements[i].GetLineElement().innerHTML != this.emptyLine) { 423 | this.elements[i].GetLineElement().innerHTML = this.emptyLine; 424 | } 425 | } 426 | } 427 | addElement(_elem) { 428 | this.elements.push(_elem); 429 | } 430 | lockDisplay() { 431 | this.isDisplayLocked = true; 432 | } 433 | unlockDisplay() { 434 | this.isDisplayLocked = false; 435 | this.updateDisplay(); 436 | } 437 | } 438 | //# sourceMappingURL=SelectableElement.js.map -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/AuxPages.js: -------------------------------------------------------------------------------- 1 | class GPS_COMSetup extends NavSystemElement { 2 | init(root) { 3 | this.channelSpacingValue = this.gps.getChildById("ChannelSpacing_Value"); 4 | this.channelSpacingMenu = new ContextualMenu("SPACING", [ 5 | new ContextualMenuElement("8.33 KHZ", this.channelSpacingSet.bind(this, 1)), 6 | new ContextualMenuElement("25.0 KHZ", this.channelSpacingSet.bind(this, 0)) 7 | ]); 8 | this.defaultSelectables = [ 9 | new SelectableElement(this.gps, this.channelSpacingValue, this.channelSpacingCB.bind(this)) 10 | ]; 11 | } 12 | onEnter() { 13 | } 14 | onUpdate(_deltaTime) { 15 | diffAndSetText(this.channelSpacingValue, SimVar.GetSimVarValue("COM SPACING MODE:" + this.gps.comIndex, "Enum") == 1 ? "8.33 kHz" : "25.0 kHz"); 16 | } 17 | onExit() { 18 | } 19 | onEvent(_event) { 20 | } 21 | channelSpacingCB(_event) { 22 | if (_event == "ENT_Push" || _event == "NavigationSmallInc" || _event == "NavigationSmallDec") { 23 | this.gps.ShowContextualMenu(this.channelSpacingMenu); 24 | } 25 | } 26 | channelSpacingSet(_mode) { 27 | if (SimVar.GetSimVarValue("COM SPACING MODE:" + this.gps.comIndex, "Enum") != _mode) { 28 | SimVar.SetSimVarValue("K:COM_" + this.gps.comIndex + "_SPACING_MODE_SWITCH", "number", 0); 29 | this.gps.dataStore.set("ChannelSpacingMode", _mode); 30 | } 31 | this.gps.SwitchToInteractionState(0); 32 | } 33 | } 34 | 35 | class GPS_METAR extends NavSystemElement { 36 | constructor(_icaoSearchField, _nbElemsMax = 8) { 37 | super(); 38 | this.name = "METAR"; 39 | this.icaoSearchField = _icaoSearchField; 40 | this.nbElemsMax = _nbElemsMax; 41 | } 42 | init(root) { 43 | this.identElement = this.gps.getChildById("APTIdent"); 44 | this.metarElement = this.gps.getChildById("MetarData_0"); 45 | this.container.defaultMenu = new ContextualMenu("METAR", [ 46 | new ContextualMenuElement("METAR Origin", this.metarOriginSet.bind(this), this.metarOriginSetCB.bind(this)), 47 | new ContextualMenuElement("METAR Destin.", this.metarDestinationSet.bind(this,), this.metarDestinationSetCB.bind(this,)) 48 | ]); 49 | this.sliderElement = this.gps.getChildById("SliderMETAR"); 50 | this.sliderCursorElement = this.gps.getChildById("SliderMETARCursor"); 51 | this.metarSliderGroup = new SelectableElementSliderGroup(this.gps, [], this.sliderElement, this.sliderCursorElement); 52 | for (let i = 0; i < this.nbElemsMax; i++) { 53 | this.metarSliderGroup.addElement(new SelectableElement(this.gps, this.gps.getChildById("MetarData_" + i), this.metar_SelectionCallback.bind(this))); 54 | } 55 | this.defaultSelectables = [ 56 | new SelectableElement(this.gps, this.identElement, this.searchField_SelectionCallback.bind(this)), 57 | this.metarSliderGroup 58 | ]; 59 | this.icaoSearchField.elements.push(this.identElement); 60 | this.doDecode = this.gps.getConfigKey("metar_decode", false); 61 | } 62 | onEnter() { 63 | if (this.gps.lastRelevantICAO && this.gps.lastRelevantICAOType == "A") { 64 | this.icaoSearchField.SetWaypoint(this.gps.lastRelevantICAOType, this.gps.lastRelevantICAO); 65 | this.initialIcao = this.gps.lastRelevantICAO; 66 | } 67 | else if (this.gps.icaoFromMap && this.gps.icaoFromMap[0] == "A") { 68 | this.icaoSearchField.SetWaypoint(this.gps.icaoFromMap[0], this.gps.icaoFromMap); 69 | this.initialIcao = this.gps.icaoFromMap; 70 | } 71 | var infos = this.icaoSearchField.getUpdatedInfos(); 72 | if(!infos || !infos.icao) { 73 | let destination = this.gps.currFlightPlanManager.getDestination(); 74 | if(destination){ 75 | this.icaoSearchField.SetWaypoint("A", destination.icao); 76 | } 77 | } 78 | if(this.icaoSearchField.wayPoint) { 79 | this.updateMetar(this.icaoSearchField.wayPoint.ident); 80 | } 81 | } 82 | onUpdate(_deltaTime) { 83 | this.icaoSearchField.Update(); 84 | var infos = this.icaoSearchField.getUpdatedInfos(); 85 | if (infos && infos.icao && infos instanceof AirportInfo) { 86 | } 87 | else { 88 | this.identElement.textContent = "_____"; 89 | } 90 | } 91 | onExit() { 92 | } 93 | onEvent(_event) { 94 | if(_event == "CLR_Push" 95 | || _event == "NavigationPush") { 96 | if(this.gps.currentContextualMenu) { 97 | this.gps.closePopUpElement(); 98 | this.gps.currentContextualMenu = null; 99 | this.gps.SwitchToInteractionState(0); 100 | } 101 | } 102 | if (_event == "ENT_Push") { 103 | if(this.gps.currentInteractionState == 0 && this.icaoSearchField.wayPoint) { 104 | this.updateMetar(this.identElement.textContent); 105 | } 106 | } 107 | } 108 | metar_SelectionCallback(_event, _index) { 109 | } 110 | searchField_SelectionCallback(_event) { 111 | if (_event == "ENT_Push" || _event == "RightSmallKnob_Right" || _event == "RightSmallKnob_Left") { 112 | this.metarSliderGroup.setStringElements([]); 113 | this.gps.currentSearchFieldWaypoint = this.icaoSearchField; 114 | this.icaoSearchField.StartSearch(function () { 115 | if(this.icaoSearchField.wayPoint) { 116 | this.updateMetar(this.icaoSearchField.wayPoint.ident); 117 | } 118 | }.bind(this)); 119 | this.gps.SwitchToInteractionState(3); 120 | } 121 | } 122 | metarOriginSetCB() { 123 | var origin = this.gps.currFlightPlanManager.getOrigin(); 124 | if(origin && origin.GetInfos().getWaypointType() == "A" ) 125 | return false; 126 | return true; 127 | } 128 | metarDestinationSetCB() { 129 | var destination = this.gps.currFlightPlanManager.getDestination(); 130 | if(destination && destination.GetInfos().getWaypointType() == "A" ) 131 | return false; 132 | return true; 133 | } 134 | metarOriginSet() { 135 | this.gps.SwitchToInteractionState(0); 136 | var origin = this.gps.currFlightPlanManager.getOrigin(); 137 | if(origin) { 138 | this.icaoSearchField.SetWaypoint("A", origin.icao); 139 | this.updateMetar(origin.ident); 140 | } 141 | } 142 | metarDestinationSet() { 143 | this.gps.SwitchToInteractionState(0); 144 | var destination = this.gps.currFlightPlanManager.getDestination(); 145 | if(destination) { 146 | this.icaoSearchField.SetWaypoint("A", destination.icao); 147 | this.updateMetar(destination.ident); 148 | } 149 | } 150 | updateMetar(ident) { 151 | this.metarSliderGroup.setStringElements([]); 152 | if(this.gps.getConfigKey("metar_avwx_token", "") == "") { 153 | this.metarSliderGroup.setStringElements(["No token. Check config."]); 154 | } 155 | else { 156 | let Lines = []; 157 | let Line = ""; 158 | let maxLineLengthMetar = 26; 159 | let maxLineLengthDecodedMetar = 32; 160 | if(this.gps.gpsType == "430") { 161 | maxLineLengthMetar = 30; 162 | maxLineLengthDecodedMetar = 36; 163 | } 164 | this.metarSliderGroup.setStringElements(["Get data..."]); 165 | this.gps.loadMetar(ident, (metar_data) => { 166 | if(metar_data.length) { 167 | let data = JSON.parse(metar_data); 168 | if(data && data.sanitized) { 169 | // Do display rows 170 | let i = 0; 171 | let SplittedLines = this.splitMetarLineData(data.sanitized, 26); 172 | for(i=0;i'; 174 | if(i==SplittedLines.length-1 && this.doDecode) 175 | Line += "
"; 176 | Lines.push(Line); 177 | } 178 | if(this.doDecode) { 179 | let translated = ""; 180 | if(data.translate["altimeter"]) { 181 | Lines = Lines.concat(this.getMetarLines("altimeter", data.translate["altimeter"])); 182 | delete data.translate["altimeter"]; 183 | } 184 | if(data.translate["wind"]) { 185 | Lines = Lines.concat(this.getMetarLines("wind", data.translate["wind"])); 186 | delete data.translate["wind"]; 187 | } 188 | if(data.translate["visibility"]) { 189 | Lines = Lines.concat(this.getMetarLines("visibility", data.translate["visibility"])); 190 | delete data.translate["visibility"]; 191 | } 192 | if(data.translate["wx_codes"]) { 193 | Lines = Lines.concat(this.getMetarLines("wx_codes", data.translate["wx_codes"])); 194 | delete data.translate["wx_codes"]; 195 | } 196 | if(data.translate["temperature"]) { 197 | Lines = Lines.concat(this.getMetarLines("temperature", data.translate["temperature"])); 198 | delete data.translate["temperature"]; 199 | } 200 | if(data.translate["dewpoint"]) { 201 | Lines = Lines.concat(this.getMetarLines("dewpoint", data.translate["dewpoint"])); 202 | delete data.translate["dewpoint"]; 203 | } 204 | if(data.translate["clouds"]) { 205 | Lines = Lines.concat(this.getMetarLines("clouds", data.translate["clouds"])); 206 | delete data.translate["clouds"]; 207 | } 208 | if(data.translate["remarks"]) { 209 | Lines = Lines.concat(this.getMetarLines("remarks", data.translate["remarks"])); 210 | delete data.translate["remarks"]; 211 | } 212 | for (var key in data.translate) { 213 | Lines = Lines.concat(this.getMetarLines(key, data.translate[key])); 214 | 215 | // if (typeof data.translate[key] === 'string' && data.translate[key].length) { 216 | // SplittedLines = this.splitMetarLineData(key + ": " + data.translate[key], 32); 217 | // if(SplittedLines.length) { 218 | // // Remove key from first line 219 | // SplittedLines[0] = SplittedLines[0].replace(key + ":", ""); 220 | // for(i=0;i'; 224 | // } 225 | // Line += '' + SplittedLines[i] + ''; 226 | // Lines.push(Line); 227 | // } 228 | // } 229 | // } 230 | // else if (typeof data.translate[key] === "object") { 231 | // // Usually for remarks entry in decoded data 232 | // let firstKey = true; 233 | // for (var key2 in data.translate[key]) { 234 | // if (typeof data.translate[key][key2] === 'string' && data.translate[key][key2].length) { 235 | // if(firstKey) { 236 | // SplittedLines = this.splitMetarLineData(key + ": " + data.translate[key][key2], 32); 237 | // if(SplittedLines.length) { 238 | // // Remove key from first line 239 | // SplittedLines[0] = SplittedLines[0].replace(key + ":", ""); 240 | // } 241 | // } 242 | // else 243 | // SplittedLines = this.splitMetarLineData(data.translate[key][key2], 32); 244 | // if(SplittedLines.length) { 245 | // for(i=0;i'; 249 | // firstKey = false; 250 | // } 251 | // Line += '' + SplittedLines[i] + ''; 252 | // Lines.push(Line); 253 | // } 254 | // } 255 | // } 256 | // } 257 | // } 258 | } 259 | } 260 | this.metarSliderGroup.setStringElements(Lines); 261 | } 262 | else { 263 | this.metarSliderGroup.setStringElements(["No data"]); 264 | } 265 | } 266 | else { 267 | this.metarSliderGroup.setStringElements(["No data"]); 268 | } 269 | }); 270 | } 271 | } 272 | getMetarLines(key ,data) { 273 | let SplittedLines = []; 274 | var Lines = []; 275 | if (typeof data === 'string' && data.length) { 276 | SplittedLines = this.splitMetarLineData(key + ": " + data, 32); 277 | if(SplittedLines.length) { 278 | // Remove key from first line 279 | SplittedLines[0] = SplittedLines[0].replace(key + ":", ""); 280 | for(let i=0;i'; 284 | } 285 | Line += '' + SplittedLines[i] + ''; 286 | Lines.push(Line); 287 | } 288 | } 289 | } 290 | else if (typeof data === "object") { 291 | // Usually for remarks entry in decoded data 292 | let firstKey = true; 293 | for (var key2 in data) { 294 | if (typeof data[key2] === 'string' && data[key2].length) { 295 | if(firstKey) { 296 | SplittedLines = this.splitMetarLineData(key + ": " + data[key2], 32); 297 | if(SplittedLines.length) { 298 | // Remove key from first line 299 | SplittedLines[0] = SplittedLines[0].replace(key + ":", ""); 300 | } 301 | } 302 | else 303 | SplittedLines = this.splitMetarLineData(data[key2], 32); 304 | if(SplittedLines.length) { 305 | for(let i=0;i'; 309 | firstKey = false; 310 | } 311 | Line += '' + SplittedLines[i] + ''; 312 | Lines.push(Line); 313 | } 314 | } 315 | } 316 | } 317 | } 318 | return Lines; 319 | } 320 | // Returns some text as array of lines of maxlenght = length 321 | splitMetarLineData(str, length) { 322 | var result = [], 323 | currentLine = '', 324 | currentLineLengthWithoutFormatting = 0; 325 | 326 | // 1. Split words on   327 | let words = str.trim().split(" "); 328 | 329 | // 2. Re-assemble lines 330 | words.forEach(function(word) { 331 | let wordLength = word.length; 332 | // Assemble line 333 | if (currentLineLengthWithoutFormatting + wordLength <= length) { 334 | // Word still fits on current line 335 | if (currentLineLengthWithoutFormatting > 0) { 336 | currentLine += ' '; 337 | currentLineLengthWithoutFormatting++; 338 | } 339 | } else { 340 | // Need to start new line 341 | result.push(currentLine); 342 | currentLine = ''; 343 | currentLineLengthWithoutFormatting = 0; 344 | } 345 | currentLine += word; 346 | currentLineLengthWithoutFormatting += wordLength; 347 | }); 348 | 349 | if (currentLineLengthWithoutFormatting > 0) 350 | result.push(currentLine); 351 | 352 | return result; 353 | } 354 | } -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/Message.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | class GPS_ConfirmationWindow extends NavSystemElement { 4 | constructor() { 5 | super(); 6 | this.CurrentText = "Confirm ?"; 7 | this.CurrentButton1Text = "Yes"; 8 | this.CurrentButton2Text = "No"; 9 | this.Result = 0; 10 | this.Active = false; 11 | } 12 | init(root) { 13 | this.window = this.gps.getChildById("ConfirmationWindow"); 14 | this.text = this.gps.getChildById("CW_ConfirmationWindowText"); 15 | this.button1 = this.gps.getChildById("CW_ConfirmationWindowButton1"); 16 | this.button1Text = this.gps.getChildById("CW_ConfirmationWindowButton1Text"); 17 | this.button2 = this.gps.getChildById("CW_ConfirmationWindowButton2"); 18 | this.button2Text = this.gps.getChildById("CW_ConfirmationWindowButton2Text"); 19 | this.defaultSelectables = [ 20 | new SelectableElement(this.gps, this.button1, this.button1_SelectionCallback.bind(this)), 21 | new SelectableElement(this.gps, this.button2, this.button2_SelectionCallback.bind(this)), 22 | ]; 23 | } 24 | onEnter() { 25 | this.initialupdate = true; 26 | this.Result = 0; 27 | this.gps.ActiveSelection(this.defaultSelectables); 28 | this.gps.cursorIndex = 0; 29 | this.Active = true; 30 | this.window.setAttribute("state", "Active"); 31 | } 32 | onUpdate(_deltaTime) { 33 | if(this.initialupdate){ 34 | this.gps.SwitchToInteractionState(1); 35 | this.initialupdate = false; 36 | } 37 | this.defaultSelectables[0].setActive(true); 38 | this.text.textContent = this.CurrentText; 39 | this.button1Text.textContent = this.CurrentButton1Text; 40 | this.button2Text.textContent = this.CurrentButton2Text; 41 | } 42 | onExit() { 43 | this.window.setAttribute("state", "Inactive"); 44 | this.Active = false; 45 | } 46 | onEvent(_event) { 47 | if (_event == "CLR_Push") { 48 | this.Result = 2; 49 | this.gps.closePopUpElement(); 50 | } 51 | } 52 | button1_SelectionCallback(_event) { 53 | if (_event == "ENT_Push") { 54 | this.Result = 1; 55 | this.gps.closePopUpElement(); 56 | } 57 | } 58 | button2_SelectionCallback(_event) { 59 | if (_event == "ENT_Push") { 60 | this.Result = 2; 61 | this.gps.closePopUpElement(); 62 | } 63 | } 64 | setTexts(WindowText = "Confirm ?", Button1Txt = "Yes", Button2Text = "No") { 65 | this.CurrentText = WindowText; 66 | this.CurrentButton1Text = Button1Txt; 67 | this.CurrentButton2Text = Button2Text; 68 | } 69 | } 70 | 71 | class GPS_AlertWindow extends NavSystemElement { 72 | constructor() { 73 | super(); 74 | this.CurrentText = "Alert"; 75 | this.CurrentButtonText = "Ok"; 76 | this.Active = false; 77 | } 78 | init(root) { 79 | this.window = this.gps.getChildById("AlertWindow"); 80 | this.text = this.gps.getChildById("CW_AlertWindowText"); 81 | this.button = this.gps.getChildById("CW_AlertWindowButton"); 82 | this.buttonText = this.gps.getChildById("CW_AlertWindowButtonText"); 83 | this.defaultSelectables = [ 84 | new SelectableElement(this.gps, this.button, this.button_SelectionCallback.bind(this)), 85 | ]; 86 | } 87 | onEnter() { 88 | this.initialupdate = true; 89 | this.gps.ActiveSelection(this.defaultSelectables); 90 | this.gps.cursorIndex = 0; 91 | this.Active = true; 92 | this.window.setAttribute("state", "Active"); 93 | } 94 | onUpdate(_deltaTime) { 95 | if(this.initialupdate){ 96 | this.gps.SwitchToInteractionState(1); 97 | this.initialupdate = false; 98 | } 99 | this.defaultSelectables[0].setActive(true); 100 | this.text.textContent = this.CurrentText; 101 | this.buttonText.textContent = this.CurrentButtonText; 102 | } 103 | onExit() { 104 | this.window.setAttribute("state", "Inactive"); 105 | this.Active = false; 106 | } 107 | onEvent(_event) { 108 | if (_event == "CLR_Push") { 109 | this.gps.closePopUpElement(); 110 | } 111 | } 112 | button_SelectionCallback(_event) { 113 | if (_event == "ENT_Push") { 114 | this.gps.closePopUpElement(); 115 | } 116 | } 117 | setTexts(WindowText = "Alert", ButtonTxt = "Ok") { 118 | this.CurrentText = WindowText; 119 | this.CurrentButtonText = ButtonTxt; 120 | } 121 | } 122 | 123 | class GPS_Messages extends NavSystemElement { 124 | constructor() { 125 | super(); 126 | this.name = "MSG"; 127 | this.annunciations = new GPS_Annunciations(); 128 | this.initialized = false; 129 | } 130 | init(root) { 131 | // this.messages = new MessageList(this.gps); 132 | if(!this.initialized) { 133 | this.initialized = true; 134 | this.messagesWindow = this.gps.getChildById("Messages"); 135 | this.annunciations.setGPS(this.gps); 136 | this.annunciations.init(root); 137 | } 138 | } 139 | onEnter() { 140 | this.gps.closeConfirmWindow(); 141 | this.gps.closeAlertWindow(); 142 | this.annunciations.onEnter(); 143 | } 144 | onUpdate(_deltaTime) { 145 | // var html = ""; 146 | // this.messagesWindow.innerHTML = html; 147 | this.annunciations.onUpdate(_deltaTime); 148 | } 149 | onExit() { 150 | this.annunciations.onExit(); 151 | this.gps.closeConfirmWindow(); 152 | this.gps.closeAlertWindow(); 153 | } 154 | onEvent(_event) { 155 | this.annunciations.onEvent(_event); 156 | if (_event == "CLR_Push") { 157 | this.gps.SwitchToInteractionState(0); 158 | this.gps.SwitchToPageName("NAV", "DefaultNav"); 159 | this.gps.currentEventLinkedPageGroup = null; 160 | } 161 | } 162 | onSoundEnd(_eventId) { 163 | this.annunciations.onSoundEnd(_eventId); 164 | } 165 | hasMessages() { 166 | return this.annunciations.hasMessages(); 167 | } 168 | hasNewMessages() { 169 | return this.annunciations.hasNewMessages(); 170 | } 171 | } 172 | 173 | 174 | class GPS_Annunciations extends PFD_Annunciations { 175 | constructor() { 176 | super(...arguments); 177 | this.isActive = false; 178 | this._tUpdateAirspaces = 0; 179 | } 180 | init(root) { 181 | // We have rebuilt all the init in order to discard XML engine alert messages. They should not be displayed in these GPS. 182 | // super.init(root); 183 | this.t_UpdateAirspaces = 0; 184 | this.engineType = Simplane.getEngineType(); 185 | if (this.rootElementName != "") 186 | this.annunciations = this.gps.getChildById(this.rootElementName); 187 | this.newAnnunciations = this.gps.getChildById("newAnnunciations"); 188 | this.acknowledged = this.gps.getChildById("acknowledged"); 189 | this.addMessage(Annunciation_MessageType.CAUTION, "Invalid waypoint index", this.invalidIndex); 190 | this.addMessage(Annunciation_MessageType.ADVISORY, "Set course to", this.chekCourse); 191 | this.addMessage(Annunciation_MessageType.ADVISORY, "Arrival at waypoint", this.arrivalWp); 192 | this.addMessage(Annunciation_MessageType.WARNING, "Attempt to delete active waypoint", this.deleteWpLeg); 193 | this.addMessage(Annunciation_MessageType.WARNING, "Attempt to delete proc waypoint", this.deleteWpProc); 194 | this.addMessage(Annunciation_MessageType.WARNING, "Cannot add waypoint at this place", this.addWp); 195 | this.addMessage(Annunciation_MessageType.WARNING, "Approach is not active", this.approachNotActive); 196 | if(!this.gps.getConfigKey("disable_airspace_messages", true)) { 197 | this.addMessage(Annunciation_MessageType.ADVISORY, "Near airspace -- less than 2nm", this.airspaceNear); 198 | this.addMessage(Annunciation_MessageType.ADVISORY, "Airspace ahead -- less than 10 min", this.airspaceAhead); 199 | this.addMessage(Annunciation_MessageType.ADVISORY, "Airspace near and ahead", this.airspaceNearAhead); 200 | this.addMessage(Annunciation_MessageType.ADVISORY, "Inside airspace", this.airspaceInside); 201 | } 202 | this.addMessage(Annunciation_MessageType.ADVISORY, "No departure airport", this.airportOrigin); 203 | this.addMessage(Annunciation_MessageType.ADVISORY, "No arrival airport", this.airportDestination); 204 | this.addMessage(Annunciation_MessageType.ADVISORY, "Approaching top of descent", this.VCALCApproaching); 205 | this.addMessage(Annunciation_MessageType.ADVISORY, "Arriving at VCALC target altitude", this.VCALCArriving); 206 | // this.addMessage(Annunciation_MessageType.WARNING, "Test Obs < 10", this.testObs); 207 | // this.addMessage(Annunciation_MessageType.ADVISORY, "Test Obs < 10", this.testObs); 208 | // this.addMessage(Annunciation_MessageType.WARNING, "Test message 1", this.sayTrue); 209 | // switch (this.engineType) { 210 | // case EngineType.ENGINE_TYPE_PISTON: 211 | // break; 212 | // case EngineType.ENGINE_TYPE_TURBOPROP: 213 | // case EngineType.ENGINE_TYPE_JET: 214 | // this.addMessageMultipleConditions(Annunciation_MessageType.WARNING, "ITT", [ 215 | // new Condition(this.itt.bind(this, "1000")), 216 | // new Condition(this.itt.bind(this, "870"), 5), 217 | // new Condition(this.itt.bind(this, "840"), 20) 218 | // ]); 219 | // this.addMessageSwitch(Annunciation_MessageType.CAUTION, ["FUEL LOW L", "FUEL LOW R", "FUEL LOW L-R"], this.fuelLowSelector); 220 | // break; 221 | // } 222 | } 223 | onEnter() { 224 | super.onEnter(); 225 | this.isActive = true; 226 | } 227 | onExit() { 228 | super.onExit(); 229 | this.isActive = false; 230 | } 231 | onUpdate(_deltaTime) { 232 | // Set all messages to unacknowledged state here 233 | if(this.isActive){ 234 | // Set all the visible messages to acknowledged state 235 | for (let i = 0; i < this.allMessages.length; i++) { 236 | if (this.allMessages[i].Visible) { 237 | this.allMessages[i].Acknowledged = true; 238 | this.needReload = true; 239 | } 240 | } 241 | } 242 | this.t_UpdateAirspaces++; 243 | if(this.gps && this.gps.airspaceList && !this.gps.getConfigKey("disable_airspace_messages", true) && this.t_UpdateAirspaces > 10) { 244 | this.t_UpdateAirspaces = 0; 245 | this.gps.airspaceList.Update(); 246 | } 247 | super.onUpdate(_deltaTime); 248 | } 249 | 250 | addMessage(_type, _text, _handler) { 251 | var msg = new Annunciation_Message(); 252 | msg.Type = _type; 253 | msg.Text = _text; 254 | msg.gps = this.gps; 255 | msg.Handler = _handler.bind(msg); 256 | this.allMessages.push(msg); 257 | } 258 | 259 | // Bug with POI waypoints 260 | invalidIndex() { 261 | if(!SimVar.GetSimVarValue("GPS IS ACTIVE FLIGHT PLAN", "boolean")) 262 | return false; 263 | if(this.gps.currFlightPlanManager.getWaypointsCount() < 2) 264 | return false; 265 | if(this.gps.currFlightPlanManager.getActiveWaypointIndex() >= 0) 266 | return false; 267 | if(this.gps.currFlightPlanManager.getIsDirectTo()) 268 | return false; 269 | this.Text = "Invalid waypoint index"; 270 | let nextWaypoint = SimVar.GetSimVarValue("GPS WP NEXT ID", "string"); 271 | if(nextWaypoint && nextWaypoint.length) 272 | this.Text += ": " + nextWaypoint.slice(0, 7); 273 | return true; 274 | } 275 | chekCourse(){ 276 | if(!SimVar.GetSimVarValue("GPS IS ACTIVE FLIGHT PLAN", "boolean")) 277 | return false; 278 | // No message if near the ground 279 | if(SimVar.GetSimVarValue("PLANE ALT ABOVE GROUND", "feet") < 100) 280 | return false; 281 | // No message if autopilot in nav mode 282 | if(SimVar.GetSimVarValue("AUTOPILOT NAV1 LOCK", "boolean")) 283 | return false; 284 | var brg = SimVar.GetSimVarValue("GPS WP BEARING", "degree"); 285 | var trk = SimVar.GetSimVarValue("GPS GROUND MAGNETIC TRACK", "degree"); 286 | if(Math.abs(brg-trk) < 10) 287 | return false; 288 | this.Text = "Set course to " + Utils.leadingZeros(fastToFixed(brg, 0), 3) + "°"; 289 | return true; 290 | } 291 | deleteWpLeg() { 292 | return this.gps.attemptDeleteWpLeg; 293 | } 294 | deleteWpProc() { 295 | return this.gps.attemptDeleteWpProc; 296 | } 297 | addWp() { 298 | return this.gps.attemptAddWp; 299 | } 300 | approachNotActive() { 301 | // Check if next point is destination and if approach is loaded 302 | if(this.gps.currFlightPlanManager.isLoadedApproach() && !this.gps.currFlightPlanManager.isActiveApproach() && this.gps.currFlightPlanManager.getDestination()) { 303 | if(this.gps.currFlightPlanManager.getActiveWaypointIdent() == this.gps.currFlightPlanManager.getDestination().ident) { 304 | let distance = this.gps.getDistanceToDestination(); 305 | if(distance < 30) { 306 | // Set the message 307 | return true; 308 | } 309 | } 310 | } 311 | return false; 312 | } 313 | arrivalWp() { 314 | if(!SimVar.GetSimVarValue("GPS IS ACTIVE FLIGHT PLAN", "boolean")) 315 | return false; 316 | if(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots") < 20) 317 | return false; 318 | if(SimVar.GetSimVarValue("GPS WP DISTANCE", "Nautical Miles") < 3) { 319 | this.Text = "Arrival at waypoint " + this.gps.currFlightPlanManager.getActiveWaypointIdent(); 320 | // Specific request for the 172X mod 321 | SimVar.SetSimVarValue("L:172X_WPT", "Bool", 1); 322 | return true; 323 | } 324 | // Specific request for the 172X mod 325 | SimVar.SetSimVarValue("L:172X_WPT", "Bool", 0); 326 | return false; 327 | } 328 | airspaceNear() { 329 | // No message if near the ground 330 | if(SimVar.GetSimVarValue("PLANE ALT ABOVE GROUND", "feet") < 100) 331 | return false; 332 | if(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots") < 20) 333 | return false; 334 | // Disable if approach loaded and distance to destination is less than 30nm 335 | if(this.gps.currFlightPlanManager.isLoadedApproach() && this.gps.getDistanceToDestination() < 30) 336 | return false; 337 | for(var i=0; i < this.gps.airspaceList.airspaces.length; i++) { 338 | if(this.gps.airspaceList.airspaces[i].status == 1) 339 | return true; 340 | } 341 | return false; 342 | } 343 | airspaceAhead() { 344 | // No message if near the ground 345 | if(SimVar.GetSimVarValue("PLANE ALT ABOVE GROUND", "feet") < 100) 346 | return false; 347 | if(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots") < 20) 348 | return false; 349 | // Disable if approach loaded and distance to destination is less than 30nm 350 | if(this.gps.currFlightPlanManager.isLoadedApproach() && this.gps.getDistanceToDestination() < 30) 351 | return false; 352 | for(var i=0; i < this.gps.airspaceList.airspaces.length; i++) { 353 | if(this.gps.airspaceList.airspaces[i].status == 2 && this.gps.airspaceList.airspaces[i].aheadTime < 600) 354 | return true; 355 | } 356 | return false; 357 | } 358 | airspaceNearAhead() { 359 | // No message if near the ground 360 | if(SimVar.GetSimVarValue("PLANE ALT ABOVE GROUND", "feet") < 100) 361 | return false; 362 | if(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots") < 20) 363 | return false; 364 | // Disable if approach loaded and distance to destination is less than 30nm 365 | if(this.gps.currFlightPlanManager.isLoadedApproach() && this.gps.getDistanceToDestination() < 30) 366 | return false; 367 | for(var i=0; i < this.gps.airspaceList.airspaces.length; i++) { 368 | if(this.gps.airspaceList.airspaces[i].status == 3 && this.gps.airspaceList.airspaces[i].nearDistance <= 2) 369 | return true; 370 | } 371 | return false; 372 | } 373 | airspaceInside() { 374 | // No message if near the ground 375 | if(SimVar.GetSimVarValue("PLANE ALT ABOVE GROUND", "feet") < 100) 376 | return false; 377 | if(SimVar.GetSimVarValue("GPS GROUND SPEED", "knots") < 20) 378 | return false; 379 | // Disable if approach loaded and distance to destination is less than 30nm 380 | if(this.gps.currFlightPlanManager.isLoadedApproach() && this.gps.getDistanceToDestination() < 30) 381 | return false; 382 | for(var i=0; i < this.gps.airspaceList.airspaces.length; i++) { 383 | if(this.gps.airspaceList.airspaces[i].status == 4) 384 | return true; 385 | } 386 | return false; 387 | } 388 | airportOrigin() { 389 | var origin = this.gps.currFlightPlanManager.getOrigin(); 390 | if(!origin || origin.GetInfos().getWaypointType() != "A" ) 391 | return true; 392 | return false; 393 | } 394 | airportDestination() { 395 | var destination = this.gps.currFlightPlanManager.getDestination(); 396 | if(!destination || destination.GetInfos().getWaypointType() != "A" ) 397 | return true; 398 | return false; 399 | } 400 | VCALCApproaching() { 401 | return SimVar.GetSimVarValue("L:PMS50_GNS530_MSG_VCALC_APPR", "bool"); 402 | } 403 | VCALCArriving() { 404 | return SimVar.GetSimVarValue("L:PMS50_GNS530_MSG_VCALC_ARR", "bool"); 405 | } 406 | testObs() { 407 | let obs = SimVar.GetSimVarValue("NAV OBS:1", "degrees"); 408 | if(obs < 10) 409 | return true; 410 | return false; 411 | } 412 | sayTrue() { 413 | return true; 414 | } 415 | 416 | // itt(_limit = 840) { 417 | // let itt = SimVar.GetSimVarValue("TURB ENG ITT:1", "celsius"); 418 | // return (itt > _limit); 419 | // } 420 | // fuelLowSelector() { 421 | // let left = SimVar.GetSimVarValue("FUEL TANK LEFT MAIN QUANTITY", "gallon") < 9; 422 | // let right = SimVar.GetSimVarValue("FUEL TANK RIGHT MAIN QUANTITY", "gallon") < 9; 423 | // if (left && right) { 424 | // return 3; 425 | // } 426 | // else if (left) { 427 | // return 1; 428 | // } 429 | // else if (right) { 430 | // return 2; 431 | // } 432 | // else { 433 | // return 0; 434 | // } 435 | // } 436 | hasMessages() { 437 | for (var i = 0; i < this.allMessages.length; i++) { 438 | if (this.allMessages[i].Visible) { 439 | return true; 440 | } 441 | } 442 | return false; 443 | } 444 | hasNewMessages() { 445 | // Check if there is a new warning or caution message 446 | // Used in GPS to blink the MSG indicator 447 | if(this.isActive) 448 | return false; 449 | for (var i = 0; i < this.allMessages.length; i++) { 450 | if (this.allMessages[i].Visible && !this.allMessages[i].Acknowledged && (this.allMessages[i].Type != Annunciation_MessageType.ADVISORY)) { 451 | return true; 452 | } 453 | } 454 | return false; 455 | } 456 | } 457 | -------------------------------------------------------------------------------- /html_ui/Pms50/Pages/VCockpit/Instruments/NavSystems/GPS/Shared/NearestPages.js: -------------------------------------------------------------------------------- 1 | class GPS_NearestAirports extends NavSystemElement { 2 | constructor(_nbElemsMax = 3) { 3 | super(); 4 | this.name = "NRSTAirport"; 5 | this.nbElemsMax = _nbElemsMax; 6 | } 7 | init() { 8 | this.sliderElement = this.gps.getChildById("SliderNRSTAirport"); 9 | this.sliderCursorElement = this.gps.getChildById("SliderNRSTAirportCursor"); 10 | this.nearestAirportList = new NearestAirportList(this.gps); 11 | this.airportsSliderGroup = new SelectableElementSliderGroup(this.gps, [], this.sliderElement, this.sliderCursorElement, 2); 12 | for (let i = 0; i < this.nbElemsMax; i++) { 13 | this.airportsSliderGroup.addElement(new SelectableElement(this.gps, this.gps.getChildById("NRSTAirport_" + i), this.airportName_SelectionCallback.bind(this))); 14 | this.airportsSliderGroup.addElement(new SelectableElement(this.gps, this.gps.getChildById("NRSTAirport_Freq_" + i), this.airportFrequency_SelectionCallback.bind(this))); 15 | } 16 | this.defaultSelectables = [this.airportsSliderGroup]; 17 | } 18 | onEnter() { 19 | } 20 | onUpdate(_deltaTime ) { 21 | this.nearestAirportList.Update(); 22 | var airportListStrings = []; 23 | let magvar = SimVar.GetSimVarValue("MAGVAR", "degrees"); 24 | for (var i = 0; i < this.nearestAirportList.airports.length; i++) { 25 | var firstLine = ""; 26 | var secondLine = ""; 27 | var logo = ""; 28 | if (this.nearestAirportList.airports[i].airportClass == 2 || this.nearestAirportList.airports[i].airportClass == 3) { 29 | logo = "Airport_Soft.png"; 30 | } 31 | else if (this.nearestAirportList.airports[i].airportClass == 1) { 32 | switch (Math.round((this.nearestAirportList.airports[i].longestRunwayDirection % 180) / 45.0)) { 33 | case 0: 34 | case 4: 35 | logo = "Airport_Hard_NS.png"; 36 | break; 37 | case 1: 38 | logo = "Airport_Hard_NE_SW.png"; 39 | break; 40 | case 2: 41 | logo = "Airport_Hard_EW.png"; 42 | break; 43 | case 3: 44 | logo = "Airport_Hard_NW_SE.png"; 45 | break; 46 | } 47 | } 48 | else if (this.nearestAirportList.airports[i].airportClass == 4) { 49 | logo = "Helipad.png"; 50 | } 51 | else if (this.nearestAirportList.airports[i].airportClass == 5) { 52 | logo = "Private_Airfield.png"; 53 | } 54 | 55 | firstLine += '' + this.nearestAirportList.airports[i].ident + ''; 56 | firstLine += ' '; 57 | firstLine += '' + fastToFixed((this.nearestAirportList.airports[i].bearing - magvar + 360)%360, 0) + '
o
M
'; 58 | firstLine += '' + (Math.round((this.nearestAirportList.airports[i].distance*10))/10).toFixed(1) + '
n
m
'; 59 | firstLine += '' + this.nearestAirportList.airports[i].bestApproach + ''; 60 | secondLine += '' + this.nearestAirportList.airports[i].frequencyName.toLowerCase() + ''; 61 | //Don't display frequency if it's zero 62 | secondLine += ' 0) { 64 | secondLine += ' class="SelectableElement"' +'>' + this.gps.frequencyFormat(this.nearestAirportList.airports[i].frequencyMHz, 3); 65 | } 66 | else { 67 | secondLine += '>'; 68 | } 69 | secondLine += ''; 70 | secondLine += 'rwy'; 71 | secondLine += '' + fastToFixed(this.nearestAirportList.airports[i].longestRunwayLength, 0) + '
f
t
'; 72 | airportListStrings.push(firstLine); 73 | console.log(firstLine); 74 | airportListStrings.push(secondLine); 75 | console.log(secondLine); 76 | } 77 | this.airportsSliderGroup.setStringElements(airportListStrings); 78 | } 79 | onExit() { 80 | if (this.gps.currentInteractionState == 1) { 81 | this.gps.lastRelevantICAO = this.nearestAirportList.airports[Math.floor(this.airportsSliderGroup.getIndex() / 2)].icao; 82 | this.gps.lastRelevantICAOType = "A"; 83 | } 84 | } 85 | onEvent(_event) { 86 | } 87 | airportName_SelectionCallback(_event, _index) { 88 | switch (_event) { 89 | case "ENT_Push": 90 | this.gps.SwitchToPageName("WPT", "AirportLocation"); 91 | this.gps.SwitchToInteractionState(0); 92 | return true; 93 | } 94 | } 95 | airportFrequency_SelectionCallback(_event, _index) { 96 | switch (_event) { 97 | case "ENT_Push": 98 | if (this.nearestAirportList.airports[Math.floor(_index / 2)].frequencyMHz >= 118) { 99 | SimVar.SetSimVarValue("K:COM" + (this.gps.comIndex == 1 ? "" : this.gps.comIndex) + "_STBY_RADIO_SET_HZ", "Hz", this.nearestAirportList.airports[Math.floor(_index / 2)].frequencyMHz * 1000 * 1000); 100 | // SimVar.SetSimVarValue("K:COM" + (this.gps.comIndex == 1 ? "" : this.gps.comIndex) + "_STBY_RADIO_SET", "Frequency BCD16", this.nearestAirportList.airports[Math.floor(_index / 2)].frequencyBCD16); 101 | } 102 | // Don't display frequency if it's zero 103 | else if(this.nearestAirportList.airports[Math.floor(_index / 2)].frequencyMHz > 0) { 104 | SimVar.SetSimVarValue("K:NAV" + this.gps.navIndex + "_STBY_SET", "Frequency BCD16", this.nearestAirportList.airports[Math.floor(_index / 2)].frequencyBCD16); 105 | } 106 | break; 107 | } 108 | } 109 | } 110 | class GPS_NearestIntersection extends NavSystemElement { 111 | constructor(_nbElemsMax = 5) { 112 | super(); 113 | this.name = "NRSTIntersection"; 114 | this.nbElemsMax = _nbElemsMax; 115 | } 116 | init() { 117 | this.sliderElement = this.gps.getChildById("SliderNRSTIntersection"); 118 | this.sliderCursorElement = this.gps.getChildById("SliderNRSTIntersectionCursor"); 119 | this.nearestIntersectionList = new NearestIntersectionList(this.gps); 120 | this.intersectionsSliderGroup = new SelectableElementSliderGroup(this.gps, [], this.sliderElement, this.sliderCursorElement); 121 | for (let i = 0; i < this.nbElemsMax; i++) { 122 | this.intersectionsSliderGroup.addElement(new SelectableElement(this.gps, this.gps.getChildById("NRST_Intersection_" + i), this.intersection_SelectionCallback.bind(this))); 123 | } 124 | this.defaultSelectables = [this.intersectionsSliderGroup]; 125 | } 126 | onEnter() { 127 | } 128 | onUpdate(_deltaTime) { 129 | this.nearestIntersectionList.Update(50, 100); 130 | var lines = []; 131 | let magvar = SimVar.GetSimVarValue("MAGVAR", "degrees"); 132 | for (var i = 0; i < this.nearestIntersectionList.intersections.length; i++) { 133 | var line = ""; 134 | line += '' + this.nearestIntersectionList.intersections[i].ident + ''; 135 | line += ''; 136 | line += '' + Utils.leadingZeros(fastToFixed((this.nearestIntersectionList.intersections[i].bearing - magvar + 360)%360, 0), 3) + '
o
M
'; 137 | line += '' + (Math.round((this.nearestIntersectionList.intersections[i].distance*10))/10).toFixed(1) + '
n
m
'; 138 | lines.push(line); 139 | } 140 | this.intersectionsSliderGroup.setStringElements(lines); 141 | } 142 | onExit() { 143 | if (this.gps.currentInteractionState == 1) { 144 | this.gps.lastRelevantICAO = this.nearestIntersectionList.intersections[this.intersectionsSliderGroup.getIndex()].icao; 145 | this.gps.lastRelevantICAOType = "W"; 146 | } 147 | } 148 | onEvent(_event) { 149 | } 150 | intersection_SelectionCallback(_event, _index) { 151 | switch (_event) { 152 | case "ENT_Push": 153 | this.gps.SwitchToPageName("WPT", "Intersection"); 154 | this.gps.SwitchToInteractionState(0); 155 | return true; 156 | } 157 | } 158 | } 159 | class GPS_NearestNDB extends NavSystemElement { 160 | constructor(_nbElemsMax = 5) { 161 | super(); 162 | this.name = "NRSTNDB"; 163 | this.nbElemsMax = _nbElemsMax; 164 | } 165 | init() { 166 | this.sliderElement = this.gps.getChildById("SliderNRSTNDB"); 167 | this.sliderCursorElement = this.gps.getChildById("SliderNRSTNDBCursor"); 168 | this.nearestNDBList = new NearestNDBList(this.gps); 169 | this.ndbsSliderGroup = new SelectableElementSliderGroup(this.gps, [], this.sliderElement, this.sliderCursorElement); 170 | for (let i = 0; i < this.nbElemsMax; i++) { 171 | this.ndbsSliderGroup.addElement(new SelectableElement(this.gps, this.gps.getChildById("NRST_NDB_" + i), this.ndb_SelectionCallback.bind(this))); 172 | } 173 | this.defaultSelectables = [this.ndbsSliderGroup]; 174 | } 175 | onEnter() { 176 | } 177 | onUpdate(_deltaTime) { 178 | this.nearestNDBList.Update(); 179 | var lines = []; 180 | let magvar = SimVar.GetSimVarValue("MAGVAR", "degrees"); 181 | for (var i = 0; i < this.nearestNDBList.ndbs.length; i++) { 182 | var line = ""; 183 | line += '' + this.nearestNDBList.ndbs[i].ident + ''; 184 | line += ''; 185 | line += '' + Utils.leadingZeros(fastToFixed((this.nearestNDBList.ndbs[i].bearing - magvar + 360)%360, 0), 3) + '
o
M
'; 186 | line += '' + (Math.round((this.nearestNDBList.ndbs[i].distance*10))/10).toFixed(1) + '
n
m
'; 187 | line += '' + fastToFixed(this.nearestNDBList.ndbs[i].frequencyMHz, 1) + ''; 188 | lines.push(line); 189 | } 190 | this.ndbsSliderGroup.setStringElements(lines); 191 | } 192 | onExit() { 193 | if (this.gps.currentInteractionState == 1) { 194 | this.gps.lastRelevantICAO = this.nearestNDBList.ndbs[this.ndbsSliderGroup.getIndex()].icao; 195 | this.gps.lastRelevantICAOType = "N"; 196 | } 197 | } 198 | onEvent(_event) { 199 | } 200 | ndb_SelectionCallback(_event, _index) { 201 | switch (_event) { 202 | case "ENT_Push": 203 | this.gps.SwitchToPageName("WPT", "NDB"); 204 | this.gps.SwitchToInteractionState(0); 205 | return true; 206 | } 207 | } 208 | } 209 | class GPS_NearestVOR extends NavSystemElement { 210 | constructor(_nbElemsMax = 5) { 211 | super(); 212 | this.name = "NRSTVOR"; 213 | this.nbElemsMax = _nbElemsMax; 214 | } 215 | init() { 216 | this.sliderElement = this.gps.getChildById("SliderNRSTVOR"); 217 | this.sliderCursorElement = this.gps.getChildById("SliderNRSTVORCursor"); 218 | this.nearestVORList = new NearestVORList(this.gps); 219 | this.vorsSliderGroup = new SelectableElementSliderGroup(this.gps, [], this.sliderElement, this.sliderCursorElement); 220 | for (let i = 0; i < this.nbElemsMax; i++) { 221 | this.vorsSliderGroup.addElement(new SelectableElementGroup(this.gps, this.gps.getChildById("NRST_VOR_" + i), [ 222 | this.vor_SelectionCallback.bind(this), 223 | this.frequency_SelectionCallback.bind(this), 224 | ])); 225 | } 226 | this.defaultSelectables = [this.vorsSliderGroup]; 227 | } 228 | onEnter() { 229 | } 230 | onUpdate(_deltaTime) { 231 | this.nearestVORList.Update(); 232 | var lines = []; 233 | let magvar = SimVar.GetSimVarValue("MAGVAR", "degrees"); 234 | for (var i = 0; i < this.nearestVORList.vors.length; i++) { 235 | var line = ""; 236 | line += '' + this.nearestVORList.vors[i].ident + ''; 237 | var image = this.nearestVORList.vors[i].imageFileName(); 238 | line += ' '; 239 | line += '' + Utils.leadingZeros(fastToFixed((this.nearestVORList.vors[i].bearing - magvar + 360)%360, 0), 3) + '
o
M
'; 240 | line += '' + (Math.round((this.nearestVORList.vors[i].distance*10))/10).toFixed(1) + '
n
m
'; 241 | line += '' + this.gps.frequencyFormat(this.nearestVORList.vors[i].frequencyMHz, 2) + ''; 242 | lines.push(line); 243 | } 244 | this.vorsSliderGroup.setStringElements(lines); 245 | } 246 | onExit() { 247 | if (this.gps.currentInteractionState == 1) { 248 | this.gps.lastRelevantICAO = this.nearestVORList.vors[this.vorsSliderGroup.getIndex()].icao; 249 | this.gps.lastRelevantICAOType = "V"; 250 | } 251 | } 252 | onEvent(_event) { 253 | } 254 | vor_SelectionCallback(_event, _index) { 255 | switch (_event) { 256 | case "ENT_Push": 257 | this.gps.SwitchToPageName("WPT", "VOR"); 258 | this.gps.SwitchToInteractionState(0); 259 | return true; 260 | } 261 | } 262 | frequency_SelectionCallback(_event, _index) { 263 | switch (_event) { 264 | case "ENT_Push": 265 | SimVar.SetSimVarValue("K:NAV" + this.gps.navIndex + "_STBY_SET", "Frequency BCD16", this.nearestVORList.vors[_index].frequencyBCD16); 266 | return true; 267 | } 268 | } 269 | } 270 | class GPS_NearestAirpaces extends NavSystemElement { 271 | constructor() { 272 | super(); 273 | this.name = "NRSTAirspace"; 274 | } 275 | init() { 276 | this.nrstAirspaceName1 = this.gps.getChildById("NRST_Airspace_Name_1"); 277 | this.nrstAirspaceStatus1 = this.gps.getChildById("NRST_Airspace_Status_1"); 278 | this.nrstAirspaceName2 = this.gps.getChildById("NRST_Airspace_Name_2"); 279 | this.nrstAirspaceStatus2 = this.gps.getChildById("NRST_Airspace_Status_2"); 280 | this.nrstAirspaceName3 = this.gps.getChildById("NRST_Airspace_Name_3"); 281 | this.nrstAirspaceStatus3 = this.gps.getChildById("NRST_Airspace_Status_3"); 282 | this.nrstAirspaceName4 = this.gps.getChildById("NRST_Airspace_Name_4"); 283 | this.nrstAirspaceStatus4 = this.gps.getChildById("NRST_Airspace_Status_4"); 284 | this.nearestAirspacesList = new GPS_NearestAirspaceList(this.gps); 285 | } 286 | onEnter() { 287 | } 288 | onUpdate(_deltaTime) { 289 | this.nearestAirspacesList.Update(); 290 | var nbAirspaces = this.nearestAirspacesList.airspaces.length; 291 | if (nbAirspaces > 0) { 292 | let airspace = this.nearestAirspacesList.airspaces[0]; 293 | this.nrstAirspaceName1.textContent = airspace.name; 294 | this.nrstAirspaceStatus1.textContent = this.GetStatus(airspace); 295 | } 296 | else { 297 | this.nrstAirspaceName1.textContent = "____________________"; 298 | this.nrstAirspaceStatus1.textContent = "___________________"; 299 | } 300 | if (nbAirspaces > 1) { 301 | let airspace = this.nearestAirspacesList.airspaces[1]; 302 | this.nrstAirspaceName2.textContent = airspace.name; 303 | this.nrstAirspaceStatus2.textContent = this.GetStatus(airspace); 304 | } 305 | else { 306 | this.nrstAirspaceName2.textContent = "____________________"; 307 | this.nrstAirspaceStatus2.textContent = "___________________"; 308 | } 309 | if (nbAirspaces > 2) { 310 | let airspace = this.nearestAirspacesList.airspaces[2]; 311 | this.nrstAirspaceName3.textContent = airspace.name; 312 | this.nrstAirspaceStatus3.textContent = this.GetStatus(airspace); 313 | } 314 | else { 315 | this.nrstAirspaceName3.textContent = "____________________"; 316 | this.nrstAirspaceStatus3.textContent = "___________________"; 317 | } 318 | if (this.nrstAirspaceName4) { 319 | if (nbAirspaces > 3) { 320 | let airspace = this.nearestAirspacesList.airspaces[3]; 321 | this.nrstAirspaceName4.textContent = airspace.name; 322 | this.nrstAirspaceStatus4.textContent = this.GetStatus(airspace); 323 | } 324 | else { 325 | this.nrstAirspaceName4.textContent = "____________________"; 326 | this.nrstAirspaceStatus4.textContent = "___________________"; 327 | } 328 | } 329 | this.nearestAirspacesList.airspaces; 330 | } 331 | onExit() { 332 | } 333 | onEvent(_event) { 334 | } 335 | GetStatus(airspace) { 336 | var aheadTime = airspace.aheadTime; 337 | aheadTime = Math.trunc(aheadTime); 338 | var displayAheadTime = "" + (aheadTime / 60 < 10 ? "0" : "") + Math.trunc(aheadTime / 60) + ':' + (aheadTime % 60 < 10 ? "0" : "") + aheadTime % 60; 339 | switch (airspace.status) { 340 | case 0: 341 | return ""; 342 | case 1: 343 | return "Near"; 344 | case 2: 345 | return "Ahead - " + displayAheadTime; // Ahead, less than 10 minutes 346 | case 3: 347 | return "Near and ahead - " + displayAheadTime; // Near and ahead 348 | case 4: 349 | return "Inside of airspace"; // Inside 350 | default: 351 | return ""; 352 | } 353 | } 354 | } 355 | 356 | // Old msfs code for airspace list because the code from 1.18.9.0 is not working 357 | // Added altitude and frequency in result (frequency available only for center type airspace) 358 | // changed the number of airspaces to 25 359 | class GPS_NearestAirspaceList { 360 | constructor(_instrument) { 361 | this.instrument = _instrument; 362 | this.airspaces = []; 363 | this.batch = new SimVar.SimVarBatch("C:fs9gps:NearestAirspaceItemsNumber", "C:fs9gps:NearestAirspaceCurrentLine"); 364 | this.batch.add("C:fs9gps:NearestAirspaceCurrentName", "string", "string"); 365 | this.batch.add("C:fs9gps:NearestAirspaceCurrentType", "number", "number"); 366 | this.batch.add("C:fs9gps:NearestAirspaceCurrentStatus", "number", "number"); 367 | this.batch.add("C:fs9gps:NearestAirspaceCurrentNearDistance", "nautical mile", "number"); 368 | this.batch.add("C:fs9gps:NearestAirspaceCurrentAheadTime", "seconds", "number"); 369 | this.batch.add("C:fs9gps:NearestAirspaceCurrentGeometry", "number", "number"); 370 | this.batch.add("C:fs9gps:NearestAirspaceCurrentMinAltitude", "feet", "number"); 371 | this.batch.add("C:fs9gps:NearestAirspaceCurrentMaxAltitude", "feet", "number"); 372 | this.batch.add("C:fs9gps:NearestAirspaceCurrentFrequency", "hertz", "number"); 373 | } 374 | Update(_nbMax = 25, _milesDistance = 200) { 375 | this.nbMax = _nbMax; 376 | this.milesDistance = _milesDistance; 377 | if (GPS_NearestAirspaceList.readManager.AddToQueue(this.instrument, this)) { 378 | this.loadState = 0; 379 | this.needUpdate = false; 380 | } 381 | else { 382 | this.needUpdate = true; 383 | } 384 | } 385 | LoadData() { 386 | var instrId = this.instrument.instrumentIdentifier; 387 | switch (this.loadState) { 388 | case 0: 389 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceCurrentLatitude", "degree latitude", SimVar.GetSimVarValue("GPS POSITION LAT", "degree latitude", instrId), instrId); 390 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceCurrentLongitude", "degree longitude", SimVar.GetSimVarValue("GPS POSITION LON", "degree longitude", instrId), instrId); 391 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceCurrentAltitude", "meter", SimVar.GetSimVarValue("GPS POSITION ALT", "meter", instrId), instrId); 392 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceTrueGroundTrack", "degree", SimVar.GetSimVarValue("GPS GROUND TRUE TRACK", "degree", instrId), instrId); 393 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceGroundSpeed", "meter per second", SimVar.GetSimVarValue("GPS GROUND SPEED", "meter per second", instrId), instrId); 394 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceNearDistance", "nautical mile", 2, instrId); 395 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceNearAltitude", "feet", 200, instrId); 396 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceAheadTime", "minute", 10, instrId); 397 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceMaximumItems", "number", this.nbMax, instrId); 398 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceMaximumDistance", "nautical miles", this.milesDistance, instrId); 399 | SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceQuery", "number", 0xEFC038, instrId); 400 | // SimVar.SetSimVarValue("C:fs9gps:NearestAirspaceQuery", "number", 0xFFFFFE, instrId); 401 | this.loadState++; 402 | break; 403 | case 1: 404 | SimVar.GetSimVarArrayValues(this.batch, function (_Values) { 405 | this.airspaces = []; 406 | for (var i = 0; i < _Values.length && i < 100; i++) { 407 | var airspace = new NearestAirspace(); 408 | airspace.name = Utils.Translate(_Values[i][0]); 409 | airspace.ident = (airspace.name + "_" + i).replace(new RegExp(" ", "g"), ""); 410 | airspace.ident = airspace.ident.replace(new RegExp("/", "g"), ""); 411 | airspace.type = _Values[i][1]; 412 | airspace.status = _Values[i][2]; 413 | airspace.nearDistance = _Values[i][3]; 414 | airspace.aheadTime = _Values[i][4]; 415 | airspace.geometry = _Values[i][5]; 416 | airspace.minAltitude = Math.floor(_Values[i][6]); 417 | airspace.maxAltitude = Math.min(60000, Math.floor(_Values[i][7])); 418 | airspace.frequency = _Values[i][8]; 419 | this.airspaces.push(airspace); 420 | } 421 | this.loadState++; 422 | }.bind(this), instrId); 423 | this.loadState++; 424 | break; 425 | } 426 | } 427 | IsUpToDate() { 428 | return this.loadState == 3; 429 | } 430 | EndLoad() { 431 | if (this.needUpdate) { 432 | this.Update(this.nbMax, this.milesDistance); 433 | } 434 | } 435 | } 436 | GPS_NearestAirspaceList.readManager = new InstrumentDataReadManager(); 437 | --------------------------------------------------------------------------------