Namespace globals canvas map
map.nas - provide a high level method to create typical maps in FlightGear (airports, navaids, fixes and waypoints) for both, the GUI and instruments implements the notion of a "layer" by using canvas groups and adding geo-referenced elements to a layer layered maps are linked to boolean properties so that visibility can be easily toggled (via GUI checkboxes or cockpit hotspots) without having to redraw other layers GOALS: have a single Nasal/Canvas wrapper for all sort of maps in FlightGear, that can be easily shared and reused for different purposes DESIGN: ... is slowly evolving, but still very much beta for the time being API: not yet documented, but see eventually design.txt (will need to add doxygen-strings then) PERFORMANCE: will be improved, probabaly by moving some features to C++ space and optimizing things there ISSUES: just look for the FIXME and TODO strings - currently, the priority is to create an OOP/MVC design with less specialized code in XML files REGRESSIONS: 744 ND: toggle layer on/off, support different dialogs ROADMAP: Generalize this further, so that: - it can be easily reused - it uses a MVC approach, where layer-specific data is provided by a Model object - other dialogs can use this without tons of custom code (airports.xml, route-manager.xml, map-canvas.xml) - generalize this further so that it can be used by MFDs/instruments - implement additional layers (tcas, wxradar, agradar) - especially expose the required data to Nasal - implement better GUI support (events) so that zooming/panning via mouse can be supported - make the whole thing styleable - keep track of things getting added here and decide if they should better move to the core canvas module or the C++ code C++ RFEs: - overload findNavaidsWithinRange() to support an optional position argument, so that arbitrary navaids can be looked up - add Nasal extension function to get scenery vector data (landclass) - -
Classes
Layer
A layer is mapped to a canvas group Layers are linked to a single boolean property to toggle them on/off FIXME: this is GUI specific ATM
LayeredMap
A layered map consists of several layers TODO: Support nested LayeredMaps, where a LayeredMap may contain other LayeredMaps TODO: use MapBehavior here and move the zoom/refpos methods there, so that map behavior can be easily customized
Runway
Runway
SURFACECOLORS
Mapping from surface codes to colors (shared by runways.draw and taxiways.draw)
Functions
draw_layer
ALL LayeredMap "draws" go through this wrapper, which makes it easy to check what's going on:
files_with
read in the file names dynamically: *.draw, *.model, *.layer
Variables
callbacks
FIXME: this is a hack so that dialogs can register their own callbacks that are automatically invoked at the end of the generic-canvas-map.xml file (canvas/nasal section)