Class: Marker

cercalia.Marker

Marker graphical format with which perform a set of operations and customizations. The core of this class is based on OpenLayers3 ol.Feature class For obtain the reference of this object, use the getMap() function call.

new cercalia.Marker(options)

Name Type Description
options

Marker options

Name Type Description
draggable boolean | undefined optional

Boolean indicating if dragging is enabled or not.

icon cercalia.Icon | undefined optional

cercalia.Icon object, if not specified use the default value.

id string | undefined optional

Marker Id. If not specified, generates a automatic value.

label cercalia.Label | undefined optional

Label content.

onClick function | undefined optional

Function to execute on marker click.

onDoubleClick function | undefined optional

Function to execute on marker double click.

onDragEnd function | undefined optional

Function to execute when ends marker dragging.

onDragMove function | undefined optional

Function to execute during marker dragging.

onDragStart function | undefined optional

Function to execute on marker dragging start.

onDrop function | undefined optional

Function to execute on marker drop. Returns the position of dragged markers list

onMouseOut function | undefined optional

Function to execute on Mouse Out.

onMouseOver function | undefined optional

Function to execute on Mouse Over.

onRightClick function | undefined optional

Function to execute on marker right click.

popup cercalia.Popup | undefined optional

Marker popup.

position cercalia.LonLat

Position.

simpleLabel cercalia.SimpleLabel | undefined optional

Marker Simple Label object.

zIndex number

Z-Index marker. Default value 200.

Members

onClick{function}

onDoubleClick{function}

onMouseOut{function}

onMouseOver Function, if specified

onMouseOver{function}

onRightClick{function}

Methods

Add extra icon with a plus zIndex. You can add multiple icons to a marker.

Name Type Description
icon cercalia.Icon

Icon

Name Type Description
popup cercalia.Popup

Destroy popup

Returns:
ClassName: cercalia.Marker
Returns:
Return extra icons
Returns:
Object ol.Feature
Returns:
Icon.
Returns:
Marker ID. If specified, if not returns null.
Returns:
label Label assigned to th marker.
Returns:
The map where it's painted, if not returns null.
Returns:
Popup, if don't have returns null.
Returns:
position The marker Array position [lat, lon].
Returns:
Returns cercalia.SimpleLabel if created. If not, returns null.
Returns:
CSS marker zIndex
Returns:
true if extra icons.

Hide marker label

Returns:
Boolean showing if marker it's draggable.
Returns:
true if marker is dragging, otherwise false.
Returns:
true if visible, else false.

movePosition(position, duration, callbackFn, centerMapDuringMovement, numSteps)

Move the parker position with an animation movement from a starting to ending position, in a specified time (duration). Optionally it's possible to call a function specified via parameter.

Name Type Description
position cercalia.LonLat

Coordinate.

duration number | undefined optional

Movement duration, in milliseconds (default value 2000ms)

callbackFn function | undefined optional

Callback function, when movement ends

centerMapDuringMovement boolean | undefined optional

Center map during movement. Default false.

numSteps number | undefined optional

Number of steps to animate. Default 100.

Force to draw feature.

refreshPositionFromGeometry()

Updates the marker position through its geometry. This function is usefull on marker dragging, where its position (obtained through its geometry) has been updated, but not its popup or label.

Destroy the label object

Name Type Description
draggable boolean

Change the marker icon

Name Type Description
icon cercalia.Icon

Assign ID to marker

Name Type Description
id string

Assign/change marker label text

Name Type Description
label cercalia.Label

Label content

Name Type Description
map cercalia.Map

Move the marker position to the specified via parameter

Name Type Description
position cercalia.LonLat

setSimpleLabel(simpleLabel)

SimpleLabel to add/modify related with the marker

Name Type Description
simpleLabel cercalia.SimpleLabel

Show or hide the marker, including its SimpleLabel, Label or Popup.

Name Type Description
visible boolean

Change the zIndex value

Name Type Description
zIndex number

Show marker label