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 |
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 |
Throws:
-
if the specified base URL is invalid.
Extends
Members
-
The state of the style.
Properties:
Name Description ERRORloading/parsing of the style config failed
INITstyle is not loaded yet
LOADINGstyle is loading
READYstyle 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
removeEventListenerordisposeon the given object when you no longer need it.Name Type Description typestring The name of the event
handlerfunction An event handler function
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject 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
EventTargetobject is being disposed.Name Type Description callbackfunction The callback function.
opt_scopeObject optional An optional scope for the callback function
-
dispatchEvent (evt) inherited
-
This method dispatches an event on the
EventTargetobject.Name Type Description evtH.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
EventTargetmay need to override this method in order to remove references to DOM Elements and additional listeners. -
Returns the style base URL.
Returns:
Type Description string | undefined -
To get the current style configuration as a JavaScript Object, or
nullif there was an error loading/parsing the style configuration.Note that the copy of the configuration is returned.
Returns:
Type Description T -
getState ()H.map.render.Style.State
-
Returns the state of the current style.
Returns:
Type Description H.map.render.Style.State -
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
EventTargetinstance.Name Type Description typestring The name of the event
handlerfunction A previously added event handler
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject optional An object defining the scope for the handler function
Events
-
Event fired when style changes
Type:
-
Event fired when error occurs during style load, parsing, etc.
Type: