public class TLspLayer extends ALspLayer implements ILspEditableStyledLayer, ILspSnappable, ILspInteractivePaintableLayer
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.
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.
ALspStyler
.
Before passing the domain objects, the layer will first apply the filter
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.
ALspStyler
itself can decide to not visualize certain objects by not submitting
them on the style collector.
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.
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.
ALspLayerBuilder
,
Serialized FormILspLayer.LayerType
Constructor and Description |
---|
TLspLayer(ILcdModel aModel)
Initializes a new
TLspLayer object with the given model and the display name of the
model's ILcdModelDescriptor as the layer label. |
TLspLayer(ILcdModel aModel,
ILspLayer.LayerType aLayerType)
Initializes a new
TLspLayer object with given model and layer type. |
TLspLayer(ILcdModel aModel,
String aLabel)
Initializes a new
TLspLayer object with given model and label. |
TLspLayer(ILcdModel aModel,
String aLabel,
ILspLayer.LayerType aLayerType)
Initializes a new
TLspLayer object with given model, label and layer type. |
Modifier and Type | Method and Description |
---|---|
void |
addEditingStateListener(ILspEditingStateListener aEditingStateListener)
/**
Adds an
ILspEditingStateListener to this ILspInteractivePaintableLayer . |
void |
addPaintRepresentation(TLspPaintRepresentation aPaintRepresentation)
Adds a new paint representation.
|
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.
|
ILcdBounds |
getBounds(TLspContext aContext)
Returns the bounds of the layer in world coordinates.
|
ILspEditor |
getEditor(TLspPaintRepresentation aPaintRepresentation)
Returns the editor currently associated with the given paint representation, or
null
if no editor is associated. |
Collection<ILspEditor> |
getEditors()
Returns all editors currently registered on this layer.
|
ILspLayer.LayerType |
getLayerType()
Returns the layer type set via this layer's constructor.
|
ILspMapScaleProvider |
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.
|
TLcdDimensionInterval<TLcdMapScale> |
getMapScaleRange(TLspPaintRepresentation aPaintRepresentation)
Returns the scale range of a TLspPaintRepresentation of this layer in unitless map scale ratios.
|
double |
getMinimumObjectSizeForPainting()
Returns the minimum size of an object in the view for it to be painted and handled otherwise.
|
TLcdModelQueryConfiguration |
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.
|
ILcdCollection<Object> |
getObjectsWithPaintState(TLspPaintState aState)
Returns the objects in the specified paint state.
|
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.
|
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.
|
ILspPainter |
getPainter(TLspPaintRepresentation aPaintRepresentation)
Returns the painter currently associated with the specified paint
representation, or
null if no painter is associated. |
Collection<ILspPainter> |
getPainters()
Returns all painters currently registered on this layer.
|
Collection<TLspPaintRepresentation> |
getPaintRepresentations()
By default the
TLspPaintRepresentation.BODY and TLspPaintRepresentation.LABEL
paint representations are supported. |
TLspOpenGLProfile |
getRequiredOpenGLProfile()
Returns an OpenGL profile which is a superset of the profiles of all the painters currently
associated with this layer.
|
ILcdInterval |
getScaleRange(TLspPaintRepresentation aPaintRepresentation)
Returns the scale range of a TLspPaintRepresentation of this layer in toolkit pixels/meter.
|
ILspStyler |
getStyler(TLspPaintRepresentationState aPaintRepresentationState)
Returns the styler of the painter for the given TLspPaintRepresentationState.
|
boolean |
isCulling()
Determines whether objects outside the visible view portion are culled and not painted.
|
boolean |
isEditableSupported()
Returns
true if the layer supports editing its objects. |
boolean |
isSelectableSupported()
Returns
true if this layer supports selecting objects, false otherwise. |
boolean |
isSnapTarget()
Determines whether this object should be regarded as a source for snapping points.
|
boolean |
isSynchronizePainters()
Returns whether the painters are synchronized.
|
TLspPaintProgress |
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 an
ILspEditingStateListener from this ILspInteractivePaintableLayer . |
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 the
ILcdDynamicFilter 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 |
setModel(ILcdModel aModel)
Sets the
ILcdModel to this layer. |
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 the
painter
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 all
TLspPaintRepresentationState s of the specified
TLspPaintRepresentation . |
void |
setVisible(TLspPaintRepresentationState aPaintRepresentationState,
boolean aVisible)
Enables or disables the a paint representation state.
|
String |
toString() |
void |
unregisterView(ILspView aView)
Unregisters a view from this layer.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
addLayerStateListener, addStatusListener, getCurrentViews, getLayerStyle, getModelXYZWorldTransformation, invalidate, isEditable, isVisible, isVisible, removeLayerStateListener, removeStatusListener, setEditable, setEditable, setLayerStyle
clearSelection, fireCollectedSelectionChanges, getIcon, getLabel, getModel, isEditable, isSelectable, isVisible, selectObject, setIcon, setLabel, setSelectable
addSelectionListener, getSelectedObjects, getSelectionCount, isSelected, removeSelectionListener, selectedObjects
addPropertyChangeListener, removePropertyChangeListener
public TLspLayer(ILcdModel aModel, String aLabel, ILspLayer.LayerType aLayerType)
TLspLayer
object with given model, label and layer type.aModel
- the model that is to be added to the new layeraLabel
- the label of the new layeraLayerType
- the LayerType
of the new layerpublic TLspLayer(ILcdModel aModel, ILspLayer.LayerType aLayerType)
TLspLayer
object with given model and layer type.aModel
- the model that is to be added to the new layeraLayerType
- the LayerType
of the new layerpublic TLspLayer(ILcdModel aModel, String aLabel)
TLspLayer
object with given model and label.aModel
- the model that is to be added to the new layeraLabel
- the label of the new layerpublic TLspLayer(ILcdModel aModel)
TLspLayer
object with the given model and the display name of the
model's ILcdModelDescriptor
as the layer label.aModel
- the model to assign to the new layerpublic double getMinimumObjectSizeForPainting()
setMinimumObjectSizeForPainting(double)
public void setMinimumObjectSizeForPainting(double aMinimumObjectSizeForPainting)
culling
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.aMinimumObjectSizeForPainting
- The minimal size, expressed in pixels.getMinimumObjectSizeForPainting()
public double getObjectViewMargin()
setObjectViewMargin(double)
public void setObjectViewMargin(double aObjectViewMargin)
culling
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 a maximum distance in meters
.
The default value is 64
.aObjectViewMargin
- the maximum difference in pixelssetCulling(boolean)
,
setObjectWorldMargin(double)
public double getObjectWorldMargin()
setObjectWorldMargin(double)
public void setObjectWorldMargin(double aObjectWorldMargin)
culling
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 a maximum distance in pixels
.
The default value is 0
.aObjectWorldMargin
- the maximum difference in meterssetCulling(boolean)
,
setObjectWorldMargin(double)
public boolean isSynchronizePainters()
true
if the painters are synchronized.setSynchronizePainters(boolean)
public void setSynchronizePainters(boolean aSynchronizePainters)
true
.
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)
and ILspPaintGroupsChangeListener.commitChanges(java.lang.Object)
.
This is optional however.
aSynchronizePainters
- true
if the painters should be synchronizedILspPaintGroupsChangeListener.prepareChanges(java.util.List<com.luciad.view.lightspeed.layer.paintgroup.TLspPaintGroupsChangedEvent>, java.lang.Object, com.luciad.view.lightspeed.layer.paintgroup.ILspPaintGroupsChangeListener.Callback)
,
ILspPaintGroupsChangeListener.commitChanges(java.lang.Object)
public ILspLayer.LayerType getLayerType()
LayerType
argument is used, the default value is ILspLayer.LayerType.EDITABLE
.getLayerType
in interface ILspLayer
getLayerType
in class ALspLayer
LayerType
ILspLayer.LayerType
public TLspOpenGLProfile getRequiredOpenGLProfile()
getRequiredOpenGLProfile
in interface ILspPaintableLayer
TLspOpenGLProfile.getSuperSet(com.luciad.view.lightspeed.TLspOpenGLProfile...)
,
ILspPainter.getRequiredOpenGLProfile()
public void setFilter(ILcdDynamicFilter aFilter)
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 is null
.
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.
setFilter
in class ALspLayer
aFilter
- the filter that accepts only those objects that should be taken
into accountALspLayer.getFilter()
public void addEditingStateListener(ILspEditingStateListener aEditingStateListener)
ILspInteractivePaintableLayer
ILspEditingStateListener
to this ILspInteractivePaintableLayer
.addEditingStateListener
in interface ILspInteractivePaintableLayer
aEditingStateListener
- the ILspEditingStateListener
to be added.public void removeEditingStateListener(ILspEditingStateListener aEditingStateListener)
ILspInteractivePaintableLayer
ILspEditingStateListener
from this ILspInteractivePaintableLayer
.removeEditingStateListener
in interface ILspInteractivePaintableLayer
aEditingStateListener
- the ILspEditingStateListener
to be removed.public ILcdCollection<Object> getObjectsWithPaintState(TLspPaintState aState)
ILspInteractivePaintableLayer
TLspPaintState.REGULAR
, you can use ILspInteractivePaintableLayer.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.getObjectsWithPaintState
in interface ILspInteractivePaintableLayer
aState
- a paint statepublic void editedObjectChanged(Object aObject)
ILspInteractivePaintableLayer
editedObjectChanged
in interface ILspInteractivePaintableLayer
aObject
- the objectTLspEditingStateEvent.ChangeType.EDITING_CHANGE
,
ILspInteractivePaintableLayer.addEditingStateListener(com.luciad.view.lightspeed.editor.operation.ILspEditingStateListener)
public void editedObjectsChanged(Collection<Object> aObjectList)
ILspInteractivePaintableLayer
editedObjectsChanged
in interface ILspInteractivePaintableLayer
aObjectList
- A list of domain objects (in this layer) that have changed significantly. Never null.TLspEditingStateEvent.ChangeType.EDITING_CHANGE
,
ILspInteractivePaintableLayer.addEditingStateListener(com.luciad.view.lightspeed.editor.operation.ILspEditingStateListener)
public boolean isSelectableSupported()
true
if this layer supports selecting objects, false
otherwise.isSelectableSupported
in interface ILcdLayer
isSelectableSupported
in class ALspLayer
true
setSelectableSupported(boolean)
public void setSelectableSupported(boolean aSelectableSupported)
true
.
If the layer supports selection, selection can be activated by calling ALspLayer.setSelectable(boolean)
.
It is recommended to only set this property once, right after constructing the layer, e.g. in a layer factory.
aSelectableSupported
- true
to allow making this layer's contents selectable, and false
otherwise.public ILspPainter getPainter(TLspPaintRepresentation aPaintRepresentation)
ILspInteractivePaintableLayer
null
if no painter is associated.getPainter
in interface ILspInteractivePaintableLayer
aPaintRepresentation
- the paint representation for which to obtain a painternull
otherwisepublic void setPainter(TLspPaintRepresentation aPaintRepresentation, ILspPainter aPainter)
aPaintRepresentation
- the paint representationaPainter
- the painter or null
IllegalArgumentException
- if aPaintRepresentation
is not supportedpublic void setVisible(TLspPaintRepresentationState aPaintRepresentationState, boolean aVisible)
ILspLayer
layer visibility
. So a paint
representation state will only be visible when this method and the ILcdLayer.isVisible()
method
return true
.setVisible
in interface ILspLayer
setVisible
in class ALspLayer
aPaintRepresentationState
- the representations to enable or disableaVisible
- true to enable the representations or false to disable itILspLayer.setVisible(boolean)
public void setVisible(TLspPaintRepresentation aPaintRepresentation, boolean aVisible)
ILspLayer
TLspPaintRepresentationState
s of the specified
TLspPaintRepresentation
.
This can be used to quickly switch representations (e.g. labels) on and off
without having to remove its related properties (ex. a painter).setVisible
in interface ILspLayer
setVisible
in class ALspLayer
aPaintRepresentation
- the representation to enable or disableaVisible
- true to enable the representations or false to disable itILspLayer.setVisible(TLspPaintRepresentationState, boolean)
public void setVisible(boolean aVisible)
ALspLayer
This method is not thread safe, it is recommended to synchronize on the layer instance if needed.
setVisible
in interface ILcdLayer
setVisible
in interface ILspLayer
setVisible
in class ALspLayer
aVisible
- true
if the layer should be visible, false
otherwise.ILspLayer.setVisible(TLspPaintRepresentationState, boolean)
public ILspEditor getEditor(TLspPaintRepresentation aPaintRepresentation)
ILspInteractivePaintableLayer
null
if no editor is associated.getEditor
in interface ILspInteractivePaintableLayer
aPaintRepresentation
- the paint representation for which to retrieve an editornull
otherwisepublic boolean isEditableSupported()
true
if the layer supports editing its objects.
This implementation returns true if the layer has an editor.isEditableSupported
in interface ILcdLayer
isEditableSupported
in class ALspLayer
true
ILcdLayer.setEditable(boolean)
public void setEditor(TLspPaintRepresentation aPaintRepresentation, ILspEditor aEditor)
aPaintRepresentation
- the paint representationaEditor
- the editor or null
IllegalArgumentException
- if aPaintRepresentation
is not supportedpublic boolean isSnapTarget()
ILspSnappable
isSnapTarget
in interface ILspSnappable
public void setSnapTarget(boolean aIsSnapTarget)
ILspSnappable
setSnapTarget
in interface ILspSnappable
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.public ILcdInterval getScaleRange(TLspPaintRepresentation aPaintRepresentation)
unitless map scale range
instead.
This property is mutually exclusive with the map scale range:
only one of them has a non-null
value.aPaintRepresentation
- the paint representation for which to return the scale rangenull
if the scale constraints are determined by getMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation)
.
The min and max values of the given interval are in toolkit pixels / meters.IllegalArgumentException
- if aPaintRepresentation
is not supportedgetMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation)
public void setScaleRange(TLspPaintRepresentation aPaintRepresentation, ILcdInterval aScaleRange)
createScaleRange(double, double, double, double, com.luciad.view.lightspeed.camera.TLspViewXYZWorldTransformation2D)
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 a model query configuration
.aPaintRepresentation
- the paint representationaScaleRange
- the new scale range of this layer, in toolkit pixels / meter, or null
to deactivate any scale restriction
The minimum (smallest) value is the most zoomed out, the maximum (largest) value is the most zoomed in.IllegalArgumentException
- if aPaintRepresentation
is not supportedsetMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation, com.luciad.multidimensional.TLcdDimensionInterval<com.luciad.view.TLcdMapScale>)
,
createScaleRange(double, double, double, double, com.luciad.view.lightspeed.camera.TLspViewXYZWorldTransformation2D)
,
createScaleRange(double, double, com.luciad.view.lightspeed.camera.TLspViewXYZWorldTransformation3D)
public TLcdDimensionInterval<TLcdMapScale> getMapScaleRange(TLspPaintRepresentation aPaintRepresentation)
toolkit scale range
:
only one of them has a non-null
value.getMapScaleRange
in class ALspLayer
aPaintRepresentation
- the paint representation for which to return the scale rangeIllegalArgumentException
- if aPaintRepresentation
is not supportedsetMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation, com.luciad.multidimensional.TLcdDimensionInterval<com.luciad.view.TLcdMapScale>)
public void setMapScaleRange(TLspPaintRepresentation aPaintRepresentation, TLcdDimensionInterval<TLcdMapScale> aMapScaleRange)
model query configuration
.setMapScaleRange
in class ALspLayer
aPaintRepresentation
- the paint representationaMapScaleRange
- the new scale range of this layer, or null
to deactivate any scale restrictionIllegalArgumentException
- if aPaintRepresentation
is not supportedsetMapScaleRange(TLspPaintRepresentation, TLcdDimensionInterval)
,
TLcdMapScale.createScaleRange(TLcdMapScale, TLcdMapScale)
public ILspMapScaleProvider getMapScaleProvider()
ILspLayer
TLspScaleBasedStyler
.getMapScaleProvider
in interface ILspLayer
null
. The default map scale provider takes the map scale directly from
the view and can be created with ILspMapScaleProvider.fromView()
.public void setMapScaleProvider(ILspMapScaleProvider aMapScaleProvider)
TLspScaleBasedStyler
.
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.aMapScaleProvider
- a map scale provider, must not be null. The default provider can be created with
ILspMapScaleProvider.fromView()
public Collection<TLspPaintRepresentation> getPaintRepresentations()
TLspPaintRepresentation.BODY
and TLspPaintRepresentation.LABEL
paint representations are supported. You can use the
addPaintRepresentation(TLspPaintRepresentation)
and
removePaintRepresentation(TLspPaintRepresentation)
methods to add or remove supported
paint representations.getPaintRepresentations
in interface ILspLayer
getPaintRepresentations
in class ALspLayer
PaintRepresentation
s, never null
public void addPaintRepresentation(TLspPaintRepresentation aPaintRepresentation)
addPaintRepresentation
in class ALspLayer
aPaintRepresentation
- the paint representationgetPaintRepresentations()
public void removePaintRepresentation(TLspPaintRepresentation aPaintRepresentation)
removePaintRepresentation
in class ALspLayer
aPaintRepresentation
- the paint representationgetPaintRepresentations()
public Collection<ILspPainter> getPainters()
public Collection<ILspEditor> getEditors()
public void setModel(ILcdModel aModel)
ALspLayer
ILcdModel
to this layer.
This method is not thread safe, it is recommended to synchronize on the layer instance if needed.
public TLspPaintProgress paint(ILcdGLDrawable aGLDrawable, TLspPaintPhase aPhase, TLspPaintRepresentationState aPaintRepresentationState, ILspView aView)
ILspPaintableLayer
ILcdGLDrawable
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
supplied TLspPaintPhase
.
This method returns a TLspPaintProgress
object to indicate whether the repaint
was entirely finished or not. This might not be the case if the paint()
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 the paint()
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.paint
in interface ILspPaintableLayer
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 renderedpublic void setCulling(boolean aCulling)
ILcd2DBoundsIndexedModel
.
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 both pixels
and meters
.
The default value is true
unless the layer type is ILspLayer.LayerType.REALTIME
.
In most cases, it should not be necessary to modify this property.aCulling
- whether objects are culled or notsetObjectViewMargin(double)
,
setObjectWorldMargin(double)
public boolean isCulling()
setCulling(boolean)
public ILcdBounds getBounds(TLspContext aContext) throws TLcdNoBoundsException, TLcdOutOfBoundsException
ALspLayer
TLspContext.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.getBounds
in interface ILspLayer
getBounds
in class ALspLayer
aContext
- The context that defines the reference system for the bounds to be
returned.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.public void registerView(ILspView aView)
ILspLayer
ILspLayer.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.registerView
in interface ILspLayer
registerView
in class ALspLayer
aView
- the view to which this layer has been addedpublic void unregisterView(ILspView aView)
ILspLayer
ILspLayer.registerView(com.luciad.view.lightspeed.ILspView)
, this method
determines the result of ILspLayer.getCurrentViews()
.unregisterView
in interface ILspLayer
unregisterView
in class ALspLayer
aView
- the view from which this layer has been removedpublic static ILcdInterval createScaleRange(double aMinHeight, double aMaxHeight, TLspViewXYZWorldTransformation3D aW2V)
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 transformationsetScaleRange(TLspPaintRepresentation, com.luciad.util.ILcdInterval)
public static ILcdInterval createScaleRange(double aMinWidth, double aMinHeight, double aMaxWidth, double aMaxHeight, TLspViewXYZWorldTransformation2D aW2V)
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 transformationsetScaleRange(TLspPaintRepresentation, com.luciad.util.ILcdInterval)
public <T> T query(ALspPaintQuery<T> aQuery, TLspContext aContext)
ILspInteractivePaintableLayer
query
in interface ILspInteractivePaintableLayer
T
- the type of the return value of ALspPaintQuery.getResult()
aQuery
- the queryaContext
- the contextALspPaintQuery.getResult()
after processing is finishedpublic ILspStyler getStyler(TLspPaintRepresentationState aPaintRepresentationState)
getStyler
in interface ILspStyledLayer
aPaintRepresentationState
- the paint representation state for which the
styler should be retrievedIllegalArgumentException
- if aPaintRepresentationState.getPaintRepresentation()
is not supportedgetPainter(TLspPaintRepresentation)
public void setStyler(TLspPaintRepresentationState aPaintRepresentationState, ILspStyler aStyler)
painter
that is currently set for the given
TLspPaintRepresentationState. This painter must implement
ILspEditableStyledPainter
. The
painter may only be null for TLspPaintRepresentation.LABEL
or
TLspPaintRepresentation.BODY
. For other, unknown, paint
representations, an exception will be thrown in the painter is null.setStyler
in interface ILspEditableStyledLayer
aPaintRepresentationState
- The paint representation state for which the
styler should be set.aStyler
- the new styler for the layerIllegalArgumentException
- if aPaintRepresentationState.getPaintRepresentation()
is not supportedgetPainter(TLspPaintRepresentation)
,
ILspEditableStyledPainter
public final TLcdModelQueryConfiguration getModelQueryConfiguration()
null
.public final void setModelQueryConfiguration(TLcdModelQueryConfiguration aModelQueryConfiguration)
aModelQueryConfiguration
- The non-null
model query configurationpublic final void configureForSLDStyling(TLcdSLDFeatureTypeStyle aSLDFeatureTypeStyle)
Style this layer using the specified SLD style. This method is a utility method, which is the equivalent of:
TLspSLDStyler
for the specified SLD style as body and label styler.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.
aSLDFeatureTypeStyle
- The SLD styleTLspShapeLayerBuilder.sldStyle(TLcdSLDFeatureTypeStyle)