Class: MapSettingsControl
- Last UpdatedMay 21, 2025
- 6 minute read
This class represents a menu control allowing the user to select the base map types as well as add additional layers on top.
Name | Type | Description |
---|---|---|
opt_options |
H.ui.MapSettingsControl.Options |
optional
Optional initialization parameters for the given control object |
Extends
Methods
-
addChild (child)H.ui.base.Container inherited
-
This method adds a child element to be rendered within the given container element.
Name Type Description child
H.ui.base.Element The child element to be added
Returns:
Type Description H.ui.base.Container This container instance -
addClass (className)H.ui.base.Element inherited
-
This method adds a CSS class to the given UI element (if it is not already present).
Name Type Description className
string The name of the CSS class to add
Returns:
Type Description H.ui.base.Element The given UI element instance -
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method sets a listener for a specific event triggered by the given element.
-
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. -
getAlignment ()H.ui.LayoutAlignment inherited
-
This method retrieves a value indicating layout alignment for the given control.
Returns:
Type Description H.ui.LayoutAlignment A value indicating layout alignment for the given control -
getChildren ()Array.<!H.ui.base.Element> inherited
-
This method retrieves the child element collection of the given container.
Returns:
Type Description Array.<!H.ui.base.Element> The child elements of the given container -
getData ()* inherited
-
This method retrieves previously stored arbitrary data from the given element.
Returns:
Type Description * The previously stored data object or null
if no data was stored. -
getElement ()HTMLElement inherited
-
This method retrieves the HTML element that represents the given UI element.
Note: If the UI element has not been rendered, the method retrieves
null
.Returns:
Type Description HTMLElement An object representing the given element instance or null
-
getLocalization ()H.ui.i18n.Localization inherited
-
This method retrieves the localization object which corresponds to the current locale of the UI.
Returns:
Type Description H.ui.i18n.Localization An object representing the location settings -
This method retrieves the map object to which the given control is attached.
Note: This method returns
null
if called before any controls have been added to a UI object.Returns:
Type Description H.Map An object representing the map to which the given control is attached -
getVisibility ()boolean inherited
-
This method retrieves a value indicating if the given element is visibile.
Returns:
Type Description boolean true
if the given element is visible, otherwisefalse
-
isDisabled ()boolean inherited
-
This method retrieves a value indicating if the given UI element is disabled.
Returns:
Type Description boolean true
if the element is disabled,false
otherwise -
onUnitSystemChange (unitSystem) inherited
-
This abstract method can be overridden by deriving classes to be invoked when the UI object distance measurement system changes.
Name Type Description unitSystem
H.ui.UnitSystem An identifier indicating the distance measurement system the UI currently uses
-
removeChild (child) inherited
-
This method removes a child element from the given container's child element collection.
Name Type Description child
H.ui.base.Element The child element to be removed
-
removeClass (className)H.ui.base.Element inherited
-
This method removes a CSS class from the given UI element (if it is present).
Name Type Description className
string The CSS class name to add
Returns:
Type Description H.ui.base.Element The given UI element instance -
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the event target.
-
This method is the concrete implementation of the UI element. It receives the pre-rendered HTML element which may be modified by deriving classes.
Name Type Description element
Element The HTML representation of the given UI element
doc
Document The HTML document into which the give UI element is rendered
-
setAlignment (alignment)H.ui.Control inherited
-
This method sets the layout alignment for the given control.
The alignment within the map view port can be:
+--------------------------------------------------------------------------------+ | "top-left" > > < < "top-center" > > < < "top-right" | | "left-top" "right-top" | | v v | | v v | | | | | | ^ ^ | | ^ ^ | | "left-middle" "right-middle" | | v v | | v v | | | | | | ^ ^ | | ^ ^ | | "left-bottom" "right-bottom" | | "bottom-left" > > < < "bottom-center" > > < < "bottom-right" | +--------------------------------------------------------------------------------+
Elements with the same layout alignments are lined up in the directions of the arrows in the illustration.
Name Type Description alignment
H.ui.LayoutAlignment A value indicating the new alignment of the control
Returns:
Type Description H.ui.Control An object representing the given control instance -
setData (data) inherited
-
This method stores arbitrary data with the given UI element.
Name Type Description data
* The data to be stored
-
setDisabled (opt_disabled, opt_force)H.ui.base.Element inherited
-
This method sets a value indicating if the given UI element is disabled.
Name Type Description opt_disabled
boolean optional true
to disable the element,false
to enable it. Default isfalse
opt_force
boolean optional An optional Boolean flag indicating that the value should be set and propagated even if it is the same as the current state
Returns:
Type Description H.ui.base.Element An object representing the given element instance -
setTabIndex (tabIndex) inherited
-
This method sets the tabIndex of the element. See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex for more details.
Name Type Description tabIndex
number -
setVisibility (visibility) inherited
-
This method sets a value indicating if the given element is visible.
Name Type Description visibility
boolean true
if the given element is visible, otherwisefalse
Type Definitions
-
This object describes an entry of the map settings control. The
label
is used as a translation key for finding the translated label from the UI'sH.ui.i18n.Localization
object. If such text is not found thelabel
is used as is.See
H.ui.UI#getLocalization
andH.ui.i18n.Localization#getKeys
methods for available translation keys.Properties:
Name Type Description label
string A label which describes the layer.
layer
!Array.<!H.map.layer.Layer> | H.map.layer.Layer | undefined A reference to the layer or a list of composed layers (for example
"hybrid.day.raster"
and"hybrid.day.vector"
, provided byH.service.Platform#createDefaultLayers
) to show on the map. If a list of layers is defined and the entry is used within theH.ui.MapSettingsControl.Options#baseLayers
collection then the layer at index 0 is used as base layer. Iflayer
is not specified then the entry is rendered as disabled. -
This typedef defines the configuration options (initialization options) for the
MapSettingsControl
. Entries of thebaseLayers
property are rendered first in the control and selecting any of them changes the map base layer, whereas entries from thelayers
list are rendered afterwards and are added/removed from the map as a separate layers.For example normal map and satellite can be good candidates for passing as
layers
entries, and traffic incidents aslayers
entry, because it can be shown regardless of a base layer type.Properties:
Events
-
alignmentchange inherited
-
This event is fired when control is realigned.
Type: