Maps API for JavaScript Developer's Guide

H.map.render.p2d.RenderEngine

Class Summary

Extends: H.map.render.RenderEngine

This class implements a map render engine. It presents a geographic location (camera data from a view model) and renders all map layers in the order in which they are provided in a single 2D canvas element.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

setAnimationDuration (duration)

This method sets the length (duration) for all animations run by the render engine.

getAnimationDuration () : {number}

This method retrieves the current setting indicating the length of animations (duration) run by the the render engine.

setAnimationEase (easeFunction)

This method sets a value indicating the easing to apply to animations run by the render engine.

getAnimationEase () : {function(number) : number}

This method retrieves the current setting representing the easing to be applied to animations.

resetAnimationDefaults ()

This method resets animation settings on the render engine to defaults. duration is set to 300ms and easing to H.util.animation.ease.EASE_OUT_QUAD.

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

render : {H.util.Event}

Fired when one of the layers or the engine (all layers) has been rendered completely. The event target references either the completed layer or the render engine itself

Class Description

This class implements a map render engine. It presents a geographic location (camera data from a view model) and renders all map layers in the order in which they are provided in a single 2D canvas element.

Constructor Details

H.map.render.p2d.RenderEngine(viewPort, viewModel, dataModel, options)

Parameters:
 
viewPort:
{H.map.ViewPort}
 
An object representing the map viewport
viewModel:
{H.map.ViewModel}
 
An object representing a view of the map
dataModel:
{H.map.DataModel}
 
An object encapsulating the data to be rendered on the map (layers and objects)
options:
{H.map.render.RenderEngine.Options}
 
An object containing the render engine initialization options

Method Details

setAnimationDuration (duration)

This method sets the length (duration) for all animations run by the render engine.

Parameters:
 
duration:
{number}
 
A value indicating the duration of animations

getAnimationDuration () : {number}

This method retrieves the current setting indicating the length of animations (duration) run by the the render engine.

Returns:
 
{number}

setAnimationEase (easeFunction)

This method sets a value indicating the easing to apply to animations run by the render engine.

Parameters:
 
easeFunction:
{function(number) : number}
 
A function that alters the progress ratio of an animation. It receives an argument indicating animation progress as a numeric value in the range between 0 and 1 and must return a numeric value in the same range.

getAnimationEase () : {function(number) : number}

This method retrieves the current setting representing the easing to be applied to animations.

Returns:
 
{function(number) : number}
A numeric value in the range 0 to 1

resetAnimationDefaults ()

This method resets animation settings on the render engine to defaults. duration is set to 300ms and easing to H.util.animation.ease.EASE_OUT_QUAD.

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

render: {H.util.Event}

Fired when one of the layers or the engine (all layers) has been rendered completely. The event target references either the completed layer or the render engine itself