Class TLcdLayerTreeNodeUtil

java.lang.Object
com.luciad.view.TLcdLayerTreeNodeUtil

public class TLcdLayerTreeNodeUtil extends Object

Class with utility methods for working with ILcdLayerTreeNodes. The methods in this class are all thread-safe.

Since:
9.0
  • Method Details

    • getLayers

      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

      Parameters:
      aNode - the start node for the search. Must not be null
      Returns:
      a list containing all the underlying layers, including the node aNode
      See Also:
    • getLayers

      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

      Parameters:
      aNode - the start node for the search. Must not be null
      aIncludeNode - True if the given aNode should be part of the returned list.
      Returns:
      a list containing all the underlying layers
      See Also:
    • getLayerCount

      public static int getLayerCount(ILcdLayer aLayer)
      Returns the total number of layers and layer nodes in the tree with root node aLayer, including aLayer
      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

      public static List<ILcdLayerTreeNode> getPathToParent(ILcdLayerTreeNode aFrom, ILcdLayer aTo)
      Returns a list containing all the ILcdLayerTreeNodes to go from aFrom to the parent of aTo. The list starts with aFrom and ends with the parent node.
      Parameters:
      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.
      Returns:
      a list containing all the ILcdLayerTreeNodes to go from aFrom to the parent of aTo, or null when aTo is not a part of the tree with root node aTo
    • getPath

      public static List<ILcdLayer> getPath(ILcdLayerTreeNode aFrom, ILcdLayer aTo)
      Returns a list containing all the ILcdLayers to go from aFrom to the layer aTo. The list starts with aFrom and ends with aTo.
      Parameters:
      aFrom - the starting node of the path
      aTo - the end node of the path
      Returns:
      a list containing all the ILcdLayer to go from aFrom to the layer aTo, or null when aTo is not a part of the tree with root node aTo.
    • getFirstCommonAncestor

      public static ILcdLayerTreeNode getFirstCommonAncestor(ILcdLayer aFirstLayer, ILcdLayerTreeNode aFirstRootNode, ILcdLayer aSecondLayer, ILcdLayerTreeNode aSecondRootNode)
      Returns the first ancestor that two ILcdLayers 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 ancestor
      Parameters:
      aFirstLayer - the first layer
      aFirstRootNode - the root node of the tree containing the first node
      aSecondLayer - the second layer
      aSecondRootNode - the root node of the tree containing the second node
      Returns:
      the first common ancestor of aFirstLayer and aSecondLayer, or null when the two layers do not belong to the same tree
    • findSubTreeIndex

      public 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.
      Parameters:
      aAncestorNode - the ancestor node
      aLayer - the layer
      Returns:
      the index of the sub tree in aAncestorNode which contains the node aLayer or -1 when aAncestorNode is not an ancestor of aLayer.
    • getParent

      public static ILcdLayerTreeNode getParent(ILcdLayer aLayer, ILcdLayerTreeNode aRootNode)
      Finds the parent node of aLayer in the tree with root node aRootNode.
      Parameters:
      aLayer - the layer for which the parent is searched
      aRootNode - the root node of the tree to be searched
      Returns:
      the parent node for aLayer, or null when no parent can be found
    • isEmptyNode

      public static boolean isEmptyNode(ILcdLayer aLayer)
      Returns 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.
      Parameters:
      aLayer - the layer
      Returns:
      true when layer aLayer is an ILcdLayerTreeNode with an empty model
      See Also:
    • containsLayerInTree

      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.

      Parameters:
      aLayer - the layer
      aRootNode - the root node of the tree
      Returns:
      true if and only if the layer aLayer is an element of the tree with root node aRootNode