Package com.luciad.view
Class TLcdLayerTreeNodeUtil
java.lang.Object
com.luciad.view.TLcdLayerTreeNodeUtil
Class with utility methods for working with ILcdLayerTreeNode
s. The
methods in this class are all thread-safe.
- Since:
- 9.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsLayerInTree
(ILcdLayer aLayer, ILcdLayer aRootNode) Returnstrue
if and only if the layeraLayer
is an element of the tree with root nodeaRootNode
.static int
findSubTreeIndex
(ILcdLayerTreeNode aAncestorNode, ILcdLayer aLayer) This method returns the index of the sub tree inaAncestorNode
which contains the nodeaLayer
, or -1 whenaAncestorNode
is not an ancestor ofaLayer
.static ILcdLayerTreeNode
getFirstCommonAncestor
(ILcdLayer aFirstLayer, ILcdLayerTreeNode aFirstRootNode, ILcdLayer aSecondLayer, ILcdLayerTreeNode aSecondRootNode) Returns the first ancestor that twoILcdLayer
s have in common.static int
getLayerCount
(ILcdLayer aLayer) Returns the total number of layers and layer nodes in the tree with root nodeaLayer
, includingaLayer
getLayers
(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 nodeaNode
getLayers
(ILcdLayerTreeNode aNode, boolean aIncludeNode) Returns a list containing all the layers underneath the nodeaNode
by using a depth first search (respecting the paintOnTopOfChildren hint of the nodes) over the tree starting at nodeaNode
static ILcdLayerTreeNode
getParent
(ILcdLayer aLayer, ILcdLayerTreeNode aRootNode) Finds the parent node ofaLayer
in the tree with root nodeaRootNode
.getPath
(ILcdLayerTreeNode aFrom, ILcdLayer aTo) Returns a list containing all theILcdLayer
s to go fromaFrom
to the layeraTo
.static List
<ILcdLayerTreeNode> getPathToParent
(ILcdLayerTreeNode aFrom, ILcdLayer aTo) Returns a list containing all theILcdLayerTreeNode
s to go fromaFrom
to the parent ofaTo
.static boolean
isEmptyNode
(ILcdLayer aLayer) Returnstrue
when 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
aNode
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
aIncludeNode
-True
if the givenaNode
should 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 theILcdLayerTreeNode
s to go fromaFrom
to the parent ofaTo
. The list starts withaFrom
and 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
ILcdLayerTreeNode
s to go fromaFrom
to the parent ofaTo
, ornull
whenaTo
is not a part of the tree with root nodeaTo
-
getPath
Returns a list containing all theILcdLayer
s to go fromaFrom
to the layeraTo
. The list starts withaFrom
and ends withaTo
.- Parameters:
aFrom
- the starting node of the pathaTo
- the end node of the path- Returns:
- a list containing all the
ILcdLayer
to go fromaFrom
to the layeraTo
, ornull
whenaTo
is 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 twoILcdLayer
s 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
aFirstLayer
andaSecondLayer
, ornull
when the two layers do not belong to the same tree
-
findSubTreeIndex
This method returns the index of the sub tree inaAncestorNode
which contains the nodeaLayer
, or -1 whenaAncestorNode
is not an ancestor ofaLayer
.- Parameters:
aAncestorNode
- the ancestor nodeaLayer
- the layer- Returns:
- the index of the sub tree in
aAncestorNode
which contains the nodeaLayer
or -1 whenaAncestorNode
is not an ancestor ofaLayer
.
-
getParent
Finds the parent node ofaLayer
in 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
, ornull
when no parent can be found
-
isEmptyNode
Returnstrue
when 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:
true
when layeraLayer
is anILcdLayerTreeNode
with an empty model- See Also:
-
containsLayerInTree
Returns
true
if and only if the layeraLayer
is an element of the tree with root nodeaRootNode
.- Parameters:
aLayer
- the layeraRootNode
- the root node of the tree- Returns:
true
if and only if the layeraLayer
is an element of the tree with root nodeaRootNode
-