Library globals

Class globals . canvas . MapStructure . Symbol

View source

A base class for Symbols placed on a map.

Note: for the derived objects, the element is stored as obj.element.
This is also part of the object's parents vector, which allows
callers to use obj.setVisible() et al. However, for code that
manipulates the element's path (if it is a Canvas Path), it is best
to use obj.element.addSegmentGeo() et al. for consistency.

Classes

registry

Static/singleton:

Functions

add

callback

Executes callback function specified by the first argument with variable arguments. The callback is executed within the 'me' context. Callbacks must be defined inside the options hash. EXAMPLE: me.options = { dump_callback: func(){ print('Waypoint '~ me.model.id); } } me.callback('dump');

del

draw

formattedString

Helper method that can be used to create a formatted String using values extracted from the current model. SYNOPSIS: symbol.formattedString(format, model_property_names) Arguments: - format: string - model_property_names: a vector of strings representing the model property names to be used as arguments EXAMPLE: var label = waypoint.formattedString('Waypoint %s: lat %.4f, lng %.4f', [model.id, model.lat, model.lon]);

get

getLabelFromModel

getOption

Wrapper method for accessing options. It allows to pass a default value if the requested option is not defined. EXAMPLE: var ok = (contains(me.options, 'enabled') ? me.options.enabled : 0); var ok = me.getOption('enabled', 0);

getStyle

Wrapper method for accessing style. It allows to pass a default value if the requested style is not defined. It also automatically resolves style properties when they're defined as functions, by calling the corresponding function using the 'me' context EXAMPLE: me.style = { color: [1,1,1], line_color: func(){ me.model.tuned ? [0,0,1] : [1,1,1] } } var color = me.getStyle('color'); # --> [1,1,1] me.model.tuned = 1; var line_color = me.getStyle('line_color'); # --> [0,0,1] var txt_color = me.getStyle('text_color', [1,1,1]); # --> [1,1,1]

new

Calls corresonding symbol constructor @param group #Canvas.Group to place this on. @param layer The #SymbolLayer this is a child of.

newText

Add a text element with styling

update

Update the drawing of this object (position and others).

Variables

df_controller

Non-static: