20,741
edits
| Line 270: | Line 270: | ||
* _map_handle - a handle to the layer's map (map group) | * _map_handle - a handle to the layer's map (map group) | ||
These are properly initialized during construction of the layer. | These are properly initialized during construction of the layer, but will probably be phased out, once the design has improved a little and becomes more stable - so please just consider them "helpers" for now, because we don't have all of the API in place yet. | ||
Now, to actually make a new layer known to the system, we need to add another file that registers the layer. For an example of how to do this, please see navaids.layer: | Now, to actually make a new layer known to the system, we need to add another file that registers the layer. For an example of how to do this, please see navaids.layer: | ||
| Line 301: | Line 301: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== How the whole thing works == | |||
This is targeted at people who are interested in helping improve the whole thing, so that they get a better understanding of how the whole thing hangs together at the moment. | |||
For the time being, the implementation is specific to GUI dialogs - in that it will largely simplify (and even automate) the creation of GUI dialogs with an embedded canvas "map". This is accomplished using a handful of fixed assumptions, most of which will need to be addressed in order to support additional dialogs, and eventually, also non-GUI, i.e. instrument-use. Namely, that means: | |||
* that people can simply instantiate a "GenericMap" by including an existing XML file | |||
* dialog-specific settings can be overridden and customized (see above, or $FG_ROOT/gui/dialogs/airports.xml) | |||
* the GenericMap is a LayeredMap where layers are created for different features and linked to toggle properties | |||
* there are a handful of variables/functions that need to be declared in the body of the dialog's Nasal/open block | |||
* in addition, 1-2 function calls need to be made during initialization, in the Nasal/OPEN section | |||
* these are later on used by the system to instantiate all requested layers dynamically | |||
* first of all, this is the "setupGUI" function, which will create the requested layers, and add GUI checkboxes and zoom buttons to the dialog automatically | |||