Interface ILcdLayerTreeNode

All Superinterfaces:
ILcdLayer, ILcdLayered, ILcdPropertyChangeSource, ILcdSelection<Object>, Serializable
All Known Implementing Classes:
TLcdGXYAsynchronousEditableLabelsLayerTreeNodeWrapper, TLcdGXYAsynchronousLayerTreeNodeWrapper, TLcdGXYLayerTreeNode, TLcdGXYLspAsynchronousLayerTreeNodeWrapper, TLspGXYLayerTreeNodeAdapter, TLspLayerTreeNode

public interface ILcdLayerTreeNode extends ILcdLayer, ILcdLayered

An ILcdLayerTreeNode is an ILcdLayer which can also have child layers. This allows to create a hierarchical layer structure.

ILcdLayerTreeNode class diagram

This interface extends ILcdLayered since it can have child layers. Therefore, all methods inherited from ILcdLayered only apply on the child layers. An example is layerCount() which will return the number of child layers of this layer node. This does not include the node itself.

It also extends ILcdLayer since every layer node is a layer itself. Therefore, all methods inherited from ILcdLayer only apply on the node, and not on its child layers. For example calling ILcdLayer.setVisible(boolean) will only change the visibility of the node and not of its child layers.

It is possible to attach listeners which will be notified of changes in the whole hierarchical structure (see addHierarchyLayeredListener(ILcdLayeredListener), addHierarchySelectionListener(com.luciad.util.ILcdSelectionListener) and addHierarchyPropertyChangeListener(java.beans.PropertyChangeListener)) or which will only be notified of changes in the node (see addLayeredListener(ILcdLayeredListener), ILcdSelection.addSelectionListener(com.luciad.util.ILcdSelectionListener) and addPropertyChangeListener(java.beans.PropertyChangeListener)).

Since:
9.0
  • Method Details

    • addLayer

      boolean addLayer(ILcdLayer aNewChildNode) throws IllegalArgumentException

      Adds a new node to the tree as a child of this node. This newly added node will normally be the last child node, but that can be implementation specific. Implementations could for example decide to use the initial layer index provider to determine the best index to add the layer. Notice that in order to avoid loops in the tree aNewChildNode must not already be an element of the tree. This method should also generate a TLcdLayeredEvent to warn its listeners that a node has been added.

      Parameters:
      aNewChildNode - the node which must be added as a child
      Returns:
      true when the layer was successfully added to this node, false if the node already contained layer aNewChildNode
      Throws:
      IllegalArgumentException - when the node is already an element of the tree
    • addLayer

      boolean addLayer(ILcdLayer aNewChildNode, int aIndex) throws IndexOutOfBoundsException, IllegalArgumentException

      Adds a new node to the tree as a child of this node. The child will be inserted at index aIndex in the child list of this node. Notice that in order to avoid loops in the tree aNewChildNode must not already be an element of the tree. This method should also generate a TLcdLayeredEvent to warn its listeners that a node has been added.

      Parameters:
      aNewChildNode - the new child
      aIndex - the index in the child list of this node for the new child
      Returns:
      true when the layer was successfully added to this node, false if the node already contained layer aNewChildNode
      Throws:
      IndexOutOfBoundsException - when index > layerCount()
      IllegalArgumentException - when the node is already an element of the tree
    • removeLayer

      void removeLayer(int aIndex)

      Removes the node at index aIndex from this node and sends the appropriate TLcdLayeredEvent.

      Parameters:
      aIndex - the index of the child node which has to be removed
    • addHierarchyLayeredListener

      void addHierarchyLayeredListener(ILcdLayeredListener aListener)

      Registers the given ILcdLayeredListener to receive TLcdLayeredEvents from all the ILcdLayerTreeNodes contained in the tree with this node as root node. If the listener should only receive events for changes occurring in this node, it should be registered as a regular listener (see addLayeredListener(ILcdLayeredListener).

      The source ILcdLayered of the event can be retrieved by calling TLcdLayeredEvent.getLayered() on the received TLcdLayeredEvent.

      Parameters:
      aListener - the listener
    • removeHierarchyLayeredListener

      void removeHierarchyLayeredListener(ILcdLayeredListener aListener)

      Unregisters the given ILcdLayeredListener from receiving TLcdLayeredEvents for the tree with this node as root node.

      Parameters:
      aListener - the listener
    • addHierarchyPropertyChangeListener

      void addHierarchyPropertyChangeListener(PropertyChangeListener aListener)

      Registers the given PropertyChangeListener to receive PropertyChangeEvents from all the ILcdLayers contained in the tree with this node as root node. If the listener should only receive events for changes occurring in this layer, it should be registered as a regular listener (see addPropertyChangeListener(java.beans.PropertyChangeListener)).

      The source layer of the event can be retrieved by calling EventObject.getSource() on the received PropertyChangeEvent.

      Parameters:
      aListener - the listener
    • removeHierarchyPropertyChangeListener

      void removeHierarchyPropertyChangeListener(PropertyChangeListener aListener)

      Unregisters the given PropertyChangeListener from receiving PropertyChangeEvents for the tree with this node as root node.

      Parameters:
      aListener - the listener
    • addHierarchySelectionListener

      void addHierarchySelectionListener(ILcdSelectionListener aListener)

      Registers the given ILcdSelectionListener to receive TLcdSelectionChangedEvents from all the ILcdLayers contained in the tree with this node as root node. If the listener should only receive events for selection changes occurring in this layer, it should be registered as a regular listener (see ILcdSelection.addSelectionListener(com.luciad.util.ILcdSelectionListener)).

      The source layer of the event can be retrieved by calling TLcdSelectionChangedEvent.getSelection() on the received TLcdSelectionChangedEvent.

      Parameters:
      aListener - the listener
    • removeHierarchySelectionListener

      void removeHierarchySelectionListener(ILcdSelectionListener aListener)

      Unregisters the given ILcdSelectionListener from receiving TLcdSelectionChangedEvents for the tree with this node as root node.

      Parameters:
      aListener - the listener
    • removeAllLayers

      void removeAllLayers()
      Removes all the ILcdLayer objects from this ILcdLayered.

      This method will generate a TLcdLayeredEvent indicating a layer was removed for every child layer.

      Specified by:
      removeAllLayers in interface ILcdLayered
    • isPaintOnTopOfChildrenHint

      boolean isPaintOnTopOfChildrenHint()

      Returns whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers.

      Returns:
      true when a node should be painted on top of its children, false when the node should be painted underneath its child layers
      See Also:
    • setPaintOnTopOfChildrenHint

      void setPaintOnTopOfChildrenHint(boolean aPaintOnTopOfChildrenHint)

      Sets whether a node should be painted on top of its children when the node is added to a view, or beneath its child layers. Notice that this is only a hint, hence the paint order of the node and its children is not guaranteed.

      This property must be set before the node is added to the view. Otherwise it will have no effect. Changing it afterwards will have no effect, unless the node is removed and re-added to the view.

      The default behavior is to paint nodes underneath the child layers.

      Parameters:
      aPaintOnTopOfChildrenHint - true when a node should be painted on top of its children, false when the node should be painted underneath its child layers
      See Also:
    • addPropertyChangeListener

      void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)

      Registers the given PropertyChangeListener to be notified when this object's properties change.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this change source, you can use a ALcdWeakPropertyChangeListener instance as property change listener.

      This property change listener will only be notified of changes in this layer node, not of changes in any of the child layers. Use addHierarchyPropertyChangeListener(java.beans.PropertyChangeListener) for this purpose.

      Specified by:
      addPropertyChangeListener in interface ILcdPropertyChangeSource
      Parameters:
      aPropertyChangeListener - The listener to be notified
      See Also:
    • removePropertyChangeListener

      void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)

      De-registers the given PropertyChangeListener from receiving property change events for this object.

      If the listener was added more than once, it will be notified one less time after being removed. If the listener is null, or was never added, no exception is thrown and no action is taken.

      It is not possible to remove a hierarchy property change listener with this method. Use removeHierarchyPropertyChangeListener(java.beans.PropertyChangeListener) for this purpose.

      Specified by:
      removePropertyChangeListener in interface ILcdPropertyChangeSource
      Parameters:
      aPropertyChangeListener - the listener that should no longer be notified of changes of this object's properties
      See Also:
    • addLayeredListener

      void addLayeredListener(ILcdLayeredListener aLayeredListener)

      Registers the given ILcdLayeredListener to be notified when layers are added, removed or moved.

      In case you need to register a listener which keeps a reference to an object with a shorter life-time than this layered, you can use a ALcdWeakLayeredListener instance as layered listener.

      This layer will only be informed when child layers are added, removed or moved in this layer node. To receive the events of the whole hierarchical structure, the listener must be added as a hierarchical listener (see addHierarchyLayeredListener(ILcdLayeredListener)).

      Specified by:
      addLayeredListener in interface ILcdLayered
      Parameters:
      aLayeredListener - the listener that from now on will be notified of all changes to the ILcdLayered
      See Also:
    • removeLayeredListener

      void removeLayeredListener(ILcdLayeredListener aLayeredListener)
      Unregisters the given ILcdLayeredListener from receiving layered events for the ILcdLayered.

      It is not possible to remove a hierarchy listener with this method. Use removeHierarchyLayeredListener(ILcdLayeredListener) for this purpose.

      Specified by:
      removeLayeredListener in interface ILcdLayered
      Parameters:
      aLayeredListener - the listener that will no longer be notified of changes to the ILcdLayered
      See Also:
    • containsLayer

      boolean containsLayer(ILcdLayer aLayer)
      Returns whether this ILcdLayered contains the given layer. More formally, returns true if and only if the ILcdLayered contains at least one layer l such that (aLayer==null ? l==null : aLayer.equals(l)).

      Calling this method with this node as parameter will return false, since this method only checks the child layers and not the layer node itself.

      Specified by:
      containsLayer in interface ILcdLayered
      Parameters:
      aLayer - the layer to check whether it is in this layered.
      Returns:
      true if aLayer is in this ILcdLayered, false otherwise.
    • layers

      Enumeration layers()
      Returns an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the bottom layer to the top layer.

      This enumeration does not include this layer node, but only the child layers.

      Specified by:
      layers in interface ILcdLayered
      Returns:
      an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the bottom layer to the top layer.
    • layersBackwards

      Enumeration layersBackwards()
      Returns an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the top layer to the bottom layer.

      This enumeration does not include this layer node, but only the child layers.

      Specified by:
      layersBackwards in interface ILcdLayered
      Returns:
      an Enumeration of all ILcdLayer objects currently in this ILcdLayered, starting from the top layer to the bottom layer.
    • layerCount

      int layerCount()
      Returns the number of ILcdLayer objects in this ILcdLayered.

      This number does not include this layer node. It is the number of child layers of this node that is returned.

      Specified by:
      layerCount in interface ILcdLayered
      Returns:
      the number of ILcdLayer objects in this ILcdLayered.
    • getInitialLayerIndexProvider

      ILcdInitialLayerIndexProvider getInitialLayerIndexProvider()

      Returns the initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.

      It is however up to the implementation to decide whether it uses the ILcdInitialLayerIndexProvider.

      Returns:
      the initial layer index provider. Can be null
      See Also:
    • setInitialLayerIndexProvider

      void setInitialLayerIndexProvider(ILcdInitialLayerIndexProvider aInitialLayerIndexProvider)

      Sets an initial layer index provider, which can be used to determine the best index when a layer is added without specifying an index.

      Parameters:
      aInitialLayerIndexProvider - The new initial layer index provider. May be null
      See Also: