1
0
Fork 0

- consider --units-meters option for altitude display (Note that the option

has to be given before a --wp or --flight-plan option to work.)
- let the "Remove" button remove the first entry by default, not the last.
  (Note that you can remove any entry if you selected it in the list first.
  Likewise you can insert a new waypoint at any position by selecting the
  respective entry.)
This commit is contained in:
mfranz 2006-05-11 14:56:55 +00:00
parent 5e400f35b9
commit bb8b06e294

View file

@ -24,6 +24,7 @@ command interface /autopilot/route-manager/input:
<nasal> <nasal>
<open> <open>
var ft = getprop("/sim/startup/units") == "feet";
var dlg = props.globals.getNode("/sim/gui/dialogs/route-manager", 1); var dlg = props.globals.getNode("/sim/gui/dialogs/route-manager", 1);
var selection = dlg.getNode("selection", 1); var selection = dlg.getNode("selection", 1);
var input = dlg.getNode("input", 1); var input = dlg.getNode("input", 1);
@ -51,7 +52,8 @@ command interface /autopilot/route-manager/input:
} }
remove = func { remove = func {
cmd.setValue("@delete" ~ sel_index()) var pos = sel_index();
cmd.setValue("@delete" ~ (pos > 0 ? pos : 0));
} }
route_changed = func { route_changed = func {
@ -61,11 +63,15 @@ command interface /autopilot/route-manager/input:
var id = wp[i].getNode("id").getValue(); var id = wp[i].getNode("id").getValue();
var lon = wp[i].getNode("longitude-deg").getValue(); var lon = wp[i].getNode("longitude-deg").getValue();
var lat = wp[i].getNode("latitude-deg").getValue(); var lat = wp[i].getNode("latitude-deg").getValue();
var alt = wp[i].getNode("altitude-ft").getValue(); var alt = wp[i].getNode("altitude-m").getValue();
var entry = sprintf("%d: %-5s %3.4f lon %3.4f lat", var entry = sprintf("%d: %-5s %3.4f lon %3.4f lat ",
i + 1, id, lon, lat); i + 1, id, lon, lat);
if (alt > -9990) { if (alt > -9990) {
entry ~= sprintf(" %.0f ft", alt); if (ft) {
entry ~= sprintf("%.0f ft", alt / 0.3048);
} else {
entry ~= sprintf("%.0f m", alt);
}
} }
list.getChild("value", i, 1).setValue(entry); list.getChild("value", i, 1).setValue(entry);
} }