Interface ILspLayer
- All Superinterfaces:
ILcdLayer
,ILcdPropertyChangeSource
,ILcdSelection<Object>
,Serializable
- All Known Subinterfaces:
ILspEditableStyledLayer
,ILspImageProjectionLayer
,ILspInteractivePaintableLayer
,ILspPaintableLayer
,ILspStyledLayer
- All Known Implementing Classes:
ALspLayer
,TLspGXYLayerAdapter
,TLspGXYLayerTreeNodeAdapter
,TLspLayer
,TLspLayerTreeNode
,TLspRasterLayer
ILspView
.
This interface introduces the concept of "paint representations": each layer can
define any number of ways to visually represent the contents of its model. These representations
are rendered into the view in separate passes, and each of them can be toggled on and off
individually. The two commonly used representations are the geometries of objects
(TLspPaintRepresentation.BODY
) and textual representations
(TLspPaintRepresentation.LABEL
). This layer does not specify any mechanism for
visualization of the layer's model; this is done in derived interfaces.
This interface extends the basic ILcdLayer
interface with:
- support for transformations between the layer's model coordinate reference and the world coordinate system of the containing view
- changing visibility and editability of specific
TLspPaintRepresentation
s - listening to
layer state changes
- listening to
layer status changes
- retrieving the
bounds
of the layer - a
layer type
- a
layer style
- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Provides hints about the type of a givenILspLayer
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayerStateListener
(ILspLayerStateListener aListener) Adds a state change listener to this layer.void
addStatusListener
(ILcdStatusListener<ILspLayer> aListener) Adds a status listener to this layer that is notified when the layer starts work asynchronously, when it is in progress, and when it is finished.getBounds
(TLspContext aContext) Returns the bounds of the layer in world coordinates.Returns a collection of all the views in which this layer is currently present.Gets the current layer style.Returns the layer type of this layer.default ILspMapScaleProvider
Returns the map scale provider that determines the relationship between the view's map scale and the map scale as used by stylers and data loading for this layer.Returns the transformation that will be used to transform coordinates of the objects in the model to world coordinates of the given view.Returns allPaintRepresentation
s that are supported by this layer.void
Marks the contents of this layer as invalid, indicating that a repaint is required.boolean
isEditable
(TLspPaintRepresentation aPaintRepresentation) Returns whether the specifiedPaintRepresentation
is editable or not.boolean
isVisible
(TLspPaintRepresentation aPaintRepresentation) Returns whether one of theTLspPaintRepresentationState
s of the the specifiedTLspPaintRepresentation
is enabled.boolean
isVisible
(TLspPaintRepresentationState aPaintRepresentationState) Returns whether the specifiedPaintRepresentationState
is enabled or not.void
registerView
(ILspView aView) Registers a view with this layer.void
removeLayerStateListener
(ILspLayerStateListener aListener) Removes the specified state listener from this layer.void
removeStatusListener
(ILcdStatusListener<ILspLayer> aListener) Removes a previously added status listener from this layer.void
setEditable
(boolean aEditable) Sets whether the layer should allow editing the content that it visualizes.void
setEditable
(TLspPaintRepresentation aPaintRepresentation, boolean aEditable) Enables or disables the editable property of a paint representation.void
setLayerStyle
(TLspLayerStyle aLayerStyle) Sets a layer style to this layer.void
setVisible
(boolean aVisible) Sets whether or not the layer's content is painted.void
setVisible
(TLspPaintRepresentation aPaintRepresentation, boolean aVisible) Enables or disables allTLspPaintRepresentationState
s of the specifiedTLspPaintRepresentation
.void
setVisible
(TLspPaintRepresentationState aPaintRepresentationState, boolean aVisible) Enables or disables the a paint representation state.void
unregisterView
(ILspView aView) Unregisters a view from this layer.Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isEditableSupported, isSelectable, isSelectableSupported, isVisible, selectObject, setIcon, setLabel, setSelectable
Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.luciad.util.ILcdSelection
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
-
Method Details
-
getLayerType
ILspLayer.LayerType getLayerType()Returns the layer type of this layer. This layer type can be used to choose the optimal strategy for a certain operation. For example painting a layer might be done differently for dynamic and static layers.- Returns:
- the layer type of this layer
- See Also:
-
getPaintRepresentations
Collection<TLspPaintRepresentation> getPaintRepresentations()Returns allPaintRepresentation
s that are supported by this layer.- Returns:
- a collection of
PaintRepresentation
s, nevernull
-
setVisible
void setVisible(boolean aVisible) Description copied from interface:ILcdLayer
Sets whether or not the layer's content is painted.- Specified by:
setVisible
in interfaceILcdLayer
- Parameters:
aVisible
-true
if the layer should be visible,false
otherwise.- See Also:
-
setVisible
Enables or disables allTLspPaintRepresentationState
s of the specifiedTLspPaintRepresentation
. This can be used to quickly switch representations (e.g. labels) on and off without having to remove its related properties (ex. a painter).- Parameters:
aPaintRepresentation
- the representation to enable or disableaVisible
- true to enable the representations or false to disable it- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
-
isVisible
Returns whether one of theTLspPaintRepresentationState
s of the the specifiedTLspPaintRepresentation
is enabled.- Parameters:
aPaintRepresentation
- the paint representation to check- Returns:
- whether the specified
PaintRepresentation
is enabled or not - Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
-
setVisible
Enables or disables the a paint representation state. This can be used to quickly switch representations (e.g. labels) on and off without having to remove its related properties (ex. a painter). Note that this method is independent of thelayer visibility
. So a paint representation state will only be visible when this method and theILcdLayer.isVisible()
method returntrue
.- Parameters:
aPaintRepresentationState
- the representations to enable or disableaVisible
- true to enable the representations or false to disable it- Throws:
IllegalArgumentException
- ifaPaintRepresentationState
is not supported- See Also:
-
isVisible
Returns whether the specifiedPaintRepresentationState
is enabled or not.- Parameters:
aPaintRepresentationState
- the paint representation to check- Returns:
- whether the specified
PaintRepresentationState
is enabled or not - Throws:
IllegalArgumentException
- ifaPaintRepresentationState
is not supported- See Also:
-
setEditable
void setEditable(boolean aEditable) Description copied from interface:ILcdLayer
Sets whether the layer should allow editing the content that it visualizes. CheckisEditableSupported
to see if the layer supports editing.- Specified by:
setEditable
in interfaceILcdLayer
- Parameters:
aEditable
- true if the layer content can be edited- See Also:
-
setEditable
Enables or disables the editable property of a paint representation. This can be used to quickly switch editing for representations (e.g. labels) on and off without having to remove its related properties (ex. a painter). Note that this method is independent of thelayer editability
. So paint representation will only be editable when both the layer and the paint representation are editable andediting is supported
.- Parameters:
aPaintRepresentation
- the representation to enable or disableaEditable
- true to enable the representations or false to disable it- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
-
isEditable
Returns whether the specifiedPaintRepresentation
is editable or not.- Parameters:
aPaintRepresentation
- the paint representation to check- Returns:
- whether the specified
PaintRepresentation
is editable or not - Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
-
registerView
Registers a view with this layer. This method is called by the view when this layer is added to it. When the layer is removed from the view, the view invokesunregisterView(com.luciad.view.lightspeed.ILspView)
. This allows the layer to know at all times in which views it is currently present; this information may help it to manage any data that it caches.- Parameters:
aView
- the view to which this layer has been added
-
unregisterView
Unregisters a view from this layer. This method is called by the view when this layer is removed from it. Along withregisterView(com.luciad.view.lightspeed.ILspView)
, this method determines the result ofgetCurrentViews()
.- Parameters:
aView
- the view from which this layer has been removed
-
getCurrentViews
Collection<ILspView> getCurrentViews()Returns a collection of all the views in which this layer is currently present. This list is kept up-to-date via the view's invocations of
registerView(com.luciad.view.lightspeed.ILspView)
andunregisterView(com.luciad.view.lightspeed.ILspView)
.The returned collection should not be modified.
- Returns:
- a collection of views in which this layer is currently present
- See Also:
-
getModelXYZWorldTransformation
Returns the transformation that will be used to transform coordinates of the objects in the model to world coordinates of the given view.
In order for this method to be thread-safe, the model-world transformation should not be modified after it is returned by this method. In practice this means that this method and its callers should treat the model-world transformation as an immutable object. So it shouldn't reuse the same
ILcdModelXYZWorldTransformation
for differentILcdModelReferences
orILcdXYZWorldReference
.- Parameters:
aView
- the view- Returns:
- the transformation that will be used to transform coordinates of the objects in the model to world coordinates of the given view
-
addLayerStateListener
Adds a state change listener to this layer. The layer must notify this listener when any of its state for a specificTLspPaintRepresentation
orTLspPaintRepresentationState
is changed. This state change is described respectively by aTLspLayerStateEvent
or aTLspLayerPaintStateEvent
.- Parameters:
aListener
- the state change listener to be registered on this layer
-
removeLayerStateListener
Removes the specified state listener from this layer.- Parameters:
aListener
- the listener to be removed from the layer- See Also:
-
addStatusListener
Adds a status listener to this layer that is notified when the layer starts work asynchronously, when it is in progress, and when it is finished.- Parameters:
aListener
- a status listener
-
removeStatusListener
Removes a previously added status listener from this layer. The listener will no longer be notified of changes in layer progress- Parameters:
aListener
- a status listener
-
invalidate
void invalidate()Marks the contents of this layer as invalid, indicating that a repaint is required. -
getBounds
Returns the bounds of the layer in world coordinates. The world reference system returned byTLspContext.getXYZWorldReference()
is used.- Parameters:
aContext
- The context that defines the reference system for the bounds to be returned.- Returns:
- The bounds of the layer in the reference system specified by aContext.
- Throws:
TLcdNoBoundsException
- If the layer has no bounds in the reference system. For instance, if the layer paints directly in the view.TLcdOutOfBoundsException
- If the bounds can not be represented in the specified reference system.
-
getLayerStyle
TLspLayerStyle getLayerStyle()Gets the current layer style. You can reset the layer style like this:layer.setLayerStyle(TLspLayerStyle.newBuilder().build());
- Returns:
- the layer style. Never
null
. - Since:
- 2017.0
-
setLayerStyle
Sets a layer style to this layer. Layer style can for example modify the transparency of a layer as a whole. You can reset the layer style like this:layer.setLayerStyle(TLspLayerStyle.newBuilder().build());
- Parameters:
aLayerStyle
- the layer style. must not benull
.- Since:
- 2017.0
-
getMapScaleProvider
Returns the map scale provider that determines the relationship between the view's map scale and the map scale as used by stylers and data loading for this layer. This impacts stylers that select their style by map scale, such as an SLD styler or aTLspScaleBasedStyler
.- Returns:
- a map scale provider, not
null
. The default map scale provider takes the map scale directly from the view and can be created withILspMapScaleProvider.fromView()
. - Since:
- 2022.0
-