1
0
Fork 0

Fix the track line / indicator

This commit is contained in:
legoboyvdlp R 2021-08-03 18:44:22 +01:00
parent 250d177d17
commit 352c64b930
3 changed files with 64 additions and 73 deletions

View file

@ -225,7 +225,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
# anything that needs updatecenter called, should be added to the vector here # anything that needs updatecenter called, should be added to the vector here
# #
foreach(var element; ["staFromL2","staToL2","staFromR2","staToR2", foreach(var element; ["staFromL2","staToL2","staFromR2","staToR2",
"hdgTrk","trkInd","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr", "hdgTrk","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr",
"HdgBugCRT2","TrkBugLCD2","HdgBugLCD2","hdgBug2","selHdgLine","selHdgLine2","curHdgPtr2", "HdgBugCRT2","TrkBugLCD2","HdgBugLCD2","hdgBug2","selHdgLine","selHdgLine2","curHdgPtr2",
"staToL","staFromL","staToR","staFromR"] ) "staToL","staFromL","staToR","staFromR"] )
me.symbols[element] = me.nd.getElementById(element).updateCenter(); me.symbols[element] = me.nd.getElementById(element).updateCenter();
@ -613,13 +613,11 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT") if((me.in_mode("toggle_display_mode", ["MAP"]) and me.get_switch("toggle_display_type") == "CRT")
or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD")) or (me.get_switch("toggle_track_heading") and me.get_switch("toggle_display_type") == "LCD"))
{ {
me.symbols.trkInd.setRotation(0);
me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R); me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R);
me.symbols.curHdgPtr2.setRotation((userHdg-userTrk)*D2R); me.symbols.curHdgPtr2.setRotation((userHdg-userTrk)*D2R);
} }
else else
{ {
me.symbols.trkInd.setRotation((userTrk-userHdg)*D2R);
me.symbols.curHdgPtr.setRotation(0); me.symbols.curHdgPtr.setRotation(0);
me.symbols.curHdgPtr2.setRotation(0); me.symbols.curHdgPtr2.setRotation(0);
} }
@ -656,10 +654,6 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
var adf0hdg = getprop("/instrumentation/adf/indicated-bearing-deg"); var adf0hdg = getprop("/instrumentation/adf/indicated-bearing-deg");
var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg"); var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg");
if(!me.get_switch("toggle_centered")) { if(!me.get_switch("toggle_centered")) {
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();
if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) {
me.symbols.staToL.setColor(0.195,0.96,0.097); me.symbols.staToL.setColor(0.195,0.96,0.097);
me.symbols.staFromL.setColor(0.195,0.96,0.097); me.symbols.staFromL.setColor(0.195,0.96,0.097);
@ -713,7 +707,6 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec
} }
me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active); me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active);
} else { } else {
me.symbols.trkInd.hide();
if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) {
me.symbols.staFromL2.setColor(0.195,0.96,0.097); me.symbols.staFromL2.setColor(0.195,0.96,0.097);
me.symbols.staToL2.setColor(0.195,0.96,0.097); me.symbols.staToL2.setColor(0.195,0.96,0.097);

View file

@ -1183,25 +1183,23 @@
x="198.86594" x="198.86594"
y="648.10144">99</tspan></text> y="648.10144">99</tspan></text>
<g <path
id="trkInd" style="display:inline;fill:none;stroke:#0dc04b;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:label="#g3107"
inkscape:transform-center-y="-318.607"
inkscape:transform-center-x="-0.165"><path
inkscape:transform-center-y="-715.775"
inkscape:label="#path3882"
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="curTrkPtr"
d="M 494.187,150.9257 512.25,179.3894 530.312,150.9257 512.25,122.462 Z" d="M 494.187,150.9257 512.25,179.3894 530.312,150.9257 512.25,122.462 Z"
style="display:inline;fill:none;stroke:#0dc04b;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /><path id="curTrkPtr"
inkscape:label="#path6714"
inkscape:transform-center-y="-436.38973"
style="fill:none;stroke:#66b266;stroke-width:5.12176;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 512,179.04645 V 777.94594"
id="trkline"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" /><path sodipodi:nodetypes="cccc"
inkscape:label="#path3882"
inkscape:transform-center-y="-673.07581"
inkscape:transform-center-x="-0.25" /><path
sodipodi:nodetypes="cc"
inkscape:connector-curvature="0"
id="trkline"
d="M 512,179.04645 V 777.94594"
style="fill:none;stroke:#66b266;stroke-width:5.12175989;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:transform-center-y="-345.50518"
inkscape:label="#path6714"
inkscape:transform-center-x="-0.001953124" /><path
style="fill:none;stroke:#ededed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:none;stroke:#ededed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 497.671,651.001 h 27.578" d="m 497.671,651.001 h 27.578"
id="path3823" id="path3823"
@ -1219,7 +1217,7 @@
id="altArc" id="altArc"
d="m 351.124,888.591 c 0,0 72.1,-39.455 161.041,-39.455 88.941,0 161.041,39.455 161.041,39.455 v 0" d="m 351.124,888.591 c 0,0 72.1,-39.455 161.041,-39.455 88.941,0 161.041,39.455 161.041,39.455 v 0"
style="fill:none;stroke:#00ff00;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0" style="fill:none;stroke:#00ff00;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0"
inkscape:label="#path3888-1" /></g> inkscape:label="#path3888-1" />
<g <g
inkscape:transform-center-x="-0.198874" inkscape:transform-center-x="-0.198874"
inkscape:transform-center-y="4.4952743" inkscape:transform-center-y="4.4952743"
@ -1614,22 +1612,24 @@
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
id="path4921" id="path4921"
d="m 97.36195,-183.49186 34.40958,0.79658 v 0" d="m 97.36195,-183.49186 34.40958,0.79658 v 0"
style="fill:none;stroke:#ff00ff;stroke-width:6.72142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></g><g style="fill:none;stroke:#ff00ff;stroke-width:6.72142;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /></g>
id="trkInd2" <path
inkscape:transform-center-y="-221.51123"><path
id="curTrkPtr2" id="curTrkPtr2"
d="M 494.187,114.9257 512.25,143.3894 530.312,114.9257 512.25,86.462 Z" d="M 494.187,114.9257 512.25,143.3894 530.312,114.9257 512.25,86.462 Z"
style="display:inline;fill:none;stroke:#0dc04b;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="display:inline;fill:none;stroke:#0dc04b;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" sodipodi:nodetypes="cccccccc"
inkscape:label="#path3998" /><path inkscape:label="#path3998"
sodipodi:nodetypes="cc" inkscape:transform-center-x="-0.28439381"
inkscape:connector-curvature="0" inkscape:transform-center-y="-400.24318" /><path
id="trkline2" inkscape:label="#path6714"
inkscape:transform-center-y="-195.62267"
style="fill:none;stroke:#66b266;stroke-width:4.09095001;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 512,143.84995 V 525.93899" d="M 512,143.84995 V 525.93899"
style="fill:none;stroke:#66b266;stroke-width:4.09095;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="trkline2"
inkscape:transform-center-y="-278.41021" inkscape:connector-curvature="0"
inkscape:label="#path6714" /></g><path sodipodi:nodetypes="cc"
inkscape:transform-center-x="-0.16436971" /><path
id="aplSymVor" id="aplSymVor"
style="fill:none;stroke:#ededed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:none;stroke:#ededed;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 523.994,501.789 v 58 h 51.042 m -51.042,0 v 57 h 18.782 m -43.653,-115 v 58 h -50.158 m 50.158,0 v 57 h -19.136" d="m 523.994,501.789 v 58 h 51.042 m -51.042,0 v 57 h 18.782 m -43.653,-115 v 58 h -50.158 m 50.158,0 v 57 h -19.136"

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View file

@ -1321,37 +1321,47 @@ canvas.NDStyles["Airbus"] = {
is_false: func(nd) nd.symbols.dme.hide(), is_false: func(nd) nd.symbols.dme.hide(),
}, },
}, },
{
id:"curTrkPtr",
impl: {
init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and !nd.get_switch("toggle_centered")
and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))
and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42),
is_true: func(nd) {
nd.symbols.curTrkPtr.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R);
nd.symbols.curTrkPtr.show();
},
is_false: func(nd) nd.symbols.curTrkPtr.hide(),
},
},
{ {
id:"trkline", id:"trkline",
impl: { impl: {
init: func(nd,symbol), init: func(nd,symbol),
predicate: func(nd){ predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and
nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") !nd.get_switch("toggle_centered") and (nd.change_phase != 1) and
and (nd.change_phase != 1) getprop(nd.options.defaults.lat_ctrl) == 0 and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42 and
and ( (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
getprop(nd.options.defaults.lat_ctrl) == 0 or
nd.get_switch("toggle_trk_line")
)
},
is_true: func(nd) { is_true: func(nd) {
nd.symbols.trkline.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R);
nd.symbols.trkline.show(); nd.symbols.trkline.show();
}, },
is_false: func(nd) nd.symbols.trkline.hide(), is_false: func(nd) nd.symbols.trkline.hide(),
}, },
}, },
{ {
id:"trkInd2", id:"curTrkPtr2",
impl: { impl: {
init: func(nd,symbol), init: func(nd,symbol),
predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered") predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR","MAP"]) and nd.get_switch("toggle_centered")
and (nd.change_phase != 1)
and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting)) and (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))
and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42), and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42),
is_true: func(nd) { is_true: func(nd) {
nd.symbols.trkInd2.show(); nd.symbols.curTrkPtr2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R);
nd.symbols.trkInd2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R); nd.symbols.curTrkPtr2.show();
}, },
is_false: func(nd) nd.symbols.trkInd2.hide(), is_false: func(nd) nd.symbols.curTrkPtr2.hide(),
}, },
}, },
{ {
@ -1360,9 +1370,10 @@ canvas.NDStyles["Airbus"] = {
init: func(nd,symbol), init: func(nd,symbol),
predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and
nd.get_switch("toggle_centered") and (nd.change_phase != 1) and nd.get_switch("toggle_centered") and (nd.change_phase != 1) and
getprop(nd.options.defaults.lat_ctrl) == 0 and getprop(nd.options.defaults.lat_ctrl) == 0 and abs(nd.aircraft_source.get_trk_mag() - nd.aircraft_source.get_hdg_mag()) <= 42 and
(nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))), (nd.adirs_property.getValue() == 1 or (adirs_3.getValue() == 1 and att_switch.getValue() == nd.attitude_heading_setting))),
is_true: func(nd) { is_true: func(nd) {
nd.symbols.trkline2.setRotation((nd.aircraft_source.get_trk_mag()-nd.aircraft_source.get_hdg_mag())*D2R);
nd.symbols.trkline2.show(); nd.symbols.trkline2.show();
}, },
is_false: func(nd) nd.symbols.trkline2.hide(), is_false: func(nd) nd.symbols.trkline2.hide(),
@ -1522,8 +1533,6 @@ canvas.NDStyles["Airbus"] = {
predicate: func(nd) (getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100), predicate: func(nd) (getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100),
is_true: func(nd) { is_true: func(nd) {
var windDir = pts.Instrumentation.PFD.windDirection.getValue() or 0; var windDir = pts.Instrumentation.PFD.windDirection.getValue() or 0;
if(nd.get_switch("toggle_true_north"))
windDir = windDir + getprop("environment/magnetic-variation-deg");
nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,pts.Instrumentation.PFD.windSpeed.getValue() or 0)); nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,pts.Instrumentation.PFD.windSpeed.getValue() or 0));
}, },
is_false: func(nd) { is_false: func(nd) {
@ -1538,18 +1547,7 @@ canvas.NDStyles["Airbus"] = {
predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD")) and (pts.Instrumentation.PFD.windSpeed.getValue() or 0) >= 2 and getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100), predicate: func(nd) (!(nd.in_mode("toggle_display_mode", ["PLAN"]) and (nd.get_switch("toggle_display_type") == "LCD")) and (pts.Instrumentation.PFD.windSpeed.getValue() or 0) >= 2 and getprop("/instrumentation/airspeed-indicator/true-speed-kt") >= 100),
is_true: func(nd) { is_true: func(nd) {
nd.symbols.windArrow.show(); nd.symbols.windArrow.show();
var windArrowRot = pts.Instrumentation.PFD.windDirection.getValue() or 0; var windArrowRot = (pts.Instrumentation.PFD.windDirection.getValue() or 0) - nd.aircraft_source.get_hdg_tru();
if(nd.in_mode("toggle_display_mode", ["MAP","PLAN"])) {
if(nd.get_switch("toggle_true_north"))
windArrowRot = windArrowRot - nd.aircraft_source.get_trk_tru();
else
windArrowRot = windArrowRot - nd.aircraft_source.get_trk_mag();
} else {
if(nd.get_switch("toggle_true_north"))
windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_tru();
else
windArrowRot = windArrowRot - nd.aircraft_source.get_hdg_mag();
}
nd.symbols.windArrow.setRotation(windArrowRot*D2R); nd.symbols.windArrow.setRotation(windArrowRot*D2R);
}, },
is_false: func(nd) nd.symbols.windArrow.hide(), is_false: func(nd) nd.symbols.windArrow.hide(),