Class: Style

H.map.render.Style

new H.map.render.Style (config, opt_baseUrl) abstract

Instances of this class hold style configuration for rendering data on the map. It also provides utility methods for operating with the style.

This is a generic class and type of the style configuration is T.

Name Type Description
config string | T

Either a URL to load the style from, encoded style configuration as string or object describing the style configuration. See H.map.render.webgl.StyleConfig.

opt_baseUrl string optional

The base URL to use for resolving relative URLs in the style like textures, fonts. When URL is passed as a config, it is used as a default base URL, unless defined base URL is specified. Otherwise resources with the relative paths are resolved relative to the page location.

Throws:

if the specified base URL is invalid.

Type
H.lang.InvalidArgumentError

Extends

Members

H.map.render.Style.State number static

The state of the style.

Properties:
Name Description
ERROR

loading/parsing of the style config failed

INIT

style is not loaded yet

LOADING

style is loading

READY

style is ready to be used

Methods

addEventListener (type, handler, opt_capture, opt_scope) inherited

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.

Name Type Description
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

addOnDisposeCallback (callback, opt_scope) inherited

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

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited

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.

getBaseUrl ()string | undefined

Returns the style base URL.

Returns:
Type Description
string | undefined

getConfig ()T

To get the current style configuration as a JavaScript Object, or null if there was an error loading/parsing the style configuration.

Note that the copy of the configuration is returned.

Returns:
Type Description
T

Returns the state of the current style.

Returns:
Type Description
H.map.render.Style.State

load () abstract

Starts loading the style configuration if it was specified as a URL or parsing the style configuration if it was passed encoded string or object.

removeEventListener (type, handler, opt_capture, opt_scope) inherited

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

Name Type Description
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 object defining the scope for the handler function

Events

change

Event fired when style changes

Type:

error

Event fired when error occurs during style load, parsing, etc.

Type: