2003-11-27 23:43:43 +00:00
|
|
|
<?xml version="1.0"?>
|
2006-03-25 07:49:52 +00:00
|
|
|
|
2003-11-27 23:43:43 +00:00
|
|
|
<PropertyList>
|
2004-05-12 15:37:17 +00:00
|
|
|
<name>airports</name>
|
|
|
|
<layout>vbox</layout>
|
2009-01-10 22:20:15 +00:00
|
|
|
<resizable>true</resizable>
|
2004-05-12 15:37:17 +00:00
|
|
|
|
2010-12-27 20:19:31 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<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>
|
|
|
|
</button>
|
|
|
|
</group>
|
2003-11-27 23:43:43 +00:00
|
|
|
|
2007-03-26 15:25:27 +00:00
|
|
|
<hrule/>
|
2006-03-25 07:49:52 +00:00
|
|
|
|
2006-03-31 10:26:08 +00:00
|
|
|
<nasal>
|
2012-09-19 21:35:56 +00:00
|
|
|
<open><![CDATA[
|
2012-09-17 19:17:52 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/rwy", "");
|
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", "");
|
2012-09-18 18:28:56 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/list", "");
|
|
|
|
|
2012-09-19 21:35:56 +00:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2012-09-20 20:51:23 +00:00
|
|
|
# Start with the closest airport
|
|
|
|
var airport_id = airportinfo().id;
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
var dlg = props.globals.getNode("/sim/gui/dialogs/airports", 1);
|
|
|
|
var avail_runways = dlg.getNode("available-runways", 1);
|
|
|
|
var avail_parking = dlg.getNode("available-parking", 1);
|
|
|
|
|
|
|
|
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 ~ " (" ~ airport_id ~ ")");
|
2012-09-19 21:35:56 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/location", sprintf("%.3f / %.3f", info.lat, info.lon));
|
2012-09-17 19:17:52 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/lon", info.lon);
|
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/elevation-ft", 3.28 * info.elevation);
|
2012-09-18 18:28:56 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/rwy", "");
|
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/parkpos", "");
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
var longest_runway = 0;
|
|
|
|
var runway_string = "";
|
|
|
|
var runways = info.runways;
|
|
|
|
|
|
|
|
avail_runways.removeChildren("value");
|
|
|
|
avail_parking.removeChildren("value");
|
|
|
|
var runway_keys = sort(keys(runways), string.icmp);
|
|
|
|
var i = 0;
|
|
|
|
|
|
|
|
foreach(var rwy; runway_keys) {
|
|
|
|
runway_string = runway_string ~ rwy ~ " ";
|
|
|
|
longest_runway = math.max(longest_runway, runways[rwy].length * 3.28);
|
|
|
|
avail_runways.getNode("value[" ~ i ~ "]", 1).setValue(rwy);
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
foreach (var park; info.parking()) {
|
|
|
|
avail_parking.getNode("value[" ~ i ~ "]", 1).setValue(park.name);
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/longest-runway", longest_runway);
|
|
|
|
|
2012-09-19 21:35:56 +00:00
|
|
|
var airport_pos = geo.Coord.new();
|
|
|
|
airport_pos.set_latlon(info.lat, info.lon);
|
|
|
|
|
2012-09-20 20:51:23 +00:00
|
|
|
var pos = geo.aircraft_position();
|
|
|
|
var dst = pos.distance_to(airport_pos) / 1852.0;
|
|
|
|
var crs = pos.course_to(airport_pos);
|
2012-09-19 21:35:56 +00:00
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/distance-nm", dst);
|
|
|
|
setprop("/sim/gui/dialogs/airports/selected-airport/course-deg", crs);
|
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
gui.dialog_update("airports", "runway-list");
|
|
|
|
gui.dialog_update("airports", "parking-list");
|
|
|
|
}
|
2006-03-31 10:26:08 +00:00
|
|
|
|
2008-07-30 21:56:18 +00:00
|
|
|
var listbox = func {
|
2012-09-17 19:17:52 +00:00
|
|
|
airport_id = pop(split(" ", airportlist.getValue()));
|
|
|
|
airport_id = substr(airport_id, 1, size(airport_id) - 2); # strip parentheses
|
|
|
|
|
|
|
|
update_info();
|
2006-03-31 10:26:08 +00:00
|
|
|
}
|
|
|
|
|
2008-07-30 21:56:18 +00:00
|
|
|
var apply = func {
|
2012-09-17 19:17:52 +00:00
|
|
|
setprop("/sim/presets/airport-id", airport_id);
|
2006-03-31 10:26:08 +00:00
|
|
|
setprop("/sim/presets/longitude-deg", -9999);
|
|
|
|
setprop("/sim/presets/latitude-deg", -9999);
|
|
|
|
setprop("/sim/presets/altitude-ft", -9999);
|
|
|
|
setprop("/sim/presets/airspeed-kt", 0);
|
2008-05-01 21:15:40 +00:00
|
|
|
setprop("/sim/presets/offset-distance-nm", 0);
|
|
|
|
setprop("/sim/presets/offset-azimuth-deg", 0);
|
2006-03-31 10:26:08 +00:00
|
|
|
setprop("/sim/presets/glideslope-deg", 0);
|
|
|
|
setprop("/sim/presets/heading-deg", 0);
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
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"));
|
2012-09-19 21:35:56 +00:00
|
|
|
}
|
2012-09-17 19:17:52 +00:00
|
|
|
}
|
2012-09-19 21:35:56 +00:00
|
|
|
|
2012-09-18 18:28:56 +00:00
|
|
|
update_info();
|
2012-09-19 21:35:56 +00:00
|
|
|
]]>
|
2006-03-31 10:26:08 +00:00
|
|
|
</open>
|
|
|
|
</nasal>
|
2012-09-17 19:17:52 +00:00
|
|
|
|
2006-03-31 10:26:08 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<default-padding>4</default-padding>
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
2006-03-31 10:26:08 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<default-padding>4</default-padding>
|
2006-03-31 10:26:08 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
<text>
|
|
|
|
<label>Airport:</label>
|
|
|
|
</text>
|
2006-03-31 10:26:08 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
<input>
|
|
|
|
<name>input</name>
|
|
|
|
<pref-width>200</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>
|
2006-03-31 10:26:08 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
<button>
|
|
|
|
<legend>Clear</legend>
|
|
|
|
<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>dialog-apply</command>
|
|
|
|
<object-name>input</object-name>
|
|
|
|
</binding>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-update</command>
|
|
|
|
<object-name>airport-list</object-name>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<airport-list>
|
|
|
|
<name>airport-list</name>
|
|
|
|
<pref-width>300</pref-width>
|
|
|
|
<pref-height>260</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>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>table</layout>
|
|
|
|
|
|
|
|
<text>
|
|
|
|
<row>0</row>
|
|
|
|
<col>0</col>
|
2012-09-19 21:35:56 +00:00
|
|
|
<width>100</width>
|
2012-09-17 19:17:52 +00:00
|
|
|
<halign>right</halign>
|
|
|
|
<label>Airport:</label>
|
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>0</row>
|
|
|
|
<col>1</col>
|
|
|
|
<colspan>3</colspan>
|
|
|
|
<halign>left</halign>
|
|
|
|
<live>true</live>
|
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/name</property>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<text>
|
|
|
|
<row>1</row>
|
|
|
|
<col>0</col>
|
|
|
|
<halign>right</halign>
|
2012-09-19 21:35:56 +00:00
|
|
|
<label>Lat / Lon:</label>
|
2012-09-17 19:17:52 +00:00
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>1</row>
|
|
|
|
<col>1</col>
|
|
|
|
<halign>left</halign>
|
|
|
|
<live>true</live>
|
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/location</property>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<text>
|
|
|
|
<row>1</row>
|
2012-09-19 21:35:56 +00:00
|
|
|
<col>2</col>
|
2012-09-17 19:17:52 +00:00
|
|
|
<halign>right</halign>
|
2012-09-19 21:35:56 +00:00
|
|
|
<label>Elevation:</label>
|
2012-09-17 19:17:52 +00:00
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>1</row>
|
2012-09-19 21:35:56 +00:00
|
|
|
<col>3</col>
|
2012-09-17 19:17:52 +00:00
|
|
|
<halign>left</halign>
|
|
|
|
<live>true</live>
|
2012-09-19 21:35:56 +00:00
|
|
|
<format>%.0f ft</format>
|
2012-09-17 19:17:52 +00:00
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/elevation-ft</property>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<text>
|
|
|
|
<row>2</row>
|
|
|
|
<col>0</col>
|
|
|
|
<halign>right</halign>
|
2012-09-19 21:35:56 +00:00
|
|
|
<label>Longest runway:</label>
|
2012-09-17 19:17:52 +00:00
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>2</row>
|
|
|
|
<col>1</col>
|
|
|
|
<halign>left</halign>
|
|
|
|
<live>true</live>
|
2012-09-19 21:35:56 +00:00
|
|
|
<format>%.0f ft</format>
|
2012-09-17 19:17:52 +00:00
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/longest-runway</property>
|
|
|
|
</text>
|
|
|
|
|
2012-09-19 21:35:56 +00:00
|
|
|
<text>
|
|
|
|
<row>3</row>
|
|
|
|
<col>0</col>
|
|
|
|
<halign>right</halign>
|
|
|
|
<label>Distance:</label>
|
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>3</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>3</row>
|
|
|
|
<col>2</col>
|
|
|
|
<halign>right</halign>
|
|
|
|
<label>Course:</label>
|
|
|
|
</text>
|
|
|
|
<text>
|
|
|
|
<row>3</row>
|
|
|
|
<col>3</col>
|
|
|
|
<halign>left</halign>
|
|
|
|
<live>true</live>
|
|
|
|
<format>%.0f deg</format>
|
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/course-deg</property>
|
|
|
|
</text>
|
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
</group>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<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>
|
|
|
|
<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>
|
|
|
|
|
|
|
|
<combo>
|
|
|
|
<name>parking-list</name>
|
|
|
|
<row>4</row><col>2</col>
|
|
|
|
<pref-width>85</pref-width>
|
|
|
|
<enable>
|
|
|
|
<property>/sim/gui/dialogs/airports/use_parkpos</property>
|
|
|
|
</enable>
|
|
|
|
<property>/sim/gui/dialogs/airports/selected-airport/parkpos</property>
|
|
|
|
<editable>false</editable>
|
|
|
|
<properties>sim/gui/dialogs/airports/available-parking</properties>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>parking-list</object-name>
|
|
|
|
</binding>
|
|
|
|
</combo>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<vrule/>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>vbox</layout>
|
2010-12-27 20:19:31 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
<canvas>
|
|
|
|
<name>map-dialog</name>
|
|
|
|
<valign>fill</valign>
|
|
|
|
<halign>fill</halign>
|
|
|
|
<stretch>true</stretch>
|
|
|
|
<pref-width>600</pref-width>
|
|
|
|
<pref-height>400</pref-height>
|
|
|
|
<view n="0">600</view>
|
|
|
|
<view n="1">400</view>
|
|
|
|
|
|
|
|
<nasal>
|
|
|
|
|
|
|
|
|
|
|
|
<load><![CDATA[
|
|
|
|
var my_canvas = canvas.get(cmdarg());
|
|
|
|
my_canvas.setColorBackground(0.2, 0.5, 0.2, 0.5);
|
|
|
|
|
|
|
|
var root = my_canvas.createGroup();
|
|
|
|
|
2012-09-17 22:32:54 +00:00
|
|
|
var map = root.createChild("map", "map-test")
|
|
|
|
.setTranslation(300, 200);
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
var layer_runways = map.createChild("group", "runways");
|
2012-09-17 22:32:54 +00:00
|
|
|
|
2012-09-17 19:17:52 +00:00
|
|
|
var updateMap = func() {
|
|
|
|
var id = getprop("/sim/gui/dialogs/airports/selected-airport/id");
|
|
|
|
|
|
|
|
if (id != "") {
|
|
|
|
var apt = airportinfo(id);
|
2012-09-18 18:28:56 +00:00
|
|
|
|
2012-09-18 21:38:53 +00:00
|
|
|
map.removeAllChildren();
|
|
|
|
layer_runways = map.createChild("group", "runways");
|
2012-09-18 18:28:56 +00:00
|
|
|
|
2012-09-19 21:35:56 +00:00
|
|
|
var display_taxiways = getprop("/sim/gui/dialogs/airports/display-taxiways");
|
|
|
|
var display_parking = getprop("/sim/gui/dialogs/airports/display-parking");
|
|
|
|
var display_tower = getprop("/sim/gui/dialogs/airports/display-tower");
|
|
|
|
|
|
|
|
var airport = canvas.AirportMap.new(apt, 1, display_taxiways, display_parking, display_tower);
|
2012-09-18 18:28:56 +00:00
|
|
|
airport.build(layer_runways);
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
map._node.getNode("ref-lat", 1).setDoubleValue(apt.lat);
|
|
|
|
map._node.getNode("ref-lon", 1).setDoubleValue(apt.lon);
|
|
|
|
map._node.getNode("hdg", 1).setDoubleValue(0.0);
|
2012-09-20 20:51:23 +00:00
|
|
|
|
|
|
|
updateZoom();
|
2012-09-18 18:28:56 +00:00
|
|
|
}
|
2012-09-17 19:17:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var ranges = [0.1, 0.25, 0.5, 1, 2.5, 5];
|
|
|
|
|
|
|
|
var updateZoom = func()
|
|
|
|
{
|
|
|
|
var z = getprop("/sim/gui/dialogs/airports/zoom");
|
|
|
|
if( z == nil )
|
|
|
|
z = 0;
|
|
|
|
var zoom = ranges[4 - z];
|
|
|
|
map._node.getNode("range", 1).setDoubleValue(zoom);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2012-09-18 18:28:56 +00:00
|
|
|
var updateRunwayHighlight = func()
|
|
|
|
{
|
|
|
|
var selected_rwy = getprop("/sim/gui/dialogs/airports/selected-airport/rwy");
|
|
|
|
var selected_apt = getprop("/sim/gui/dialogs/airports/selected-airport/id");
|
|
|
|
|
|
|
|
var is_heli = substr(selected_rwy, 0, 1) == "H";
|
|
|
|
var rw_dir = is_heli ? nil : int(substr(selected_rwy, 0, 2));
|
|
|
|
|
|
|
|
var rw_rec = "";
|
|
|
|
if( rw_dir != nil ) {
|
|
|
|
rw_rec = sprintf("%02d", math.mod(rw_dir - 18, 36));
|
|
|
|
if( size(selected_rwy) == 3 ) {
|
|
|
|
var map_rec = {
|
|
|
|
"R": "L",
|
|
|
|
"L": "R",
|
|
|
|
"C": "C"
|
|
|
|
};
|
|
|
|
rw_rec ~= map_rec[substr(selected_rwy, 2)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var apt; layer_runways.getChildren()) {
|
|
|
|
if (apt.get("id") == "apt-" ~ selected_apt) {
|
|
|
|
foreach (var rwy; apt.getChildren()) {
|
|
|
|
if ((rwy.get("id") == "runway-" ~ selected_rwy) or
|
|
|
|
(rwy.get("id") == "runway-" ~ rw_rec) )
|
|
|
|
{
|
|
|
|
rwy.setColor(1.0,0.0,0.0);
|
|
|
|
} else {
|
|
|
|
rwy.setColor(1.0,1.0,1.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var updateParkingHighlight = func()
|
|
|
|
{
|
|
|
|
var selected_parkpos = getprop("/sim/gui/dialogs/airports/selected-airport/parkpos");
|
|
|
|
var selected_apt = getprop("/sim/gui/dialogs/airports/selected-airport/id");
|
|
|
|
|
|
|
|
foreach (var apt; layer_runways.getChildren()) {
|
|
|
|
if (apt.get("id") == "apt-" ~ selected_apt) {
|
|
|
|
foreach (var rwy; apt.getChildren()) {
|
|
|
|
if (rwy.get("id") == "parking-" ~ selected_parkpos) {
|
|
|
|
rwy.setColor(1.0,0.0,0.0);
|
|
|
|
} else {
|
|
|
|
rwy.setColor(1.0,1.0,1.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-19 21:35:56 +00:00
|
|
|
var listeners = [];
|
|
|
|
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/selected-airport/id", updateMap));
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/selected-airport/rwy", updateRunwayHighlight));
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/selected-airport/parkpos", updateParkingHighlight));
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/display-taxiways", updateMap));
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/display-parking", updateMap));
|
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/display-tower", updateMap));
|
2012-09-20 20:51:23 +00:00
|
|
|
append(listeners, setlistener("/sim/gui/dialogs/airports/zoom", updateZoom));
|
2012-09-17 19:17:52 +00:00
|
|
|
|
|
|
|
update_info();
|
|
|
|
]]>
|
|
|
|
</load>
|
2012-09-19 21:35:56 +00:00
|
|
|
<close><![CDATA[
|
|
|
|
foreach (var listener, listeners)
|
|
|
|
{
|
|
|
|
removelistener(listener);
|
|
|
|
|
|
|
|
}
|
|
|
|
]]>
|
2012-09-17 19:17:52 +00:00
|
|
|
</close>
|
|
|
|
</nasal>
|
|
|
|
</canvas>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<name>zoomout</name>
|
|
|
|
<legend>-</legend>
|
|
|
|
<pref-width>22</pref-width>
|
|
|
|
<pref-height>22</pref-height>
|
|
|
|
|
|
|
|
<binding>
|
|
|
|
<command>property-adjust</command>
|
|
|
|
<property>/sim/gui/dialogs/airports/zoom</property>
|
|
|
|
<min>0</min>
|
|
|
|
<step>-1</step>
|
|
|
|
</binding>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<text>
|
2012-09-19 21:35:56 +00:00
|
|
|
<label>MMMM</label>
|
|
|
|
<halign>center</halign>
|
2012-09-17 19:17:52 +00:00
|
|
|
<format>Zoom %d</format>
|
|
|
|
<property>/sim/gui/dialogs/airports/zoom</property>
|
|
|
|
<live>true</live>
|
|
|
|
</text>
|
|
|
|
|
|
|
|
<button>
|
|
|
|
<name>zoomin</name>
|
|
|
|
<legend>+</legend>
|
|
|
|
<pref-width>22</pref-width>
|
|
|
|
<pref-height>22</pref-height>
|
|
|
|
|
|
|
|
<binding>
|
|
|
|
<command>property-adjust</command>
|
2012-09-19 21:35:56 +00:00
|
|
|
<property>/sim/gui/dialogs/airports/zoom</property>
|
2012-09-17 19:17:52 +00:00
|
|
|
<step>1</step>
|
|
|
|
<max>4</max>
|
|
|
|
</binding>
|
|
|
|
</button>
|
2012-09-19 21:35:56 +00:00
|
|
|
|
|
|
|
<empty><stretch>true</stretch></empty>
|
|
|
|
|
|
|
|
<checkbox>
|
|
|
|
<name>display-taxiways</name>
|
|
|
|
<label>Display Taxiways</label>
|
|
|
|
<property>/sim/gui/dialogs/airports/display-taxiways</property>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>display-taxiways</object-name>
|
|
|
|
</binding>
|
|
|
|
</checkbox>
|
|
|
|
|
|
|
|
<checkbox>
|
|
|
|
<name>display-parking</name>
|
|
|
|
<label>Display Parking Position</label>
|
|
|
|
<property>/sim/gui/dialogs/airports/display-parking</property>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>display-parking</object-name>
|
|
|
|
</binding>
|
|
|
|
</checkbox>
|
|
|
|
|
|
|
|
<checkbox>
|
|
|
|
<name>display-tower</name>
|
|
|
|
<label>Display Tower</label>
|
|
|
|
<property>/sim/gui/dialogs/airports/display-tower</property>
|
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>display-tower</object-name>
|
|
|
|
</binding>
|
|
|
|
</checkbox>
|
2012-09-17 19:17:52 +00:00
|
|
|
</group>
|
|
|
|
</group>
|
|
|
|
</group>
|
|
|
|
|
|
|
|
<hrule/>
|
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<group>
|
|
|
|
<layout>hbox</layout>
|
|
|
|
<default-padding>10</default-padding>
|
2012-09-17 19:17:52 +00:00
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<empty><stretch>true</stretch></empty>
|
2003-11-27 23:43:43 +00:00
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<button>
|
2012-09-19 21:35:56 +00:00
|
|
|
<legend>Go To Airport</legend>
|
2004-05-12 15:37:17 +00:00
|
|
|
<equal>true</equal>
|
|
|
|
<binding>
|
2005-01-31 10:37:21 +00:00
|
|
|
<command>dialog-apply</command>
|
2006-03-31 10:26:08 +00:00
|
|
|
<object-name>airport-list</object-name>
|
2004-05-12 15:37:17 +00:00
|
|
|
</binding>
|
|
|
|
<binding>
|
2006-03-31 10:26:08 +00:00
|
|
|
<command>nasal</command>
|
|
|
|
<script>apply()</script>
|
2004-05-12 15:37:17 +00:00
|
|
|
</binding>
|
|
|
|
<binding>
|
2006-03-31 10:26:08 +00:00
|
|
|
<command>presets-commit</command>
|
2004-05-12 15:37:17 +00:00
|
|
|
</binding>
|
2012-09-17 19:17:52 +00:00
|
|
|
<binding>
|
|
|
|
<command>dialog-close</command>
|
|
|
|
</binding>
|
2004-05-12 15:37:17 +00:00
|
|
|
</button>
|
2003-11-27 23:43:43 +00:00
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<empty><stretch>true</stretch></empty>
|
2003-11-27 23:43:43 +00:00
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<button>
|
2012-09-19 21:35:56 +00:00
|
|
|
<legend>Close</legend>
|
2004-05-12 15:37:17 +00:00
|
|
|
<equal>true</equal>
|
2005-11-05 18:42:28 +00:00
|
|
|
<key>Esc</key>
|
2006-03-31 10:26:08 +00:00
|
|
|
<binding>
|
|
|
|
<command>dialog-apply</command>
|
|
|
|
<object-name>input</object-name>
|
|
|
|
</binding>
|
2004-05-12 15:37:17 +00:00
|
|
|
<binding>
|
2006-03-25 07:49:52 +00:00
|
|
|
<command>dialog-close</command>
|
2004-05-12 15:37:17 +00:00
|
|
|
</binding>
|
|
|
|
</button>
|
2003-11-27 23:43:43 +00:00
|
|
|
|
2004-05-12 15:37:17 +00:00
|
|
|
<empty><stretch>true</stretch></empty>
|
|
|
|
</group>
|
2003-11-27 23:43:43 +00:00
|
|
|
</PropertyList>
|