diff --git a/gui/dialogs/route-manager.xml b/gui/dialogs/route-manager.xml index 6f7960605..8c1db4ff2 100644 --- a/gui/dialogs/route-manager.xml +++ b/gui/dialogs/route-manager.xml @@ -93,70 +93,59 @@ command interface /autopilot/route-manager/input: var destRunways = dlg.getNode("destination-runways", 1); var sids = dlg.getNode("sids", 1); var stars = dlg.getNode("stars", 1); - + var approaches = dlg.getNode("approaches", 1); + var updateRunways = func { - var depIcao = dep.getNode("airport").getValue(); departureRunways.removeChildren("value"); - - var currentRunway = dep.getNode("runway").getValue(); - var foundCurrent = 0; - - var apt = airportinfo(depIcao); + destRunways.removeChildren("value"); + + var apt = flightplan().departure; if (apt != nil) { var i=0; foreach (var rwy; keys(apt.runways)) { departureRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy); i += 1; - if (rwy == currentRunway) { - foundCurrent = 1; - } } } - if (!foundCurrent) { - dep.getNode("runway").clearValue(); - } - - var destIcao = dest.getNode("airport").getValue(); - destRunways.removeChildren("value"); - currentRunway = dest.getNode("runway").getValue(); - foundCurrent = 0; - - var apt = airportinfo(destIcao); + apt = flightplan().destination; if (apt != nil) { var i=0; foreach (var rwy; keys(apt.runways)) { destRunways.getNode("value[" ~ i ~ "]", 1).setValue(rwy); i += 1; - if (rwy == currentRunway) { - foundCurrent = 1; - } } } - if (!foundCurrent) { - dest.getNode("runway").clearValue(); - } - gui.dialog_update("route-manager"); } var updateSIDs = func { sids.removeChildren("value"); - var depIcao = dep.getNode("airport").getValue(); - var rwy = dep.getNode("runway").getValue(); - var apt = airportinfo(depIcao); + + var apt = flightplan().departure; + var rwy = flightplan().departure_runway; if (apt == nil or apt.sids(rwy) == nil) { - dep.getNode("sid").clearValue(); - gui.dialog_update("route-manager", "sid"); return; } sids.getNode("value[0]", 1).setValue("(none)"); var i=1; foreach (var s; apt.sids(rwy)) { - sids.getNode("value[" ~ i ~ "]", 1).setValue(s); - i += 1; + var sid = apt.getSid(s); + 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"); @@ -164,24 +153,56 @@ command interface /autopilot/route-manager/input: var updateSTARs = func { stars.removeChildren("value"); - var icao = dest.getNode("airport").getValue(); - var rwy = dest.getNode("runway").getValue(); - var apt = airportinfo(icao); + var apt = flightplan().destination; + var rwy = flightplan().destination_runway; if (apt == nil or apt.stars(rwy) == nil) { - dest.getNode("star").clearValue(); - gui.dialog_update("route-manager", "star"); return; } - + var i=1; stars.getNode("value[0]", 1).setValue("(none)"); foreach (var s; apt.stars(rwy)) { - stars.getNode("value[" ~ i ~ "]", 1).setValue(s); - i += 1; + var star = apt.getStar(s); + 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"); } + + 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 cmd.setValue("@posinit"); @@ -189,6 +210,7 @@ command interface /autopilot/route-manager/input: updateRunways(); updateSIDs(); updateSTARs(); + updateApproaches(); @@ -287,13 +309,13 @@ command interface /autopilot/route-manager/input: 0 - 5 + 7 right 0 - 6 + 8 left sid /autopilot/route-manager/departure/sid @@ -362,7 +384,10 @@ command interface /autopilot/route-manager/input: nasal - + @@ -370,12 +395,34 @@ command interface /autopilot/route-manager/input: 1 5 right - + 1 6 left + approach + /autopilot/route-manager/destination/approach + false + /sim/gui/dialogs/route-manager/approaches + + + dialog-apply + approach + + + + + + 1 + 7 + right + + + + 1 + 8 + left star /autopilot/route-manager/destination/star false