20,741
edits
| Line 41: | Line 41: | ||
Add this to a group in the dialog where you want the Canvas to appear | Add this to a group in the dialog where you want the Canvas to appear | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<!-- 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>600</pref-width> | |||
<pref-height>400</pref-height> | |||
<view n="0">600</view> | |||
<view n="1">400</view> | |||
<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>airport_test</name> | |||
<init-property>selected-airport/id</init-property> <!-- the init/input property that re-inits the layer --> | |||
<property>display-test</property> <!-- property switch to toggle the layer on/off --> | |||
<description>Show TestLayer</description> <!-- GUI label for the checkbox --> | |||
<default>disabled</default> <!-- default checkbox/layer state --> | |||
<hide-checkbox>true</hide-checkbox> <!-- for default layers so that the checkbox is hidden --> | |||
</layer> | |||
<layer> | |||
<name>runways</name> | |||
<init-property>selected-airport/id</init-property> | |||
<property>display-runways</property> | |||
<description>Show Runways</description> | |||
<default>enabled</default> | |||
<hide-checkbox>true</hide-checkbox> | |||
</layer> | |||
<layer> | |||
<name>taxiways</name> | |||
<init-property>selected-airport/id</init-property> | |||
<property>display-taxiways</property> | |||
<description>Show Taxiways</description> | |||
<default>disabled</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> | |||
<!-- | |||
<layer> | |||
<name>navaid_test</name> | |||
<init-property>selected-airport/id</init-property> | |||
<property>display-navaids</property> | |||
<default>disabled</default> | |||
</layer> | |||
--> | |||
</features> | |||
</canvas> | |||
</syntaxhighlight> | </syntaxhighlight> | ||