From 6f69dee2acde6849d1619f1a4af35b3a81b53b0e Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 9 Aug 2020 08:38:46 -0400 Subject: [PATCH] Add up/down arrows to winds, support navaid/fix import --- Models/Instruments/MCDU/MCDU.nas | 25 +- Models/Instruments/MCDU/res/mcdu.svg | 5075 +++++++++++++------------- Nasal/FMGC/SimbriefParser.nas | 12 +- Nasal/MCDU/WINDHIST.nas | 12 +- 4 files changed, 2596 insertions(+), 2528 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 62883c06..500fe2c1 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -232,7 +232,7 @@ var canvas_MCDU_base = { "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND", - "WIND","WIND_CANCEL","WIND_INSERT_star","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -3877,11 +3877,6 @@ var canvas_MCDU_base = { } else if (page == "WINDCLB" or page == "WINDCRZ" or page == "WINDDES" or page == "WINDHIST") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); - # if (page == "WINDCRZ") { - # up/down arrows show - # } else { - # up/down arrows hide - # } me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); @@ -3926,8 +3921,7 @@ var canvas_MCDU_base = { } if (page == "WINDHIST") { - var hist_winds = fmgc.windController.hist_winds; - if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { + if (fmgc.windController.hist_winds.wind1.set) { me["WIND_INSERT_star"].show(); } else { me["WIND_INSERT_star"].hide(); @@ -3946,9 +3940,24 @@ var canvas_MCDU_base = { if (myWind[i] != nil) { if (page == "WINDCRZ") { me["Simple_Title"].setText(sprintf("%s", myWind[i].title[0] ~ myWind[i].title[1] ~ myWind[i].title[2])); + if (fmgc.flightPlanController.temporaryFlag[i]) { + if (size(fmgc.windController.nav_indicies[i]) > 1) { + me["WIND_UPDOWN"].show(); + } else { + me["WIND_UPDOWN"].hide(); + } + } else { + if (size(fmgc.windController.nav_indicies[2]) > 1) { + me["WIND_UPDOWN"].show(); + } else { + me["WIND_UPDOWN"].hide(); + } + } } else { me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); + me["WIND_UPDOWN"].hide(); } + me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/b")); me.dynamicPageArrowFunc(myWind[i]); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 8f784603..365d0760 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -7,13 +7,13 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="mcdu.svg" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" - id="svg2" - version="1.1" - viewBox="0 0 1024 864" + width="1280" height="1080" - width="1280"> + viewBox="0 0 1024 864" + version="1.1" + id="svg2" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + sodipodi:docname="mcdu.svg"> @@ -29,749 +29,656 @@ + borderopacity="1" + objecttolerance="20" + gridtolerance="20" + guidetolerance="20" + inkscape:pageopacity="1" + inkscape:pageshadow="2" + inkscape:window-width="1440" + inkscape:window-height="819" + id="namedview371" + showgrid="true" + inkscape:zoom="0.78947164" + inkscape:cx="929.63178" + inkscape:cy="751.57487" + inkscape:window-x="481" + inkscape:window-y="23" + inkscape:window-maximized="0" + inkscape:current-layer="WIND" + showguides="false" + inkscape:snap-global="false" + units="px" + inkscape:document-rotation="0"> + type="xygrid" + id="grid5153" /> SCRATCHPAD + x="20.138426" + id="tspan4242" + sodipodi:role="line">SCRATCHPAD + transform="translate(-1.2,-0.2)"> - - - - - + + + + + + inkscape:label="Simple"> + inkscape:label="Simple_Center"> TEXT + x="521.1662" + y="187.10254" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="521.1662" + id="tspan4243" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT TEXT + TEXT + x="520.20905" + id="tspan4266" + sodipodi:role="line">TEXT TEXT + x="520.20905" + y="247.74202" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="520.20905" + id="tspan4274" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT + id="tspan4286" + x="520.20905" + y="717.159" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + TEXT TITLE + x="521.74713" + y="69.238266" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TITLE X/X + id="tspan4217" + sodipodi:role="line">X/X + cy="15.471865" + r="1.5" /> + cy="15.754708" + r="1.5" /> + cy="16.320395" + r="1.5" /> + cx="796.48511" + cy="13.774809" + r="3" /> TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT + id="Simple_L1_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,236.8439)" + style="fill:#ffffff;fill-opacity:1"> TEXT + id="Simple_L3_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,473.56068)" + style="fill:#ffffff;fill-opacity:1"> TEXT + + + + + TEXT + + + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + TEXT + id="Simple_R2_Arrow" + style="fill:#ffffff;fill-opacity:1"> @@ -779,1612 +686,942 @@ xml:space="preserve" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="1022.194" - y="773.87396" - id="Simple_R6" + y="421.81125" + id="Simple_R3" transform="scale(0.991516,1.0085566)" inkscape:label="#text4244">TEXT + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,355.20231)" + style="fill:#ffffff;fill-opacity:1"> - TEXT TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - - - - - - - - - - - - - CALLSIG - - TMPY - - ERASE - TMPY - - - - - - - - TMPY - INSERT - - - - - - - - - FROM - - - - ERASE - DIR TO - - - - - - - - DIR TO - INSERT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="Simple_R4_Arrow" + style="fill:#ffffff;fill-opacity:1"> + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + TEXT + id="Simple_R5_Arrow" + inkscape:label="#g4241" + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,591.91912)" + style="fill:#ffffff;fill-opacity:1"> - + id="path4319" + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + TEXT + + id="path4327" + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + + + + + inkscape:label="INITA" + id="INITA-9" + style="display:inline" /> + + + / + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1" + y="69.238258" + x="750.78857" + id="tspan4388" + sodipodi:role="line">CALLSIG - - - - + id="FPLN_TMPY_group" + inkscape:label="#g3767"> + TMPY + + ERASE + TMPY + + + + + + + + TMPY + INSERT + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / + id="FPLN_FROM" + y="68.861366" + x="177.72771" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">FROM + + + + ERASE + DIR TO + + + + + + + + DIR TO + INSERT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:groupmode="layer" + id="INITA" + inkscape:label="INITA"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - . - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - - - + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="path4482" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - - - - - - + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - - - + id="INITA_FromTo" + inkscape:label="#g4320"> + / + + + + + + + + + + + + + + + + + + + + id="INITA_FltNbr" + transform="translate(-833.84951,236.71687)"> + + + + + + + + + + - + + + + + + + + + F - S - O - = - = - = + x="1113.7798" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#bb6100;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">/ + - F - S - O - = - = - = + inkscape:groupmode="layer" + id="IRSINIT" + inkscape:label="IRSINIT"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + . + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + transform="translate(-833.84951,0.00320079)" + id="PERFTO_V1" + inkscape:label="#g4310-0"> + + + - - - - - - + inkscape:label="#g4310-0" + id="PERFTO_VR" + transform="translate(-833.84951,118.3616)"> + + + + + + + + - - - F F + S + S - O - = + x="398.21817" + id="tspan4399" + sodipodi:role="line">O = = + = + F + S + O + = + = + = + + + + + + + + + + + + + + + + + + + + + + + F + S + O + = + = + = + + + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-76.372598,-23.411021)"> + d="m 998.71909,284.70793 -28.52965,0" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 984.45427,298.97275 -10e-6,-28.52964" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + id="NOTIFY_FLTNBR" + inkscape:label="#g4310-0"> - + - + - + - + - + + inkscape:label="#g1271"> - + + style="opacity:0.94000005;stroke:#179ab7;stroke-opacity:1"> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 994.54102,294.79468 -20.17351,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + d="m 974.36752,294.79468 20.17349,-20.1735" + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + inkscape:label="#g4324" + transform="matrix(1.0807111,0,0,1.0807111,-1029.0108,-141.09805)"> - + - + - - - - - - + transform="matrix(1.0807111,0,0,1.0807111,-1029.7034,213.33078)"> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> - + + id="path1279" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + transform="matrix(1.0807111,0,0,1.0807111,-76.606518,451.54255)"> + style="fill:none;stroke:#ffffff;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#ffffff;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + id="MODEVHF3" + style="stroke:#ffffff;stroke-opacity:1"> - + + + + + + + diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index d5589bca..f75a56e6 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -131,8 +131,16 @@ var SimbriefParser = { if (me.store1[i].getChild("ident").getValue() == "TOC" or me.store1[i].getChild("ident").getValue() == "TOD") { continue; } var coord = geo.Coord.new(); coord.set_latlon(me.store1[i].getChild("pos_lat").getValue(), me.store1[i].getChild("pos_long").getValue()); - var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); - fmgc.flightPlanController.flightplans[3].appendWP(WP); + var fixes = findFixesByID(coord, me.store1[i].getChild("ident").getValue()); + var navaids = findNavaidsByID(coord, me.store1[i].getChild("ident").getValue()); + if (size(fixes) > 0) { + fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(fixes[0])); + } else if (size(navaids) > 0) { + fmgc.flightPlanController.flightplans[3].appendWP(createWPFrom(navaids[0])); + } else { + var WP = createWP(coord, me.store1[i].getChild("ident").getValue()); + fmgc.flightPlanController.flightplans[3].appendWP(WP); + } } fmgc.flightPlanController.flightplans[3].sid = fmgc.flightPlanController.flightplans[3].departure.getSid(SIDID); fmgc.flightPlanController.flightplans[3].star = fmgc.flightPlanController.flightplans[3].destination.getStar(STARID); diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 86c2c6a4..ba5bfc21 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -179,13 +179,11 @@ var windHISTPage = { pushButtonRight: func(index) { if (index == 6) { var hist_winds = fmgc.windController.hist_winds; - if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) { - if (hist_winds.wind1.set) { - fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading; - fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude; - fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude; - fmgc.windController.clb_winds[2].wind1.set = 1; - } + if (hist_winds.wind1.set) { + fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading; + fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude; + fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude; + fmgc.windController.clb_winds[2].wind1.set = 1; if (hist_winds.wind2.set) { fmgc.windController.clb_winds[2].wind2.heading = hist_winds.wind2.heading; fmgc.windController.clb_winds[2].wind2.magnitude = hist_winds.wind2.magnitude;