Interface ILcdTreeLayered
- All Superinterfaces:
ILcdLayered,Serializable
- All Known Subinterfaces:
ILcdGXYView,ILcdRotationCapableGXYView,ILcdTreeLayeredSupport,ILspAWTView,ILspView
- All Known Implementing Classes:
ALspAWTView,TLcdGXYViewBufferedImage,TLcdGXYViewCanvas,TLcdGXYViewJPanel,TLcdGXYViewJPanelLightWeight,TLcdGXYViewPanel,TLcdGXYViewPlanarImage,TLcdIndependentOrderTreeLayeredSupport,TLcdMapBufferedImage,TLcdMapCanvas,TLcdMapJPanel,TLcdMapJPanelLightWeight,TLcdMapPanel,TLcdTreeLayeredSupport,TLspAWTView,TLspExternalView,TLspFXView,TLspOffscreenView,TLspSwingView
An extension of ILcdLayered, to access a flat list of layers as
a hierarchical structure. The hierarchical structure can be accessed directly
by calling getRootNode(). This is illustrated in the figure below.
The figure shows that the ILcdTreeLayered exposes a
root node for the hierarchical layer structure through the
getRootNode() method.
At the same time, ILcdTreeLayered is linked to all the layers of the
hierarchical structure, and provides a flat list
representation of this hierarchical layer structure. The root node is not
included in the flat list representation.
All the operations, defined in the ILcdLayered interface, can now be performed on the hierarchical structure.
Adding and/or removing layers from the hierarchical structure will also remove them from the flat list representation, and vice versa.
Two support classes allow for an easy concrete
implementation of this interface in GXY views:
TLcdTreeLayeredSupport and
TLcdIndependentOrderTreeLayeredSupport. TLcdTreeLayeredSupport
is the default. It derives the flat list from the hierarchical layer structure, and keeps them
both synchronized. Moving a layer in the hierarchical structure will move the
layer in the flat list representation and vice versa. The
TLcdIndependentOrderTreeLayeredSupport allows having an
independent layer order in the flat list representation and in the
hierarchical structure.
The following assumptions are made:
- Layers or layer nodes may only occur once in the hierarchical structure.
- No loops are created in the hierarchical structure. This means a layernode must not be inserted into one of the layernodes contained in his subtree.
The class TLcdLayerTree is available to
visualise the hierarchical layer structure.
- Since:
- 9.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayeredListener(ILcdLayeredListener aLayeredListener) Registers the givenILcdLayeredListenerto be notified when layers are added, removed or moved in the flat list.booleancontainsLayer(ILcdLayer aLayer) Returns whether the flat list representation of the hierarchical layer structure contains the given layer.getLayer(int aIndex) Returns theILcdLayerwith indexaIndexin the flat list representation of the hierarchical layer structure.Returns the root node of the tree structure.intReturns the index of the given layeraLayerin the flat list representation of the hierarchical structure.intReturns the number of layers in the flat list representation of the hierarchical layer structure.Returns theILcdLayerof the flat list that contains the givenILcdModel.layers()Returns anEnumerationof all theILcdLayers currently in the flat list representation of the hierarchical layer structure, starting from the bottom layer to the top layer.Returns anEnumerationof all theILcdLayers currently in the flat list representation of the hierarchical layer structure, starting from the top layer to the bottom layer.voidRemove all the layers from the hierarchical layer structure and the flat list representation.voidremoveLayer(ILcdLayer aLayer) Removes a layer from both the hierarchical layer structure and the flat list representation.voidremoveLayeredListener(ILcdLayeredListener aLayeredListener) Unregisters the givenILcdLayeredListenerfrom receiving layered events for the flat list.Methods inherited from interface com.luciad.view.ILcdLayered
addLayeredListener, getLayers, moveLayerAt, removeLayeredListener
-
Method Details
-
getRootNode
ILcdLayerTreeNode getRootNode()Returns the root node of the tree structure.
- Returns:
- the root node of the tree structure
-
layerCount
int layerCount()Returns the number of layers in the flat list representation of the hierarchical layer structure. This does not include the root node.
- Specified by:
layerCountin interfaceILcdLayered- Returns:
- the number of layers in the flat list. Does not include the root node.
-
layers
Enumeration layers()Returns an
Enumerationof all theILcdLayers currently in the flat list representation of the hierarchical layer structure, starting from the bottom layer to the top layer. This does not include the root node.- Specified by:
layersin interfaceILcdLayered- Returns:
- an
Enumerationof all theILcdLayers currently in the flat list, starting from the bottom layer to the top layer. Does not include the root node.
-
layersBackwards
Enumeration layersBackwards()Returns an
Enumerationof all theILcdLayers currently in the flat list representation of the hierarchical layer structure, starting from the top layer to the bottom layer. This does not include the root node.- Specified by:
layersBackwardsin interfaceILcdLayered- Returns:
- an
Enumerationof all theILcdLayers currently in the flat list, starting from the top layer to the bottom layer. Does not include the root node.
-
getLayer
Returns the
ILcdLayerwith indexaIndexin the flat list representation of the hierarchical layer structure.- Specified by:
getLayerin interfaceILcdLayered- Parameters:
aIndex- the position of the layer to retrieve in the flat list representation.- Returns:
- the
ILcdLayerwith indexaIndexin the flat list representation - Throws:
ArrayIndexOutOfBoundsException- if the given index is invalid
-
indexOf
Returns the index of the given layer
aLayerin the flat list representation of the hierarchical structure.- Specified by:
indexOfin interfaceILcdLayered- Parameters:
aLayer- the layer whose index to return- Returns:
- the index of
aLayerin the flat list representation - Throws:
NoSuchElementException- ifaLayeris not in the flat list
-
removeLayer
Removes a layer from both the hierarchical layer structure and the flat list representation. When removing an
ILcdLayerTreeNodeall of its children will also be removed. An event will then be generated for every layer that has been removed (one for the node and one for each of its child layers).It is not possible to remove the root node
- Specified by:
removeLayerin interfaceILcdLayered- Parameters:
aLayer- the layer to remove. If the layer is not in the flat list, this method has no effect.
-
containsLayer
Returns whether the flat list representation of the hierarchical layer structure contains the given layer. More formally, returns
trueif and only if the flat list representation contains at least one layerlsuch that (aLayer==null ? l==null : aLayer.equals(l)).Calling this method with the root node will return
false, since the root node is not a part of the flat list representation.- Specified by:
containsLayerin interfaceILcdLayered- Parameters:
aLayer- the layer to check whether it is in the flat list representation- Returns:
truewhen the flat list representation contains the given layer,falseotherwise
-
removeAllLayers
void removeAllLayers()Remove all the layers from the hierarchical layer structure and the flat list representation. An event will be fired for every layer that has been removed. This will not remove the root node.
- Specified by:
removeAllLayersin interfaceILcdLayered
-
addLayeredListener
Registers the givenILcdLayeredListenerto be notified when layers are added, removed or moved in the flat list.- Specified by:
addLayeredListenerin interfaceILcdLayered- Parameters:
aLayeredListener- the listener that from now on will be notified of all changes to the flat list.- See Also:
-
removeLayeredListener
Unregisters the givenILcdLayeredListenerfrom receiving layered events for the flat list.- Specified by:
removeLayeredListenerin interfaceILcdLayered- Parameters:
aLayeredListener- the listener that will no longer be notified of changes in the flat list.- See Also:
-
layerOf
Returns theILcdLayerof the flat list that contains the givenILcdModel.- Specified by:
layerOfin interfaceILcdLayered- Parameters:
aModel- the model to check for in the flat list- Returns:
- the
ILcdLayerof the flat list that contains the givenILcdModel. - Throws:
NoSuchElementException- if there is no layer containing the given model
-