Private
constructorThe list of direct children of the node. The children are ordered according to the painting order (the bottom layer is the first element in the array). Note that also the nodes that are not visible will be included.
The node's ID (immutable). This ID was configured at construction time and is unique over the whole layer tree. If no ID was given, a UUID will have been generated automatically.
The node's label. This label was configured at construction time. If no label was given, the label will correspond to the layer's ID.
The parent of this node or null
. This property
will be null
if this node has not been added as the child of another
node yet.
Denotes what PaintRepresentations are available for this layer. This usually depends on the type of layer or the painter configuration on the layer
The LayerTreeNodeType
of this layer. The value is LAYER_GROUP
.
Denotes whether the node is visible. This can be considered to be the master visibility switch: Setting this to false makes the layer entirely invisible. If it is true, the visible paint representations will be visible.
This property does not reflect whether this node's parent is visible as well, If this is desired, use visibleInTree instead.
Denotes whether this layer is visible on the map. This method will only return true if this layer and every parent layer up to the root of the layer tree is visible.
If visibleInTree is set to true, this will ensure that every parent LayerTreeNode up to the of the tree is configured to be visible as well.
Accepts the given visitor on this LayerTreeNode.
The visitor instance that must be used to process this
either LayerTreeVisitor.ReturnValue.CONTINUE or LayerTreeVisitor.ReturnValue.ABORT
Add a node to the LayerGroup
The LayerTreeNode to be added
Optional
position: "top" | "bottom" | "above" | "below"The position where the layer will be added. Possible
options are: "top", "bottom" "above", "below". With the last
two options, the positionReference
parameter is
mandatory. If no position parameter is present, "top" is assumed.
Optional
positionReference: LayerTreeNodeThe reference layer in case "above" or "below" is passed to addLayer.
Optional
noEvent: booleanDo not fire an event when a layer is added.
Verifies whether the node can be added at the specified position. This check does not modify
the LayerGroup. This check takes into account the ID uniqueness and the ordering rules for layers that are
applicable to the entire LayerTree
. Layers of type LayerType.BASE
must always be positioned at the bottom of the LayerTree
.
The LayerTreeNode to be added
Optional
position: "top" | "bottom" | "above" | "below"The position where the layer could be added. Possible
options are: "top", "bottom" "above", "below". With the last
two options, the positionReference
parameter is
mandatory. If no position parameter is present, "top" is assumed.
Optional
positionReference: LayerTreeNodeThe reference layer in case "above" or "below" is passed to addLayer.
whether the node can be added.
Verifies whether the node can be moved to the specified position. This check does not modify
the LayerGroup. This check takes into account the ordering rules for layers that are applicable
to the entire LayerTree
. Layers of type
LayerType.BASE
must always be positioned at the bottom of the LayerTree
.
The LayerTreeNode to be added
Optional
position: "top" | "bottom" | "above" | "below"The position where the layer could be moved. Possible
options are: "top", "bottom" "above", "below". With the last
two options, the positionReference
parameter is
mandatory. If no position parameter is present, "top" is assumed.
Optional
positionReference: LayerTreeNodeThe reference layer in case "above" or "below" is passed to addLayer.
whether the node can be moved
Returns the layer with the given ID if that layer is this node or one of its children. Note that the layer's ID does not correspond with the layer's label.
The id of the layer that you want to retrieve.
the requested layer or undefined if it is not present in the tree
Returns the layer group with the given ID if that layer is this node or one of its children.
The id of the layer group that you want to retrieve.
the requested layer group or undefined if it is not present in the tree
2014.0
Returns the layer tree node with the given ID if that layer is this node or one of its children. This may be a layer-group or a layer.
The id of the layerTreeNode that you want to retrieve.
the requested layerTreeNode or undefined if it is not present in the tree
2014.0
Indicates whether the specified paint representation is supported for this layer. It returns always true since a LayerGroup is a collection of LayerTreeNodes. In other words, a group can support all the possible paint representations of its children.
the paint representation
true
in any case
Indicates whether the specified paint representation is visible.
The paint representation
true
when paintRepresentation
is supported
and visible, false
otherwise
Indicates whether the specified paint representation is visible on the map. This method will only return true if this paint representation is visible for this layer and every parent layer up to the layer tree.
The paint representation
true
when paintRepresentation
is supported
and visible, false
otherwise
Move a node that belongs to the same map to another location in its layer tree.
The layer to be moved
Optional
position: "top" | "bottom" | "above" | "below"The position where the layer must be moved to.
Possible options are: "top", "bottom", "above", "below".
With the last two options, the positionReference
parameter is mandatory.
If no position parameter is present, "top" is assumed.
Optional
positionReference: LayerTreeNodeThe reference layer tree node in case "above" or "below" is passed to
moveChild
.
If the reference node is not a child of this layer group, the given layerTreeNode will be moved to the parent
group of the reference node.
Optional
noEvent: booleanDo not fire an event when a layer is moved.
Removes a child from this node.
The node to be removed.
Optional
noEvent: booleando not fire an event when the layer is removed.
Sets the visibility of a specific paint representation. This allows for example to only show the PaintRepresentation.BODY of a layer and not the PaintRepresentation.LABEL:
var layer = ...;
layer.setPaintRepresentationVisible( PaintRepresentation.BODY, true );
layer.setPaintRepresentationVisible( PaintRepresentation.LABEL, false );
The renderer-type of the layer. Must be one of the supported paint representations.
the new visible state of the paint representation
Sets the visibility of a specific paint representation in a layer tree. If it set to true, this will ensure that the paint representation of every parent LayerTreeNode up to the roof of the tree is configured to be visible as well.
The renderer-type of the layer. Must be one of the supported paint representations.
the new visible state of the paint representation
Accepts the given visitor on the children of this
.
The visitor which will receive the callbacks for the children.
The order in which the children need to be traversed.
Wait until this layer or layer group is finished with all possible work related to any change that happened before this call.
At that moment, the screen is up-to-date with all changes.
map.mapNavigator.fit({ bounds: somewhere });
map.layerTree.whenReady().then(makeScreenshot);
or
layer.painter.invalidateAll();
layer.whenReady().then(alert);
or
layer.model.add(newFeature);
layer.whenReady().then(alert);
This call can be used to have a reliable, programmatic way to wait for all work leading up to the call to be reflected on the screen.
A promise that resolves to the LayerTreeNode when all current work is done
Registers a callback function for a given event type.
the event type to register on
the callback function to register
Rest
...args: any[]Optional
context: anythe context in which the callback function should be invoked implementation dependent.
a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.
Event that indicates that a node was added to the tree.
the 'NodeAdded' event
the callback to be invoked when a node is added to the tree.
Optional
context: anyvalue to use as this when executing callback
Event that indicates that a node was added to the tree.
the 'NodeRemoved' event
the callback to be invoked when a node is removed from the tree.
Optional
context: anyvalue to use as this when executing callback
Event that indicates that a node was moved in the tree.
the 'NodeMoved' event
the callback to be invoked when a node is moved in the tree.
Optional
context: anyvalue to use as this when executing callback
A layer tree. that acts as the root of all layers in a Map.
The 'layerTree' property of Map is an instance of this type. It is not possible to create your own LayerTree.