1
0
Fork 0

VOR/ADF arrow and distance update

This commit is contained in:
Inuyaksa 2021-02-28 22:22:07 +01:00
parent e84d54ff90
commit 6996931252
3 changed files with 173 additions and 83 deletions

View file

@ -82,6 +82,41 @@ var easeArrow = {
}
};
var symbolFloat = {
new: func(name, nd) {
var m = {parents: [symbolFloat] };
m.group = nd.getElementById(name);
m.expn = nd.getElementById(name ~ "1");
m.mant = nd.getElementById(name ~ "2");
return m;
},
hide: func {
me.group.hide();
},
show: func {
me.group.show();
},
setText: func(txt) {
var parts = ( txt != "" ) ? split( "." , txt ) : nil;
if ( parts != nil and size(parts) == 2 ) {
me.expn.setText(parts[0]);
me.mant.setText("." ~ parts[1]);
} else {
me.expn.setText(txt);
me.mant.setText("");
}
},
setColor: func(r,g,b) {
me.expn.setColor(r,g,b);
me.mant.setColor(r,g,b);
},
setFloat: func(val) {
var parts = split( "." , sprintf("%03.1f",val) );
me.expn.setText(parts[0]);
me.mant.setText("." ~ parts[1]);
}
};
canvas.NavDisplay.set_switch = func(s, v) {
var switch = me.efis_switches[s];
if(switch == nil) return nil;
@ -137,10 +172,13 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
### this is the "old" method that"s less flexible, we want to use the style hash instead (see above)
# because things are much better configurable that way
# now look up all required SVG elements and initialize member fields using the same name to have a convenient handle
foreach(var element; ["dmeLDist","dmeRDist","dmeL","dmeR","vorL","vorR","vorLId","vorRId",
foreach(var element; ["dmeL","dmeR","vorL","vorR","vorLId","vorRId",
"status.wxr","status.wpt","status.sta","status.arpt","terrHI","terrLO","TerrLabel","terrAhead"])
me.symbols[element] = me.nd.getElementById(element);
foreach(var element; ["dmeLDist","dmeRDist"])
me.symbols[element] = symbolFloat.new( element, me.nd );
# 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
#
@ -576,7 +614,7 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg");
if(!me.get_switch("toggle_centered"))
{
if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 and (me.change_phase != 1) and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting)))
if(me.in_mode("toggle_display_mode", ["PLAN"]) or (me.adirs_property.getValue() != 1 or (me.change_phase == 1) and (adirs_3.getValue() != 1 or att_switch.getValue() != me.attitude_heading_setting)))
me.symbols.trkInd.hide();
else
me.symbols.trkInd.show();

View file

@ -26,13 +26,13 @@
inkscape:window-height="1017"
id="namedview102"
showgrid="false"
inkscape:zoom="2.197766"
inkscape:cx="933.14634"
inkscape:cy="816.83256"
inkscape:zoom="3.1081105"
inkscape:cx="163.03816"
inkscape:cy="979.87161"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="terrGroup"
inkscape:current-layer="layer3"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-object-midpoints="true"
@ -80,7 +80,28 @@
id="guide3498" /><sodipodi:guide
position="74.643421,502.13953"
orientation="0,-1"
id="guide3552" /></sodipodi:namedview><metadata
id="guide3552" /><sodipodi:guide
position="43.434749,95.13984"
orientation="0,-1"
id="guide1262" /><sodipodi:guide
position="23.634,-25.190503"
orientation="-1,0"
id="guide1264"
inkscape:label=""
inkscape:locked="false"
inkscape:color="rgb(0,0,255)" /><sodipodi:guide
position="45.728253,127.63524"
orientation="0,-1"
id="guide1266" /><sodipodi:guide
position="40.040659,26.851076"
orientation="1,0"
id="guide1325" /><sodipodi:guide
position="96.521665,66.50508"
orientation="0,-1"
id="guide1327" /><sodipodi:guide
position="1017.0166,55.726826"
orientation="1,0"
id="guide1344" /></sodipodi:namedview><metadata
id="metadata5186"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /><dc:creator><cc:Agent><dc:title>Gijs de Rooy</dc:title></cc:Agent></dc:creator><cc:license
@ -247,7 +268,7 @@
inkscape:label="#path3843"
sodipodi:nodetypes="cc" /><g
id="terrGroup"
transform="translate(-7.356522,-6.2275037)"><text
transform="translate(-9.356522,-6.2275037)"><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
x="954.74292"
@ -325,14 +346,14 @@
inkscape:label="#text7243"
id="wpActiveId"
y="34.099972"
x="788.04407"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#cecdce;fill-opacity:1;stroke:none"
x="908.58118"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#cecdce;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="34.099972"
x="788.04407"
x="908.58118"
id="tspan7245"
sodipodi:role="line"
style="font-size:36px;line-height:1.25">ABCD</tspan></text>
style="font-size:36px;line-height:1.25;text-align:end;text-anchor:end">XXXX99X</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
@ -980,96 +1001,74 @@
</g><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.73262"
y="913.5495"
x="39.859375"
y="919.5495"
id="vorL"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b;fill-opacity:1"
sodipodi:role="line"
id="tspan3056"
x="71.73262"
y="913.5495">VOR 1</tspan></text>
x="39.859375"
y="919.5495">VOR 1</tspan></text>
<text
inkscape:label="#text7243"
id="dmeL"
y="993.85461"
x="151.73262"
x="85.73262"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="151.73262"
x="85.73262"
id="tspan3060"
sodipodi:role="line"
style="font-size:24px;line-height:1.25">NM</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.129601"
y="993.85461"
id="dmeLDist"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan3068"
x="71.129601"
y="993.85461">99.9</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="71.73262"
y="954.56171"
x="39.9375"
y="956.56171"
id="vorLId"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan3072"
x="71.73262"
y="954.56171">ABC</tspan></text>
x="39.9375"
y="956.56171">ABC</tspan></text>
<text
inkscape:label="#text7243"
id="vorR"
y="913.5495"
x="859.7326"
y="919.5495"
x="884.85938"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="913.5495"
x="859.7326"
y="919.5495"
x="884.85938"
id="tspan3076"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">VOR 2</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#179ab7;fill-opacity:1;stroke:none"
x="931.7326"
x="967.7326"
y="993.85461"
id="dmeR"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25"
sodipodi:role="line"
id="tspan3080"
x="931.7326"
x="967.7326"
y="993.85461">NM</tspan></text>
<text
inkscape:label="#text7243"
id="dmeRDist"
y="993.85461"
x="859.12958"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="859.12958"
id="tspan3084"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">99.9</tspan></text>
<text
inkscape:label="#text7243"
id="vorRId"
y="954.56171"
x="859.7326"
y="955.91815"
x="884.9375"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="954.56171"
x="859.7326"
y="955.91815"
x="884.9375"
id="tspan3088"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;fill:#0dc04b">ABC</tspan></text>
@ -1300,16 +1299,8 @@
sodipodi:role="line"
style="font-size:32px;line-height:125%;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#af0063;fill-opacity:1">999.99</tspan></text>
<path
style="fill:none;stroke:#cecdce;stroke-width:2.4611;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 20.951614,914.85538 v 82.41763 m 4.201291,-92.8082 -4.04,-8.83104 -4.040001,8.50433 L 12,914.85538 h 8.951614 l 8.467743,0.21255 z"
id="vorLSym"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc"
inkscape:label="#path3100"
inkscape:transform-center-y="-498.20098"
inkscape:transform-center-x="-0.080644898" /><path
style="fill:none;stroke:#cecdce;stroke-width:2.38918;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 997.8036,988.07643 V 933.81909 H 987.5 l 17.7357,-42.20198 m 7.1787,96.45932 v -54.25734 h 10.557 l -17.7357,-42.20198"
style="display:inline;fill:none;stroke:#cecdce;stroke-width:3.28819;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 1006.4144,954.86998 v -26.25734 h 10.557 l -17.7357,-26.20198 m -7.4321,52.45932 V 928.61264 H 981.5 l 17.7357,-26.20198 v -6.00909"
id="vorRSym"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc"
@ -1419,7 +1410,58 @@
x="872.1673"
id="tspan748"
sodipodi:role="line"
style="font-size:36px;line-height:1.25;fill:#179ab7;fill-opacity:1">999</tspan></text></g><g
style="font-size:36px;line-height:1.25;fill:#179ab7;fill-opacity:1">999</tspan></text><path
id="vorLSym"
style="display:inline;fill:none;stroke:#cecdce;stroke-width:3.28819;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 23.634,896.5254 v 7.83228 m 1.26e-4,24.4977 v 24.41763 M 23.634,903.63377 8.682512,928.85538 H 23.634 l 14.467869,0.21255 z"
sodipodi:nodetypes="ccccccccc" /><g
id="dmeLDist"><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="56.791557"
y="993.85461"
id="dmeLDist1"
inkscape:label="#text7243"><tspan
style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b"
sodipodi:role="line"
id="tspan3068"
x="56.791557"
y="993.85461">999</tspan></text><text
inkscape:label="#text7243"
id="dmeLDist2"
y="993.85461"
x="55.73262"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="55.73262"
id="tspan1329"
sodipodi:role="line"
style="font-size:24px;line-height:1.25;fill:#0dc04b">.9</tspan></text></g><g
id="dmeRDist"
transform="translate(0.09918213)"><text
inkscape:label="#text7243"
id="dmeRDist1"
y="993.85461"
x="936.79144"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
xml:space="preserve"><tspan
y="993.85461"
x="936.79144"
id="tspan3084"
sodipodi:role="line"
style="font-size:32px;line-height:1.25;text-align:end;text-anchor:end;fill:#0dc04b">999</tspan></text><text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Liberation Sans';-inkscape-font-specification:'Liberation Sans';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;display:inline;fill:#0dc04b;fill-opacity:1;stroke:none"
x="935.7326"
y="993.85461"
id="dmeRDist2"
inkscape:label="#text7243"><tspan
style="font-size:24px;line-height:1.25;fill:#0dc04b"
sodipodi:role="line"
id="tspan1346"
x="935.7326"
y="993.85461">.9</tspan></text></g></g><g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="CTR"

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 144 KiB

View file

@ -14,9 +14,11 @@ var vhdg_bug = props.globals.getNode("/it-autoflight/input/hdg",0); # ND compass
var terrain_minalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/min-altitude", 0);
var terrain_maxalt = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-altitude", -9999);
var terrain_maxcol = props.globals.getNode("/instrumentation/efis[0]/nd/terrain-on-nd/max-color", 0);
var terrain_alert = props.globals.getNode("/instrumentation/mk-viii/outputs/alert-mode",0);
var AMBER = [0.7333,0.3803,0.0000];
var GREEN = [0.0509,0.7529,0.2941];
var YELLOW = [0.9333,0.9333,0.0000];
var RED = [1.0000,0.0000,0.0000];
canvas.NDStyles["Airbus"] = {
@ -1628,15 +1630,16 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.vorL.setColor(0.195,0.96,0.097);
nd.symbols.vorLId.setColor(0.195,0.96,0.097);
nd.symbols.dmeLDist.setColor(0.195,0.96,0.097);
nd.symbols.dmeL.setText("");
}
else{
nd.symbols.vorL.setText("VOR 1");
nd.symbols.vorL.setColor(1,1,1);
nd.symbols.vorLId.setColor(1,1,1);
nd.symbols.dmeLDist.setColor(1,1,1);
nd.symbols.dmeL.setText("NM");
nd.symbols.dmeL.setColor(0,0.59,0.8);
}
nd.symbols.dmeL.setText("NM");
nd.symbols.dmeL.setColor(0,0.59,0.8);
},
is_false: func(nd){
nd.symbols.dmeL.hide();
@ -1648,21 +1651,21 @@ canvas.NDStyles["Airbus"] = {
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_rh_vor_adf") != 0),
is_true: func(nd) {
nd.symbols.dmeR.show();
is_true: func(nd) {
if(nd.get_switch("toggle_rh_vor_adf") < 0){
nd.symbols.vorR.setText("ADF 2");
nd.symbols.vorR.setColor(0.195,0.96,0.097);
nd.symbols.vorRId.setColor(0.195,0.96,0.097);
nd.symbols.dmeRDist.setColor(0.195,0.96,0.097);
nd.symbols.dmeR.setText("");
} else {
nd.symbols.vorR.setText("VOR 2");
nd.symbols.vorR.setColor(1,1,1);
nd.symbols.vorRId.setColor(1,1,1);
nd.symbols.dmeRDist.setColor(1,1,1);
nd.symbols.dmeR.setText("NM");
nd.symbols.dmeR.setColor(0,0.59,0.8);
}
nd.symbols.dmeR.setText("NM");
nd.symbols.dmeR.setColor(0,0.59,0.8);
},
is_false: func(nd){
nd.symbols.dmeR.hide();
@ -1698,10 +1701,12 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.vorLId.setText(navID);
else
nd.symbols.vorLId.setText(frq);
if(getprop(dme~ "in-range"))
nd.symbols.dmeLDist.setText(sprintf("%3.1f",
dst));
else nd.symbols.dmeLDist.setText(" ---");
if(getprop(dme~ "in-range")){
nd.symbols.dmeLDist.setText(sprintf("%3.1f",dst));
}
else {
nd.symbols.dmeLDist.setText(" ---");
}
}
},
is_false: func(nd){
@ -1753,10 +1758,12 @@ canvas.NDStyles["Airbus"] = {
nd.symbols.vorRId.setText(navID);
else
nd.symbols.vorRId.setText(frq);
if(getprop(dme~ "in-range"))
nd.symbols.dmeRDist.setText(sprintf("%3.1f",
dst));
else nd.symbols.dmeRDist.setText(" ---");
if(getprop(dme~ "in-range")){
nd.symbols.dmeRDist.setText(sprintf("%3.1f",dst));
}
else {
nd.symbols.dmeRDist.setText(" ---");
}
}
},
is_false: func(nd){
@ -2000,11 +2007,14 @@ canvas.NDStyles["Airbus"] = {
} else {
nd.symbols.TerrLabel.setVisible(0);
nd.symbols.terrAhead.setVisible(1);
if (alert == 1) nd.symbols.terrAhead.setColor(AMBER[0],AMBER[1],AMBER[2]);
if (alert == 1) nd.symbols.terrAhead.setColor(YELLOW[0],YELLOW[1],YELLOW[2]);
else nd.symbols.terrAhead.setColor(RED[0],RED[1],RED[2]);
}
nd.symbols.terrLO.setText(sprintf("%03d",math.round(terrain_minalt.getValue()/100)));
nd.symbols.terrHI.setText(sprintf("%03d",math.round(terrain_maxalt.getValue()/100)));
if (terrain_maxcol.getValue() == 0) nd.symbols.terrHI.setColor(GREEN[0],GREEN[1],GREEN[2]);
else if (terrain_maxcol.getValue() == 1) nd.symbols.terrHI.setColor(YELLOW[0],YELLOW[1],YELLOW[2]);
else nd.symbols.terrHI.setColor(RED[0],RED[1],RED[2]);
nd.symbols.terrGroup.show();
terrain_maxalt.setValue(-9999); #update visual at radar cycle
}