From 73c2c0c8bb76472eba1981c40c5ecae6d0aefac8 Mon Sep 17 00:00:00 2001 From: Gijs de Rooy Date: Sat, 18 Jan 2014 15:22:42 +0100 Subject: [PATCH] Navigation display: fix map range, hide HDG bug after 10 sec, fix route predicates, fix SVG centers --- Nasal/canvas/map/boeingND.svg | 944 +++++++++++++++++--------------- Nasal/canvas/map/navdisplay.mfd | 28 +- 2 files changed, 523 insertions(+), 449 deletions(-) diff --git a/Nasal/canvas/map/boeingND.svg b/Nasal/canvas/map/boeingND.svg index 641be3035..d3834d53b 100644 --- a/Nasal/canvas/map/boeingND.svg +++ b/Nasal/canvas/map/boeingND.svg @@ -29,9 +29,9 @@ inkscape:window-height="716" id="namedview102" showgrid="false" - inkscape:zoom="5.65688" - inkscape:cx="523.817" - inkscape:cy="425.32" + inkscape:zoom="0.353555" + inkscape:cx="265.201" + inkscape:cy="188.143" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" @@ -46,7 +46,7 @@ position="512,200" />30 + style="font-size:39.999996px">30 + @@ -601,10 +550,10 @@ id="text3088" y="-108.93858" x="-845.96948" - style="font-size:36.00001144px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" + style="font-size:36.000011px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" xml:space="preserve" transform="matrix(0,-1,1,0,0,0)">24 + style="font-size:39.99995px">24 + @@ -635,10 +586,10 @@ id="text3096" y="-1071.5541" x="-879.19897" - style="font-size:36.00004578px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" + style="font-size:36.000046px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" xml:space="preserve" transform="matrix(-0.866026,-0.5,0.5,-0.866026,0,0)">18 + style="font-size:40.000004px">18 + @@ -669,10 +622,10 @@ id="text3104" y="-1581.0712" x="-51.792171" - style="font-size:36.00000381px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" + style="font-size:36.000004px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" xml:space="preserve" transform="matrix(-0.866025,0.5,-0.5,-0.866025,0,0)">12 + style="font-size:40.000011px">12 + @@ -703,10 +658,10 @@ id="text3112" y="-1123.9312" x="812.80585" - style="font-size:36.00004196px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" + style="font-size:36.000042px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" xml:space="preserve" transform="matrix(0,1,-1,0,0,0)">6 + style="font-size:39.999981px">6 + @@ -737,10 +694,10 @@ id="text3120" y="-158.40652" x="844.79596" - style="font-size:36.00009537px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" + style="font-size:36.000095px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ededed;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans" xml:space="preserve" transform="matrix(0.866026,0.5,-0.5,0.866026,0,0)">0 - - - -33 - - - -30 - - - -27 - - - -24 - - - -21 - - - -18 - - - -15 - - - -12 - - - -9 - - - -4 - - - -3 - - - -0 + + + + +33 + + + + +30 + + + + +27 + + + + +24 + + + + +21 + + + + +18 + + + + +15 + + + + +12 + + + + +9 + + + + +4 + + + + +3 + + + + + \ No newline at end of file + + \ No newline at end of file diff --git a/Nasal/canvas/map/navdisplay.mfd b/Nasal/canvas/map/navdisplay.mfd index f3fc85030..cafe7c359 100644 --- a/Nasal/canvas/map/navdisplay.mfd +++ b/Nasal/canvas/map/navdisplay.mfd @@ -152,10 +152,9 @@ var NDStyles = { }, # end of layer update predicate }, # end of traffic layer - { name:'runway-nd', update_on:['toggle_range','toggle_display_mode'], predicate: func(nd, layer) { - var visible = (nd.rangeNm() <= 40 and getprop("autopilot/route-manager/active") ) ; + var visible = (nd.rangeNm() <= 40) and getprop("autopilot/route-manager/active") and nd.in_mode('toggle_display_mode', ['MAP','PLAN']) ; if (visible) trigger_update( layer ); # clear & redraw layer._view.setVisible( visible ); @@ -164,8 +163,10 @@ var NDStyles = { { name:'route', update_on:['toggle_range','toggle_display_mode'], predicate: func(nd, layer) { - trigger_update( layer ); # clear & redraw - layer._view.setVisible( 1 ); #nd.get_switch('toggle_traffic') + var visible= (nd.in_mode('toggle_display_mode', ['MAP','PLAN'])); + if (visible) + trigger_update( layer ); # clear & redraw + layer._view.setVisible( visible ); }, # end of layer update predicate }, # end of route layer @@ -271,7 +272,7 @@ var NDStyles = { id:'rangeArcs', impl: { init: func(nd,symbol), - predicate: func(nd) (((nd.get_switch('toggle_display_mode') == "APP" or nd.get_switch('toggle_display_mode') == "VOR") and nd.get_switch('toggle_weather')) or nd.get_switch('toggle_display_mode') == "MAP"), + predicate: func(nd) ((((nd.get_switch('toggle_display_mode') == "APP" or nd.get_switch('toggle_display_mode') == "VOR") and nd.get_switch('toggle_weather')) or nd.get_switch('toggle_display_mode') == "MAP") and (!nd.get_switch('toggle_centered'))), is_true: func(nd) nd.symbols.rangeArcs.show(), is_false: func(nd) nd.symbols.rangeArcs.hide(), }, # of rangeArcs.impl @@ -522,7 +523,8 @@ var NavDisplay = { # this should probably be using Philosopher's new SymbolLayer ? me.map = me.nd.createChild("map","map") - .set("clip", "rect(124, 1024, 1024, 0)"); + .set("clip", "rect(124, 1024, 1024, 0)") + .set("screen-range", "700"); # this callback will be passed onto the model via the controller hash, and used for the positioned queries, to specify max query range: var get_range = func me.get_switch('toggle_range'); @@ -701,7 +703,6 @@ var NavDisplay = { latNm = latlen*M2NM; #60 at equator lonNm = lonlen*M2NM; #60 at equator - me.symbols.windArrow.setRotation((getprop("/environment/wind-from-heading-deg")-userHdg)*D2R); me.symbols.wind.setText(sprintf("%3.0f / %2.0f",getprop("/environment/wind-from-heading-deg"),getprop("/environment/wind-speed-kt"))); if(me.get_switch('toggle_lh_vor_adf') == 1) @@ -784,9 +785,14 @@ var NavDisplay = { me.map._node.getNode("ref-lon",1).setDoubleValue(userLon); } # The set range of the map does not correspond to what we see in-sim!! - me.map._node.getNode("range",1).setDoubleValue(me.rangeNm()/3.2); # avoid this here, use a listener instead + me.map._node.getNode("range",1).setDoubleValue(me.rangeNm()); # avoid this here, use a listener instead + # Hide heading bug 10 secs after change var vhdg_bug = getprop("autopilot/settings/heading-bug-deg"); + var hdg_bug_active = getprop("autopilot/settings/heading-bug-active"); + if (hdg_bug_active == nil) + hdg_bug_active = 1; + if(me.in_mode('toggle_display_mode', ['MAP'])) { me.symbols.HdgBugCRT.setRotation((vhdg_bug-userTrk)*D2R); me.symbols.HdgBugLCD.setRotation((vhdg_bug-userTrk)*D2R); @@ -802,6 +808,7 @@ var NavDisplay = { me.symbols.compass.setRotation(-userTrk*D2R); me.symbols.compassApp.setRotation(-userTrk*D2R); me.symbols.hdgTrk.setText("TRK"); + me.symbols.windArrow.setRotation((getprop("/environment/wind-from-heading-deg")-userTrk)*D2R); } if(me.in_mode('toggle_display_mode', ['APP','VOR'])) { me.symbols.HdgBugCRT.setRotation((vhdg_bug-userHdg)*D2R); @@ -817,6 +824,7 @@ var NavDisplay = { me.symbols.compass.setRotation(-userHdg*D2R); me.symbols.compassApp.setRotation(-userHdg*D2R); me.symbols.hdgTrk.setText("HDG"); + me.symbols.windArrow.setRotation((getprop("/environment/wind-from-heading-deg")-userHdg)*D2R); } if(me.get_switch('toggle_centered')) { if (me.in_mode('toggle_display_mode', ['APP','VOR'])) { @@ -918,7 +926,7 @@ var NavDisplay = { me.symbols.TrkBugLCD.hide(); me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD); me.symbols.HdgBugLCD.setVisible(staPtrVis and dispLCD); - me.symbols.selHdgLine.setVisible(staPtrVis); + me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active); } else { me.symbols.trkInd.hide(); if((getprop("instrumentation/nav/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) { @@ -970,7 +978,7 @@ var NavDisplay = { me.symbols.TrkBugLCD2.hide(); me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD); me.symbols.HdgBugLCD2.setVisible(staPtrVis and dispLCD); - me.symbols.selHdgLine2.setVisible(staPtrVis); + me.symbols.selHdgLine2.setVisible(staPtrVis and hdg_bug_active); } }