Package com.luciad.view
Class TLcdLayerTreeNodeUtil
java.lang.Object
com.luciad.view.TLcdLayerTreeNodeUtil
Class with utility methods for working with ILcdLayerTreeNodes. The
methods in this class are all thread-safe.
- Since:
- 9.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsLayerInTree(ILcdLayer aLayer, ILcdLayer aRootNode) Returnstrueif and only if the layeraLayeris an element of the tree with root nodeaRootNode.static intfindSubTreeIndex(ILcdLayerTreeNode aAncestorNode, ILcdLayer aLayer) This method returns the index of the sub tree inaAncestorNodewhich contains the nodeaLayer, or -1 whenaAncestorNodeis not an ancestor ofaLayer.static ILcdLayerTreeNodegetFirstCommonAncestor(ILcdLayer aFirstLayer, ILcdLayerTreeNode aFirstRootNode, ILcdLayer aSecondLayer, ILcdLayerTreeNode aSecondRootNode) Returns the first ancestor that twoILcdLayers have in common.static intgetLayerCount(ILcdLayer aLayer) Returns the total number of layers and layer nodes in the tree with root nodeaLayer, includingaLayergetLayers(ILcdLayerTreeNode aNode) Returns a list containing all the layers underneath the nodeaNode, includingaNode, by using a depth first search (respecting the paintOnTopOfChildren hint of the nodes) over the tree starting at nodeaNodegetLayers(ILcdLayerTreeNode aNode, boolean aIncludeNode) Returns a list containing all the layers underneath the nodeaNodeby using a depth first search (respecting the paintOnTopOfChildren hint of the nodes) over the tree starting at nodeaNodestatic ILcdLayerTreeNodegetParent(ILcdLayer aLayer, ILcdLayerTreeNode aRootNode) Finds the parent node ofaLayerin the tree with root nodeaRootNode.getPath(ILcdLayerTreeNode aFrom, ILcdLayer aTo) Returns a list containing all theILcdLayers to go fromaFromto the layeraTo.static List<ILcdLayerTreeNode> getPathToParent(ILcdLayerTreeNode aFrom, ILcdLayer aTo) Returns a list containing all theILcdLayerTreeNodes to go fromaFromto the parent ofaTo.static booleanisEmptyNode(ILcdLayer aLayer) Returnstruewhen a layer tree node has an empty model, indicating it contains no useful data.
-
Method Details
-
getLayers
Returns a list containing all the layers underneath the node
aNode, includingaNode, by using a depth first search (respecting the paintOnTopOfChildren hint of the nodes) over the tree starting at nodeaNode- Parameters:
aNode- the start node for the search. Must not benull- Returns:
- a list containing all the underlying layers, including the node
aNode - See Also:
-
getLayers
Returns a list containing all the layers underneath the node
aNodeby using a depth first search (respecting the paintOnTopOfChildren hint of the nodes) over the tree starting at nodeaNode- Parameters:
aNode- the start node for the search. Must not benullaIncludeNode-Trueif the givenaNodeshould be part of the returned list.- Returns:
- a list containing all the underlying layers
- See Also:
-
getLayerCount
Returns the total number of layers and layer nodes in the tree with root nodeaLayer, includingaLayer- Parameters:
aLayer- the root node of the tree- Returns:
- the total number of layers and layer nodes in the tree with root node
aLayer
-
getPathToParent
Returns a list containing all theILcdLayerTreeNodes to go fromaFromto the parent ofaTo. The list starts withaFromand ends with the parent node.- Parameters:
aFrom- the starting node of the path. Must be different fromaTo.aTo- the node for which the path to its parent must be found. Must be different fromaFrom.- Returns:
- a list containing all the
ILcdLayerTreeNodes to go fromaFromto the parent ofaTo, ornullwhenaTois not a part of the tree with root nodeaTo
-
getPath
Returns a list containing all theILcdLayers to go fromaFromto the layeraTo. The list starts withaFromand ends withaTo.- Parameters:
aFrom- the starting node of the pathaTo- the end node of the path- Returns:
- a list containing all the
ILcdLayerto go fromaFromto the layeraTo, ornullwhenaTois not a part of the tree with root nodeaTo.
-
getFirstCommonAncestor
public static ILcdLayerTreeNode getFirstCommonAncestor(ILcdLayer aFirstLayer, ILcdLayerTreeNode aFirstRootNode, ILcdLayer aSecondLayer, ILcdLayerTreeNode aSecondRootNode) Returns the first ancestor that twoILcdLayers have in common. When no common ancestor is found, this method will returnnull. This is only possible when the two layers are not part of the same tree. Otherwise the root node will be the common ancestor- Parameters:
aFirstLayer- the first layeraFirstRootNode- the root node of the tree containing the first nodeaSecondLayer- the second layeraSecondRootNode- the root node of the tree containing the second node- Returns:
- the first common ancestor of
aFirstLayerandaSecondLayer, ornullwhen the two layers do not belong to the same tree
-
findSubTreeIndex
This method returns the index of the sub tree inaAncestorNodewhich contains the nodeaLayer, or -1 whenaAncestorNodeis not an ancestor ofaLayer.- Parameters:
aAncestorNode- the ancestor nodeaLayer- the layer- Returns:
- the index of the sub tree in
aAncestorNodewhich contains the nodeaLayeror -1 whenaAncestorNodeis not an ancestor ofaLayer.
-
getParent
Finds the parent node ofaLayerin the tree with root nodeaRootNode.- Parameters:
aLayer- the layer for which the parent is searchedaRootNode- the root node of the tree to be searched- Returns:
- the parent node for
aLayer, ornullwhen no parent can be found
-
isEmptyNode
Returnstruewhen a layer tree node has an empty model, indicating it contains no useful data. A model is considered empty whenTLcdModelTreeNodeUtil.isEmptyModel(com.luciad.model.ILcdModel)returnstrue.- Parameters:
aLayer- the layer- Returns:
truewhen layeraLayeris anILcdLayerTreeNodewith an empty model- See Also:
-
containsLayerInTree
Returns
trueif and only if the layeraLayeris an element of the tree with root nodeaRootNode.- Parameters:
aLayer- the layeraRootNode- the root node of the tree- Returns:
trueif and only if the layeraLayeris an element of the tree with root nodeaRootNode
-