A group is a container for other map objects. Its visibility, zIndex and object-order affect the contained map objects.
| Name | Type | Description |
|---|---|---|
opt_options |
H.map.Group.Options |
optional
An optional object containing initialization values |
Throws:
-
-
if the option's "objects" property is specified but not an Array of
H.map.Objectinstances
-
-
-
if the options "provider" and "objects" are specified, but the provider for one or more of the contained objects and the group's provider are different and neither
nullnor an instance ofH.map.provider.LocalObjectProvider
-
Extends
Members
-
draggable boolean inherited
-
Indicates whether the map object will be considered as target for drag events. The default value is
false
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
-
addObject (object)H.map.Object
-
This method adds an object to the group.
Name Type Description objectH.map.Object Throws:
-
-
if the argument is not an instance of
H.map.Object
-
-
-
if the provider for the object to be added is different from the group's provider and is neither
nullnor an instance ofH.map.provider.LocalObjectProvider
-
Returns:
Type Description H.map.Object a reference to the appended object -
-
This method appends a list of objects to the given group.
Name Type Description objectsArray.<!H.map.Object> Throws:
-
-
if the argument is not an Array of
H.map.Objectinstances
-
-
-
if the options "provider" and "objects" are specified, but the provider for one or more of the objects to be added is different from the group's provider and neither
nullnor an instance ofH.map.provider.LocalObjectProvider
-
-
-
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
-
compareZOrder (other)number inherited
-
This method compares the rendering z-order of the given object with another object. (The 'given object' mean the object on which the method has been invoke.)
Name Type Description otherH.map.Object The map object with which to compare the given object.
Returns:
Type Description number A value lower than 0indicates that the given object has a lower z-order.0indicates that both objects have the same z-order. A value greater than0, indicates that the given object has a higher z-order. -
This method checks whether the received object is an inclusive descendant of the given object.
Name Type Description object* The object to check.
Returns:
Type Description boolean trueif the given object is contained in the given object, otherwisefalse -
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. -
This method invokes a provided callback once per object in add order. The callback receives the following arguments:
- the currently traversed object
- the index of the object
- the group itself
Name Type Description callbackfunction(H.map.Object, number, H.map.Group) opt_recursiveboolean optional A Boolean value indicating whether sub-groups should be traversed recursively
opt_context* optional The context to use as "this" within the callback
-
getBoundingBox ()H.geo.Rect
-
This method retrieves the rectangular bounding box for the group. The bounding box is the smallest rectangle that covers all objects. If the group does not contain any objects, the method returns
null.Returns:
Type Description H.geo.Rect A rectangle that covers all objects in the group or nullif the group contains no objects -
getData ()* inherited
-
To retrieve arbitrary data associated with the given object.
Returns:
Type Description * The associated data. -
getId ()* inherited
-
This method retrieves the ID of the given object.
Returns:
Type Description * The identifier of the given object. -
getInvalidations ()H.map.provider.Invalidations inherited
-
This method retrieves the invalidation states for the given object.
Returns:
Type Description H.map.provider.Invalidations An object containing the invalidation states -
getObjects (opt_recursive)Array.<!H.map.Object>
-
This method retrieves a list of all objects of this group. On groups with many children this method can cause a higher memory and CPU consumption. Alternatively you case use
H.map.Group#forEachName Type Description opt_recursiveboolean optional Indicates whether objects in sub-groups are also collected .
Returns:
Type Description Array.<!H.map.Object> -
getParentGroup ()H.map.Group inherited
-
This method retrieves the parent group which contains the given object or
nullif the object is not contained in any group.Returns:
Type Description H.map.Group An object representing the containing group object or nullif the given object is not contained in any group. -
getProvider ()H.map.provider.ObjectProvider inherited
-
This method obtains the current provider of the given object.
Returns:
Type Description H.map.provider.ObjectProvider An object representing the provider -
getRemoteId ()number | string | undefined inherited
-
This method retrieves the remote ID of the given object.
Returns:
Type Description number | string | undefined The remote identifier of the given object. -
getRootGroup ()H.map.Object inherited
-
The root object to which the given object is attached or the object itself if it is not attached to another.
Returns:
Type Description H.map.Object An object representing the root group for the given object or the given object if it is not part of a group. -
getVisibility (opt_effective)boolean inherited
-
This method retrieves a value indicating the visibility of the given object.
Name Type Description opt_effectiveboolean optional Indicates whether the effective visibility is requested, defaults to
false. If set totruethe visibility of all nesting parent groups on the ancestor axis are also taken into account: The object is only visible if the object itself and all of its nesting parent groups are visible.Returns:
Type Description boolean A value indicating whether the object is visible -
getVolatility (opt_effective)boolean inherited
-
To obtain the volatility indicator of the object.
Name Type Description opt_effectiveboolean optional Indicates whether the effective volatility is requested, defaults to
false. If set totruethe volatility of all nesting parent groups on the ancestor axis are also taken into account: The object is volatile if the object itself or at least one of its nesting parent groups is volatile.Returns:
Type Description boolean -
getZIndex ()number | undefined inherited
-
This method retrieves the z-index of the given object.
Returns:
Type Description number | undefined A value reflecting the z-index of the given object. -
This method invalidates the given map object.
Name Type Description flagsH.math.BitMask.<!H.map.provider.Invalidations.Flag> The value indicates the types of invalidations to the given object.
Returns:
Type Description boolean Indicates whether a validation was executed (only if the object has a provider) -
This method removes all objects from the group.
-
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
-
removeObject (object)H.map.Object
-
This method removes an object from the group.
Name Type Description objectH.map.Object The object to remove
Throws:
-
if the object specified by the caller is not a object of this group
Returns:
Type Description H.map.Object A reference to the removed object -
-
This method removes objects from the group.
Name Type Description objectsArray.<!H.map.Object> A list of objects to remove
Throws:
-
if the list of objects to remove is not an array or it contains objects that are not part of the group
-
-
setData (data)H.map.Object inherited
-
This method stores arbitrary data associated with the given object.
Name Type Description data* The data to be stored
Returns:
Type Description H.map.Object The given map object itself -
setRemoteId (id)H.map.Object inherited
-
This method sets the ID that identifies the given object in a remote service.
Name Type Description idnumber | string The identifier to assign to the given object.
Returns:
Type Description H.map.Object The given map object itself -
setVisibility (opt_visibility)H.map.Object inherited
-
This method sets the visibility of the given object.
Name Type Description opt_visibilityboolean optional Indicates whether the map object should be visible, the default value is
false.Returns:
Type Description H.map.Object The given object -
setVolatility (opt_volatility)H.map.Object inherited
-
To set the volatility indicator of the object
Name Type Description opt_volatilityboolean optional The volatility value to set,
truemeans volatile,falsemeans non-volatile. The default value isfalse.Returns:
Type Description H.map.Object The given object -
setZIndex (zIndex)H.map.Object inherited
-
This method sets the z-index of the given object.
Name Type Description zIndexnumber | undefined A value indicating the new z-index
Returns:
Type Description H.map.Object The given object -
To obtain a GeoJSON
FeatureCollectionobject representing the given group.Name Type Description opt_callbackfunction(*) optional Callback called with the object's data as argument. It must return either a valid JSON object or
nullwhich will be set as value for the Feature's properties key.- See:
-
-
All the direct objects in its collection will be converted into GeoJSON
Featureobjects while the other objects in their sub-trees will be converted into geometries using the following schema:- Instances of
H.map.Groupwill be converted intoGeometryCollectionobjects and theirgeometriesproperties will be recursively populated with the objects in their sub-trees. - Any other instances of
H.map.Objectwill be converted into their respective geometries.
- Instances of
-
Throws:
-
-
If the provided callback is not a function.
-
-
-
If the callback (if provided) returns an invalid JSON object/null or (if not) the data of any object in its collection is an invalid JSON object.
- Type
- Error
-
Returns:
Type Description Object A GeoJSON FeatureCollectionobject representing the given group.
Type Definitions
-
Options used to initialize a group object.
Properties:
Name Type Argument Description minnumber <optional>
The minimum zoom level at which the object is visible, the default is
-Infinitymaxnumber <optional>
The maximum zoom level at which the object is visible, the default is
Infinityvisibilityboolean <optional>
Indicates whether the map object is visible, the default is
trueA map object is only treated as visible, if it self and all of its nesting parent groups are visible.volatilityboolean <optional>
Indicates whether the map object is volatile, the default is
false. A volatile map object has frequently invalidations (for example geometry or style changes). A map object is already treated as volatile, if it self or one of its nesting parent groups is volatile.zIndexnumber <optional>
The z-index value of the map object, the default is
undefined.providerH.map.provider.Provider <optional>
The provider of the given group object. This property is only needed if a custom implementation of
ObjectProviderwants to instantiate an object.data* Optional arbitrary data to be stored with the group object. This data can be retrieved by calling
getData().objectsArray.<H.map.Object> <optional>
A list of map objects to add initially to this group.