Class: Marker

Marker

WPGMZA.Marker

new Marker( [row])

Base class for markers. Please do not call this constructor directly. Always use createInstance rather than instantiating this class directly. Using createInstance allows this class to be externally extensible.
Parameters:
Name Type Argument Description
row object <optional>
Data to map to this object (eg from the database)

Extends

Methods


<static> createInstance( [row])

Creates an instance of a marker, please always use this function rather than calling the constructor directly.
Parameters:
Name Type Argument Description
row object <optional>
Data to map to this object (eg from the database)

<static> getConstructor()

Returns the contructor to be used by createInstance, depending on the selected maps engine.
Returns:
The appropriate contructor
Type
function

_triggerListeners()

Handles the logic of triggering listeners
Inherited From:

addEventListener(type, callback [, thisObject] [, useCapture])

Adds an event listener on this object
Parameters:
Name Type Argument Description
type string The event type, or multiple types separated by spaces
callback function The callback to call when the event fires
thisObject object <optional>
The object to use as "this" when firing the callback
useCapture bool <optional>
If true, fires the callback on the capture phase, as opposed to bubble phase
Inherited From:

dispatchEvent(event)

Fires an event on this object
Parameters:
Name Type Description
event string | WPGMZA.Event Either the event type as a string, or an instance of WPGMZA.Event
Inherited From:

getAnimation()

Returns the animation set on this marker (see WPGMZA.Marker ANIMATION_* constants).

getDraggable()

Gets whether this marker is draggable or not
Returns:
True if the marker is draggable
Type
bool

getIcon()

Gets the marker icon image URL, without the protocol prefix
Returns:
The URL to the markers icon image
Type
string

getPosition()

Gets the position of the marker
Returns:
LatLng literal of this markers position
Type
object

getVisible()

Get the marker visibility

hasEventListener(type)

Test for listeners of type on this object
Parameters:
Name Type Description
type string The event type to test for
Inherited From:
Returns:
True if this object has listeners bound for the specified type
Type
bool

hidePreviousInteractedInfoWindow()

This function will hide the last info the user interacted with, so that only one InfoWindow can be open at any given moment.

off()

Alias for removeEventListener
Inherited From:
See:

on()

Alias for addEventListener
Inherited From:
See:

onAdded()

Called when the marker has been added to a map

onClick()

Called when the marker has been clicked

onMouseOver()

Called when the user hovers the mouse over this marker

onSelect()

Called when the marker has been selected, either by the icon being clicked, or from a marker listing

openInfoWindow()

Placeholder for future use

panIntoView()

Centers the map this marker belongs to on this marker
Throws:
Marker hasn't been added to a map

parseGeometry(string)

Scans a string for all floating point numbers and build an array of latitude and longitude literals from the matched numbers
Parameters:
Name Type Description
string string The string to parse numbers from
Inherited From:
Returns:
An array of LatLng literals parsed from the string
Type
array

removeEventListener(type [, listener] [, thisObject] [, useCapture])

Removes event listeners from this object
Parameters:
Name Type Argument Description
type string The event type to remove listeners from
listener function <optional>
The function to remove. If omitted, all listeners will be removed
thisObject object <optional>
Use the parameter to remove listeners bound with the same thisObject
useCapture bool <optional>
Remove the capture phase event listener. Otherwise, the bubble phase event listener will be removed.
Inherited From:

setAnimation(animation)

Sets the animation for this marker (see WPGMZA.Marker ANIMATION_* constants).
Parameters:
Name Type Description
animation int The animation to set.

setDraggable(draggable)

Sets whether the marker is draggable
Parameters:
Name Type Description
draggable bool Set to true to make this marker draggable

setMap(map)

Sets the map this marker should be displayed on. If it is already on a map, it will be removed from that map first, before being added to the supplied map.
Parameters:
Name Type Description
map WPGMZA.Map The map to add this markmer to

setOptions(options)

Sets options on this marker
Parameters:
Name Type Description
options object An object containing the options to be set

setPosition(latLng)

Sets the position of the marker.
Parameters:
Name Type Description
latLng object | WPGMZA.LatLng The position either as a LatLng literal or instance of WPGMZA.LatLng.

setVisible(visible)

Set the marker visibility. This is used by the store locator etc. and is not a setting. Closes the InfoWindow if the marker is being hidden and the InfoWindow for this marker is open.
Parameters:
Name Type Description
visible bool Whether the marker should be visible or not

toJSON()

Overrides MapObject.toJSON, serializes the marker to a JSON object
Overrides:
Returns:
A JSON representation of this marker
Type
object

trigger()

Alias for removeEventListener
Inherited From:
See: