Maps API for JavaScript Developer's Guide

H.map.Icon

Class Summary

Extends: H.util.EventTarget

A visual representation of the H.map.Marker.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

getState () : {H.map.Icon.prototype.State}

Retrieves the bitmap loading state of the given icon object.

getBitmap () : {?(HTMLImageElement | HTMLCanvasElement)}

Retrieves the bitmap of the give icon or null if the bitmap is not yet ready (see H.map.Icon#getState)

getSize () : {?H.math.Size}

Retrieves the size of the given icon or null if a size was not specified in the constructor options and the state of the icon is not H.map.Icon.prototype.State.READY

getAnchor () : {?H.math.Point}

Retrieves the anchor point of the given icon or null if an anchor was not specified in the constructor options and the state of this icon is not H.map.Icon.prototype.State.READY.

getHitArea () : {?H.map.HitArea}

Retrieves the hit area of the icon.

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

dispose ()

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds a callback which is triggered when the EventTarget object is being disposed.

Events Summary

Table 2. Events
Events

statechange : {H.util.Event}

Event fired when the icon bitmap loading state changes, see H.map.Icon#getState

Class Description

A visual representation of the H.map.Marker.

Constructor Details

H.map.Icon(bitmap, opt_options)

Parameters:
 
bitmap:
{!(string | HTMLImageElement | HTMLCanvasElement)}
 
An image URL, an SVG (string), an bitmap image or a canvas.
opt_options:
{H.map.Icon.Options=} [optional]
 
an object containing icon initialization attributes such as width and height, etc.
Throws:
 
{H.lang.InvalidArgumentError}
 
if size, anchor or hitArea is specified with invalid type or values

Method Details

getState () : {H.map.Icon.prototype.State}

Retrieves the bitmap loading state of the given icon object.

Returns:
 
{H.map.Icon.prototype.State}
A value indicating the icon loading state.

getBitmap () : {?(HTMLImageElement | HTMLCanvasElement)}

Retrieves the bitmap of the give icon or null if the bitmap is not yet ready (see H.map.Icon#getState)

Returns:
 
{?(HTMLImageElement | HTMLCanvasElement)}

getSize () : {?H.math.Size}

Retrieves the size of the given icon or null if a size was not specified in the constructor options and the state of the icon is not H.map.Icon.prototype.State.READY

Returns:
 
{?H.math.Size}

getAnchor () : {?H.math.Point}

Retrieves the anchor point of the given icon or null if an anchor was not specified in the constructor options and the state of this icon is not H.map.Icon.prototype.State.READY.

Returns:
 
{?H.math.Point}

getHitArea () : {?H.map.HitArea}

Retrieves the hit area of the icon.

Returns:
 
{?H.map.HitArea}
The the hit area of the icon or null if no hit area is specified.

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
An event handler function
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An object defining the scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
A previously added event handler
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An oject defining the scope for the handler function

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

Parameters:
 
evt:
{(H.util.Event | string)}
 
An object representing the event or a string with the event name

dispose ()

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds a callback which is triggered when the EventTarget object is being disposed.

Parameters:
 
callback:
{!Function}
 
The callback function.
opt_scope:
{Object=} [optional]
 
An optional scope for the callback function

Event Details

statechange: {H.util.Event}

Event fired when the icon bitmap loading state changes, see H.map.Icon#getState