This class encapsulates map UI functionality.
| Name | Type | Description |
|---|---|---|
map |
H.Map |
An object representing the map |
opt_options |
H.ui.UI.Options |
optional
An optional object containing the initialization parameters. |
Extends
Implements
Methods
-
H.ui.UI.createDefault (map, defaultLayers, opt_locale)H.ui.UI static
-
This function creates the default UI including the zoom control, map settings control and scalebar. The default controls are assigned the following values:
- Zoom control:
- id: 'zoom'
- alignment: 'right-middle'
- Map settings control:
- id: 'mapsettings'
- alignment: 'bottom-right'
- Scalebar:
- id: 'scalebar'
- alignment: 'bottom-right'
Name Type Description mapH.Map The map instance to which to append the UI
defaultLayersObject The default layers obtained via
H.service.Platform#createDefaultLayers.opt_localeH.ui.i18n.Localization | string The language to use (or a full localization object).
Returns:
Type Description H.ui.UI The UI instance configured with the default controls - Zoom control:
-
This method adds an info bubble to the UI.
Name Type Description bubbleH.ui.InfoBubble The info bubble to be added
-
This method appends a control to the UI.
Name Type Description namestring The name under which to register the control
controlH.ui.Control The control to add to the UI
-
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
-
This method is used to capture the element view.
Name Type Description canvasHTMLCanvasElement The HTML Canvas element to draw the view of the capturable element.
pixelRationumber The pixel ratio to use for over-sampling for high-resolution displays, the default is
window.devicePixelRatio.callbackfunction(HTMLCanvasElement) A callback function to call once the result of capture is ready.
opt_errbackfunction(string) optional A callback function to call if error occurred during capture.
-
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 () overrides
-
This method disposes of the given UI object, including currently open info bubbles and controls attached to the UI.
-
getBubbles ()Array.<!H.ui.InfoBubble>
-
This method retrieves a list of info bubble objects which are currently attached to the UI.
Returns:
Type Description Array.<!H.ui.InfoBubble> A list object containing the retrieved info bubbles -
getControl (name)H.ui.Control | undefined
-
This method retrieves a UI control which was previously registered with the provided name.
Name Type Description namestring The name under which the control was registered
Returns:
Type Description H.ui.Control | undefined The retrieved control object or undefinedif the control does not exist. -
This method retrieves the root element of the user interface.
Returns:
Type Description Element | undefined The root element of the user interface or undefined after the UI was disposed. -
getMap ()H.Map
-
This method retrieves the map instance to which the UI was added.
Returns:
Type Description H.Map An object representing the map instance -
getUnitSystem ()H.ui.UnitSystem
-
This method retrieves the current distance measurement system for the given UI instance.
Returns:
Type Description H.ui.UnitSystem The identifier of the distance measurement system currently in use -
This method removes a previously added info bubble from the UI.
Name Type Description bubbleH.ui.InfoBubble The info bubble to be removed
-
removeControl (name)H.ui.Control | undefined
-
This method removes a previously registered control from the UI object.
Name Type Description namestring The name under which the control was previously registered
Returns:
Type Description H.ui.Control | undefined An object representing the removed control or undefined if not found -
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
-
Sets the "direction" CSS property on UI DOM element for the correct rendering of the languages written from right to left (like Hebrew or Arabic).
Name Type Description opt_directionstring optional The "direction" to use. When value is not specified, we detect it automatically from the inherited CSS property of the map container.
-
This method sets the distance measurement system for the given UI object.
Name Type Description unitSystemH.ui.UnitSystem The distance measurement system to use
-
This method toggles distance measurement system between
H.ui.UnitSystem.METRICandH.ui.UnitSystem.IMPERIAL.
Type Definitions
-
Optional parameters to be passed to the UI constructor.
Properties:
Name Type Argument Description unitSystemH.ui.UnitSystem <optional>
An optional value indicating the distance measurement system for the UI, the default is
H.ui.UnitSystem.METRICzoomH.ui.ZoomControl.Options | boolean <optional>
A value indicating the zoom level
zoomrectangleH.ui.ZoomRectangle.Options | boolean <optional>
An object containing
ZoomRectangleinitialization optionsmapsettingsH.ui.MapSettingsControl.Options | boolean <optional>
An object containing
MapSettingControlinitialization optionsscalebarH.ui.ScaleBar.Options | boolean <optional>
An object containing
ScaleBarinitialization optionsdistancemeasurementH.ui.DistanceMeasurement.Options | boolean <optional>
An object containing
DistanceMeasurementinitialization optionslocaleH.ui.i18n.Localization | string <optional>
Defines the language in which UI is to be rendered. It can be a predefined
H.ui.i18n.Localizationobject with a custom translation map, or one of following strings, 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If the property is not specified, the UI uses 'en-US' by default