Class TLspLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdLayer
,ILspSnappable
,ILspEditableStyledLayer
,ILspInteractivePaintableLayer
,ILspLayer
,ILspPaintableLayer
,ILspStyledLayer
,Serializable
- Direct Known Subclasses:
TLspLayerTreeNode
ILspInteractivePaintableLayer
.
The recommended way to create layers is through the layer builder
mechanism. The minimal setup of a TLspLayer
comprises setting a
model
and a painter
. Additionally,
an editor
may be set to provide support for graphical editing of domain objects in this layer's
model.
There are a number of ways to reduce the amount of data that is painted by a layer. Using these
can significantly reduce the memory usage and increase the performance of a layer:
setScaleRange(TLspPaintRepresentation, com.luciad.util.ILcdInterval)
setMinimumObjectSizeForPainting(double)
setFilter(com.luciad.util.ILcdDynamicFilter)
setCulling(boolean)
ILspTaskExecutor
of the view for any asynchronous operation.
Note that a TLspLayer can be added to a single ILspView.
Data filtering
The data that gets loaded and visualized on the layer can be controlled at multiple locations:- By defining a scale range on the layer, you can control for which map scales the layer gets painted.
-
During a paint operation, the layer queries the model for the
available data.
The layer will retrieve the filter for the current scale of the view from the
getModelQueryConfiguration()
model query configuration} and use that filter to limit the data it requests from the model. This filtering happens at the model side, meaning that all the data that is filtered out is not transferred from the model to the layer. -
In order to visualize the queried domain objects, they are passed to the
ALspStyler
. Before passing the domain objects, the layer will first apply thefilter
to remove all objects which are not accepted by the filter. This filtering happens at the layer side. This means that the data is first transferred to the layer when the layer queries the model, and only then discarded. -
The
ALspStyler
itself can decide to not visualize certain objects by not submitting them on the style collector. -
You can specify a
minimum size
, in pixels on the screen, before objects appear. For example, if you specify a minimum size of 5, an object is displayed only if its geometry would be about 5x5 pixels large on the screen.
Data filtering in 3D
Unlike a 2D view, a 3D view does not have a single map scale, every point in the visible area in a 3D view has another scale.
If you have a model query configuration
on a layer in 3D,
the layer will use different OGC conditions for different regions in your view at the same time.
For example, within one view you can have major roads in the distance as well as minor roads nearby.
Similarly, the scale range
of a layer in a 3D view is applied using a local scale instead of a single scale per view.
Within one view the layer can load data for nearby regions within the scale range, and leave out data for regions outside the scale range.
The "minimum object size for painting"
setting on a layer is also applied adaptively.
The layer can load smaller elements near the viewer and only larger elements further in the distance.
- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.view.lightspeed.layer.ILspLayer
ILspLayer.LayerType
-
Constructor Summary
ConstructorDescriptionInitializes a newTLspLayer
object with the given model and the display name of the model'sILcdModelDescriptor
as the layer label.TLspLayer
(ILcdModel aModel, ILspLayer.LayerType aLayerType) Initializes a newTLspLayer
object with given model and layer type.Initializes a newTLspLayer
object with given model and label.TLspLayer
(ILcdModel aModel, String aLabel, ILspLayer.LayerType aLayerType) Initializes a newTLspLayer
object with given model, label and layer type. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEditingStateListener
(ILspEditingStateListener aEditingStateListener) /** Adds anILspEditingStateListener
to thisILspInteractivePaintableLayer
.void
addPaintRepresentation
(TLspPaintRepresentation aPaintRepresentation) Adds a new paint representation.final void
configureForSLDStyling
(TLcdSLDFeatureTypeStyle aSLDFeatureTypeStyle) Style this layer using the specified SLD style.static ILcdInterval
createScaleRange
(double aMinWidth, double aMinHeight, double aMaxWidth, double aMaxHeight, TLspViewXYZWorldTransformation2D aW2V) Creates a scale range based on the given width- and height values and the world-to-view transformation.static ILcdInterval
createScaleRange
(double aMinHeight, double aMaxHeight, TLspViewXYZWorldTransformation3D aW2V) Creates a scale range interval based on the given height values and given world-to-view transformation.void
editedObjectChanged
(Object aObject) This method should be called when an object that is being edited has changed significantly.void
editedObjectsChanged
(Collection<Object> aObjectList) This method should be called when a group of objects that is being edited has changed significantly.getBounds
(TLspContext aContext) Returns the bounds of the layer in world coordinates.getEditor
(TLspPaintRepresentation aPaintRepresentation) Returns the editor currently associated with the given paint representation, ornull
if no editor is associated.Returns all editors currently registered on this layer.Returns the layer type set via this layer's constructor.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.getMapScaleRange
(TLspPaintRepresentation aPaintRepresentation) Returns the scale range of a TLspPaintRepresentation of this layer in unitless map scale ratios.double
Returns the minimum size of an object in the view for it to be painted and handled otherwise.Returns the model query configuration which is used by this layer to retrieve the filters to query the model with during a paint operation.Returns the objects in the specified paint state.double
Sets the largest possible difference (in pixels) between an object's model bounds and its painted representation's bounds that should be taken into account.double
Sets the largest possible difference (in meters) between an object's model bounds and its painted representation's bounds that should be taken into account.getPainter
(TLspPaintRepresentation aPaintRepresentation) Returns the painter currently associated with the specified paint representation, ornull
if no painter is associated.Returns all painters currently registered on this layer.By default theTLspPaintRepresentation.BODY
andTLspPaintRepresentation.LABEL
paint representations are supported.Returns an OpenGL profile which is a superset of the profiles of all the painters currently associated with this layer.getScaleRange
(TLspPaintRepresentation aPaintRepresentation) Returns the scale range of a TLspPaintRepresentation of this layer in toolkit pixels/meter.getStyler
(TLspPaintRepresentationState aPaintRepresentationState) Returns the styler of the painter for the given TLspPaintRepresentationState.boolean
Determines whether objects outside the visible view portion are culled and not painted.boolean
Returnstrue
if the layer supports editing its objects.boolean
Returnstrue
if this layer supports selecting objects,false
otherwise.boolean
Determines whether this object should be regarded as a source for snapping points.boolean
Returns whether the painters are synchronized.paint
(ILcdGLDrawable aGLDrawable, TLspPaintPhase aPhase, TLspPaintRepresentationState aPaintRepresentationState, ILspView aView) Renders the specified paint representation of this layer into a view.<T> T
query
(ALspPaintQuery<T> aQuery, TLspContext aContext) Retrieves a set of domain objects and data based on the parameters given by the query.void
registerView
(ILspView aView) Registers a view with this layer.void
removeEditingStateListener
(ILspEditingStateListener aEditingStateListener) Removes anILspEditingStateListener
from thisILspInteractivePaintableLayer
.void
removePaintRepresentation
(TLspPaintRepresentation aPaintRepresentation) Removes a paint representation.void
setCulling
(boolean aCulling) Sets whether objects outside the visible view portion are culled and not painted.void
setEditor
(TLspPaintRepresentation aPaintRepresentation, ILspEditor aEditor) Sets the editor for a paint representation.void
setFilter
(ILcdDynamicFilter aFilter) Sets theILcdDynamicFilter
to filter the objects on this layer.void
setMapScaleProvider
(ILspMapScaleProvider aMapScaleProvider) Sets 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.void
setMapScaleRange
(TLspPaintRepresentation aPaintRepresentation, TLcdDimensionInterval<TLcdMapScale> aMapScaleRange) Sets the scale range of this layer to the given unitless map scale ratio range.void
setMinimumObjectSizeForPainting
(double aMinimumObjectSizeForPainting) Specify a minimum size, in pixels on the screen, before objects appear.void
Sets theILcdModel
to this layer.final void
setModelQueryConfiguration
(TLcdModelQueryConfiguration aModelQueryConfiguration) Sets the model query configuration which defines the filters to query the model with during a paint operation.void
setObjectViewMargin
(double aObjectViewMargin) Sets the largest possible difference (in pixels) between an object's model bounds and its painted representation's bounds that should be taken into account.void
setObjectWorldMargin
(double aObjectWorldMargin) Sets the largest possible difference (in meters) between an object's model bounds and its painted representation's bounds that should be taken into account.void
setPainter
(TLspPaintRepresentation aPaintRepresentation, ILspPainter aPainter) Sets the painter for a paint representation.void
setScaleRange
(TLspPaintRepresentation aPaintRepresentation, ILcdInterval aScaleRange) Sets the scale range of this layer to the given range in toolkit pixels/meter.void
setSelectableSupported
(boolean aSelectableSupported) Controls whether this layer supports selection.void
setSnapTarget
(boolean aIsSnapTarget) Sets whether this object should be regarded as a source for snapping points.void
setStyler
(TLspPaintRepresentationState aPaintRepresentationState, ILspStyler aStyler) Sets the styler of thepainter
that is currently set for the given TLspPaintRepresentationState.void
setSynchronizePainters
(boolean aSynchronizePainters) Sets whether the painters should be synchronized or not.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.toString()
void
unregisterView
(ILspView aView) Unregisters a view from this layer.Methods inherited from class com.luciad.view.lightspeed.layer.ALspLayer
addLayerStateListener, addPropertyChangeListener, addSelectionListener, addStatusListener, clearSelection, createModelXYZWorldTransformation, fireCollectedSelectionChanges, fireLayerStateChange, fireLayerStateChange, fireLayerStateChange, fireLayerStateChange, firePropertyChange, fireStatusEvent, getCurrentViews, getFilter, getIcon, getLabel, getLayerStyle, getModel, getModelXYZWorldTransformation, getSelectionCount, invalidate, isEditable, isEditable, isSelectable, isSelected, isSynchronous, isVisible, isVisible, isVisible, removeLayerStateListener, removePropertyChangeListener, removeSelectionListener, removeStatusListener, selectedObjects, selectObject, selectObjects, setEditable, setEditable, setIcon, setLabel, setLayerStyle, setSelectable, setSynchronous
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.view.ILcdLayer
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isSelectable, 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
Methods inherited from interface com.luciad.view.lightspeed.layer.ILspLayer
addLayerStateListener, addStatusListener, getCurrentViews, getLayerStyle, getModelXYZWorldTransformation, invalidate, isEditable, isVisible, isVisible, removeLayerStateListener, removeStatusListener, setEditable, setEditable, setLayerStyle
Methods inherited from interface com.luciad.view.lightspeed.editor.snapping.ILspSnappable
addPropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
TLspLayer
Initializes a newTLspLayer
object with given model, label and layer type.- Parameters:
aModel
- the model that is to be added to the new layeraLabel
- the label of the new layeraLayerType
- theLayerType
of the new layer
-
TLspLayer
Initializes a newTLspLayer
object with given model and layer type.- Parameters:
aModel
- the model that is to be added to the new layeraLayerType
- theLayerType
of the new layer
-
TLspLayer
Initializes a newTLspLayer
object with given model and label.- Parameters:
aModel
- the model that is to be added to the new layeraLabel
- the label of the new layer
-
TLspLayer
Initializes a newTLspLayer
object with the given model and the display name of the model'sILcdModelDescriptor
as the layer label.- Parameters:
aModel
- the model to assign to the new layer
-
-
Method Details
-
getMinimumObjectSizeForPainting
public double getMinimumObjectSizeForPainting()Returns the minimum size of an object in the view for it to be painted and handled otherwise.- Returns:
- the minimum size of an object in the view for it to be painted and handled otherwise.
- See Also:
-
setMinimumObjectSizeForPainting
public void setMinimumObjectSizeForPainting(double aMinimumObjectSizeForPainting) Specify a minimum size, in pixels on the screen, before objects appear. For example, if you specify a minimum size of 5, an object is displayed only if its geometry would be about 5x5 pixels large on the screen. This way, you can get automatic level-of-detail: small objects automatically disappear when zooming out, but re-appear when zooming in. This is particularly useful for polygon datasets such as buildings or land usage: Objects that are smaller as this minimum size are ignored during painting and during model queries (which is for example used during selection). A value of 0 will always paint all objects, no matter how small they appear. Larger values can discard more objects. This typically improves the painting speed, although it might leave undesirable gaps in models containing many small objects. Note that this property is currently only used ifculling
is enabled. Note that the size that is checked, is the size of the domain object, styling is not taken into account (e.g. not the size of an 3D icon to style a point). The default value is 1 pixel. The minimum object size is evaluated by the model, so the layer doesn't need to retrieve unnecessary elements. As with an OGC condition, the performance depends largely on the model implementation. Database models will evaluate it using SQL, WFS clients will send it to the WFS server if it supports it, SHP models will do a fairly cheap pre-check to avoid loading the entire geometry.- Parameters:
aMinimumObjectSizeForPainting
- The minimal size, expressed in pixels.- See Also:
-
getObjectViewMargin
public double getObjectViewMargin()Sets the largest possible difference (in pixels) between an object's model bounds and its painted representation's bounds that should be taken into account.- Returns:
- the maximum difference in pixels
- See Also:
-
setObjectViewMargin
public void setObjectViewMargin(double aObjectViewMargin) Sets the largest possible difference (in pixels) between an object's model bounds and its painted representation's bounds that should be taken into account. This value is used when determining what objects are visible (ifculling
is enabled). It ensures, for example, that a model element is still painted if its visual representation falls inside the view, but its model bounds do not. If for example view-sized icons are used to represent points on the map, the icon could be 16 by 16 pixels, whereas the object itself is a point, having a zero size. Depending on where the point is located in the icon, the required margin for this example can be up to 16 pixels. The drawback of setting a too large value is a performance loss. The drawback of setting a too small value is that objects (e.g. icons) disappear when they are located partly outside the view. You can also configure amaximum distance in meters
. The default value is64
.- Parameters:
aObjectViewMargin
- the maximum difference in pixels- See Also:
-
getObjectWorldMargin
public double getObjectWorldMargin()Sets the largest possible difference (in meters) between an object's model bounds and its painted representation's bounds that should be taken into account.- Returns:
- the maximum difference in meters
- See Also:
-
setObjectWorldMargin
public void setObjectWorldMargin(double aObjectWorldMargin) Sets the largest possible difference (in meters) between an object's model bounds and its painted representation's bounds that should be taken into account. This value is used when determining what objects are visible (ifculling
is enabled). It ensures, for example, that a model element is still painted if its visual representation falls inside the view, but its model bounds do not. If for example circles are used to represent points on the map, the circle could have a radius of 1km, whereas the object itself is a point, having a zero size. The required margin for this example is 1000 meters. The drawback of setting a too large value is a performance loss. The drawback of setting a too small value is that objects (e.g. icons) disappear when they are located partly outside the view. You can also configure amaximum distance in pixels
. The default value is0
.- Parameters:
aObjectWorldMargin
- the maximum difference in meters- See Also:
-
isSynchronizePainters
public boolean isSynchronizePainters()Returns whether the painters are synchronized.- Returns:
true
if the painters are synchronized.- See Also:
-
setSynchronizePainters
public void setSynchronizePainters(boolean aSynchronizePainters) Sets whether the painters should be synchronized or not. If the synchronization is enabled then all painters will be update at the same time. For example the body and label of the objects in the view will be consistent. However enabling synchronization typically also increases the memory usage and latency of the layer. The default value istrue
.Note that the synchronization depends on the co-operation of the painters. In particular, the painters should implement a two-phased commit cycle using
ILspPaintGroupsChangeListener.prepareChanges(java.util.List<com.luciad.view.lightspeed.layer.paintgroup.TLspPaintGroupsChangedEvent>, java.lang.Object, com.luciad.view.lightspeed.layer.paintgroup.ILspPaintGroupsChangeListener.Callback)
andILspPaintGroupsChangeListener.commitChanges(java.lang.Object)
. This is optional however.- Parameters:
aSynchronizePainters
-true
if the painters should be synchronized- See Also:
-
getLayerType
Returns the layer type set via this layer's constructor. If a constructor without aLayerType
argument is used, the default value isILspLayer.LayerType.EDITABLE
.- Specified by:
getLayerType
in interfaceILspLayer
- Overrides:
getLayerType
in classALspLayer
- Returns:
- this layer's
LayerType
- See Also:
-
getRequiredOpenGLProfile
Returns an OpenGL profile which is a superset of the profiles of all the painters currently associated with this layer.- Specified by:
getRequiredOpenGLProfile
in interfaceILspPaintableLayer
- Returns:
- the layer's required OpenGL profile
- See Also:
-
setFilter
Sets the
ILcdDynamicFilter
to filter the objects on this layer. Operations on this layer will only be applied to objects of the model that pass the filter. This includes painting, labeling, selection, editing, ...Setting a
null
filter, lets all objects pass for rendering. By default the filter isnull
.This method is not thread safe, it is recommended to synchronize on the layer instance if needed.
The filtering performed by this filter is done inside the JVM, after the data has been queried from the model and been passed to the layer. Use the
setModelQueryConfiguration(TLcdModelQueryConfiguration)
if you have filters which should be evaluated on the model side. For example when using a database model, this would allow the database to do the filtering. The class javadoc contains more information about the available data filtering mechanisms. -
addEditingStateListener
Description copied from interface:ILspInteractivePaintableLayer
/** Adds anILspEditingStateListener
to thisILspInteractivePaintableLayer
.- Specified by:
addEditingStateListener
in interfaceILspInteractivePaintableLayer
- Parameters:
aEditingStateListener
- theILspEditingStateListener
to be added.
-
removeEditingStateListener
Description copied from interface:ILspInteractivePaintableLayer
Removes anILspEditingStateListener
from thisILspInteractivePaintableLayer
.- Specified by:
removeEditingStateListener
in interfaceILspInteractivePaintableLayer
- Parameters:
aEditingStateListener
- theILspEditingStateListener
to be removed.
-
getObjectsWithPaintState
Description copied from interface:ILspInteractivePaintableLayer
Returns the objects in the specified paint state. The paint state must not beTLspPaintState.REGULAR
, you can useILspInteractivePaintableLayer.query(com.luciad.view.lightspeed.query.ALspPaintQuery<T>, com.luciad.view.lightspeed.TLspContext)
instead to get the current regular objects in the view. The state of objects can be modified by adding/removing them from the returned collection. You can be informed when the objects in a certain state change by adding a listener to the returned collection. To avoid threading issues when multiple threads read or write to these collections, it is required to take a read or write lock on this collection when you access it, using theTLcdLockUtil
. For example:ILcdCollection<Object> editedObjects = layer.getObjectsWithPaintState(TLspPaintState.EDITED); try (TLcdLockUtil.Lock lock = TLcdLockUtil.writeLock(editedObjects)) { editedObjects.add(newlySelectedObject, ILcdFireEventMode.FIRE_LATER); } finally { editedObjects.fireCollectedChanges(); }
- Specified by:
getObjectsWithPaintState
in interfaceILspInteractivePaintableLayer
- Parameters:
aState
- a paint state- Returns:
- the objects
-
editedObjectChanged
Description copied from interface:ILspInteractivePaintableLayer
This method should be called when an object that is being edited has changed significantly. As a result all editing listeners will be informed of this.- Specified by:
editedObjectChanged
in interfaceILspInteractivePaintableLayer
- Parameters:
aObject
- the object- See Also:
-
editedObjectsChanged
Description copied from interface:ILspInteractivePaintableLayer
This method should be called when a group of objects that is being edited has changed significantly. As a result, all editing listeners will be informed of this change.- Specified by:
editedObjectsChanged
in interfaceILspInteractivePaintableLayer
- Parameters:
aObjectList
- A list of domain objects (in this layer) that have changed significantly. Never null.- See Also:
-
isSelectableSupported
public boolean isSelectableSupported()Returnstrue
if this layer supports selecting objects,false
otherwise.- Specified by:
isSelectableSupported
in interfaceILcdLayer
- Overrides:
isSelectableSupported
in classALspLayer
- Returns:
true
- See Also:
-
setSelectableSupported
public void setSelectableSupported(boolean aSelectableSupported) Controls whether this layer supports selection. By default this property istrue
. If the layer supports selection, selection can be activated by callingALspLayer.setSelectable(boolean)
.It is recommended to only set this property once, right after constructing the layer, e.g. in a layer factory.
- Parameters:
aSelectableSupported
-true
to allow making this layer's contents selectable, andfalse
otherwise.
-
getPainter
Description copied from interface:ILspInteractivePaintableLayer
Returns the painter currently associated with the specified paint representation, ornull
if no painter is associated.- Specified by:
getPainter
in interfaceILspInteractivePaintableLayer
- Parameters:
aPaintRepresentation
- the paint representation for which to obtain a painter- Returns:
- the associated painter if it exists, or
null
otherwise
-
setPainter
Sets the painter for a paint representation.- Parameters:
aPaintRepresentation
- the paint representationaPainter
- the painter ornull
- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported
-
setVisible
Description copied from interface:ILspLayer
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
.- Specified by:
setVisible
in interfaceILspLayer
- Overrides:
setVisible
in classALspLayer
- Parameters:
aPaintRepresentationState
- the representations to enable or disableaVisible
- true to enable the representations or false to disable it- See Also:
-
setVisible
Description copied from interface:ILspLayer
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).- Specified by:
setVisible
in interfaceILspLayer
- Overrides:
setVisible
in classALspLayer
- Parameters:
aPaintRepresentation
- the representation to enable or disableaVisible
- true to enable the representations or false to disable it- See Also:
-
setVisible
public void setVisible(boolean aVisible) Description copied from class:ALspLayer
Sets whether or not the layer's content is painted.This method is not thread safe, it is recommended to synchronize on the layer instance if needed.
- Specified by:
setVisible
in interfaceILcdLayer
- Specified by:
setVisible
in interfaceILspLayer
- Overrides:
setVisible
in classALspLayer
- Parameters:
aVisible
-true
if the layer should be visible,false
otherwise.- See Also:
-
getEditor
Description copied from interface:ILspInteractivePaintableLayer
Returns the editor currently associated with the given paint representation, ornull
if no editor is associated.- Specified by:
getEditor
in interfaceILspInteractivePaintableLayer
- Parameters:
aPaintRepresentation
- the paint representation for which to retrieve an editor- Returns:
- the associated editor if it exists, or
null
otherwise
-
isEditableSupported
public boolean isEditableSupported()Returnstrue
if the layer supports editing its objects. This implementation returns true if the layer has an editor.- Specified by:
isEditableSupported
in interfaceILcdLayer
- Overrides:
isEditableSupported
in classALspLayer
- Returns:
true
- See Also:
-
setEditor
Sets the editor for a paint representation.- Parameters:
aPaintRepresentation
- the paint representationaEditor
- the editor ornull
- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported
-
isSnapTarget
public boolean isSnapTarget()Description copied from interface:ILspSnappable
Determines whether this object should be regarded as a source for snapping points.- Specified by:
isSnapTarget
in interfaceILspSnappable
- Returns:
- true if this object should be regarded as a source for snapping points; false otherwise.
-
setSnapTarget
public void setSnapTarget(boolean aIsSnapTarget) Description copied from interface:ILspSnappable
Sets whether this object should be regarded as a source for snapping points.- Specified by:
setSnapTarget
in interfaceILspSnappable
- Parameters:
aIsSnapTarget
- if true, this object should be regarded as a source for snapping points, i.e. it should be possible to snap to this object; if false, this object should not produce snapping candidates.
-
getScaleRange
Returns the scale range of a TLspPaintRepresentation of this layer in toolkit pixels/meter. If configured, the layer contents are only shown if and when the view's toolkit scale is larger than the interval's minimum and smaller than the interval's maximum. For most use cases, we recommended using theunitless map scale range
instead. This property is mutually exclusive with the map scale range: only one of them has a non-null
value.- Parameters:
aPaintRepresentation
- the paint representation for which to return the scale range- Returns:
- the scale range or
null
if the scale constraints are determined bygetMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation)
. The min and max values of the given interval are in toolkit pixels / meters. - Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
-
setScaleRange
Sets the scale range of this layer to the given range in toolkit pixels/meter. If configured, the layer contents are only shown if and when the view's toolkit scale is larger than the interval's minimum and smaller than the interval's maximum. You can use the following convenience methods for creation of a scale range intervals:- For 2D views:
createScaleRange(double, double, double, double, com.luciad.view.lightspeed.camera.TLspViewXYZWorldTransformation2D)
- For 3D views:
createScaleRange(double, double, com.luciad.view.lightspeed.camera.TLspViewXYZWorldTransformation3D)
unitless map scale range
instead. This method overrides any configured map scale range for the given paint representation. An alternative for setting a scale range is configuring amodel query configuration
.- Parameters:
aPaintRepresentation
- the paint representationaScaleRange
- the new scale range of this layer, in toolkit pixels / meter, ornull
to deactivate any scale restriction The minimum (smallest) value is the most zoomed out, the maximum (largest) value is the most zoomed in.- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- See Also:
- For 2D views:
-
getMapScaleRange
public TLcdDimensionInterval<TLcdMapScale> getMapScaleRange(TLspPaintRepresentation aPaintRepresentation) Returns the scale range of a TLspPaintRepresentation of this layer in unitless map scale ratios. If configured, the layer contents are only shown if and when the view's map scale is larger than the interval's minimum and smaller than the interval's maximum. This property is mutually exclusive with thetoolkit scale range
: only one of them has a non-null
value.- Overrides:
getMapScaleRange
in classALspLayer
- Parameters:
aPaintRepresentation
- the paint representation for which to return the scale range- Returns:
- the scale range
- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- Since:
- 2021.0
- See Also:
-
setMapScaleRange
public void setMapScaleRange(TLspPaintRepresentation aPaintRepresentation, TLcdDimensionInterval<TLcdMapScale> aMapScaleRange) Sets the scale range of this layer to the given unitless map scale ratio range. If configured, the layer contents are only shown if and when the view's map scale is larger than the interval's minimum and smaller than the interval's maximum. This method overrides any configured toolkit scale range for the given paint representation. An alternative for setting a scale range is configuring amodel query configuration
.- Overrides:
setMapScaleRange
in classALspLayer
- Parameters:
aPaintRepresentation
- the paint representationaMapScaleRange
- the new scale range of this layer, ornull
to deactivate any scale restriction- Throws:
IllegalArgumentException
- ifaPaintRepresentation
is not supported- Since:
- 2021.0
- See Also:
-
getMapScaleProvider
Description copied from interface:ILspLayer
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
.- Specified by:
getMapScaleProvider
in interfaceILspLayer
- 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()
.
-
setMapScaleProvider
Sets 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
. The map scale provider can be used to control scale-based styling in a custom way, for example to lock the style to a specific scale. More information can be found in the map scale provider howto. In 3D views, setting a map scale provider disables Lightspeed's default "scale-range"-based approach to data loading and styling. Normally, different objects in the view may be loaded or styled based on a different scale, depending on how far they are from the camera. This prevents for example loading lots of high-detail data in the far distance, when the camera is relatively close to the surface, but also tilted towards the horizon. When a custom map scale provider is installed, this optimization is disabled. All data in the view will be loaded and styled based on the same map scale, as specified by the given map scale provider.- Parameters:
aMapScaleProvider
- a map scale provider, must not be null. The default provider can be created withILspMapScaleProvider.fromView()
- Since:
- 2022.0
-
getPaintRepresentations
By default theTLspPaintRepresentation.BODY
andTLspPaintRepresentation.LABEL
paint representations are supported. You can use theaddPaintRepresentation(TLspPaintRepresentation)
andremovePaintRepresentation(TLspPaintRepresentation)
methods to add or remove supported paint representations.- Specified by:
getPaintRepresentations
in interfaceILspLayer
- Overrides:
getPaintRepresentations
in classALspLayer
- Returns:
- a collection of
PaintRepresentation
s, nevernull
-
addPaintRepresentation
Adds a new paint representation.- Overrides:
addPaintRepresentation
in classALspLayer
- Parameters:
aPaintRepresentation
- the paint representation- See Also:
-
removePaintRepresentation
Removes a paint representation.- Overrides:
removePaintRepresentation
in classALspLayer
- Parameters:
aPaintRepresentation
- the paint representation- See Also:
-
getPainters
Returns all painters currently registered on this layer.- Returns:
- all painters currently registered on this layer
-
getEditors
Returns all editors currently registered on this layer.- Returns:
- all editors currently registered on this layer
-
setModel
Description copied from class:ALspLayer
Sets theILcdModel
to this layer.This method is not thread safe, it is recommended to synchronize on the layer instance if needed.
-
paint
public TLspPaintProgress paint(ILcdGLDrawable aGLDrawable, TLspPaintPhase aPhase, TLspPaintRepresentationState aPaintRepresentationState, ILspView aView) Description copied from interface:ILspPaintableLayer
Renders the specified paint representation of this layer into a view. The view invokes this method for each enabled paint representation and supplies anILcdGLDrawable
as an access point to the OpenGL API. In addition to rendering the individual paint representations, views may also perform multiple rendering passes to support things such as transparency rendering or terrain of data on a 3D terrain. To this effect, the layer must honor the suppliedTLspPaintPhase
. This method returns aTLspPaintProgress
object to indicate whether the repaint was entirely finished or not. This might not be the case if thepaint()
method scheduled some asynchronous processing task, whose result is needed to complete the paint operation. For instance, if the layer loads data in the background on demand, it may return early rather than letting thepaint()
method block until the data is available. In this case the view is left incomplete, but additional repaints of the view will incrementally become more up-to-date, and the progress objects retrieved after each new repaint can be used to provide progress information to the user.- Specified by:
paint
in interfaceILspPaintableLayer
- Parameters:
aGLDrawable
- the access point to OpenGLaPhase
- describes the phase that the view repaint process is currently inaPaintRepresentationState
- identifies which paint representation state the layer should render into the viewaView
- the view into which the layer is being rendered- Returns:
- progress information describing the painting operation
-
setCulling
public void setCulling(boolean aCulling) Sets whether objects outside the visible view portion are culled and not painted. Enabling culling restricts the objects that are painted to those that (approximately) overlap with the view. This typically reduces the memory usage and increases the frame rate. However because culling also introduces an additional overhead, you may get better performance by disabling it for either very dynamic layers or layers with only a small amount of objects. The cost of culling is typically higher if the model does not implementILcd2DBoundsIndexedModel
. The culling of objects is based on their model bounds. These bounds may be (slightly) different from the painted representation's bounds. This can occur due to styling (for example painting a point as a circle or as a view-sized icon). To ensure that objects all objects are correctly painted in these cases you can configure a margin in bothpixels
andmeters
. The default value istrue
unless the layer type isILspLayer.LayerType.REALTIME
. In most cases, it should not be necessary to modify this property.- Parameters:
aCulling
- whether objects are culled or not- See Also:
-
isCulling
public boolean isCulling()Determines whether objects outside the visible view portion are culled and not painted.- Returns:
- whether objects outside the visible view portion are culled
- See Also:
-
getBounds
public ILcdBounds getBounds(TLspContext aContext) throws TLcdNoBoundsException, TLcdOutOfBoundsException Description copied from class:ALspLayer
Returns the bounds of the layer in world coordinates. The world reference system returned byTLspContext.getXYZWorldReference()
is used. ALspLayer provides a default model based implementation of this method. In some cases, this is only an approximation of the actual bounds, so more specific implementations are encouraged to provide a more precise implementation.- Specified by:
getBounds
in interfaceILspLayer
- Overrides:
getBounds
in classALspLayer
- 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.
-
registerView
Description copied from interface:ILspLayer
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 invokesILspLayer.unregisterView(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.- Specified by:
registerView
in interfaceILspLayer
- Overrides:
registerView
in classALspLayer
- Parameters:
aView
- the view to which this layer has been added
-
unregisterView
Description copied from interface:ILspLayer
Unregisters a view from this layer. This method is called by the view when this layer is removed from it. Along withILspLayer.registerView(com.luciad.view.lightspeed.ILspView)
, this method determines the result ofILspLayer.getCurrentViews()
.- Specified by:
unregisterView
in interfaceILspLayer
- Overrides:
unregisterView
in classALspLayer
- Parameters:
aView
- the view from which this layer has been removed
-
toString
-
createScaleRange
public static ILcdInterval createScaleRange(double aMinHeight, double aMaxHeight, TLspViewXYZWorldTransformation3D aW2V) Creates a scale range interval based on the given height values and given world-to-view transformation. Note that this method is only suitable for 3D views, for this reason a 3D world-to-view must be provided.- Parameters:
aMinHeight
- the minimum height in meters above the terrain of the scale rangeaMaxHeight
- the maximum height in meters above the terrain of the scale rangeaW2V
- the world-to-view transformation- Returns:
- a scale range represented in pixels / meters
- See Also:
-
createScaleRange
public static ILcdInterval createScaleRange(double aMinWidth, double aMinHeight, double aMaxWidth, double aMaxHeight, TLspViewXYZWorldTransformation2D aW2V) Creates a scale range based on the given width- and height values and the world-to-view transformation. The width- and height values describe the visible viewing rectangle in meters resp. for the minimum and maximum range in which a layer is visible.- Parameters:
aMinWidth
- the minimum width in meters of the scale rangeaMinHeight
- the minimum height in meters of the scale rangeaMaxWidth
- the maximum width in meters of the scale rangeaMaxHeight
- the maximum height in meters of the scale rangeaW2V
- the world-to-view transformation- Returns:
- a scale range represented in pixels / meters
- See Also:
-
query
Description copied from interface:ILspInteractivePaintableLayer
Retrieves a set of domain objects and data based on the parameters given by the query.- Specified by:
query
in interfaceILspInteractivePaintableLayer
- Type Parameters:
T
- the type of the return value ofALspPaintQuery.getResult()
- Parameters:
aQuery
- the queryaContext
- the context- Returns:
- the value returned by
ALspPaintQuery.getResult()
after processing is finished
-
getStyler
Returns the styler of the painter for the given TLspPaintRepresentationState.- Specified by:
getStyler
in interfaceILspStyledLayer
- Parameters:
aPaintRepresentationState
- the paint representation state for which the styler should be retrieved- Returns:
- the styler used for the given paint representation state
- Throws:
IllegalArgumentException
- ifaPaintRepresentationState.getPaintRepresentation()
is not supported- See Also:
-
setStyler
Sets the styler of thepainter
that is currently set for the given TLspPaintRepresentationState. This painter must implementILspEditableStyledPainter
. The painter may only be null forTLspPaintRepresentation.LABEL
orTLspPaintRepresentation.BODY
. For other, unknown, paint representations, an exception will be thrown in the painter is null.- Specified by:
setStyler
in interfaceILspEditableStyledLayer
- Parameters:
aPaintRepresentationState
- The paint representation state for which the styler should be set.aStyler
- the new styler for the layer- Throws:
IllegalArgumentException
- ifaPaintRepresentationState.getPaintRepresentation()
is not supported- See Also:
-
getModelQueryConfiguration
Returns the model query configuration which is used by this layer to retrieve the filters to query the model with during a paint operation. This model query configuration allows to reduce the amount of the data that is loaded by this layer during painting. The default is a configuration which loads all data for the whole scale range. Consult the class javadoc for more information about data filtering.- Returns:
- the model query configuration which is used by the layer to retrieve the filters to query the model with during
a paint operation. Never
null
. - Since:
- 2017.0
-
setModelQueryConfiguration
Sets the model query configuration which defines the filters to query the model with during a paint operation. This model query configuration allows to reduce the amount of the data that is loaded by this layer during painting. Consult the class javadoc for more information about data filtering.- Parameters:
aModelQueryConfiguration
- The non-null
model query configuration- Since:
- 2017.0
-
configureForSLDStyling
Style this layer using the specified SLD style. This method is a utility method, which is the equivalent of:
- Setting a
TLspSLDStyler
for the specified SLD style as body and label styler. - Setting a
model query configuration
based on the scales present in the SLD.
Note that in future versions of the product it is possible that this method will overwrite more settings.
- Parameters:
aSLDFeatureTypeStyle
- The SLD style- Since:
- 2017.0
- See Also:
- Setting a
-