Class nokia.maps.map.Marker
Class Summary
A marker represents a location on the map and identifies that location with an icon. A marker can be visible or hidden, draggable or fixed. It can also be grouped together with other markers in a container. Markers can be event targets and can be made to react to events. Changes in their state can also be observed by registered observer objects.
Extends
nokia.maps.map.Object.
new nokia.maps.map.Marker
(coord, [props])
Properties
This interface defines the properties (keys) that can be passed to the constructor of all classes derived from
nokia.maps.map.Marker.
Method Summary
addListener
(type, callback, useCapture)
: Object
This method registers an event listener.
addListenerNS
(namespaceURI, type, callback, useCapture)
: nokia.maps.dom.EventTarget
This method registers an event listener for events originating from a specific namespace.
addListeners
(obj)
Nonstandard method to register multiple event listeners.
addObserver
(key, callback, [context])
: nokia.maps.util.OObject
This method registers an observer for the property named by the caller.
click
(evt)
This event is fired after a mousedown/mouseup sequence at the same target has occurred.
dblclick
(evt)
This event is fired after two click events have been fired within a certain time period.
dbltap
(evt)
This event is fired after a two
tap events have been fired in a certain amount of time.
destroy
()
This method cleans the given instance of
Object and removes it from all Displays to which it is connected.
disableDrag
()
: nokia.maps.dom.EventTarget
This method disables dragging of this event target, causing this event target not to receive
dragstart, drag and dragend events.
disableUserSelect
()
: nokia.maps.dom.EventTarget
This method prevents user selection of text and elements within the event target and prevents the magnifier on the iPhone or other similar mobile devices.
dispatch
(evt)
: Boolean
This method dispatches an event.
drag
(evt)
This event is fired at the target object of the
dragstart event while a drag operation is in propgress.
dragend
(evt)
This event is fired at the end of a drag operation at the object that was dragged (the target of the
dragstart event).
dragenter
(evt)
This event is fired at an object if the mouse/finger is moved into the visible area of the object during a drag operation.
dragleave
(evt)
This event is fired at the current drop target if the the mouse/finger leaves the visible area of the target.
dragover
(evt)
This event is fired at the current drop target while the mouse/finger is on/above the drop target.
dragstart
(evt)
This event is fired at an object that has the property
draggable set to true and after a mousedown/touch has occurred and the mouse/finger was moved at least three pixels.
drop
(evt)
This event is fired at the current drop target if the mouse button or finger is released on/above it, which means that the
dragenter event and the dragover events were canceled, so their preventDefault methods were called and the allowedEffect property matches the dropEffect property.
enableDrag
()
: nokia.maps.dom.EventTarget
This method enables dragging of this event target and disables the user selection, allowing this event target to receive
dragstart, drag and dragend events.
enableUserSelect
()
: nokia.maps.dom.EventTarget
This method allows the user to select text and elements within the event target and allows the magnifier on the iPhone or other similar mobile devices.
gesturechange
(evt)
This high-level event is fired whenever either of the two finger making a gesture is moved, changing the properties of the gesture.
gestureend
(evt)
This high-level event is fired as soon as the gesture ends, for example because one of the two fingers touching the touch screen are lifted.
gesturestart
(evt)
This high-level event is fired when two or more fingers touch the touch screen and are used to make a "gesture".
get
(key)
: Variant
This method retrieves the value of the property with the name provided by the caller.
abstract
getBoundingBox
()
: nokia.maps.geo.BoundingBox
This method calculates the outer geographic bounding box of the given object.
getDisplayBoundingBox
(display)
: nokia.maps.util.Rectangle
This method retrieves the bounding box of the marker icon for the display specified by the caller.
getDisplayOffset
(display, x, y)
The method calculates the pixel offset between the screen coordinates supplied by the caller and those of the given marker.
getDisplays
()
: nokia.maps.map.Display[]
This method retrieves the instances of
map.Display to which the given object is connected.
getIconForRendering
([doc])
: nokia.maps.gfx.Image
The method returns the icon for the given marker bound to the document specified by the caller.
getParent
(display)
: nokia.maps.map.Object
This method retrieves the parent of the given map object.
hitTest
(display, x, y, [tolerance])
The method tests if the given marker (its hit area) covers the location specified by the caller.
hitTest
(pageX, pageY)
: Boolean
This method tests if the given x/y position relative to the document lies within the outer bounding box of the node corresponding to the given
EventTarget object.
insertListener
(type, callback, useCapture)
: Object
This method registers an event listener as the first listener in the listener chain.
insertListenerNS
(namespaceURI, type, callback, useCapture)
: nokia.maps.dom.EventTarget
This method registers an event listener for events originating from a specific namespace as the first in the listener chain.
isAdded
(display)
This method checks if the given map object has been added to the instance of
map.Display specified by the caller.
isVisible
(display)
This method checks if the given map object is visible.
longpress
(evt)
This event is fired after a mouse button has been pressed for a certain amount of time without starting a drag.
longpress
(evt)
This event is fired after a finger has been pressed against the screen for a certain amount of time without starting a drag or gesture.
mousedown
(evt)
This event is fired if a mouse button has been pressed.
mouseenter
(evt)
This event is fired if the mouse cursor enters the visible area of a node -- it is fired at the node that the mouse has entered.
mouseleave
(evt)
This event is fired when the mouse cursor leaves the physical area of a node -- it is fired at the node the mouse has left.
mousemove
(evt)
This event is fired if the mouse is moved.
mouseout
(evt)
This event is fired if the mouse cursor leaves the visible area of a node -- the event is fired at the node that the mouse has left.
mouseover
(evt)
This event is fired when the mouse cursor enters the visible area of a node -- the event is fired at the node that is entered.
mouseup
(evt)
This event is fired if a mouse button has been released.
mousewheel
(evt)
This event is fired if the mousewheel is moved.
remove
(key)
: nokia.maps.util.OObject
This method removes the property with the name provided by the caller.
removeListener
(type, listener, useCapture)
: nokia.maps.dom.EventTarget
This method removes an event listener.
removeListenerNS
(namespaceURI, type, listener, useCapture)
: nokia.maps.dom.EventTarget
This method removes an event listener for events originating from a specific namespace.
removeObserver
(key, callback, context)
: nokia.maps.util.OObject
This method removes the observer for the property named by the caller.
set
(nameOrObject, [value, [force]])
: nokia.maps.util.OObject
This method sets property values, using the property names and values supplied by the caller.
tap
(evt)
This event is fired after a
touchstart and touchend has occurred at the same target and only if neither of the touchstart nor the touchend event has been canceled and no gesture was started in between.
touchend
(evt)
This event is fired when a finger is lifted from a touch screen.
touchmove
(evt)
This event is fired when a finger touches and moves on a touch screen.
touchstart
(evt)
This event is fired when a finger is touches a touch screen.
Field Summary
Number
CHANGE_SPATIAL
This property represents the invalidation type for spatial changes.
Number
CHANGE_VISUAL
This property represents the invalidation type for visual changes.
Number
CHANGE_ZINDEX
This property represents the invalidation type for z-index changes.
nokia.maps.util.IPoint
anchor
The anchor point of this marker.
nokia.maps.geo.Coordinate
coordinate
The coordinates the marker points to.
Boolean
draggable
This property indicates if the given event target is draggable and may receive a
dragstart, drag and dragend events (true); false otherwise.
Object
eventListener
This property is either undefined or holds a hash table that, for every event type, contains an array with the elements:
[(listener, useCapture, namespaceURI)(listener, useCapture, namespaceURI)(…)]
nokia.maps.map.IHitArea
hitArea
The (optional) hit area of the Marker.
nokia.maps.gfx.Image | Image | String
icon
The image that indicates the marker's location on the map (makes the marker visible).
Boolean
isEventTarget
This property indicates whether an object implements the nokia.maps.dom.EventTarget interface (
true) or not (false).
nokia.maps.dom.EventTarget
parentNode
This property holds a reference to the parent node of the event target (if set).
Object
parentNodes
If this property is set it holds a hash table that contains the "namespaceURI" as key and the corresponding value is the parent node of the given event target.
Boolean
visibility
This property is a flag that determines the visibility of the given
Object instance.
Number
zIndex
This property represents the z-index relative to the container.
Direct Inheritance
Inherited from nokia.maps.map.Object:
destroy
getBoundingBox
getDisplays
getParent
isAdded
isVisible
CHANGE_SPATIAL
CHANGE_VISUAL
CHANGE_ZINDEX
visibility
zIndex
Indirect Inheritance
Inherited from nokia.maps.dom.DragEventTarget:
drag
dragend
dragenter
dragleave
dragover
dragstart
drop
Inherited from nokia.maps.dom.EventTarget:
addListener
addListenerNS
addListeners
disableDrag
disableUserSelect
dispatch
enableDrag
enableUserSelect
hitTest
insertListener
insertListenerNS
removeListener
removeListenerNS
draggable
eventListener
isEventTarget
parentNode
parentNodes
Inherited from nokia.maps.dom.MouseEventTarget:
click
dblclick
longpress
mousedown
mouseenter
mouseleave
mousemove
mouseout
mouseover
mouseup
mousewheel
Constructor Detail
This method creates a marker object.
new nokia.maps.map.Marker(coord, [props])
Parameters:
| {nokia.maps.geo.Coordinate} | coord | An object containing the geographical coordinates of the marker |
| {nokia.maps.map.Marker.Properties} | [props] | An object containing the initial values of marker properties |
Method Detail
getDisplayBoundingBox
(display)
: nokia.maps.util.Rectangle
This method retrieves the bounding box of the marker icon for the display
specified by the caller.
Parameters:
| {nokia.maps.map.Display} | display | The display for which the bounding box of the marker should be determined |
Returns:
| {nokia.maps.util.Rectangle} |
A rectangle object containing the pixel dimensions on the maker or null
if the marker is not part of the display specified by the caller or if
the marker has no icon
|
getDisplayOffset
(display, x, y)
The method calculates the pixel offset between the screen coordinates supplied by the
caller and those of the given marker.
Parameters:
| {nokia.maps.map.Display} | display | The display for which the offset should be calculated |
| {Object} | x | The x position as a number of pixels from the top-left corner of the display |
| {Object} | y | The y position as a number of pixels from the top-left corner of the display |
Returns:
An object (nokia.maps.util.Point) that represents the difference
between the screen coordinates supplied by the caller and the screen coordinates
of the given marker, or null if the marker is not visible in
the specified display
|
getIconForRendering
([doc])
: nokia.maps.gfx.Image
The method returns the icon for the given marker bound to the document specified by
the caller.
Parameters:
| {Document} | [doc]: document | The document to which the given marker is attached |
Returns:
| {nokia.maps.gfx.Image} | The icon image for the marker bound to the given document |
hitTest
(display, x, y, [tolerance])
The method tests if the given marker (its hit area) covers the location specified by
the caller. If no hit area (
map.Marker.hitArea) is defined, the entire
screen bounding box within which of the marker appears is taken into account.
Parameters:
| {nokia.maps.map.Display} | display | The display within which to carry out the check |
| {Number} | x | The X component of the screen coordinate in pixels |
| {Number} | y | The Y component of the screen coordinate in pixels |
| {Number} | [tolerance]: 0 | The tolerance to use for hit testing as a number of pixels |
Returns:
A {Boolean} whose value indicates if the given marker covers the specified location
(true) or not (false)
|
Field Detail
nokia.maps.util.IPoint
anchor
The anchor point of this marker. The marker's icon is positioned on the map in relation
to this anchor point. By default the anchor references the top left corner of the image.
nokia.maps.gfx.Image | Image | String
icon
The image that indicates the marker's location on the map (makes the marker visible).
NOTE: Either a URL of a bitmap image or an SVG mark-up string can be used when passing
a {String} as the value of this property.
