1
0
Fork 0
fgdata/gui/dialogs/airports.xml

1484 lines
48 KiB
XML
Raw Normal View History

<?xml version="1.0"?>
<PropertyList>
<name>airports</name>
<layout>vbox</layout>
<resizable>true</resizable>
<default-padding>3</default-padding>
<group>
<layout>hbox</layout>
<default-padding>1</default-padding>
<empty><stretch>1</stretch></empty>
<text>
<label>Select an Airport</label>
</text>
<empty><stretch>1</stretch></empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
<binding>
<command>property-toggle</command>
<property>/sim/gui/dialogs/airports/signals/dialog-close</property>
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
</binding>
</button>
</group>
<hrule/>
<nasal>
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
<!-- Generalize all this, turn into helpers and load defaults via XML -->
<open><![CDATA[
var MAX_RUNWAYS = 28; # number of entries at KEDW
var DIALOG = cmdarg();
## "prologue" currently required by the canvas-generic-map
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
var dialog_name ="airports"; #TODO: use substr() and cmdarg() to get this dynamically
var dialog_property = func(p) return "/sim/gui/dialogs/airports/"~p; #TODO: generalize using cmdarg
var DIALOG_CANVAS = gui.findElementByName(DIALOG, "airport-selection");
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
canvas.GenericMap.setupGUI(DIALOG_CANVAS, "canvas-control"); #TODO: this is not a method!
## end of canvas-generic-map prologue
setprop("/sim/gui/dialogs/airports/selected-airport/rwy", "");
setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", "");
setprop("/sim/gui/dialogs/airports/mode", "search");
setprop("/sim/gui/dialogs/airports/display-mode", "0");
setprop("/sim/gui/dialogs/airports/list", "");
if (getprop("/sim/gui/dialogs/airports/display-taxiways") == "") {
setprop("/sim/gui/dialogs/airports/display-taxiways", "1");
}
if (getprop("/sim/gui/dialogs/airports/display-parking") == "") {
setprop("/sim/gui/dialogs/airports/display-parking", "0");
}
if (getprop("/sim/gui/dialogs/airports/display-tower") == "") {
setprop("/sim/gui/dialogs/airports/display-tower", "1");
}
# Start with the closest airport
var airport_id = airportinfo().id;
# Retrieve METAR
fgcommand("request-metar", var n = props.Node.new({ "path": "/sim/gui/dialogs/airports/selected-airport/metar",
"station": airport_id}));
var dlg = props.globals.getNode("/sim/gui/dialogs/airports", 1);
var avail_runways = dlg.getNode("available-runways", 1);
var avail_parking = {};
if (dlg.getNode("list") == nil)
dlg.getNode("list", 1).setValue("");
var airportlist = dlg.getNode("list");
var mode = {
runway: dlg.getNode("use_runway", 1),
bestrunway: dlg.getNode("use_best_runway", 1),
parkpos: dlg.getNode("use_parkpos", 1)
};
var set_radio = func(m) {
foreach (k; keys(mode)) {
mode[k].setBoolValue(m == k);
}
}
var initialized = 0;
foreach (k; keys(mode)) {
if (mode[k].getType() == "NONE" or initialized) {
mode[k].setBoolValue(0);
} else {
initialized += mode[k].getBoolValue();
}
}
if (!initialized) {
set_radio("bestrunway");
}
var update_info = func {
var info = airportinfo(airport_id);
setprop("/sim/gui/dialogs/airports/selected-airport/id", airport_id);
setprop("/sim/gui/dialogs/airports/selected-airport/name", info.name);
setprop("/sim/gui/dialogs/airports/selected-airport/location", sprintf("%.3f / %.3f", info.lat, info.lon));
setprop("/sim/gui/dialogs/airports/selected-airport/lon", info.lon);
setprop("/sim/gui/dialogs/airports/selected-airport/elevation-ft", 3.28 * info.elevation);
setprop("/sim/gui/dialogs/airports/selected-airport/rwy", "");
setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", "");
if (info.has_metar) {
# Retrieve an updated METAR, and indicate that we've not got one currently.
setprop("/sim/gui/dialogs/airports/selected-airport/metar/station-id", airport_id);
setprop("/sim/gui/dialogs/airports/selected-airport/metar/time-to-live", 0);
setprop("/sim/gui/dialogs/airports/selected-airport/metar/data", "Retrieving METAR, please wait.");
} else {
# This airport has no METAR. Rather than cancelling the retrieve-metar command, simply set the TTL
# to a very long time so it won't over-ride our message.
setprop("/sim/gui/dialogs/airports/selected-airport/metar/data", "No METAR available from this airport");
setprop("/sim/gui/dialogs/airports/selected-airport/metar/time-to-live", 9999);
}
# Display the comms frequencies for this airport
var fcount = 0;
if (size(info.comms()) > 0) {
# Airport has one or more frequencies assigned to it.
var freqs = {};
var comms = info.comms();
foreach (var c; comms) {
var f = sprintf("%.3f", c.frequency);
if (freqs[c.ident] == nil) {
freqs[c.ident] = f;
} else {
freqs[c.ident] = freqs[c.ident] ~ " " ~ f;
}
}
foreach (var c; sort(keys(freqs), string.icmp)) {
setprop("sim/gui/dialogs/airports/selected-airport/comms/freq[" ~ fcount ~ "]/label", c);
setprop("sim/gui/dialogs/airports/selected-airport/comms/freq[" ~ fcount ~ "]/value", freqs[c]);
fcount += 1;
}
}
while (fcount < 13) {
# zero remaining comms channels
setprop("sim/gui/dialogs/airports/selected-airport/comms/freq[" ~ fcount ~ "]/label", "");
setprop("sim/gui/dialogs/airports/selected-airport/comms/freq[" ~ fcount ~ "]/value", "");
fcount += 1;
}
var longest_runway = 0;
var runways = info.runways;
avail_runways.removeChildren("value");
var runway_keys = sort(keys(runways), string.icmp);
var i = 0;
foreach(var rwy; runway_keys) {
var r = runways[rwy];
longest_runway = math.max(longest_runway, r.length * 3.28);
avail_runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/label", rwy);
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/length-hdg",
sprintf("%d'/%03d deg", r.length * 3.28, r.heading));
if (r.ils != nil) {
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", sprintf("%.3fMhz", r.ils.frequency / 100));
} else {
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", "");
}
i += 1;
if (i == MAX_RUNWAYS)
break;
}
while (i < MAX_RUNWAYS) {
# zero remaining runway data
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/label", "");
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/length-hdg", "");
setprop("sim/gui/dialogs/airports/selected-airport/runway[" ~ i ~ "]/ils", "");
i += 1;
}
# Update the list of available parking positions
avail_parking = {};
foreach (var park; info.parking()) {
avail_parking[park.name] = 1;
}
setprop("/sim/gui/dialogs/airports/selected-airport/longest-runway", longest_runway);
var airport_pos = geo.Coord.new();
airport_pos.set_latlon(info.lat, info.lon);
var pos = geo.aircraft_position();
var dst = pos.distance_to(airport_pos) / 1852.0;
var crs = pos.course_to(airport_pos);
setprop("/sim/gui/dialogs/airports/selected-airport/distance-nm", dst);
setprop("/sim/gui/dialogs/airports/selected-airport/course-deg", crs);
gui.dialog_update("airports", "runway-list");
}
2008-07-30 21:56:18 +00:00
var listbox = func {
airport_id = pop(split(" ", airportlist.getValue()));
airport_id = substr(airport_id, 1, size(airport_id) - 2); # strip parentheses
update_info();
}
2008-07-30 21:56:18 +00:00
var apply = func {
setprop("/sim/presets/airport-id", airport_id);
setprop("/sim/presets/longitude-deg", -9999);
setprop("/sim/presets/latitude-deg", -9999);
setprop("/sim/presets/altitude-ft", -9999);
setprop("/sim/presets/airspeed-kt", 0);
setprop("/sim/presets/offset-distance-nm", 0);
setprop("/sim/presets/offset-azimuth-deg", 0);
setprop("/sim/presets/glideslope-deg", 0);
setprop("/sim/presets/heading-deg", 0);
if (mode["bestrunway"].getBoolValue()) {
setprop("/sim/presets/runway", "");
setprop("/sim/presets/parkpos", "");
} else if (mode["runway"].getBoolValue()) {
setprop("/sim/presets/runway", getprop("/sim/gui/dialogs/airports/selected-airport/rwy"));
setprop("/sim/presets/parkpos", "");
} else {
setprop("/sim/presets/runway", "");
setprop("/sim/presets/parkpos", getprop("/sim/gui/dialogs/airports/selected-airport/parkpos"));
}
}
canvas.register_callback(update_info); # FIXME: this is a workaround to run dialog-specific code in the canvas block
]]>
</open>
<close>
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
fgcommand("clear-metar", var n = props.Node.new({ "path": "/sim/gui/dialogs/airports/selected-airport/metar",
"station": airport_id}));
map.cleanup_listeners(); #TODO: We should be setting a signal when closing the dialog, so that cleanup code can be invoked automatically
</close>
</nasal>
<group>
<layout>hbox</layout>
<default-padding>4</default-padding>
<halign>fill</halign>
<group>
<layout>vbox</layout>
<valign>top</valign>
<group>
<layout>hbox</layout>
<default-padding>4</default-padding>
<text>
<label>Airport:</label>
</text>
<input>
<name>input</name>
<pref-width>120</pref-width>
<halign>fill</halign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/airports/list</property>
<binding>
<command>dialog-apply</command>
<object-name>input</object-name>
</binding>
<binding>
<command>dialog-update</command>
<object-name>airport-list</object-name>
</binding>
</input>
<!--
<button>
<legend>Clear</legend>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/mode</property>
<value>search</value>
</binding>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/list</property>
<value></value>
</binding>
<binding>
<command>dialog-update</command>
<object-name>input</object-name>
</binding>
<binding>
<command>dialog-update</command>
<object-name>airport-list</object-name>
</binding>
</button>
-->
<button>
<legend>Search</legend>
<default>true</default>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/mode</property>
<value>search</value>
</binding>
<binding>
<command>dialog-apply</command>
<object-name>input</object-name>
</binding>
<binding>
<command>dialog-update</command>
<object-name>airport-list</object-name>
</binding>
</button>
<button>
<legend>&lt;100nm</legend>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/mode</property>
<value>100nm</value>
</binding>
<binding>
<command>nasal</command>
<script>
var airports = findAirportsWithinRange(100);
var list = dlg.getNode("close-airports", 1);
list.removeChildren("value");
forindex (var idx; airports) {
list.getNode("value["~ idx ~ "]", 1).setValue(airports[idx].name ~ " (" ~ airports[idx].id ~ ")");
}
</script>
</binding>
<binding>
<command>dialog-update</command>
<object-name>close-airport-list</object-name>
</binding>
</button>
</group>
<group>
<layout>table</layout>
<default-padding>0</default-padding>
<list>
<row>0</row><col>0</col>
<visible>
<equals>
<property>/sim/gui/dialogs/airports/mode</property>
<value>100nm</value>
</equals>
</visible>
<name>close-airport-list</name>
<pref-width>260</pref-width>
<pref-height>260</pref-height>
<halign>fill</halign>
<valign>fill</valign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/airports/list</property>
<properties>/sim/gui/dialogs/airports/close-airports</properties>
<binding>
<command>dialog-apply</command>
<object-name>close-airport-list</object-name>
</binding>
<binding>
<command>nasal</command>
<script>listbox()</script>
</binding>
</list>
<airport-list>
<row>0</row><col>0</col>
<visible>
<equals>
<property>/sim/gui/dialogs/airports/mode</property>
<value>search</value>
</equals>
</visible>
<name>airport-list</name>
<pref-width>260</pref-width>
<pref-height>220</pref-height>
<halign>fill</halign>
<valign>fill</valign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/airports/list</property>
<binding>
<command>dialog-apply</command>
<object-name>airport-list</object-name>
</binding>
<binding>
<command>nasal</command>
<script>listbox()</script>
</binding>
</airport-list>
</group>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<text>
<label>METAR</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<textbox>
<name>metar</name>
<halign>fill</halign>
<stretch>true</stretch>
<pref-width>260</pref-width>
<pref-height>60</pref-height>
<slider>1</slider>
<editable>false</editable>
<wrap>true</wrap>
<live>true</live>
<property>/sim/gui/dialogs/airports/selected-airport/metar/data</property>
</textbox>
<group>
<layout>vbox</layout>
<valign>top</valign>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<row>0</row>
<col>0</col>
<colspan>2</colspan>
<text>
<label>Aircraft Position</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<group>
<layout>table</layout>
<halign>center</halign>
<radio>
<row>2</row><col>0</col>
<property>/sim/gui/dialogs/airports/use_best_runway</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("bestrunway")</script>
</binding>
</radio>
<text>
<row>2</row><col>1</col>
<halign>right</halign>
<label>Best runway</label>
<enable>
<property>/sim/gui/dialogs/airports/use_best_runway</property>
</enable>
</text>
<text>
<row>2</row><col>2</col>
<halign>right</halign>
<label>(based on wind)</label>
<enable>
<property>/sim/gui/dialogs/airports/use_best_runway</property>
</enable>
</text>
<radio>
<row>3</row><col>0</col>
<property>/sim/gui/dialogs/airports/use_runway</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("runway")</script>
</binding>
</radio>
<text>
<row>3</row><col>1</col>
<halign>right</halign>
<label>Runway:</label>
<enable>
<property>/sim/gui/dialogs/airports/use_runway</property>
</enable>
</text>
<combo>
<name>runway-list</name>
<row>3</row><col>2</col>
<pref-width>85</pref-width>
<halign>left</halign>
<enable>
<property>/sim/gui/dialogs/airports/use_runway</property>
</enable>
<property>/sim/gui/dialogs/airports/selected-airport/rwy</property>
<editable>false</editable>
<properties>sim/gui/dialogs/airports/available-runways</properties>
<binding>
<command>dialog-apply</command>
<object-name>runway-list</object-name>
</binding>
</combo>
<radio>
<row>4</row><col>0</col>
<property>/sim/gui/dialogs/airports/use_parkpos</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>set_radio("parkpos")</script>
</binding>
</radio>
<text>
<row>4</row><col>1</col>
<halign>right</halign>
<label>Parking:</label>
<enable>
<property>/sim/gui/dialogs/airports/use_parkpos</property>
</enable>
</text>
<input>
<row>4</row><col>2</col>
<name>parking-list</name>
<pref-width>120</pref-width>
<halign>fill</halign>
<stretch>true</stretch>
<property>/sim/gui/dialogs/airports/selected-airport/parkpos</property>
<binding>
<command>dialog-apply</command>
<object-name>parking-list</object-name>
</binding>
<binding>
<command>nasal</command>
<script>
var pos = getprop("/sim/gui/dialogs/airports/selected-airport/parkpos");
setprop(
"/sim/gui/dialogs/airports/selected-airport/parkpos-invalid",
contains(avail_parking, pos) == 0);
</script>
</binding>
<binding>
<command>dialog-update</command>
<object-name>parking-list-valid</object-name>
</binding>
</input>
<text>
<row>5</row><col>1</col>
<colspan>2</colspan>
<name>parking-list-valid</name>
<halign>left</halign>
<label>Parking position not found</label>
<visible>
<property>/sim/gui/dialogs/airports/selected-airport/parkpos-invalid</property>
</visible>
</text>
</group>
</group>
</group>
<vrule/>
<group>
<layout>vbox</layout>
<halign>fill</halign>
<valign>top</valign>
<default-padding>0</default-padding>
<group>
<layout>hbox</layout>
<halign>left</halign>
<default-padding>2</default-padding>
<button>
<legend>Airfield Information</legend>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/display-mode</property>
<value>0</value>
</binding>
</button>
<button>
<legend>Airfield Chart</legend>
<binding>
<command>property-assign</command>
<property>/sim/gui/dialogs/airports/display-mode</property>
<value>1</value>
</binding>
</button>
</group>
<group>
<layout>table</layout>
<halign>fill</halign>
<valign>fill</valign>
<default-padding>0</default-padding>
<group>
<layout>vbox</layout>
<valign>top</valign>
<row>0</row>
<col>0</col>
<visible>
<equals>
<property>/sim/gui/dialogs/airports/display-mode</property>
<value>1</value>
</equals>
</visible>
<group>
<layout>vbox</layout>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<row>0</row>
<text>
<label>Airfield Chart</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<!-- Instantiate a generic canvas map and parametrize it via inclusion -->
<!-- TODO: use params and aliasing -->
<canvas include="/Nasal/canvas/generic-canvas-map.xml">
<name>airport-selection</name>
<valign>fill</valign>
<halign>fill</halign>
<stretch>true</stretch>
<pref-width>400</pref-width>
<pref-height>400</pref-height>
<features>
<!-- TODO: use params and aliases to make this shorter -->
<!-- TODO: support styling, i.e. image sets/fonts and colors to be used -->
<!-- this will set up individual "layers" and map them to boolean "toggle" properties -->
<!-- providing an optional "description" tag here allows us to create all checkboxes procedurally -->
<dialog-root>/sim/gui/dialogs/airports</dialog-root>
<range-property>zoom</range-property>
<!-- These are the ranges available for the map: var ranges = [0.1, 0.25, 0.5, 1, 2.5, 5] -->
<ranges>
<range>0.1</range>
<range>0.25</range>
<range>0.5</range>
<range>1</range>
<range>2.5</range>
<range>5</range>
</ranges>
<!-- available layers and their toggle property (appended to dialog-root specified above) -->
<layer>
<name>runways</name> <!-- the name of the layer -->
<init-property>selected-airport/id</init-property> <!-- the init/input property that re-inits the layer MODEL -->
<property>display-runways</property> <!-- the property switch that toggles the layer on/off (show/hide) -->
<description>Show Runways</description> <!-- the checkbox label for the property -->
<default>enabled</default> <!-- default state -->
<hide-checkbox>true</hide-checkbox> <!-- if the checkbox should be shown or hidden -->
</layer>
<layer>
<name>taxiways</name>
<init-property>selected-airport/id</init-property>
<property>display-taxiways</property>
<description>Show Taxiways</description>
<default>enabled</default>
</layer>
<layer>
<name>parkings</name>
<init-property>selected-airport/id</init-property>
<property>display-parking</property>
<description>Show Parking</description>
<default>disabled</default>
</layer>
<layer>
<name>towers</name>
<init-property>selected-airport/id</init-property>
<property>display-tower</property>
<description>Show Tower</description>
<default>enabled</default>
</layer>
<!-- Uncomment this to add a navaid layer (not yet fully implemented, and no LOD yet)
<layer>
<name>navaids</name>
<init-property>selected-airport/id</init-property>
<property>display-navaids</property>
<description>Display Navaids within current range</description>
<default>disabled</default>
</layer>
-->
</features>
</canvas>
<group>
<name>canvas-control</name> <!-- this is the handle we use to procedurally add all "toggle layer" checkboxes and the zoom control-->
<layout>hbox</layout>
</group>
</group>
</group>
<!-- airport info -->
<group>
<layout>table</layout>
<valign>top</valign>
<row>0</row>
<col>0</col>
<visible>
<equals>
<property>/sim/gui/dialogs/airports/display-mode</property>
<value>0</value>
</equals>
</visible>
<!-- airport info table -->
<group>
<row>0</row>
<col>0</col>
<layout>table</layout>
<valign>top</valign>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<row>0</row>
<col>0</col>
<colspan>2</colspan>
<text>
<label>Airfield Information</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<text>
<row>1</row>
<col>0</col>
<halign>right</halign>
<label>Name:</label>
</text>
<text>
<row>1</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>Athens Intl Airport Elefterios Venizel</label>
<!-- The above airport is the longest name in Airports/apt.dat.gz as of 3 November 2012 -->
<property>/sim/gui/dialogs/airports/selected-airport/name</property>
</text>
<text>
<row>2</row>
<col>0</col>
<halign>right</halign>
<label>ICAO:</label>
</text>
<text>
<row>2</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>AAAA</label>
<property>/sim/gui/dialogs/airports/selected-airport/id</property>
</text>
<text>
<row>3</row>
<col>0</col>
<halign>right</halign>
<label>Lat / Lon:</label>
</text>
<text>
<row>3</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>XXXXXXXXXXXX</label>
<property>/sim/gui/dialogs/airports/selected-airport/location</property>
</text>
<text>
<row>4</row>
<col>0</col>
<halign>right</halign>
<label>Elevation:</label>
</text>
<text>
<row>4</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<format>%.0f ft</format>
<property>/sim/gui/dialogs/airports/selected-airport/elevation-ft</property>
</text>
<text>
<row>5</row>
<col>0</col>
<halign>right</halign>
<label>Longest runway:</label>
</text>
<text>
<row>5</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<format>%.0f ft</format>
<property>/sim/gui/dialogs/airports/selected-airport/longest-runway</property>
</text>
<text>
<row>6</row>
<col>0</col>
<halign>right</halign>
<label>Distance:</label>
</text>
<text>
<row>6</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<format>%.1f nm</format>
<property>/sim/gui/dialogs/airports/selected-airport/distance-nm</property>
</text>
<text>
<row>7</row>
<col>0</col>
<halign>right</halign>
<label>Course:</label>
</text>
<text>
<row>7</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<format>%.0f deg</format>
<property>/sim/gui/dialogs/airports/selected-airport/course-deg</property>
</text>
</group>
<!-- comms frequencies table -->
<group>
<row>0</row>
<col>1</col>
<layout>table</layout>
<halign>fill</halign>
<default-padding>2</default-padding>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<row>0</row>
<col>0</col>
<colspan>2</colspan>
<text>
<label>Communications Frequencies</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<text>
<row>1</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[0]/label</property>
</text>
<text>
<row>1</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[0]/value</property>
</text>
<text>
<row>2</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[1]/label</property>
</text>
<text>
<row>2</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[1]/value</property>
</text>
<text>
<row>3</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[2]/label</property>
</text>
<text>
<row>3</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[2]/value</property>
</text>
<text>
<row>4</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[3]/label</property>
</text>
<text>
<row>4</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[3]/value</property>
</text>
<text>
<row>5</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[4]/label</property>
</text>
<text>
<row>5</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[4]/value</property>
</text>
<text>
<row>6</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[5]/label</property>
</text>
<text>
<row>6</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[5]/value</property>
</text>
<text>
<row>7</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[6]/label</property>
</text>
<text>
<row>7</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[6]/value</property>
</text>
<text>
<row>8</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[7]/label</property>
</text>
<text>
<row>8</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[7]/value</property>
</text>
<text>
<row>9</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[8]/label</property>
</text>
<text>
<row>9</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[8]/value</property>
</text>
<text>
<row>10</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[9]/label</property>
</text>
<text>
<row>10</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[9]/value</property>
</text>
<text>
<row>11</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[10]/label</property>
</text>
<text>
<row>11</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[10]/value</property>
</text>
<text>
<row>12</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[11]/label</property>
</text>
Canvas Scripting Layer (Mapping): - first stab at refactoring the map.nas module, and trying to let the API evolve according to our requirements - split up the module into separate files (some of them will disappear soon) - split up the "drawing" loops into separate functions so that they can be individually called - move actual "drawing" to map_layers.nas - introduce some OOP helpers to prepare a pure Layer-based design - prepare helpers: LayeredMap, GenericMap, AirportMap (TODO: use a real "Layer" class) - move airport features (taxiways, runways, parking, tower) to separate layers (i.e. canvas groups) - avoid using a single update callback and use different layer-specific callbacks to update individual layers more efficiently - add some boilerplate hashes to prepare the MVC design - allow lazy updating of layers, where canvas groups are only populated on demand, to save some time during instantiation, i.e. loading an airport without "parking" selected, will only populate the layer once the checkbox is checked - extend the original code such that it supports showing multiple airports at once - add some proof of concept "navaid" layer using SVG files for navaid symbols (added only NDB symbol from wikimedia commons) regressions: - runway highlighting needs to be re-implemented - parking highlighting will be done differently - enforcing a specific drawing order for layers is currently not explicitly supported, so that taxiways may be rendered on top of runways Also: - integrated with the latest changes in git/master (HEAD) -i.e. metar support - further generalized map.nas - partially moved instantiation from Nasal space to XML space (WIP) - create "toggle layer" checkboxes procedurally in Nasal space - prepared the code to be better reusable in other dialogs (e.g. route manager, map dialog etc) - completely removed the "highlighting" (runway/parking) feature for now, because we talked about re-implementing it anyhow
2012-09-20 23:49:17 +00:00
<text>
<row>12</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[11]/value</property>
</text>
<text>
<row>13</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>ACTIVATE LIGHTS</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[12]/label</property>
</text>
<text>
<row>13</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>123.456 123.456</label>
<property>/sim/gui/dialogs/airports/selected-airport/comms/freq[12]/value</property>
</text>
</group> <!-- of comm frequencies table -->
<!-- runways table -->
<group>
<row>1</row>
<col>0</col>
<colspan>2</colspan>
<layout>table</layout>
<halign>fill</halign>
<default-padding>2</default-padding>
<group>
<layout>hbox</layout>
<halign>fill</halign>
<row>0</row>
<col>0</col>
<colspan>4</colspan>
<text>
<label>Runways</label>
</text>
<hrule><stretch>1</stretch></hrule>
</group>
<text>
<row>1</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[0]/label</property>
</text>
<text>
<row>1</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[0]/length-hdg</property>
</text>
<text>
<row>1</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[0]/ils</property>
</text>
<text>
<row>2</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[1]/label</property>
</text>
<text>
<row>2</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[1]/length-hdg</property>
</text>
<text>
<row>2</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[1]/ils</property>
</text>
<text>
<row>3</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[2]/label</property>
</text>
<text>
<row>3</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[2]/length-hdg</property>
</text>
<text>
<row>3</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[2]/ils</property>
</text>
<text>
<row>4</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[3]/label</property>
</text>
<text>
<row>4</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[3]/length-hdg</property>
</text>
<text>
<row>4</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[3]/ils</property>
</text>
<text>
<row>5</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[4]/label</property>
</text>
<text>
<row>5</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[4]/length-hdg</property>
</text>
<text>
<row>5</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[4]/ils</property>
</text>
<text>
<row>6</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[5]/label</property>
</text>
<text>
<row>6</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[5]/length-hdg</property>
</text>
<text>
<row>6</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[5]/ils</property>
</text>
<text>
<row>7</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[6]/label</property>
</text>
<text>
<row>7</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[6]/length-hdg</property>
</text>
<text>
<row>7</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[6]/ils</property>
</text>
<text>
<row>8</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[7]/label</property>
</text>
<text>
<row>8</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[7]/length-hdg</property>
</text>
<text>
<row>8</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[7]/ils</property>
</text>
<text>
<row>9</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[8]/label</property>
</text>
<text>
<row>9</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[8]/length-hdg</property>
</text>
<text>
<row>9</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[8]/ils</property>
</text>
<text>
<row>10</row>
<col>0</col>
<halign>left</halign>
<live>true</live>
<label>28L</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[9]/label</property>
</text>
<text>
<row>10</row>
<col>1</col>
<halign>left</halign>
<live>true</live>
<label>10000'/236*</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[9]/length-hdg</property>
</text>
<text>
<row>10</row>
<col>2</col>
<halign>left</halign>
<live>true</live>
<label>108.90Mhz</label>
<property>/sim/gui/dialogs/airports/selected-airport/runway[9]/ils</property>
</text>
</group> <!-- of runways table -->
</group> <!-- of airport info outer table -->
</group>
</group>
<!-- End of RH Pane -->
</group>
<hrule/>
<group>
<layout>hbox</layout>
<default-padding>5</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Go To Airport</legend>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
<object-name>airport-list</object-name>
</binding>
<binding>
<command>nasal</command>
<script>apply()</script>
</binding>
<binding>
<command>reposition</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
<button>
<legend>Close</legend>
<equal>true</equal>
<key>Esc</key>
<binding>
<command>dialog-apply</command>
<object-name>input</object-name>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<empty><stretch>true</stretch></empty>
</group>
</PropertyList>