public interface ILcdLayered extends Serializable
ILcdLayered
is a list of zero or more ILcdLayers
.
Each ILcdLayer
has
a unique index, ranging from 0 to the number of ILcdLayers
in this
ILcdLayered
minus one (#layers-1).
The layers are ordered by their index.
The bottom layer of this ILcdLayered
is the first ILcdLayer
.
The top layer of this ILcdLayered
is the last ILcdLayer
.
The meaning of top and bottom is that when all ILcdLayers
of
the ILcdLayered
are displayed, an ILcdLayer
closer to the top may
cover objects of an ILcdLayer
closer to the bottom, but not vice versa.
An ILcdLayered
has zero or more ILcdLayeredListeners
associated to it.
The ILcdLayered
sends a TLcdLayeredEvent
whenever the state of the
ILcdLayered
changes (listener pattern).
Modifier and Type | Method and Description |
---|---|
void |
addLayeredListener(ILcdLayeredListener aLayeredListener)
Registers the given
ILcdLayeredListener to be notified when layers are added, removed or moved. |
default void |
addLayeredListener(ILcdLayeredListener aListener,
boolean aFireForeExistingLayers)
Registers the given
ILcdLayeredListener to be notified when layers are added, removed or moved,
with the additional option to be notified for all current layers. |
boolean |
containsLayer(ILcdLayer aLayer)
Returns whether this
ILcdLayered contains the given layer. |
ILcdLayer |
getLayer(int aIndex)
Returns the
ILcdLayer in this ILcdLayered
with index aIndex . |
default List<? extends ILcdLayer> |
getLayers()
Returns a
List of the layers. |
int |
indexOf(ILcdLayer aLayer)
Returns the index if the given layer is in the list.
|
int |
layerCount()
Returns the number of
ILcdLayer objects in this ILcdLayered . |
ILcdLayer |
layerOf(ILcdModel aModel)
Returns the
ILcdLayer of this ILcdLayered that contains the given ILcdModel . |
Enumeration |
layers()
Deprecated.
use
getLayers() instead |
Enumeration |
layersBackwards()
Deprecated.
use
Collections.reverse(getLayers()) instead |
void |
moveLayerAt(int aIndex,
ILcdLayer aLayer)
Moves the given layer (which is already in
ILcdLayered ) to the existing index
aIndex. |
void |
removeAllLayers()
Removes all the
ILcdLayer objects from this ILcdLayered . |
void |
removeLayer(ILcdLayer aLayer)
Removes aLayer from this
ILcdLayered . |
void |
removeLayeredListener(ILcdLayeredListener aLayeredListener)
Unregisters the given
ILcdLayeredListener from receiving layered events for
the ILcdLayered . |
default void |
removeLayeredListener(ILcdLayeredListener aListener,
boolean aFireForeExistingLayers)
Unregisters the given
ILcdLayeredListener from receiving layered events,
with the additional option to be notified for all current layers. |
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.
aLayeredListener
- the listener that from now on will be notified of all changes
to the ILcdLayered
removeLayeredListener(com.luciad.view.ILcdLayeredListener)
default void addLayeredListener(ILcdLayeredListener aListener, boolean aFireForeExistingLayers)
Registers the given ILcdLayeredListener
to be notified when layers are added, removed or moved,
with the additional option to be notified for all current layers.
For every existing layer in this ILcdLayered
a LAYER_ADDED
event will be fired
to aListener
when aFireForExistingLayers
is true
.
A use-case for this is when you want to use the listener to perform an action on any of the existing layers and on all future layers.
aListener
- The listener that from now on will be notified of all changes to the ILcdLayered
.void removeLayeredListener(ILcdLayeredListener aLayeredListener)
ILcdLayeredListener
from receiving layered events for
the ILcdLayered
.aLayeredListener
- the listener that will no longer be notified of changes
to the ILcdLayered
addLayeredListener(ILcdLayeredListener)
default void removeLayeredListener(ILcdLayeredListener aListener, boolean aFireForeExistingLayers)
Unregisters the given ILcdLayeredListener
from receiving layered events,
with the additional option to be notified for all current layers.
For every existing layer in this ILcdLayered
a LAYER_REMOVED
event will be fired
to aListener
when aFireForExistingLayers
is true
.
A use-case for this is when you might want to unregister additional listeners for existing layers.
aListener
- The listener that will no longer be notified of changes to the ILcdLayered
.int layerCount()
ILcdLayer
objects in this ILcdLayered
.ILcdLayer
objects in this ILcdLayered
.default List<? extends ILcdLayer> getLayers()
List
of the layers.List
of the layers in this ILcdLayered
@Deprecated Enumeration layers()
getLayers()
insteadEnumeration
of all ILcdLayer
objects currently
in this ILcdLayered
,
starting from the bottom layer to the top layer.Enumeration
of all ILcdLayer
objects currently
in this ILcdLayered
,
starting from the bottom layer to the top layer.@Deprecated Enumeration layersBackwards()
Collections.reverse(getLayers())
insteadEnumeration
of all ILcdLayer
objects currently in this ILcdLayered
,
starting from the top layer to the bottom layer.Enumeration
of all ILcdLayer
objects currently in this ILcdLayered
,
starting from the top layer to the bottom layer.ILcdLayer getLayer(int aIndex) throws ArrayIndexOutOfBoundsException
ILcdLayer
in this ILcdLayered
with index aIndex
.aIndex
- the position of the layer to retrieve in the ILcdLayered
.ILcdLayer
in this ILcdLayered
with index aIndex
.ArrayIndexOutOfBoundsException
- if the given index is invalidILcdLayer layerOf(ILcdModel aModel) throws NoSuchElementException
ILcdLayer
of this ILcdLayered
that contains the given ILcdModel
.aModel
- the model to check for in this ILcdLayered
.ILcdLayer
of this ILcdLayered
that contains the given ILcdModel
.NoSuchElementException
- if there is no layer containing the given modelint indexOf(ILcdLayer aLayer) throws NoSuchElementException
aLayer
- the layer whose index to returnaLayer
NoSuchElementException
- if aLayer
is not in the listvoid moveLayerAt(int aIndex, ILcdLayer aLayer) throws NoSuchElementException, ArrayIndexOutOfBoundsException
ILcdLayered
) to the existing index
aIndex.
When a layer is moved down, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position up.
When a layer is moved up, all layers in between the previous and future position of the given layer
(including the layer at index aIndex) are moved one position down.
More formally, let previousIndex be the index of aLayer
before the move.
If previousIndex < aIndex, then the index of all ILcdLayer
objects
in from previousIndex + 1 to aIndex is decremented with 1.
If previousIndex > aIndex, then the index of all ILcdLayer
objects
in from aIndex to previousIndex -1 is incremented with 1.
aLayer
- the layer to move.aIndex
- the index of the position where to move the layer.NoSuchElementException
- if aLayer
is not in this ILcdLayered
.ArrayIndexOutOfBoundsException
- if aIndex
is not an index of one of
the layers of this ILcdLayered
.void removeLayer(ILcdLayer aLayer)
ILcdLayered
.aLayer
- the layer to remove.void removeAllLayers()
ILcdLayer
objects from this ILcdLayered
.boolean containsLayer(ILcdLayer aLayer)
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)).aLayer
- the layer to check whether it is in this layered.aLayer
is in this ILcdLayered
,
false otherwise.