new LayerTree()
The LayerTree.
Note. This component expects that all layerGroups are permanently visibile.
- Source:
Extends
- React.Component
Members
defaultProps :Object
The default properties.
Type:
- Object
- Source:
getVisibleOlUids
Get the flat array of ol_uids from visible non groupLayers.
- Source:
hasListener
Determines if the target has already registered the given listener for the given eventtype.
- Source:
onCollectionAdd
Listens to the collections add event of a collection. Registers add/remove listeners if element is a collection and rebuilds the treeNodes.
- Source:
onCollectionRemove
Listens to the collections remove event of a collection. Unregisters the events of deleted layers and rebuilds the treeNodes.
- Source:
onLayerChangeVisible
Reacts to the layer change:visible event and calls setCheckedState.
- Source:
propTypes :Object
The properties.
Type:
- Object
- Source:
rebuildTreeNodes
Rebuilds the treeNodes and its checked states.
- Source:
unregisterEventsByLayer
Unregisters the Events of a given layer.
- Source:
Methods
componentDidMount()
Determines what to do on the initial mount.
- Source:
componentWillReceiveProps(nextProps)
Determines what to do with new props.
Parameters:
Name | Type | Description |
---|---|---|
nextProps |
Object | The new props. |
- Source:
componentWillUnmount()
Determines what to do when the component is unmounted.
- Source:
getTreeNodeTitle(layer) → {Element}
Returns the title to render in the LayerTreeNode. If a nodeTitleRenderer has been passed as prop, it will be called and the (custom) return value will be rendered. Note: This can be any renderable element collection! If no function is given (the default) the layer name will be passed.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Base | The layer attached to the tree node. |
- Source:
Returns:
The title composition to render.
- Type
- Element
onCheck(checkedKeys, checked)
Sets the visibility of a layer due to its checked state.
Parameters:
Name | Type | Description |
---|---|---|
checkedKeys |
Array.<String> | Contains all checkedKeys. |
checked |
e | The ant-tree event object for this event. See ant docs. |
- Source:
onDrop(e)
The callback method for the drop event. Layers will get reordered in the map and the tree.
Parameters:
Name | Type | Description |
---|---|---|
e |
Object | The ant-tree event object for this event. See ant docs. |
- Source:
registerAddRemoveListeners(groupLayer)
Registers the add/remove listeners recursively for all ol.layer.Group.
Parameters:
Name | Type | Description |
---|---|---|
groupLayer |
ol.layer.Group | A ol.layer.Group |
- Source:
registerResolutionChangeHandler()
Registers an eventhandler on the ol.View
, which will rebuild the tree
nodes whenever the view's resolution changes.
- Source:
render()
The render function.
- Source:
setLayerVisibility(layer, visiblity)
Sets the layer visibility. Calls itself recursively for groupLayers.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Base | The layer. |
visiblity |
Boolean | The visiblity. |
- Source:
treeNodeFromLayer(layer) → {LayerTreeNode}
Creates a treeNode from a given layer.
Parameters:
Name | Type | Description |
---|---|---|
layer |
ol.layer.Base | The given layer. |
- Source:
Returns:
The corresponding LayerTreeNode Element.
- Type
- LayerTreeNode
treeNodesFromLayerGroup(groupLayer)
Creates TreeNodes from a given layergroup and sets the treeNodes in the state.
Parameters:
Name | Type | Description |
---|---|---|
groupLayer |
ol.layer.Group | A grouplayer. |
- Source: