1
0
Fork 0

NavDisplay bug fixes:

- NM font correction
- Range displayed in PLAN mode
- ETA seconds format correction
- Calculate wind arrow based on track/heading
This commit is contained in:
Gijs de Rooy 2014-01-31 23:36:41 +01:00
parent cab89b1b5a
commit 653d86db46
2 changed files with 290 additions and 64 deletions

View file

@ -29,13 +29,13 @@
inkscape:window-height="716"
id="namedview102"
showgrid="false"
inkscape:zoom="0.353555"
inkscape:cx="265.201"
inkscape:cy="188.143"
inkscape:zoom="1"
inkscape:cx="303.412"
inkscape:cy="-37.9065"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer3"
inkscape:current-layer="layer2"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-object-midpoints="true"
@ -46,7 +46,7 @@
position="512,200" /><sodipodi:guide
id="guide3167"
orientation="1,0"
position="512,875.213" /><sodipodi:guide
position="512,808.996" /><sodipodi:guide
id="guide3169"
orientation="-0.866025,0.5"
position="512,200" /><sodipodi:guide
@ -159,6 +159,8 @@
<text
xml:space="preserve"
style="font-size:36px;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;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -170,7 +172,9 @@
sodipodi:role="line"
id="tspan7251"
x="844.04407"
y="126.12489">99.9NM</tspan></text>
y="126.12489">99.9</tspan></text>
@ -203,6 +207,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -219,6 +225,8 @@
<text
xml:space="preserve"
style="font-size:36px;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;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -235,12 +243,14 @@
<text
xml:space="preserve"
style="font-size:36px;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;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="38.276394"
y="53.306854"
id="text3815"
id="gsLbl"
sodipodi:linespacing="125%"
inkscape:label="#text7243"><tspan
style="font-size:24px"
@ -252,10 +262,12 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
id="text3819"
id="tasLbl"
y="53.306854"
x="158.17084"
style="font-size:36px;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;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -269,6 +281,8 @@
<g
id="hdgGroup"
inkscape:label="#g3141"><path
@ -293,6 +307,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -310,6 +326,8 @@
<text
xml:space="preserve"
style="font-size:36px;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:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -327,6 +345,8 @@
</g><text
xml:space="preserve"
style="font-size:36px;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:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -344,6 +364,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -361,6 +383,8 @@
<text
xml:space="preserve"
style="font-size:36px;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:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -378,6 +402,8 @@
<text
xml:space="preserve"
style="font-size:36px;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:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -395,6 +421,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -412,6 +440,8 @@
<text
xml:space="preserve"
style="font-size:36px;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:#32f519;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -429,6 +459,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -446,6 +478,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -463,6 +497,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -480,6 +516,8 @@
<g
inkscape:label="#g3124"
id="compass"><path
@ -508,6 +546,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -526,6 +566,8 @@
<text
transform="matrix(0.5,-0.866026,0.866026,0.5,0,0)"
xml:space="preserve"
@ -544,6 +586,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -562,6 +606,8 @@
<text
transform="matrix(-0.5,-0.866025,0.866025,-0.5,0,0)"
xml:space="preserve"
@ -580,6 +626,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -598,6 +646,8 @@
<text
transform="scale(-1,-1)"
xml:space="preserve"
@ -616,6 +666,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -634,6 +686,8 @@
<text
transform="matrix(-0.5,0.866026,-0.866026,-0.5,0,0)"
xml:space="preserve"
@ -652,6 +706,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -670,6 +726,8 @@
<text
transform="matrix(0.5,0.866025,-0.866025,0.5,0,0)"
xml:space="preserve"
@ -688,6 +746,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -706,6 +766,8 @@
<path
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccscccscccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccscccccc"
id="path3181"
@ -775,6 +837,8 @@
<path
sodipodi:nodetypes="cscc"
inkscape:connector-curvature="0"
@ -798,6 +862,8 @@
<path
inkscape:transform-center-y="-662.357"
inkscape:label="#path3100"
@ -862,6 +928,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -879,6 +947,8 @@
<text
xml:space="preserve"
style="font-size:36px;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:#0099d9;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
@ -896,6 +966,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -913,6 +985,8 @@
<path
inkscape:label="#path7253"
style="fill:none;stroke:#ededed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
@ -933,7 +1007,21 @@
d="m 532,123 0,-21 -6,0 -12,21 -4,0 -12,-21 -6,0 0,21 z"
style="fill:none;stroke:#ff00ff;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
inkscape:label="#path4994"
inkscape:transform-center-y="-711.514" /></g><g
inkscape:transform-center-y="-711.514" /><text
xml:space="preserve"
style="font-size:36px;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;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="918.30713"
y="125.43141"
id="wpActiveDistLbl"
sodipodi:linespacing="125%"
inkscape:label="#text7243"><tspan
style="font-size:24px"
sodipodi:role="line"
id="tspan3179"
x="918.30713"
y="125.43141">NM</tspan></text>
</g><g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="CTR"
@ -1013,6 +1101,8 @@
<text
transform="matrix(0.866025,-0.5,0.5,0.866025,0,0)"
xml:space="preserve"
@ -1031,6 +1121,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -1049,6 +1141,8 @@
<text
transform="matrix(0,-1,1,0,0,0)"
xml:space="preserve"
@ -1067,6 +1161,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -1085,6 +1181,8 @@
<text
transform="matrix(-0.866026,-0.5,0.5,-0.866026,0,0)"
xml:space="preserve"
@ -1103,6 +1201,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -1121,6 +1221,8 @@
<text
transform="matrix(-0.866025,0.5,-0.5,-0.866025,0,0)"
xml:space="preserve"
@ -1139,6 +1241,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -1157,6 +1261,8 @@
<text
transform="matrix(0,1,-1,0,0,0)"
xml:space="preserve"
@ -1175,6 +1281,8 @@
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
@ -1193,6 +1301,8 @@
<text
transform="matrix(0.866026,0.5,-0.5,0.866026,0,0)"
xml:space="preserve"
@ -1211,6 +1321,8 @@
<path
inkscape:connector-curvature="0"
style="fill:#ededed;fill-opacity:1;fill-rule:nonzero;stroke:#ededed;stroke-width:10.054152;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
@ -1309,24 +1421,12 @@
id="planArcs"
inkscape:label="#g3956"
transform="matrix(1.02827,0,0,1.02827,-14.7256,-29.1838)"><path
transform="matrix(2.22078,0,0,2.22078,-717.74,-625.9)"
d="m 744,524 a 190,190 0 1 1 -380,0 190,190 0 1 1 380,0 z"
sodipodi:ry="190"
sodipodi:rx="190"
sodipodi:cy="524"
sodipodi:cx="554"
style="fill:none;stroke:#ededed;stroke-width:3.999999;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="m 542,308.656 c 105.903,14.466 187.5,105.282 187.5,215.156 0,109.875 -81.597,200.659 -187.5,215.126 m 0,217.75 C 767.783,941.437 946.219,753.462 946.219,523.812 946.219,294.164 767.783,106.188 542,90.9375 m -60,0.031 C 256.534,106.544 78.4688,294.391 78.4688,523.812 78.4688,753.235 256.534,941.049 482,956.625 m 0,-217.781 C 376.425,724.085 295.156,633.454 295.156,523.812 295.156,414.17 376.424,323.508 482,308.75"
transform="matrix(0.972507,0,0,0.972507,14.3208,28.3815)"
id="path3171"
style="fill:none;stroke:#ededed;stroke-width:1.75165;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:type="arc" /><path
sodipodi:type="arc"
style="fill:none;stroke:#ededed;stroke-width:3.499612;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3954"
sodipodi:cx="554"
sodipodi:cy="524"
sodipodi:rx="190"
sodipodi:ry="190"
d="m 744,524 a 190,190 0 1 1 -380,0 190,190 0 1 1 380,0 z"
transform="matrix(1.11156,0,0,1.11156,-103.234,-44.67)" /></g><g
inkscape:connector-curvature="0"
sodipodi:nodetypes="csccsccsccsc" /></g><g
style="display:inline"
id="northUp"
inkscape:label="#g3182"><text
@ -1345,6 +1445,8 @@
<path
inkscape:label="#path3017"
sodipodi:nodetypes="cccccc"
@ -1367,6 +1469,8 @@
<text
sodipodi:linespacing="125%"
id="text3209"
@ -1383,20 +1487,76 @@
<text
xml:space="preserve"
style="font-size:22px;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:#00ff00;fill-opacity:1;stroke:none;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="503.03763"
y="998.35583"
y="1008.2553"
id="text3213"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan3215"
x="503.03763"
y="998.35583"
y="1008.2553"
style="font-size:32px">S</tspan></text>
</g></g></svg>
</g><text
xml:space="preserve"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="511.74799"
y="320.56113"
id="rangePln2"
sodipodi:linespacing="125%"
inkscape:label="#text7243"><tspan
style="text-align:center;text-anchor:middle"
sodipodi:role="line"
id="tspan5002-7"
x="511.74799"
y="320.56113">99</tspan></text>
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
id="rangePln1"
y="102.56212"
x="512.06421"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
xml:space="preserve"><tspan
y="102.56212"
x="512.06421"
id="tspan3201"
sodipodi:role="line"
style="text-align:center;text-anchor:middle">99</tspan></text>
<text
xml:space="preserve"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
x="512.21063"
y="752.73596"
id="rangePln3"
sodipodi:linespacing="125%"
inkscape:label="#text7243"><tspan
style="text-align:center;text-anchor:middle"
sodipodi:role="line"
id="tspan3205"
x="512.21063"
y="752.73596">99</tspan></text>
<text
inkscape:label="#text7243"
sodipodi:linespacing="125%"
id="rangePln4"
y="968.55823"
x="511.77499"
style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ededed;fill-opacity:1;stroke:none;display:inline;font-family:Liberation Sans;-inkscape-font-specification:Liberation Sans"
xml:space="preserve"><tspan
y="968.55823"
x="511.77499"
id="tspan3209"
sodipodi:role="line"
style="text-align:center;text-anchor:middle">99</tspan></text>
</g></svg>

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View file

@ -208,14 +208,23 @@ var NDStyles = {
id: 'tas',
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("/velocities/airspeed-kt") > 100,
predicate: func(nd) nd.aircraft_source.get_spd() > 100,
is_true: func(nd) {
nd.symbols.tas.setText(sprintf("%3.0f",getprop("/velocities/airspeed-kt") ));
nd.symbols.tas.show();
},
is_false: func(nd) nd.symbols.tas.hide(),
}, # end of tas behavior callbacks
}, # end of tas hash
},
},
{
id: 'tasLbl',
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.aircraft_source.get_spd() > 100,
is_true: func(nd) nd.symbols.tasLbl.show(),
is_false: func(nd) nd.symbols.tasLbl.hide(),
},
},
{
id: 'wpActiveId',
impl: {
@ -234,12 +243,21 @@ var NDStyles = {
init: func(nd,symbol),
predicate: func(nd) getprop("/autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active"),
is_true: func(nd) {
nd.symbols.wpActiveDist.setText(sprintf("%3.01fNM",getprop("/autopilot/route-manager/wp/dist")));
nd.symbols.wpActiveDist.setText(sprintf("%3.01f",getprop("/autopilot/route-manager/wp/dist")));
nd.symbols.wpActiveDist.show();
},
is_false: func(nd) nd.symbols.wpActiveDist.hide(),
}, # of wpActiveDist.impl
}, # of wpActiveDist
},
},
{
id: 'wpActiveDistLbl',
impl: {
init: func(nd,symbol),
predicate: func(nd) getprop("/autopilot/route-manager/wp/dist") != nil and getprop("autopilot/route-manager/active"),
is_true: func(nd) nd.symbols.wpActiveDistLbl.show(),
is_false: func(nd) nd.symbols.wpActiveDistLbl.hide(),
},
},
{
id: 'eta',
impl: {
@ -252,8 +270,8 @@ var NDStyles = {
etaSec=etaSec-3600*h;
var m = math.floor(etaSec/60);
etaSec=etaSec-60*m;
var s = etaSec;
nd.symbols.eta.setText(sprintf("%02.0f%02.0f.%02.0fz",h,m,s));
var s = etaSec/10;
nd.symbols.eta.setText(sprintf("%02.0f%02.0f.%01.0fz",h,m,s));
nd.symbols.eta.show();
},
is_false: func(nd) nd.symbols.eta.hide(),
@ -272,14 +290,14 @@ var NDStyles = {
id:'gs',
impl: {
init: func(nd,symbol),
common: func(nd) nd.symbols.gs.setText(sprintf("%3.0f",nd.aircraft_source.get_spd() )),
predicate: func(nd) nd.aircraft_source.get_spd() >= 30,
common: func(nd) nd.symbols.gs.setText(sprintf("%3.0f",nd.aircraft_source.get_gnd_spd() )),
predicate: func(nd) nd.aircraft_source.get_gnd_spd() >= 30,
is_true: func(nd) {
nd.symbols.gs.setFontSize(36);
},
is_false: func(nd) nd.symbols.gs.setFontSize(52),
}, # of gs.impl
}, # of gs
},
},
{
id:'rangeArcs',
impl: {
@ -289,7 +307,69 @@ var NDStyles = {
is_false: func(nd) nd.symbols.rangeArcs.hide(),
}, # of rangeArcs.impl
}, # of rangeArcs
{
id:'rangePln1',
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN",
is_true: func(nd) {
nd.symbols.rangePln1.show();
nd.symbols.rangePln1.setText(sprintf("%3.0f",nd.rangeNm()));
},
is_false: func(nd) nd.symbols.rangePln1.hide(),
},
},
{
id:'rangePln2',
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN",
is_true: func(nd) {
nd.symbols.rangePln2.show();
nd.symbols.rangePln2.setText(sprintf("%3.0f",nd.rangeNm()/2));
},
is_false: func(nd) nd.symbols.rangePln2.hide(),
},
},
{
id:'rangePln3',
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN",
is_true: func(nd) {
nd.symbols.rangePln3.show();
nd.symbols.rangePln3.setText(sprintf("%3.0f",nd.rangeNm()/2));
},
is_false: func(nd) nd.symbols.rangePln3.hide(),
},
},
{
id:'rangePln4',
impl: {
init: func(nd,symbol),
predicate: func(nd) nd.get_switch('toggle_display_mode') == "PLAN",
is_true: func(nd) {
nd.symbols.rangePln4.show();
nd.symbols.rangePln4.setText(sprintf("%3.0f",nd.rangeNm()));
},
is_false: func(nd) nd.symbols.rangePln4.hide(),
},
},
{
id:'windArrow',
impl: {
init: func(nd,symbol),
predicate: func(nd) (!(nd.in_mode('toggle_display_mode', ['PLAN']) and (nd.get_switch('toggle_display_type') == "LCD")) and nd.aircraft_source.get_spd() > 100),
is_true: func(nd) {
nd.symbols.windArrow.show();
var windArrowRot = (nd.aircraft_source.get_hdg_tru()-nd.aircraft_source.get_trk_tru())*D2R;
if(nd.in_mode('toggle_display_mode', ['MAP','PLAN']))
windArrowRot = 2*windArrowRot;
nd.symbols.windArrow.setRotation(windArrowRot);
},
is_false: func(nd) nd.symbols.windArrow.hide(),
},
},
], # end of vector with features
@ -337,7 +417,8 @@ NDSourceDriver.new = func {
};
m.get_lat= func getprop("/position/latitude-deg");
m.get_lon= func getprop("/position/longitude-deg");
m.get_spd= func getprop("/velocities/groundspeed-kt");
m.get_spd= func getprop("/velocities/airspeed-kt");
m.get_gnd_spd= func getprop("/velocities/groundspeed-kt");
m.get_vspd= func getprop("/velocities/vertical-speed-fps");
return m;
}
@ -444,6 +525,7 @@ var NavDisplay = {
get_lat: func source.getNode('position/latitude-deg').getValue(),
get_lon: func source.getNode('position/longitude-deg').getValue(),
get_spd: func source.getNode('velocities/true-airspeed-kt').getValue(),
get_gnd_spd: func source.getNode('velocities/groundspeed-kt').getValue(),
};
}, # of connectAI
@ -520,7 +602,7 @@ var NavDisplay = {
foreach(var feature; me.nd_style.features ) {
# print("Setting up SVG feature:", feature.id);
me.symbols[feature.id] = me.nd.getElementById(feature.id);
me.symbols[feature.id] = me.nd.getElementById(feature.id).updateCenter();
if(contains(feature.impl,'init')) feature.impl.init(me.nd, feature); # call The element's init code (i.e. updateCenter)
}
@ -534,7 +616,7 @@ var NavDisplay = {
# load elements from vector image, and create instance variables using identical names, and call updateCenter() on each
# anything that needs updatecenter called, should be added to the vector here
#
foreach(var element; ["windArrow","compassApp","northUp","aplSymMap","aplSymMapCtr","aplSymVor",
foreach(var element; ["compassApp","northUp","aplSymMap","aplSymMapCtr","aplSymVor",
"staFromL2","staToL2","staFromR2","staToR2",
"locPtr","hdgTrk","truMag","altArc","planArcs",
"trkInd","compass","HdgBugCRT","TrkBugLCD","HdgBugLCD","selHdgLine","curHdgPtr",
@ -646,23 +728,11 @@ var NavDisplay = {
# me.drawdme();
});
# TODO: move this to the route.model
# Hack to draw the route on rm activation
me.listen("/autopilot/route-manager/active", func(active) {
if(active.getValue()) {
me.drawroute();
me.drawrunways();
} else {
#print("TODO: navdisplay.mfd: implement route-manager/layer clearing!");
#me.route_group.removeAllChildren(); # HACK!
}
});
me.listen("/autopilot/route-manager/current-wp", func(activeWp) {
canvas.updatewp( activeWp.getValue() );
});
},
drawroute: func print("drawroute no longer used!"),
drawrunways: func print("drawrunways no longer used!"),
in_mode:func(switch, modes)
{
@ -701,11 +771,11 @@ var NavDisplay = {
var userHdg=userHdgMag;
var userTrk=userTrkMag;
}
if (me.aircraft_source.get_spd() < 80)
if (me.aircraft_source.get_gnd_spd() < 80)
userTrk = userHdg;
var userLat = me.aircraft_source.get_lat();
var userLon = me.aircraft_source.get_lon();
var userSpd = me.aircraft_source.get_spd();
var userGndSpd = me.aircraft_source.get_gnd_spd();
var userVSpd = me.aircraft_source.get_vspd();
var dispLCD = me.get_switch('toggle_display_type') == "LCD";
@ -799,14 +869,12 @@ var NavDisplay = {
# reposition the map, change heading & range:
if(me.in_mode('toggle_display_mode', ['PLAN'])) {
me.symbols.windArrow.setVisible(!dispLCD);
me.map._node.getNode("hdg",1).setDoubleValue(0);
if (getprop(me.efis_path ~ "/inputs/plan-wpt-index") >= 0) {
me.map._node.getNode("ref-lat",1).setDoubleValue(getprop("/autopilot/route-manager/route/wp["~getprop(me.efis_path ~ "/inputs/plan-wpt-index")~"]/latitude-deg"));
me.map._node.getNode("ref-lon",1).setDoubleValue(getprop("/autopilot/route-manager/route/wp["~getprop(me.efis_path ~ "/inputs/plan-wpt-index")~"]/longitude-deg"));
}
} else {
me.symbols.windArrow.show();
me.map._node.getNode("ref-lat",1).setDoubleValue(userLat);
me.map._node.getNode("ref-lon",1).setDoubleValue(userLon);
}
@ -834,7 +902,6 @@ 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);
@ -850,7 +917,6 @@ 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'])) {
@ -1018,7 +1084,7 @@ var NavDisplay = {
if (abs(userVSpd) > 5) {
var altDiff = (getprop("autopilot/settings/target-altitude-ft") or 0)-(getprop("instrumentation/altimeter/indicated-altitude-ft") or 0);
if (abs(altDiff) > 50 and altDiff/userVSpd > 0) {
var altRangeNm = altDiff/userVSpd*userSpd*KT2MPS*M2NM;
var altRangeNm = altDiff/userVSpd*userGndSpd*KT2MPS*M2NM;
if(altRangeNm > 1) {
var altRangePx = (350/me.rangeNm())*altRangeNm;
if (altRangePx > 700)