Maps API for JavaScript Developer's Guide

H.ui.UI

Class Summary

Extends: H.util.EventTarget

Implements: H.util.ICapturable

This class encapsulates map UI functionality.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

getElement () : {Element}

This method retrieves the root element of the user interface.

getMap () : {H.Map}

This method retrieves the map instance to which the UI was added.

getUnitSystem () : {H.ui.UnitSystem}

This method retrieves the current distance measurement system for the given UI instance.

setUnitSystem (unitSystem)

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

toggleUnitSystem ()

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

addBubble (bubble)

This method adds an info bubble to the UI.

removeBubble (bubble)

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

getBubbles () : {Array<H.ui.InfoBubble>}

This method retrieves a list of info bubble objects which are currently attached to the UI.

addControl (name, control)

This method appends a control to the UI.

removeControl (name) : {H.ui.Control}

This method removes a previously registered control from the UI object.

getControl (name) : {H.ui.Control}

This method retrieves a UI control which was previously registered with the provided name.

static createDefault (map, mapTypes, opt_locale) : {H.ui.UI}

This function creates the default UI including the zoom control, map settings control and scalebar and panorama discovery control. The default controls are assigned the following values:

Class Description

This class encapsulates map UI functionality.

Constructor Details

H.ui.UI(map, opt_options)

Parameters:
 
map:
{H.Map}
 
An object repreenting the map
opt_options:
{H.ui.UI.Options=} [optional]
 
An optional object containing the initialization parameters.

Method Details

getElement () : {Element}

This method retrieves the root element of the user interface.

Returns:
 
{Element}
The root element of the user interface

getMap () : {H.Map}

This method retrieves the map instance to which the UI was added.

Returns:
 
{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:
 
{H.ui.UnitSystem}
The identifier of the distance measurement system currently in use

setUnitSystem (unitSystem)

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

Parameters:
 
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.

addBubble (bubble)

This method adds an info bubble to the UI.

Parameters:
 
bubble:
{H.ui.InfoBubble}
 
The info bubble to be added

removeBubble (bubble)

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

Parameters:
 
bubble:
{H.ui.InfoBubble}
 
The info bubble to be removed

getBubbles () : {Array<H.ui.InfoBubble>}

This method retrieves a list of info bubble objects which are currently attached to the UI.

Returns:
 
{Array<H.ui.InfoBubble>}
A list object containing the retrieved info bubbles

addControl (name, control)

This method appends a control to the UI.

Parameters:
 
name:
{string}
 
The name under which to register the control
control:
{H.ui.Control}
 
The control to add to the UI

removeControl (name) : {H.ui.Control}

This method removes a previously registered control from the UI object.

Parameters:
 
name:
{string}
 
The name under which the control was previously registered
Returns:
 
{H.ui.Control}
An object representing the removed control

getControl (name) : {H.ui.Control}

This method retrieves a UI control which was previously registered with the provided name.

Parameters:
 
name:
{string}
 
The name under which the control was registered
Returns:
 
{H.ui.Control}
The retrieved control object or undefined if the control does not exist.

static createDefault (map, mapTypes, opt_locale) : {H.ui.UI}

This function creates the default UI including the zoom control, map settings control and scalebar and panorama discovery control. 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'
  • Pano:
    • id: 'panorama'
    • alignment: 'top-right'
Parameters:
 
map:
{H.Map}
 
The map instance to which to append the UI
mapTypes:
{Object<H.service.MapType>}
 
The map types to use
opt_locale:
{(H.ui.i18n.Localization | string=)}
 
The language to use (or a full localization object).
Returns:
 
{H.ui.UI}
The UI instance configured with the default controls