Canvas MapStructure layers

From FlightGear wiki
Revision as of 14:39, 10 August 2014 by Hooray (talk | contribs)
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.




Note  These MapStructure layers are currently to be found in $FG_ROOT/Nasal/canvas/map - these are conventional Nasal files, but they are bound to existing data structures at run-time and become classes that can be procedurally instantiated and customized. Depending on the phase of the current release cycle, the links shown below may be outdated and more recent additions are to be found in the Canvas-hackers team clone only. There are several incomplete/missing layers, if you'd like to work on any of those, please get in touch via the forum first.
Name Type (object/position) Description Status management drawing/styling styling flags drivers Notes
ALT-profile ... route manager/flightplan Done Done ALT-profile ALT.symbol ... local only required to phase out map.nas
APS Moving Airplane Symbol Done Done APS APS.symbol ... all (main/AI/MP) caching/styling ? needs listeners to respond to map events (ref-lat/ref-lon, heading, center etc)
APT Stationary Airports (ND) Done Done APT APT.symbol line_width ... all (main/AI/MP) caching/styling ? ticket #1320 Done Done [2]basically done, but some optimizations are being considered (mostly via the positioned APIs)
ILS Stationary ILS/LOCALIZER Not done Not done ILS ILS.symbol line_width ... all (main/AI/MP) caching/styling ? should probably be split: LOC and ILS ?
AWY Stationary Airways (LO/HI) [3] Not done Not done AWY AWY.symbol ... all (main/AI/MP) also see James' comments at Map
DATA Stationary info labels for all layers Not done Not done DATA DATA.symbol ... all (main/AI/MP) also see Map and [4]
ESRI/SHP Stationary ESRI shapefiles (shp), e.g. for borders/coastlines etc [5] Not done Not done SHP ESRI.symbol ... all (main/AI/MP) prototype using a shp2svg script[6]. Either expose shapelib/OGR via cppbind or add a new CanvasElement for shapefile processing
FIX Stationary fixes 80}% completed FIX FIX.symbol line_width ... all (main/AI/MP) caching/styling ?
FLT Moving (continuous!) Flight Path/History (main aircraft-only!) 60}% completed FLT FLT.symbol ... main-only ! All API calls should be moved into aircraftpos.controller, so that we can encapsulate this and use timer-based sampling for AI traffic. caching/styling ?
GRID Stationary lat/lon grid 20}% completed GRID GRID ... all (main/AI/MP) draws a lat/lon grid with tic marks
NDB Stationary NDB stations Done Done NDB FIX.symbol (draws a SVG) line_width ... all (main/AI/MP) caching/styling ?
PARK Stationary parking/helipads Not done Not done PARK PARK.symbol ... all required to phase out map.nas
POI Stationary Points of Interest Not done Not done POI POI.symbol ... all (main/AI/MP) alreadyexposed via Nasal/NavCache
RTE Stationary Routing (legs, flightplan API) 70}% completed RTE RTE.symbol ... main-only ! the route layer needs to use listeners to receive "onChange" notifications from the route manager, or it may take a few seconds until the route shows up ticket #1326 caching/styling ?
RWY Stationary runways Not done Not done RWY-profile RWY.symbol ... all required to phase out map.nas
SAT Stationary tiled map overlay via http (mapserver/OSM) [7] 10}% completed SAT SAT.symbol ... all (main/AI/MP) performance depends on bandwidth, should probably be cached persistently in $FG_HOME
TAXI Stationary taxiways Not done Not done TAXI TAXI.symbol ... all required to phase out map.nas
TERR Stationary Terrain heightmap (G1000-style) Not done Not done TERR TERR.symbol ... all (main/AI/MP) HEAVY! use the terrain presampler to compose a heightmap using raster images. Will also be needed for modern Garmin-series avionics like the Garmin GNS530, as per[8]. Also see Omega95's pre-Canvas work at [9] and [10].

In 07/2014, omega95 started porting some of his VSD/heightmap work to use Canvas:

TFC Moving Traffic (AI/MP) Done Done TFC TFC.symbol ... all (main/AI/MP) caching/styling ? needs listener to receive notifications once enabling/disabling AI/MP, needs optimizations (e.g. draw vs. just update)
TGT Moving ATC-Targets (AI/MP) 20}% completed TGT TGT.symbol ... all (main/AI/MP) caching/styling ?
TUT Stationary Tutorial targets 80}% completed TUT TUT.symbol line_width ... main-only ! also show models?
TWR Stationary towers Not done Not done TWR-profile TWR.symbol ... all required to phase out map.nas
VOR Stationary VOR stations 80}% completed VOR VOR.symbol * line_width all (main/AI/MP) navaid layers need to register autopilot/navradio listeners in their controller, because the ND highlights certain stations based on selected frequency/OBS settings - caching/styling ?
WPT Stationary Waypoints (flightplan API) 80}% completed WPT WPT.symbol ... main-only ! bug fixed [11], caching/styling ? navdisplay.mfd still contains a few stubs from the original code - they should be replaced once we respond to RM events in RTE/WPT
WXR Moving Weather (LW/AW only!) 80}% completed WXR WXR.symbol (draws a PNG) ... all (main/AI/MP) needs to use listeners to receive notifications on enabling/disabling AW, and any settings related to it, caching/styling?


Vertical Layers

Note  Also see http://forum.flightgear.org/viewtopic.php?f=71&t=23593

Omega95 played with this a while ago: Howto:Implement a Vertical Situation Display in Nasal

Omega95-vsd-instrument.jpeg

Not important right now, but the design should be prepared to support both types of maps - it is foreseeable, that will have vertical maps, i.e. altitude/terrain graphs, such as a VSD or an approach profile (instructor station), also a VNAV map would benefit from having a straightforward way to show a vertical map, especially from a performance standpoint (i.e. having all those geodinfo calls!), basically:

  • layer dimensions (x/y)
  • geo-referencing a position, i.e. mapping the origin to geographic coordinates (lat/lon)
  • transparently mapping altitude/coordinates to proper screen coordinates.
  • i.e. say, the route manager has 5 waypoints with altitude constraints
  • the total route is 50 nm - the X axis is 400 pixels wide, so 10nm => 80 pixels on the X axis
  • well, roughly - if our first waypoint is 10 nm ahead, it needs to be drawn at 80px, and the aircraft symbol needs to be drawn at X:0
  • vertically, the altitude differences between all waypoints are between 2000ft and 14000ft, i.e. 12000 ft
  • so the Y axis (200 pixels) needs to be split into segments, where 1200 ft corresponding 20 pixels
  • waypoints would then be mapped to this coordinate system
  • this is just for prototyping, it would obviously need to support a range knob, too - i.e. directly transform as required (Tom once mentioned that he would add hardcoded support for this at some point, so before we spend any significant time on this, get in touch with him first)
  • from a design point of view, the "driver" (model) for the view could be shared between all VSD instances, i.e. should be more efficient in cases where one VSD shows a greater range than the other, because the same data could be reused/plotted, and possibly even the whole canvas group for the terrain data, i.e. as a texture map.


Cquote1.png these are the main steps to port your work to become a MapStructure layer
  • extend api.nas to allow "vertical" maps to be added, these would be just canvas groups for now, because we don't have support for hard-coded projections currently
  • i.e. change the .addLayer() method to add a mandatory mode/projection argument (defaulted to "horizontal")
  • support a *.symbol field that also defaults to "horizontal", but which can be overridden by vertical layers
  • add a new MapStructure layer that renders a polygon, the lcontroller file would then simply return a set of lat/lon/alt vertices
  • investigate if/how to reuse lcontroller files (WPT/RTE)


Overall, this shouldn't be very difficult, and it would allow omega95's work to be reused in other places, including other aircraft and GUI dialogs.
At the same time, this would mean that we'd support independent instances and styling, too.


— Hooray (Sun Jul 20). Canvas Vertical Maps vs. MapStructure VSD layer.
(powered by Instant-Cquotes)
Cquote2.png