addSymbol()

The function allows to add a custom symbol to the Maps Widget.

Synopsis

void addSymbol(string name, float lat, float lon[, mapping options[,int layerId = 1]])

void addSymbol(string name, string coordinate[, mapping options[,int layerId = 1]])

Parameter

Parameter Description
name Name of object
lat Latitude
lon Longitude
options Additional settings
coordinate Longitude and Latitude as string, see coordinate conversion.
layerId Layer number, default:1

Description

The function allows to add a custom object (panel reference) directly to the Maps Widget. The symbol is displayed at the stated coordinates (either as float value pair lat/lon or as string coordinate).

The mapping keys "minDistance" and "maxDistance" are used to define for which viewing distance the object will be displayed. If the current viewing distance is outside of the specified range the object is hidden. The default value for both is 0.

The layer where the symbol should be added can be defined additionally.

Example

Maps_ewo1.addSymbol("plane", 48.123, 16.456, makeMapping("maxDistance", 6000, "minDistance", 300));

It must be considered that the object to be displayed must first be added to the panel using the regular Control function addSymbol() before adding it to the Maps Widget using this function.

Example

addSymbol(self, "plane.pnl", "plane", makeDynString(), 0, 0, 0, 1, 1, "Maps_ewo1");
Maps_ewo1.addSymbol(“plane”, 48.123, 16.456, makeMapping("maxDistance", 6000, "minDistance", 300));

If the object with a given name is added twice it is just moved from one position to the new position. This can be used for e.g. animating movements on the map.

Note: If a public method is in the ScopeLib, it makes the panel object-oriented and different search rules apply to addSymbol. You can, however, refer to a symbol by using an absolute name. An absolute name has the form <ModuleName>.<PanelName>:<Name>. The following example shows how to use this to add the symbol "test" regardless whether the panel is object-oriented or not:
main()
{
   addSymbol( myModuleName(), myPanelName(), "mapobj.pnl", "test", makeDynString(), 0, 0, 0, 1, 1, "EWO_MAP" );
   string fullName = myModuleName() + "." + myPanelName() + ":test";
   EWO_MAP.addSymbol( fullName, 48, 16 );
}

Assignment

Maps Widget

See also

-