Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: UI

Table of Contents

Class: UI

H.ui.UI

new H.ui.UI (map, opt_options)

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'
Returns:
Type Description
H.ui.UI The UI instance configured with the default controls

addBubble (bubble)

This method adds an info bubble to the UI.

Name Type Description
bubble H.ui.InfoBubble

The info bubble to be added

addControl (name, control)

This method appends a control to the UI.

Name Type Description
name string

The name under which to register the control

control H.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 removeEventListener or dispose on the given object when you no longer need it.

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

capture (canvas, pixelRatio, callback, opt_errback)

This method is used to capture the element view.

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 () 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
name string

The name under which the control was registered

Returns:
Type Description
H.ui.Control | undefined The retrieved control object or undefined if the control does not exist.

getElement ()Element | undefined

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

removeBubble (bubble)

This method removes a previously added info bubble from the UI.

Name Type Description
bubble H.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
name string

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 EventTarget instance.

setDirection (opt_direction)

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_direction string optional

The "direction" to use. When value is not specified, we detect it automatically from the inherited CSS property of the map container.

See:

setUnitSystem (unitSystem)

This method sets the distance measurement system for the given UI object.

Name Type Description
unitSystem H.ui.UnitSystem

The distance measurement system to use

toggleUnitSystem ()

This method toggles distance measurement system between H.ui.UnitSystem.METRIC and H.ui.UnitSystem.IMPERIAL.

Type Definitions

H.ui.UI.Options Object

Optional parameters to be passed to the UI constructor.

Properties:
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert