M/layer/LayerGroup~LayerGroup


import LayerGroup from 'M/layer/LayerGroup';

Represents a group of layers, of any type. If a group is already added to a Map, layers added to that group are automatically added to the map, and layers removed from the group, are automatically removed from the map. Elements inside the group are considered children of that group.

new LayerGroup(userParameters)

facade/js/layer/LayerGroup.js, line 24
Name Type Description
userParameters string | Mx.parameters.Layer

parameters provided by the user

Extends

  • M.facade.Base

Members

collapsed{Boolean}

'true' to display the group collapsed in the TOC, 'false' to display it expanded

id{String}

Id for this LayerGroup, must be bunique

order{Number}

Position of the group in the TOC

parent{M.layer.Group}

Parent group of this group, if any

title{String}

Title of the group, to be displayed in TOC

zIndex_{Number}

Methods

module:M/layer/LayerGroup~LayerGroup.findGroupById(Id, layerGroup)

facade/js/layer/LayerGroup.js, line 316

Searchs a group by its id, recursively if there are nested groups.

Name Type Description
Id Number
layerGroup Array.<LayerGroup>

array of groups to perform the search

addChild(layer, index)

facade/js/layer/LayerGroup.js, line 187

Adds a child to the group

Name Type Default Description
layer M.Layer | M.LayerBase

Layer to add to the group

index Number last position

Position to add the layer to, starting from 0

addChildren(children)

facade/js/layer/LayerGroup.js, line 259

Adds children to the group

Name Type Description
children Array.<(M.LayerBase|M.LayerGroup)>

addTo(map)

facade/js/layer/LayerGroup.js, line 128

Sets the map object of the group

Name Type Description
map M.Map

deleteChild(child)

facade/js/layer/LayerGroup.js, line 218

Deletes a child from the group

Name Type Description
child M.LayerBase | M.LayerGroup

Child to delete

deleteChildren(children)

facade/js/layer/LayerGroup.js, line 236

Deletes children from the group

Name Type Description
children Array.<(M.LayerBase|M.LayerGroup)>

children to delete

destroy()

facade/js/layer/LayerGroup.js, line 304

Destroys the group and all its layers

getAllLayers(){Array.<M.LayerBase>}

facade/js/layer/LayerGroup.js, line 286

Returns all those children that are instances of LayerBase, whether they are direct children of the group, or children from inner groups.

getChildren(){Array.<(M.LayerBase|M.LayerGroup)>}

facade/js/layer/LayerGroup.js, line 274

Returns all the children inside the group

getZIndex(){Number}

facade/js/layer/LayerGroup.js, line 175

Gets the zIndex of the group, which is the lowest zIndex of its layers

Returns:
zIndex of the group

setVisible(visibility)

facade/js/layer/LayerGroup.js, line 145

Sets the visibility for the LayerGroup and all of its layers.

Name Type Description
visibility boolean

Visibility to set

setZIndex(zIndex)

facade/js/layer/LayerGroup.js, line 157

The Z-index is applied to the first layer of the group, then it is increased by one and applied to the next layer of the group, and so on.

Name Type Description
zIndex Number

ungroup(child)

facade/js/layer/LayerGroup.js, line 247

Moves a child out of a group, to the root level of the toc

Name Type Description
child M.LayerBase | M.LayerGroup