Canvas Nasal API: Difference between revisions

Jump to navigation Jump to search
→‎Map: more freshing out
m (→‎Path: Added note about parent)
(→‎Map: more freshing out)
Line 730: Line 730:
== Map ==
== Map ==
Inherits from Element.
Inherits from Element.
Class for a group element on a canvas with possibly geographic positions which automatically get projected according to the specified projection.
Class for a group element on a canvas with possibly geographic positions which automatically get projected according to the specified projection.
Each map consists of an arbitrary number of layers (canvas groups)
Each map consists of an arbitrary number of layers (canvas groups)
=== del ===
=== del ===
'''Parameters:''' ()
'''Parameters:''' ()
Deletes the Map instance.
=== setController ===
=== setController ===
'''Parameters:''' (controller)
'''Parameters:''' (controller)


controller needs to inherit from Map.Controller
A controller needs to inherit from Map.Controller
=== addLayer ===
=== addLayer ===
'''Parameters:''' (factory, type_arg=nil, priority=nil, style=nil, opts=nil, visible=1)
'''Parameters:''' (factory, type_arg=nil, priority=nil, style=nil, opts=nil, visible=1)
Each layer is some kind of data to be rendered - there’s all the built in layers but WXR, TERRain or anything else specific to the acft would be another layer.
=== getLayer ===
=== getLayer ===
'''Parameters:''' (type_arg)
'''Parameters:''' (type_arg)
Returns the layer corresponding to the argument type.
=== setRange ===
=== setRange ===
'''Parameters:''' (range)
'''Parameters:''' (range)
This sets the display range of the map in NM.
=== getRange ===
=== getRange ===
'''Parameters:''' ()
'''Parameters:''' ()
Get current range setting
=== setPos ===
=== setPos ===
'''Parameters:''' (lat, lon, hdg=nil, range=nil, alt=nil)
'''Parameters:''' (lat, lon, hdg=nil, range=nil, alt=nil)
This is the center of the map (very often the aircraft position, except in something special such as PLAN mode). Hdg sets the up direction (could be north, track, heading and true vs magnetic depending on the aircraft)
=== getPos ===
=== getPos ===
'''Parameters:''' ()
'''Parameters:''' ()
Line 754: Line 768:
=== getLat ===
=== getLat ===
'''Parameters:''' ()
'''Parameters:''' ()
Returns position latitude.
=== getLon ===
=== getLon ===
'''Parameters:''' ()
'''Parameters:''' ()
Returns position longitude.
=== getHdg ===
=== getHdg ===
'''Parameters:''' ()
'''Parameters:''' ()
Return current 'up' heading.
=== getAlt ===
=== getAlt ===
'''Parameters:''' ()
'''Parameters:''' ()
Returns current altitude setting in feet.
=== getRange ===
=== getRange ===
'''Parameters:''' ()
'''Parameters:''' ()


Returns current range setting.
=== getLatLon ===
=== getLatLon ===
'''Parameters:''' ()
'''Parameters:''' ()


Returns vector with lat and lon
Returns the center position of the map as a vector with lat and lon
=== getPosCoord ===
=== getPosCoord ===
'''Parameters:''' ()
'''Parameters:''' ()
Returns the center position of the map as a geo.Coord


N.B.: This always returns the same geo.Coord object,
N.B.: This always returns the same geo.Coord object,
Line 777: Line 802:
'''Parameters:''' (predicate=nil)
'''Parameters:''' (predicate=nil)


Update each layer on this Map.
Update each layer on this Map. Predicate is a function that takes a layer as argument and returns true if that layer should be updated. If predicate is not supplied, all layers will be updated.
 
=== See also ===
=== See also ===
[[Canvas_Maps|Canvas Maps]] and [[Canvas_Map_API|Canvas Map API]]
[[Canvas_Maps|Canvas Maps]] and [[Canvas_Map_API|Canvas Map API]]
574

edits

Navigation menu