Canvas Map API: Difference between revisions

Jump to navigation Jump to search
m
Link to special directory articles
m (Link to special directory articles)
Line 5: Line 5:


== Objective ==
== Objective ==
The Nasal module map.nas in $FG_ROOT/Nasal/canvas will serve as the shared backend for all sorts of mapping/charting purposes in FlightGear. So that GUI dialogs and instruments can use the same code. As of 10/2012 the module is still being designed, so nothing written here is set in stone. This page is just intended to document the whole process.
The Nasal module map.nas in [[$FG_ROOT]]/Nasal/canvas will serve as the shared backend for all sorts of mapping/charting purposes in FlightGear. So that GUI dialogs and instruments can use the same code. As of 10/2012 the module is still being designed, so nothing written here is set in stone. This page is just intended to document the whole process.


== Open Issues ==
== Open Issues ==
Line 48: Line 48:
At the moment, the system (and its design) is still evolving - so nothing is set in stone, and most things written here should be considered a "draft". This is also why the system makes currently some assumptions and requires certain variables/functions to be specified in the dialog XML.
At the moment, the system (and its design) is still evolving - so nothing is set in stone, and most things written here should be considered a "draft". This is also why the system makes currently some assumptions and requires certain variables/functions to be specified in the dialog XML.


(For the latest information, you'll want to refer to $FG_ROOT/gui/dialogs/airports.xml as the "de facto" example of how to use the system)
(For the latest information, you'll want to refer to [[$FG_ROOT]]/gui/dialogs/airports.xml as the "de facto" example of how to use the system)


Add this to the "Nasal/open" tag of your XML dialog and customize it for your dialog:
Add this to the "Nasal/open" tag of your XML dialog and customize it for your dialog:
Line 167: Line 167:




The callbacks to draw a particular layer element are to be found in $FG_ROOT/Nasal/canvas/map, at the moment, we have these modules (listed in ascending complexity):
The callbacks to draw a particular layer element are to be found in [[$FG_ROOT]]/Nasal/canvas/map, at the moment, we have these modules (listed in ascending complexity):
* Nasal/canvas/map/tower.draw
* Nasal/canvas/map/tower.draw
* Nasal/canvas/map/navaid.draw   
* Nasal/canvas/map/navaid.draw   
Line 309: Line 309:


* that people can simply instantiate a "GenericMap" by including an existing XML file  
* 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) - i.e. just copied/pasted
* dialog-specific settings can be overridden and customized (see above, or [[$FG_ROOT]]/gui/dialogs/airports.xml) - i.e. just copied/pasted
* the GenericMap is a LayeredMap where layers are created for different features and linked to toggle properties
* 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
* there are a handful of variables/functions that need to be declared in the body of the dialog's Nasal/open block

Navigation menu