Merge branch 'master' of gitorious.org:fg/fgdata
This commit is contained in:
commit
c2455bcafe
14 changed files with 1945 additions and 1464 deletions
|
@ -118,7 +118,8 @@ var init = func {
|
|||
.horiz(-14.5)
|
||||
.vert(-14.5)
|
||||
.close()
|
||||
.setStrokeLineWidth( me.layer.style.line_width );
|
||||
.setStrokeLineWidth( me.layer.style.line_width )
|
||||
.set("z-index",-2);
|
||||
|
||||
# finally scale the symbol as requested, this is done last so that people can override this when creating the layer
|
||||
me.apply_scale();
|
||||
|
|
|
@ -28,7 +28,8 @@ var drawFIX = func(group) {
|
|||
.lineTo(15,15)
|
||||
.close()
|
||||
.setStrokeLineWidth(line_width)
|
||||
.setColor(color);
|
||||
.setColor(color)
|
||||
.set("z-index",-3);
|
||||
}
|
||||
|
||||
var cache = StyleableCacheable.new(
|
||||
|
@ -44,6 +45,6 @@ var init = func {
|
|||
|
||||
# non-cached stuff:
|
||||
if (me.style.show_labels)
|
||||
me.text_fix = me.newText(me.model.id).setScale(me.style.scale_factor);
|
||||
me.text_fix = me.newText(me.model.id).setScale(me.style.scale_factor).setTranslation(17,35).set("z-index",-3);
|
||||
}
|
||||
var draw = func;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 110 KiB |
|
@ -38,7 +38,8 @@ var drawVOR = func(group) {
|
|||
.lineTo(-7.5,-12.5)
|
||||
.close()
|
||||
.setStrokeLineWidth(line_width)
|
||||
.setColor(color);
|
||||
.setColor(color)
|
||||
.set("z-index",-2);
|
||||
};
|
||||
|
||||
var cache = StyleableCacheable.new(
|
||||
|
@ -87,7 +88,8 @@ var draw = func {
|
|||
.arcSmallCW(radius,radius,0,-2*radius,0)
|
||||
.setStrokeLineWidth(me.style.range_line_width)
|
||||
.setStrokeDashArray(me.style.range_dash_array)
|
||||
.setColor(me.style.active_color);
|
||||
.setColor(me.style.active_color)
|
||||
.set("z-index",-2);
|
||||
|
||||
var course = me.map.controller.get_tuned_course(me.model.frequency/100);
|
||||
me.radial_vor = me.element.createChild("path")
|
||||
|
@ -96,7 +98,8 @@ var draw = func {
|
|||
.setStrokeLineWidth(me.style.radial_line_width)
|
||||
.setStrokeDashArray(me.style.radial_dash_array)
|
||||
.setColor(me.style.active_color)
|
||||
.setRotation(course*D2R);
|
||||
.setRotation(course*D2R)
|
||||
.set("z-index",-2);
|
||||
}
|
||||
me.range_vor.show();
|
||||
me.radial_vor.show();
|
||||
|
|
|
@ -31,10 +31,13 @@ var init = func {
|
|||
.lineTo(5,-5)
|
||||
.setColor(1,1,1)
|
||||
.close()
|
||||
.setScale(me.style.scale_factor);
|
||||
.setScale(me.style.scale_factor)
|
||||
.set("z-index",2);
|
||||
|
||||
me.newText(me.model.name, me.style.font_color).setTranslation(25,35)
|
||||
.setScale(me.style.scale_factor);
|
||||
me.text = me.newText(me.model.name, me.style.font_color)
|
||||
.setTranslation(25,35)
|
||||
.setScale(me.style.scale_factor)
|
||||
.set("z-index",2);
|
||||
|
||||
me.draw();
|
||||
};
|
||||
|
@ -46,6 +49,11 @@ var draw = func {
|
|||
me.style.active_color :
|
||||
me.style.inactive_color
|
||||
);
|
||||
me.text.setColor(
|
||||
active ?
|
||||
me.style.active_color :
|
||||
me.style.inactive_color
|
||||
);
|
||||
me.active = active;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,7 +15,8 @@ var draw = func {
|
|||
.setFile("Nasal/canvas/map/Images/storm.png")
|
||||
.setSize(128*me.model.radiusNm,128*me.model.radiusNm)
|
||||
.setTranslation(-64*me.model.radiusNm,-64*me.model.radiusNm)
|
||||
.setCenter(0,0);
|
||||
.setCenter(0,0)
|
||||
.set("z-index",-4);
|
||||
# .setScale(0.3);
|
||||
# TODO: overlapping storms should probably set their z-index according to altitudes
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ var draw_apt = func (group, apt, controller=nil, lod=0) {
|
|||
.setColor(0,0.6,0.85)
|
||||
.setFontSize(28);
|
||||
apt_grp.setGeoPosition(lat, lon)
|
||||
.set("z-index",1); # FIXME: this needs to be configurable!!
|
||||
.set("z-index",-1); # FIXME: this needs to be configurable!!
|
||||
#}
|
||||
|
||||
# draw routines should always return their canvas group to the caller for further processing
|
||||
|
|
|
@ -26,7 +26,7 @@ var drawprofile = func (group, property, disptext)
|
|||
.setTranslation(25,35)
|
||||
.setColor(0.195,0.96,0.097);
|
||||
sym_group.setGeoPosition(lat, lon)
|
||||
.set("z-index",4);
|
||||
.set("z-index",3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,6 @@ var draw_fix = func (group, fix, controller=nil, lod=0) {
|
|||
|
||||
# the fix position
|
||||
fix_grp.setGeoPosition(lat, lon)
|
||||
.set("z-index",3);
|
||||
.set("z-index",-3);
|
||||
|
||||
}
|
||||
|
|
|
@ -31,24 +31,16 @@ NDSourceDriver.new = func {
|
|||
m.get_trk_mag= func
|
||||
{
|
||||
if(getprop("/velocities/groundspeed-kt") > 80)
|
||||
{
|
||||
getprop("/orientation/track-magnetic-deg");
|
||||
}
|
||||
else
|
||||
{
|
||||
getprop("/orientation/heading-magnetic-deg");
|
||||
}
|
||||
};
|
||||
m.get_trk_tru = func
|
||||
{
|
||||
if(getprop("/velocities/groundspeed-kt") > 80)
|
||||
{
|
||||
getprop("/orientation/track-deg");
|
||||
}
|
||||
else
|
||||
{
|
||||
getprop("/orientation/heading-deg");
|
||||
}
|
||||
};
|
||||
m.get_lat= func getprop("/position/latitude-deg");
|
||||
m.get_lon= func getprop("/position/longitude-deg");
|
||||
|
@ -242,16 +234,14 @@ var NavDisplay = {
|
|||
# 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",
|
||||
"range","status.wxr","status.wpt","status.sta","status.arpt"])
|
||||
"status.wxr","status.wpt","status.sta","status.arpt"])
|
||||
me.symbols[element] = me.nd.getElementById(element);
|
||||
|
||||
# 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; ["compassApp","northUp","aplSymMap","aplSymMapCtr","aplSymVor",
|
||||
"staArrowL2","staArrowR2","staFromL2","staToL2","staFromR2","staToR2",
|
||||
"hdgTrk","truMag","altArc","planArcs",
|
||||
"trkInd","compass","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr",
|
||||
foreach(var element; ["staArrowL2","staArrowR2","staFromL2","staToL2","staFromR2","staToR2",
|
||||
"hdgTrk","trkInd","hdgBug","HdgBugCRT","TrkBugLCD","HdgBugLCD","curHdgPtr",
|
||||
"HdgBugCRT2","TrkBugLCD2","HdgBugLCD2","hdgBug2","selHdgLine","selHdgLine2","curHdgPtr2",
|
||||
"staArrowL","staArrowR","staToL","staFromL","staToR","staFromR"] )
|
||||
me.symbols[element] = me.nd.getElementById(element).updateCenter();
|
||||
|
@ -417,13 +407,15 @@ var NavDisplay = {
|
|||
var userTrkTru = me.aircraft_source.get_trk_tru();
|
||||
|
||||
if(me.get_switch('toggle_true_north')) {
|
||||
me.symbols.truMag.setText("TRU");
|
||||
var userHdg=userHdgTru;
|
||||
me.userHdg=userHdgTru;
|
||||
var userTrk=userTrkTru;
|
||||
me.userTrk=userTrkTru;
|
||||
} else {
|
||||
me.symbols.truMag.setText("MAG");
|
||||
var userHdg=userHdgMag;
|
||||
me.userHdg=userHdgMag;
|
||||
var userTrk=userTrkMag;
|
||||
me.userTrk=userTrkMag;
|
||||
}
|
||||
# this should only ever happen when testing the experimental AI/MP ND driver hash (not critical)
|
||||
# or when an error occurs (critical)
|
||||
|
@ -431,17 +423,21 @@ var NavDisplay = {
|
|||
print("aircraft source invalid, returning !");
|
||||
return;
|
||||
}
|
||||
if (me.aircraft_source.get_gnd_spd() < 80)
|
||||
if (me.aircraft_source.get_gnd_spd() < 80) {
|
||||
userTrk = userHdg;
|
||||
me.userTrk=userHdg;
|
||||
}
|
||||
|
||||
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"))
|
||||
{
|
||||
userHdgTrk = userTrk;
|
||||
me.userHdgTrk = userTrk;
|
||||
userHdgTrkTru = userTrkTru;
|
||||
me.symbols.hdgTrk.setText("TRK");
|
||||
} else {
|
||||
userHdgTrk = userHdg;
|
||||
me.userHdgTrk = userHdg;
|
||||
userHdgTrkTru = userHdgTru;
|
||||
me.symbols.hdgTrk.setText("HDG");
|
||||
}
|
||||
|
@ -562,8 +558,6 @@ var NavDisplay = {
|
|||
me.symbols.dmeRDist.setText("");
|
||||
}
|
||||
|
||||
me.symbols.range.setText(sprintf("%3.0f",me.rangeNm()/2));
|
||||
|
||||
# Hide heading bug 10 secs after change
|
||||
var vhdg_bug = getprop("autopilot/settings/heading-bug-deg") or 0;
|
||||
var hdg_bug_active = getprop("autopilot/settings/heading-bug-active");
|
||||
|
@ -574,14 +568,12 @@ var NavDisplay = {
|
|||
or (me.get_switch('toggle_track_heading') and me.get_switch('toggle_display_type') == "LCD"))
|
||||
{
|
||||
me.symbols.trkInd.setRotation(0);
|
||||
me.symbols.trkInd2.setRotation(0);
|
||||
me.symbols.curHdgPtr.setRotation((userHdg-userTrk)*D2R);
|
||||
me.symbols.curHdgPtr2.setRotation((userHdg-userTrk)*D2R);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.symbols.trkInd.setRotation((userTrk-userHdg)*D2R);
|
||||
me.symbols.trkInd2.setRotation((userTrk-userHdg)*D2R);
|
||||
me.symbols.curHdgPtr.setRotation(0);
|
||||
me.symbols.curHdgPtr2.setRotation(0);
|
||||
}
|
||||
|
@ -592,22 +584,6 @@ var NavDisplay = {
|
|||
me.symbols.hdgBug.setRotation(hdgBugRot);
|
||||
me.symbols.hdgBug2.setRotation(hdgBugRot);
|
||||
me.symbols.selHdgLine2.setRotation(hdgBugRot);
|
||||
me.symbols.compass.setRotation(-userHdgTrk*D2R);
|
||||
me.symbols.compassApp.setRotation(-userHdgTrk*D2R);
|
||||
}
|
||||
if(me.get_switch('toggle_centered')) {
|
||||
if (me.in_mode('toggle_display_mode', ['APP','VOR']))
|
||||
me.symbols.compassApp.show();
|
||||
else
|
||||
me.symbols.compassApp.setVisible(me.in_mode('toggle_display_mode', ['MAP']));
|
||||
} else {
|
||||
me.symbols.compassApp.hide();
|
||||
}
|
||||
|
||||
if ((me.get_switch('toggle_centered') and !me.in_mode('toggle_display_mode', ['PLAN'])) or me.in_mode('toggle_display_mode', ['PLAN'])) {
|
||||
me.symbols.compass.hide();
|
||||
} else {
|
||||
me.symbols.compass.show();
|
||||
}
|
||||
|
||||
var staPtrVis = !me.in_mode('toggle_display_mode', ['PLAN']);
|
||||
|
@ -622,139 +598,113 @@ var NavDisplay = {
|
|||
var vorheading = userHdgTru;
|
||||
var adfheading = userHdgMag;
|
||||
}
|
||||
if(me.in_mode('toggle_display_mode', ['APP','MAP','VOR','PLAN']))
|
||||
if(getprop("instrumentation/nav/heading-deg") != nil)
|
||||
var nav0hdg=getprop("instrumentation/nav/heading-deg") - vorheading;
|
||||
if(getprop("instrumentation/nav[1]/heading-deg") != nil)
|
||||
var nav1hdg=getprop("instrumentation/nav[1]/heading-deg") - vorheading;
|
||||
var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg");
|
||||
var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg");
|
||||
if(!me.get_switch('toggle_centered'))
|
||||
{
|
||||
if(getprop("instrumentation/nav/heading-deg") != nil)
|
||||
var nav0hdg=getprop("instrumentation/nav/heading-deg") - vorheading;
|
||||
if(getprop("instrumentation/nav[1]/heading-deg") != nil)
|
||||
var nav1hdg=getprop("instrumentation/nav[1]/heading-deg") - vorheading;
|
||||
var adf0hdg=getprop("instrumentation/adf/indicated-bearing-deg") - adfheading;
|
||||
var adf1hdg=getprop("instrumentation/adf[1]/indicated-bearing-deg") - adfheading;
|
||||
if(!me.get_switch('toggle_centered'))
|
||||
{
|
||||
if(me.in_mode('toggle_display_mode', ['PLAN']))
|
||||
me.symbols.trkInd.hide();
|
||||
else
|
||||
me.symbols.trkInd.show();
|
||||
if((getprop("instrumentation/nav/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||
me.symbols.staToL.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staFromL.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowL.setRotation(nav0hdg*D2R);
|
||||
}
|
||||
elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||
me.symbols.staToL.setColor(0,0.6,0.85);
|
||||
me.symbols.staFromL.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowL.setRotation(adf0hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowL.hide();
|
||||
}
|
||||
if((getprop("instrumentation/nav[1]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||
me.symbols.staToR.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staFromR.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowR.setRotation(nav1hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||
me.symbols.staToR.setColor(0,0.6,0.85);
|
||||
me.symbols.staFromR.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowR.setRotation(adf1hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowR.hide();
|
||||
}
|
||||
me.symbols.staArrowL2.hide();
|
||||
me.symbols.staArrowR2.hide();
|
||||
me.symbols.curHdgPtr2.hide();
|
||||
me.symbols.HdgBugCRT2.hide();
|
||||
me.symbols.TrkBugLCD2.hide();
|
||||
me.symbols.HdgBugLCD2.hide();
|
||||
me.symbols.selHdgLine2.hide();
|
||||
me.symbols.curHdgPtr.setVisible(staPtrVis);
|
||||
me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD);
|
||||
if(me.get_switch('toggle_track_heading'))
|
||||
{
|
||||
me.symbols.HdgBugLCD.hide();
|
||||
me.symbols.TrkBugLCD.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.symbols.TrkBugLCD.hide();
|
||||
me.symbols.HdgBugLCD.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active);
|
||||
} else {
|
||||
if(me.in_mode('toggle_display_mode', ['PLAN']))
|
||||
me.symbols.trkInd.hide();
|
||||
if((getprop("instrumentation/nav/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||
me.symbols.staFromL2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staToL2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowL2.setRotation(nav0hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||
me.symbols.staFromL2.setColor(0,0.6,0.85);
|
||||
me.symbols.staToL2.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowL2.setRotation(adf0hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowL2.hide();
|
||||
}
|
||||
if((getprop("instrumentation/nav[1]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||
me.symbols.staFromR2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staToR2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowR2.setRotation(nav1hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||
me.symbols.staFromR2.setColor(0,0.6,0.85);
|
||||
me.symbols.staToR2.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowR2.setRotation(adf1hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowR2.hide();
|
||||
}
|
||||
me.symbols.staArrowL.hide();
|
||||
me.symbols.staArrowR.hide();
|
||||
me.symbols.curHdgPtr.hide();
|
||||
me.symbols.HdgBugCRT.hide();
|
||||
me.symbols.TrkBugLCD.hide();
|
||||
me.symbols.HdgBugLCD.hide();
|
||||
me.symbols.selHdgLine.hide();
|
||||
me.symbols.curHdgPtr2.setVisible(staPtrVis);
|
||||
me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD);
|
||||
if(me.get_switch('toggle_track_heading'))
|
||||
{
|
||||
me.symbols.HdgBugLCD2.hide();
|
||||
me.symbols.TrkBugLCD2.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.symbols.TrkBugLCD2.hide();
|
||||
me.symbols.HdgBugLCD2.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
me.symbols.selHdgLine2.setVisible(staPtrVis and hdg_bug_active);
|
||||
else
|
||||
me.symbols.trkInd.show();
|
||||
if((getprop("instrumentation/nav/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||
me.symbols.staToL.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staFromL.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowL.setRotation(nav0hdg*D2R);
|
||||
}
|
||||
}
|
||||
|
||||
me.symbols.northUp.setVisible(me.in_mode('toggle_display_mode', ['PLAN']));
|
||||
me.symbols.aplSymMap.setVisible(me.in_mode('toggle_display_mode', ['APP','MAP','VOR']) and !me.get_switch('toggle_centered'));
|
||||
me.symbols.aplSymMapCtr.setVisible(me.in_mode('toggle_display_mode', ['MAP']) and me.get_switch('toggle_centered'));
|
||||
me.symbols.aplSymVor.setVisible(me.in_mode('toggle_display_mode', ['APP','VOR']) and me.get_switch('toggle_centered'));
|
||||
me.symbols.planArcs.setVisible(me.in_mode('toggle_display_mode', ['PLAN']));
|
||||
|
||||
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*userGndSpd*KT2MPS*M2NM;
|
||||
if(altRangeNm > 1) {
|
||||
var altRangePx = (350/me.rangeNm())*altRangeNm;
|
||||
if (altRangePx > 700)
|
||||
altRangePx = 700;
|
||||
me.symbols.altArc.setTranslation(0,-altRangePx);
|
||||
}
|
||||
me.symbols.altArc.setVisible(me.in_mode('toggle_display_mode', ['MAP']) and !me.get_switch('toggle_centered'));
|
||||
} else
|
||||
me.symbols.altArc.hide();
|
||||
elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowL.setVisible(staPtrVis);
|
||||
me.symbols.staToL.setColor(0,0.6,0.85);
|
||||
me.symbols.staFromL.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowL.setRotation(adf0hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowL.hide();
|
||||
}
|
||||
if((getprop("instrumentation/nav[1]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||
me.symbols.staToR.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staFromR.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowR.setRotation(nav1hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowR.setVisible(staPtrVis);
|
||||
me.symbols.staToR.setColor(0,0.6,0.85);
|
||||
me.symbols.staFromR.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowR.setRotation(adf1hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowR.hide();
|
||||
}
|
||||
me.symbols.staArrowL2.hide();
|
||||
me.symbols.staArrowR2.hide();
|
||||
me.symbols.curHdgPtr2.hide();
|
||||
me.symbols.HdgBugCRT2.hide();
|
||||
me.symbols.TrkBugLCD2.hide();
|
||||
me.symbols.HdgBugLCD2.hide();
|
||||
me.symbols.selHdgLine2.hide();
|
||||
me.symbols.curHdgPtr.setVisible(staPtrVis);
|
||||
me.symbols.HdgBugCRT.setVisible(staPtrVis and !dispLCD);
|
||||
if(me.get_switch('toggle_track_heading'))
|
||||
{
|
||||
me.symbols.HdgBugLCD.hide();
|
||||
me.symbols.TrkBugLCD.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.symbols.TrkBugLCD.hide();
|
||||
me.symbols.HdgBugLCD.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active);
|
||||
} else {
|
||||
me.symbols.altArc.hide();
|
||||
me.symbols.trkInd.hide();
|
||||
if((getprop("instrumentation/nav/in-range") and me.get_switch('toggle_lh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||
me.symbols.staFromL2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staToL2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowL2.setRotation(nav0hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf/in-range") and (me.get_switch('toggle_lh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowL2.setVisible(staPtrVis);
|
||||
me.symbols.staFromL2.setColor(0,0.6,0.85);
|
||||
me.symbols.staToL2.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowL2.setRotation(adf0hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowL2.hide();
|
||||
}
|
||||
if((getprop("instrumentation/nav[1]/in-range") and me.get_switch('toggle_rh_vor_adf') == 1)) {
|
||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||
me.symbols.staFromR2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staToR2.setColor(0.195,0.96,0.097);
|
||||
me.symbols.staArrowR2.setRotation(nav1hdg*D2R);
|
||||
} elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch('toggle_rh_vor_adf') == -1)) {
|
||||
me.symbols.staArrowR2.setVisible(staPtrVis);
|
||||
me.symbols.staFromR2.setColor(0,0.6,0.85);
|
||||
me.symbols.staToR2.setColor(0,0.6,0.85);
|
||||
me.symbols.staArrowR2.setRotation(adf1hdg*D2R);
|
||||
} else {
|
||||
me.symbols.staArrowR2.hide();
|
||||
}
|
||||
me.symbols.staArrowL.hide();
|
||||
me.symbols.staArrowR.hide();
|
||||
me.symbols.curHdgPtr.hide();
|
||||
me.symbols.HdgBugCRT.hide();
|
||||
me.symbols.TrkBugLCD.hide();
|
||||
me.symbols.HdgBugLCD.hide();
|
||||
me.symbols.selHdgLine.hide();
|
||||
me.symbols.curHdgPtr2.setVisible(staPtrVis);
|
||||
me.symbols.HdgBugCRT2.setVisible(staPtrVis and !dispLCD);
|
||||
if(me.get_switch('toggle_track_heading'))
|
||||
{
|
||||
me.symbols.HdgBugLCD2.hide();
|
||||
me.symbols.TrkBugLCD2.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
else
|
||||
{
|
||||
me.symbols.TrkBugLCD2.hide();
|
||||
me.symbols.HdgBugLCD2.setVisible(staPtrVis and dispLCD);
|
||||
}
|
||||
me.symbols.selHdgLine2.setVisible(staPtrVis and hdg_bug_active);
|
||||
}
|
||||
|
||||
## run all predicates in the NDStyle hash and evaluate their true/false behavior callbacks
|
||||
|
|
|
@ -319,6 +319,38 @@ var NDStyles = {
|
|||
is_false: func(nd) nd.symbols.gsGroup.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'compassApp',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['APP','VOR'])),
|
||||
is_true: func(nd) {
|
||||
if(nd.get_switch('toggle_true_north'))
|
||||
var hdg = nd.aircraft_source.get_trk_tru();
|
||||
else
|
||||
var hdg = nd.aircraft_source.get_trk_mag();
|
||||
nd.symbols.compassApp.setRotation(-hdg*D2R);
|
||||
nd.symbols.compassApp.show();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.compassApp.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'compassMapCtr',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['MAP'])),
|
||||
is_true: func(nd) {
|
||||
if(nd.get_switch('toggle_true_north'))
|
||||
var hdg = nd.aircraft_source.get_trk_tru();
|
||||
else
|
||||
var hdg = nd.aircraft_source.get_trk_mag();
|
||||
nd.symbols.compassMapCtr.setRotation(-hdg*D2R);
|
||||
nd.symbols.compassMapCtr.show();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.compassMapCtr.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'hdg',
|
||||
impl: {
|
||||
|
@ -373,6 +405,72 @@ var NDStyles = {
|
|||
is_false: func(nd) nd.symbols.gs.setFontSize(52),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'compass',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) ((nd.get_switch('toggle_centered') and !nd.in_mode('toggle_display_mode', ['PLAN'])) or nd.in_mode('toggle_display_mode', ['PLAN'])),
|
||||
is_true: func(nd) nd.symbols.compass.hide(),
|
||||
is_false: func(nd) {
|
||||
nd.symbols.compass.show();
|
||||
nd.symbols.compass.setRotation(-nd.userHdgTrk*D2R);
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'truMag',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) nd.get_switch('toggle_true_north'),
|
||||
is_true: func(nd) nd.symbols.truMag.setText("TRU"),
|
||||
is_false: func(nd) nd.symbols.truMag.setText("MAG"),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'northUp',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) nd.in_mode('toggle_display_mode', ['PLAN']),
|
||||
is_true: func(nd) nd.symbols.northUp.show(),
|
||||
is_false: func(nd) nd.symbols.northUp.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'planArcs',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) nd.in_mode('toggle_display_mode', ['PLAN']),
|
||||
is_true: func(nd) nd.symbols.planArcs.show(),
|
||||
is_false: func(nd) nd.symbols.planArcs.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'aplSymMap',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','MAP','VOR']) and !nd.get_switch('toggle_centered')),
|
||||
is_true: func(nd) nd.symbols.aplSymMap.show(),
|
||||
is_false: func(nd) nd.symbols.aplSymMap.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'aplSymMapCtr',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['MAP']) and nd.get_switch('toggle_centered')),
|
||||
is_true: func(nd) nd.symbols.aplSymMapCtr.show(),
|
||||
is_false: func(nd) nd.symbols.aplSymMapCtr.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'aplSymVor',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR']) and nd.get_switch('toggle_centered')),
|
||||
is_true: func(nd) nd.symbols.aplSymVor.show(),
|
||||
is_false: func(nd) nd.symbols.aplSymVor.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'rangeArcs',
|
||||
impl: {
|
||||
|
@ -380,8 +478,8 @@ var NDStyles = {
|
|||
predicate: func(nd) !nd.get_switch('toggle_centered') and nd.get_switch('toggle_rangearc'),
|
||||
is_true: func(nd) nd.symbols.rangeArcs.show(),
|
||||
is_false: func(nd) nd.symbols.rangeArcs.hide(),
|
||||
}, # of rangeArcs.impl
|
||||
}, # of rangeArcs
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'rangePln1',
|
||||
impl: {
|
||||
|
@ -430,6 +528,85 @@ var NDStyles = {
|
|||
is_false: func(nd) nd.symbols.rangePln4.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'range',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) !nd.get_switch('toggle_centered'),
|
||||
is_true: func(nd) {
|
||||
nd.symbols.range.setText(sprintf("%3.0f",nd.rangeNm()/2));
|
||||
},
|
||||
is_false: func(nd) nd.symbols.rangePln4.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'rangeCtr1',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['APP','MAP','VOR'])),
|
||||
is_true: func(nd) {
|
||||
nd.symbols.rangeCtr1.show();
|
||||
nd.symbols.rangeCtr1.setText(sprintf("%3.1f",nd.rangeNm()/4));
|
||||
},
|
||||
is_false: func(nd) nd.symbols.rangeCtr1.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'rangeCtr2',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['APP','MAP','VOR'])),
|
||||
is_true: func(nd) {
|
||||
nd.symbols.rangeCtr2.show();
|
||||
nd.symbols.rangeCtr2.setText(sprintf("%3.1f",nd.rangeNm()/4));
|
||||
},
|
||||
is_false: func(nd) nd.symbols.rangeCtr2.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'altArc',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (!nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['MAP'])),
|
||||
is_true: func(nd) {
|
||||
var altDiff = (getprop("autopilot/settings/target-altitude-ft") or 0)-(getprop("instrumentation/altimeter/indicated-altitude-ft") or 0);
|
||||
if (abs(altDiff) > 50 and altDiff/nd.aircraft_source.get_vspd() > 0) {
|
||||
var altRangeNm = altDiff/nd.aircraft_source.get_vspd()*nd.aircraft_source.get_gnd_spd()*KT2MPS*M2NM;
|
||||
if(altRangeNm > 1) {
|
||||
var altRangePx = (350/nd.rangeNm())*altRangeNm;
|
||||
if (altRangePx > 700)
|
||||
altRangePx = 700;
|
||||
nd.symbols.altArc.setTranslation(0,-altRangePx);
|
||||
}
|
||||
nd.symbols.altArc.show();
|
||||
} else
|
||||
nd.symbols.altArc.hide();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.altArc.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'altArcCtr',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.get_switch('toggle_centered') and nd.in_mode('toggle_display_mode', ['MAP'])),
|
||||
is_true: func(nd) {
|
||||
var altDiff = (getprop("autopilot/settings/target-altitude-ft") or 0)-(getprop("instrumentation/altimeter/indicated-altitude-ft") or 0);
|
||||
if (abs(altDiff) > 50 and altDiff/nd.aircraft_source.get_vspd() > 0) {
|
||||
var altRangeNm = altDiff/nd.aircraft_source.get_vspd()*nd.aircraft_source.get_gnd_spd()*KT2MPS*M2NM;
|
||||
if(altRangeNm > 1) {
|
||||
var altRangePx = (175/nd.rangeNm())*altRangeNm;
|
||||
if (altRangePx > 350)
|
||||
altRangePx = 350;
|
||||
nd.symbols.altArcCtr.setTranslation(0,-altRangePx);
|
||||
}
|
||||
nd.symbols.altArcCtr.show();
|
||||
} else
|
||||
nd.symbols.altArcCtr.hide();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.altArcCtr.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'crsLbl',
|
||||
impl: {
|
||||
|
@ -478,13 +655,32 @@ var NDStyles = {
|
|||
id:'trkInd2',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['MAP','APP','VOR']) and nd.get_switch('toggle_centered')),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['APP','VOR']) and nd.get_switch('toggle_centered')),
|
||||
is_true: func(nd) {
|
||||
if (nd.get_switch('toggle_track_heading') and nd.get_switch('toggle_display_type') == "LCD")
|
||||
nd.symbols.trkInd2.setRotation(0);
|
||||
else
|
||||
nd.symbols.trkInd2.setRotation((nd.userTrk-nd.userHdg)*D2R);
|
||||
nd.symbols.trkInd2.show();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.trkInd2.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'trkIndMapCtr',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: func(nd) (nd.in_mode('toggle_display_mode', ['MAP']) and nd.get_switch('toggle_centered')),
|
||||
is_true: func(nd) {
|
||||
if (nd.get_switch('toggle_display_type') == "CRT" or (nd.get_switch('toggle_track_heading') and nd.get_switch('toggle_display_type') == "LCD"))
|
||||
nd.symbols.trkIndMapCtr.setRotation(0);
|
||||
else
|
||||
nd.symbols.trkIndMapCtr.setRotation((nd.userTrk-nd.userHdg)*D2R);
|
||||
nd.symbols.trkIndMapCtr.show();
|
||||
},
|
||||
is_false: func(nd) nd.symbols.trkIndMapCtr.hide(),
|
||||
},
|
||||
},
|
||||
{
|
||||
id:'vorCrsPtr',
|
||||
impl: {
|
||||
|
@ -572,7 +768,7 @@ var NDStyles = {
|
|||
id:'wind',
|
||||
impl: {
|
||||
init: func(nd,symbol),
|
||||
predicate: ALWAYS,
|
||||
predicate: func(nd) (nd.aircraft_source.get_spd() > 100 and getprop("environment/wind-speed-kt") > 6),
|
||||
is_true: func(nd) {
|
||||
var windDir = getprop("environment/wind-from-heading-deg");
|
||||
if(!nd.get_switch('toggle_true_north'))
|
||||
|
@ -580,15 +776,16 @@ var NDStyles = {
|
|||
if(windDir < 0.5) windDir = 360 + windDir;
|
||||
elsif(windDir >= 360.5) windDir = windDir - 360;
|
||||
nd.symbols.wind.setText(sprintf("%03.0f / %02.0f",windDir,getprop("environment/wind-speed-kt")));
|
||||
nd.symbols.wind.show();
|
||||
},
|
||||
is_false: NOTHING,
|
||||
is_false: func(nd) nd.symbols.wind.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),
|
||||
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 and getprop("environment/wind-speed-kt") > 6),
|
||||
is_true: func(nd) {
|
||||
nd.symbols.windArrow.show();
|
||||
var windArrowRot = getprop("environment/wind-from-heading-deg");
|
||||
|
|
11
Nasal/canvas/map/navdisplayLayers.txt
Normal file
11
Nasal/canvas/map/navdisplayLayers.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
From top to bottom:
|
||||
|
||||
4 TCAS
|
||||
3 Altitude profile (T/C, T/D etc.)
|
||||
2 Waypoint
|
||||
1 Route
|
||||
0 Map overlay (range, track)
|
||||
-1 Airports
|
||||
-2 Stations
|
||||
-3 Fixes
|
||||
-4 Weather radar
|
|
@ -28,7 +28,8 @@ var draw_route = func (group, theroute, controller=nil, lod=0)
|
|||
|
||||
var route = route_group.createChild("path","route")
|
||||
.setStrokeLineWidth(5)
|
||||
.setColor(1,0,1);
|
||||
.setColor(1,0,1)
|
||||
.set("z-index",1);
|
||||
|
||||
var cmds = [];
|
||||
var coords = [];
|
||||
|
|
|
@ -77,7 +77,7 @@ var draw_traffic = func(group, traffic, lod=0)
|
|||
}
|
||||
|
||||
tcas_grp.setGeoPosition(lat, lon)
|
||||
.set("z-index",1);
|
||||
.set("z-index",4);
|
||||
|
||||
|
||||
#settimer(func drawtraffic(group), 2); # updates are handled by the model, not by the view!
|
||||
|
|
Loading…
Reference in a new issue