Update route-manager dialog for new Nasal API.
This commit is contained in:
parent
22352ec485
commit
5013d7ae45
1 changed files with 93 additions and 46 deletions
|
@ -93,70 +93,59 @@ command interface /autopilot/route-manager/input:
|
||||||
var destRunways = dlg.getNode("destination-runways", 1);
|
var destRunways = dlg.getNode("destination-runways", 1);
|
||||||
var sids = dlg.getNode("sids", 1);
|
var sids = dlg.getNode("sids", 1);
|
||||||
var stars = dlg.getNode("stars", 1);
|
var stars = dlg.getNode("stars", 1);
|
||||||
|
var approaches = dlg.getNode("approaches", 1);
|
||||||
|
|
||||||
var updateRunways = func {
|
var updateRunways = func {
|
||||||
var depIcao = dep.getNode("airport").getValue();
|
|
||||||
departureRunways.removeChildren("value");
|
departureRunways.removeChildren("value");
|
||||||
|
destRunways.removeChildren("value");
|
||||||
var currentRunway = dep.getNode("runway").getValue();
|
|
||||||
var foundCurrent = 0;
|
var apt = flightplan().departure;
|
||||||
|
|
||||||
var apt = airportinfo(depIcao);
|
|
||||||
if (apt != nil) {
|
if (apt != nil) {
|
||||||
var i=0;
|
var i=0;
|
||||||
foreach (var rwy; keys(apt.runways)) {
|
foreach (var rwy; keys(apt.runways)) {
|
||||||
departureRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
departureRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
||||||
i += 1;
|
i += 1;
|
||||||
if (rwy == currentRunway) {
|
|
||||||
foundCurrent = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundCurrent) {
|
apt = flightplan().destination;
|
||||||
dep.getNode("runway").clearValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
var destIcao = dest.getNode("airport").getValue();
|
|
||||||
destRunways.removeChildren("value");
|
|
||||||
currentRunway = dest.getNode("runway").getValue();
|
|
||||||
foundCurrent = 0;
|
|
||||||
|
|
||||||
var apt = airportinfo(destIcao);
|
|
||||||
if (apt != nil) {
|
if (apt != nil) {
|
||||||
var i=0;
|
var i=0;
|
||||||
foreach (var rwy; keys(apt.runways)) {
|
foreach (var rwy; keys(apt.runways)) {
|
||||||
destRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
destRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
||||||
i += 1;
|
i += 1;
|
||||||
if (rwy == currentRunway) {
|
|
||||||
foundCurrent = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundCurrent) {
|
|
||||||
dest.getNode("runway").clearValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
gui.dialog_update("route-manager");
|
gui.dialog_update("route-manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateSIDs = func {
|
var updateSIDs = func {
|
||||||
sids.removeChildren("value");
|
sids.removeChildren("value");
|
||||||
var depIcao = dep.getNode("airport").getValue();
|
|
||||||
var rwy = dep.getNode("runway").getValue();
|
var apt = flightplan().departure;
|
||||||
var apt = airportinfo(depIcao);
|
var rwy = flightplan().departure_runway;
|
||||||
if (apt == nil or apt.sids(rwy) == nil) {
|
if (apt == nil or apt.sids(rwy) == nil) {
|
||||||
dep.getNode("sid").clearValue();
|
|
||||||
gui.dialog_update("route-manager", "sid");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sids.getNode("value[0]", 1).setValue("(none)");
|
sids.getNode("value[0]", 1).setValue("(none)");
|
||||||
var i=1;
|
var i=1;
|
||||||
foreach (var s; apt.sids(rwy)) {
|
foreach (var s; apt.sids(rwy)) {
|
||||||
sids.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
var sid = apt.getSid(s);
|
||||||
i += 1;
|
var transVec = sid.transitions;
|
||||||
|
|
||||||
|
if (size(transVec) > 0) {
|
||||||
|
# list each transition of the SID
|
||||||
|
foreach (var trans; transVec) {
|
||||||
|
sids.getNode("value[" ~ i ~ "]", 1).setValue(s ~ "-" ~ trans);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# no transitions defined, simple case
|
||||||
|
sids.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.dialog_update("route-manager", "sid");
|
gui.dialog_update("route-manager", "sid");
|
||||||
|
@ -164,24 +153,56 @@ command interface /autopilot/route-manager/input:
|
||||||
|
|
||||||
var updateSTARs = func {
|
var updateSTARs = func {
|
||||||
stars.removeChildren("value");
|
stars.removeChildren("value");
|
||||||
var icao = dest.getNode("airport").getValue();
|
var apt = flightplan().destination;
|
||||||
var rwy = dest.getNode("runway").getValue();
|
var rwy = flightplan().destination_runway;
|
||||||
var apt = airportinfo(icao);
|
|
||||||
if (apt == nil or apt.stars(rwy) == nil) {
|
if (apt == nil or apt.stars(rwy) == nil) {
|
||||||
dest.getNode("star").clearValue();
|
|
||||||
gui.dialog_update("route-manager", "star");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var i=1;
|
var i=1;
|
||||||
stars.getNode("value[0]", 1).setValue("(none)");
|
stars.getNode("value[0]", 1).setValue("(none)");
|
||||||
foreach (var s; apt.stars(rwy)) {
|
foreach (var s; apt.stars(rwy)) {
|
||||||
stars.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
var star = apt.getStar(s);
|
||||||
i += 1;
|
var transVec = star.transitions;
|
||||||
|
|
||||||
|
if (size(transVec) > 0) {
|
||||||
|
# list each transition of the STAR
|
||||||
|
foreach (var trans; transVec) {
|
||||||
|
stars.getNode("value[" ~ i ~ "]", 1).setValue(s ~ "-" ~ trans);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# no transitions defined, simple case
|
||||||
|
stars.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.dialog_update("route-manager", "star");
|
gui.dialog_update("route-manager", "star");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updateApproaches = func {
|
||||||
|
approaches.removeChildren("value");
|
||||||
|
var apt = flightplan().destination;
|
||||||
|
var rwy = flightplan().destination_runway;
|
||||||
|
|
||||||
|
debug.dump("updateAproaches for " ~ rwy.id);
|
||||||
|
debug.dump(apt.getApproachList(rwy));
|
||||||
|
|
||||||
|
if (apt == nil or apt.getApproachList(rwy) == nil) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var i=1;
|
||||||
|
approaches.getNode("value[0]", 1).setValue("(none)");
|
||||||
|
foreach (var s; apt.getApproachList(rwy)) {
|
||||||
|
approaches.getNode("value[" ~ i ~ "]", 1).setValue(s);
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.dialog_update("route-manager", "approach");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# initialise departure values based on current position
|
# initialise departure values based on current position
|
||||||
cmd.setValue("@posinit");
|
cmd.setValue("@posinit");
|
||||||
|
@ -189,6 +210,7 @@ command interface /autopilot/route-manager/input:
|
||||||
updateRunways();
|
updateRunways();
|
||||||
updateSIDs();
|
updateSIDs();
|
||||||
updateSTARs();
|
updateSTARs();
|
||||||
|
updateApproaches();
|
||||||
</open>
|
</open>
|
||||||
|
|
||||||
<close>
|
<close>
|
||||||
|
@ -287,13 +309,13 @@ command interface /autopilot/route-manager/input:
|
||||||
|
|
||||||
<text>
|
<text>
|
||||||
<row>0</row>
|
<row>0</row>
|
||||||
<col>5</col>
|
<col>7</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>SID:</label>
|
<label>SID:</label>
|
||||||
</text>
|
</text>
|
||||||
<combo>
|
<combo>
|
||||||
<row>0</row>
|
<row>0</row>
|
||||||
<col>6</col>
|
<col>8</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
<name>sid</name>
|
<name>sid</name>
|
||||||
<property>/autopilot/route-manager/departure/sid</property>
|
<property>/autopilot/route-manager/departure/sid</property>
|
||||||
|
@ -362,7 +384,10 @@ command interface /autopilot/route-manager/input:
|
||||||
|
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>updateSTARs();</script>
|
<script>
|
||||||
|
updateSTARs();
|
||||||
|
updateApproaches();
|
||||||
|
</script>
|
||||||
</binding>
|
</binding>
|
||||||
</combo>
|
</combo>
|
||||||
|
|
||||||
|
@ -370,12 +395,34 @@ command interface /autopilot/route-manager/input:
|
||||||
<row>1</row>
|
<row>1</row>
|
||||||
<col>5</col>
|
<col>5</col>
|
||||||
<halign>right</halign>
|
<halign>right</halign>
|
||||||
<label>STAR:</label>
|
<label>Approach:</label>
|
||||||
</text>
|
</text>
|
||||||
<combo>
|
<combo>
|
||||||
<row>1</row>
|
<row>1</row>
|
||||||
<col>6</col>
|
<col>6</col>
|
||||||
<halign>left</halign>
|
<halign>left</halign>
|
||||||
|
<name>approach</name>
|
||||||
|
<property>/autopilot/route-manager/destination/approach</property>
|
||||||
|
<editable>false</editable>
|
||||||
|
<properties>/sim/gui/dialogs/route-manager/approaches</properties>
|
||||||
|
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>approach</object-name>
|
||||||
|
</binding>
|
||||||
|
</combo>
|
||||||
|
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<row>1</row>
|
||||||
|
<col>7</col>
|
||||||
|
<halign>right</halign>
|
||||||
|
<label>STAR:</label>
|
||||||
|
</text>
|
||||||
|
<combo>
|
||||||
|
<row>1</row>
|
||||||
|
<col>8</col>
|
||||||
|
<halign>left</halign>
|
||||||
<name>star</name>
|
<name>star</name>
|
||||||
<property>/autopilot/route-manager/destination/star</property>
|
<property>/autopilot/route-manager/destination/star</property>
|
||||||
<editable>false</editable>
|
<editable>false</editable>
|
||||||
|
|
Loading…
Add table
Reference in a new issue