public class TLcdLayerTreeNodeUtil extends Object
Class with utility methods for working with ILcdLayerTreeNode
s. The
methods in this class are all thread-safe.
Modifier and Type | Method and Description |
---|---|
static boolean |
containsLayerInTree(ILcdLayer aLayer,
ILcdLayer aRootNode)
Returns
true if and only if the layer aLayer is an element of the
tree with root node aRootNode . |
static int |
findSubTreeIndex(ILcdLayerTreeNode aAncestorNode,
ILcdLayer aLayer)
This method returns the index of the sub tree in
aAncestorNode which contains the
node aLayer , or -1 when
aAncestorNode is not an ancestor of aLayer . |
static ILcdLayerTreeNode |
getFirstCommonAncestor(ILcdLayer aFirstLayer,
ILcdLayerTreeNode aFirstRootNode,
ILcdLayer aSecondLayer,
ILcdLayerTreeNode aSecondRootNode)
Returns the first ancestor that two
ILcdLayer s have in common. |
static int |
getLayerCount(ILcdLayer aLayer)
Returns the total number of layers and layer nodes in the tree with root node
aLayer ,
including aLayer |
static List<ILcdLayer> |
getLayers(ILcdLayerTreeNode aNode)
Returns a list containing all the layers underneath the node
aNode , including
aNode , by using a depth first search (respecting the paintOnTopOfChildren hint of
the nodes) over the tree starting at node aNode |
static List<ILcdLayer> |
getLayers(ILcdLayerTreeNode aNode,
boolean aIncludeNode)
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 node aNode |
static ILcdLayerTreeNode |
getParent(ILcdLayer aLayer,
ILcdLayerTreeNode aRootNode)
Finds the parent node of
aLayer in the tree with root node aRootNode . |
static List<ILcdLayer> |
getPath(ILcdLayerTreeNode aFrom,
ILcdLayer aTo)
Returns a list containing all the
ILcdLayer s to go from aFrom to the
layer aTo . |
static List<ILcdLayerTreeNode> |
getPathToParent(ILcdLayerTreeNode aFrom,
ILcdLayer aTo)
Returns a list containing all the
ILcdLayerTreeNode s to go from aFrom
to the parent of aTo . |
static boolean |
isEmptyNode(ILcdLayer aLayer)
Returns
true when a layer tree node has an empty model, indicating it contains no
useful data. |
public static List<ILcdLayer> getLayers(ILcdLayerTreeNode aNode)
Returns a list containing all the layers underneath the node aNode
, including
aNode
, by using a depth first search (respecting the paintOnTopOfChildren hint of
the nodes) over the tree starting at node aNode
aNode
- the start node for the search. Must not be null
aNode
ILcdLayerTreeNode.isPaintOnTopOfChildrenHint()
public static List<ILcdLayer> getLayers(ILcdLayerTreeNode aNode, boolean aIncludeNode)
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 node aNode
aNode
- the start node for the search. Must not be null
aIncludeNode
- True
if the given aNode
should be part of the
returned list.ILcdLayerTreeNode.isPaintOnTopOfChildrenHint()
public static int getLayerCount(ILcdLayer aLayer)
aLayer
,
including aLayer
aLayer
- the root node of the treeaLayer
public static List<ILcdLayerTreeNode> getPathToParent(ILcdLayerTreeNode aFrom, ILcdLayer aTo)
ILcdLayerTreeNode
s to go from aFrom
to the parent of aTo
. The list starts with aFrom
and ends with the
parent node.aFrom
- the starting node of the path. Must be different from aTo
.aTo
- the node for which the path to its parent must be found. Must be different from aFrom
.ILcdLayerTreeNode
s to go from aFrom
to the parent of aTo
, or null
when aTo
is not a
part of the tree with root node aTo
public static List<ILcdLayer> getPath(ILcdLayerTreeNode aFrom, ILcdLayer aTo)
ILcdLayer
s to go from aFrom
to the
layer aTo
. The list starts with aFrom
and ends with
aTo
.aFrom
- the starting node of the pathaTo
- the end node of the pathILcdLayer
to go from aFrom
to the
layer aTo
, or null
when aTo
is not a part of the
tree with root node aTo
.public static ILcdLayerTreeNode getFirstCommonAncestor(ILcdLayer aFirstLayer, ILcdLayerTreeNode aFirstRootNode, ILcdLayer aSecondLayer, ILcdLayerTreeNode aSecondRootNode)
ILcdLayer
s have in common. When no common
ancestor is found, this method will return null
. This is only possible when the
two layers are not part of the same tree. Otherwise the root node will be the common ancestoraFirstLayer
- 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 nodeaFirstLayer
and aSecondLayer
, or
null
when the two layers do not belong to the same treepublic static int findSubTreeIndex(ILcdLayerTreeNode aAncestorNode, ILcdLayer aLayer)
aAncestorNode
which contains the
node aLayer
, or -1 when
aAncestorNode
is not an ancestor of aLayer
.aAncestorNode
- the ancestor nodeaLayer
- the layeraAncestorNode
which contains the node
aLayer
or -1 when
aAncestorNode
is not an ancestor of aLayer
.public static ILcdLayerTreeNode getParent(ILcdLayer aLayer, ILcdLayerTreeNode aRootNode)
aLayer
in the tree with root node aRootNode
.aLayer
- the layer for which the parent is searchedaRootNode
- the root node of the tree to be searchedaLayer
, or null
when no parent can be
foundpublic static boolean isEmptyNode(ILcdLayer aLayer)
true
when a layer tree node has an empty model, indicating it contains no
useful data. A model is considered empty when TLcdModelTreeNodeUtil.isEmptyModel(com.luciad.model.ILcdModel)
returns true
.aLayer
- the layertrue
when layer aLayer
is an ILcdLayerTreeNode
with an empty modelTLcdModelTreeNodeUtil#isEmptyModel
public static boolean containsLayerInTree(ILcdLayer aLayer, ILcdLayer aRootNode)
Returns true
if and only if the layer aLayer
is an element of the
tree with root node aRootNode
.
aLayer
- the layeraRootNode
- the root node of the treetrue
if and only if the layer aLayer
is an element of the
tree with root node aRootNode