Class TLspLayer

java.lang.Object
com.luciad.view.lightspeed.layer.ALspLayer
com.luciad.view.lightspeed.layer.TLspLayer
All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdLayer, ILspSnappable, ILspEditableStyledLayer, ILspInteractivePaintableLayer, ILspLayer, ILspPaintableLayer, ILspStyledLayer, Serializable
Direct Known Subclasses:
TLspLayerTreeNode

Default implementation of 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:

The layer determines asynchronously what objects need to be painted. This ensures a smooth user interaction. The layer uses the 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 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.
  • 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:
  • Constructor Details

    • TLspLayer

      public TLspLayer(ILcdModel aModel, String aLabel, ILspLayer.LayerType aLayerType)
      Initializes a new TLspLayer object with given model, label and layer type.
      Parameters:
      aModel - the model that is to be added to the new layer
      aLabel - the label of the new layer
      aLayerType - the LayerType of the new layer
    • TLspLayer

      public TLspLayer(ILcdModel aModel, ILspLayer.LayerType aLayerType)
      Initializes a new TLspLayer object with given model and layer type.
      Parameters:
      aModel - the model that is to be added to the new layer
      aLayerType - the LayerType of the new layer
    • TLspLayer

      public TLspLayer(ILcdModel aModel, String aLabel)
      Initializes a new TLspLayer object with given model and label.
      Parameters:
      aModel - the model that is to be added to the new layer
      aLabel - the label of the new layer
    • TLspLayer

      public 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.
      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 if 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.

      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 (if 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.

      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 (if 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.

      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 is 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.

      Parameters:
      aSynchronizePainters - true if the painters should be synchronized
      See Also:
    • getLayerType

      public ILspLayer.LayerType getLayerType()
      Returns the layer type set via this layer's constructor. If a constructor without a LayerType argument is used, the default value is ILspLayer.LayerType.EDITABLE.
      Specified by:
      getLayerType in interface ILspLayer
      Overrides:
      getLayerType in class ALspLayer
      Returns:
      this layer's LayerType
      See Also:
    • getRequiredOpenGLProfile

      public TLspOpenGLProfile 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 interface ILspPaintableLayer
      Returns:
      the layer's required OpenGL profile
      See Also:
    • setFilter

      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.

      Overrides:
      setFilter in class ALspLayer
      Parameters:
      aFilter - the filter that accepts only those objects that should be taken into account
      See Also:
    • addEditingStateListener

      public void addEditingStateListener(ILspEditingStateListener aEditingStateListener)
      Description copied from interface: ILspInteractivePaintableLayer
      /** Adds an ILspEditingStateListener to this ILspInteractivePaintableLayer.
      Specified by:
      addEditingStateListener in interface ILspInteractivePaintableLayer
      Parameters:
      aEditingStateListener - the ILspEditingStateListener to be added.
    • removeEditingStateListener

      public void removeEditingStateListener(ILspEditingStateListener aEditingStateListener)
      Description copied from interface: ILspInteractivePaintableLayer
      Removes an ILspEditingStateListener from this ILspInteractivePaintableLayer.
      Specified by:
      removeEditingStateListener in interface ILspInteractivePaintableLayer
      Parameters:
      aEditingStateListener - the ILspEditingStateListener to be removed.
    • getObjectsWithPaintState

      public ILcdCollection<Object> getObjectsWithPaintState(TLspPaintState aState)
      Description copied from interface: ILspInteractivePaintableLayer
      Returns the objects in the specified paint state.

      The paint state must not be 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.

      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 the TLcdLockUtil. 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 interface ILspInteractivePaintableLayer
      Parameters:
      aState - a paint state
      Returns:
      the objects
    • editedObjectChanged

      public void editedObjectChanged(Object aObject)
      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 interface ILspInteractivePaintableLayer
      Parameters:
      aObject - the object
      See Also:
    • editedObjectsChanged

      public void editedObjectsChanged(Collection<Object> aObjectList)
      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 interface ILspInteractivePaintableLayer
      Parameters:
      aObjectList - A list of domain objects (in this layer) that have changed significantly. Never null.
      See Also:
    • isSelectableSupported

      public boolean isSelectableSupported()
      Returns true if this layer supports selecting objects, false otherwise.
      Specified by:
      isSelectableSupported in interface ILcdLayer
      Overrides:
      isSelectableSupported in class ALspLayer
      Returns:
      true
      See Also:
    • setSelectableSupported

      public void setSelectableSupported(boolean aSelectableSupported)
      Controls whether this layer supports selection. By default this property is 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.

      Parameters:
      aSelectableSupported - true to allow making this layer's contents selectable, and false otherwise.
    • getPainter

      public ILspPainter getPainter(TLspPaintRepresentation aPaintRepresentation)
      Description copied from interface: ILspInteractivePaintableLayer
      Returns the painter currently associated with the specified paint representation, or null if no painter is associated.
      Specified by:
      getPainter in interface ILspInteractivePaintableLayer
      Parameters:
      aPaintRepresentation - the paint representation for which to obtain a painter
      Returns:
      the associated painter if it exists, or null otherwise
    • setPainter

      public void setPainter(TLspPaintRepresentation aPaintRepresentation, ILspPainter aPainter)
      Sets the painter for a paint representation.
      Parameters:
      aPaintRepresentation - the paint representation
      aPainter - the painter or null
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
    • setVisible

      public void setVisible(TLspPaintRepresentationState aPaintRepresentationState, boolean aVisible)
      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 the layer visibility. So a paint representation state will only be visible when this method and the ILcdLayer.isVisible() method return true.

      Specified by:
      setVisible in interface ILspLayer
      Overrides:
      setVisible in class ALspLayer
      Parameters:
      aPaintRepresentationState - the representations to enable or disable
      aVisible - true to enable the representations or false to disable it
      See Also:
    • setVisible

      public void setVisible(TLspPaintRepresentation aPaintRepresentation, boolean aVisible)
      Description copied from interface: ILspLayer
      Enables or disables all TLspPaintRepresentationStates 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).

      Specified by:
      setVisible in interface ILspLayer
      Overrides:
      setVisible in class ALspLayer
      Parameters:
      aPaintRepresentation - the representation to enable or disable
      aVisible - 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 interface ILcdLayer
      Specified by:
      setVisible in interface ILspLayer
      Overrides:
      setVisible in class ALspLayer
      Parameters:
      aVisible - true if the layer should be visible, false otherwise.
      See Also:
    • getEditor

      public ILspEditor getEditor(TLspPaintRepresentation aPaintRepresentation)
      Description copied from interface: ILspInteractivePaintableLayer
      Returns the editor currently associated with the given paint representation, or null if no editor is associated.
      Specified by:
      getEditor in interface ILspInteractivePaintableLayer
      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()
      Returns true if the layer supports editing its objects. This implementation returns true if the layer has an editor.
      Specified by:
      isEditableSupported in interface ILcdLayer
      Overrides:
      isEditableSupported in class ALspLayer
      Returns:
      true
      See Also:
    • setEditor

      public void setEditor(TLspPaintRepresentation aPaintRepresentation, ILspEditor aEditor)
      Sets the editor for a paint representation.
      Parameters:
      aPaintRepresentation - the paint representation
      aEditor - the editor or null
      Throws:
      IllegalArgumentException - if aPaintRepresentation 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 interface ILspSnappable
      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 interface ILspSnappable
      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

      public ILcdInterval getScaleRange(TLspPaintRepresentation aPaintRepresentation)
      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 the unitless 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 by getMapScaleRange(com.luciad.view.lightspeed.layer.TLspPaintRepresentation). The min and max values of the given interval are in toolkit pixels / meters.
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • setScaleRange

      public void setScaleRange(TLspPaintRepresentation aPaintRepresentation, ILcdInterval aScaleRange)
      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 most use cases, we recommended using the 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.

      Parameters:
      aPaintRepresentation - the paint representation
      aScaleRange - 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.
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • 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 the toolkit scale range: only one of them has a non-null value.

      Overrides:
      getMapScaleRange in class ALspLayer
      Parameters:
      aPaintRepresentation - the paint representation for which to return the scale range
      Returns:
      the scale range
      Throws:
      IllegalArgumentException - if aPaintRepresentation 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 a model query configuration.

      Overrides:
      setMapScaleRange in class ALspLayer
      Parameters:
      aPaintRepresentation - the paint representation
      aMapScaleRange - the new scale range of this layer, or null to deactivate any scale restriction
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      Since:
      2021.0
      See Also:
    • getMapScaleProvider

      public ILspMapScaleProvider 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 a TLspScaleBasedStyler.
      Specified by:
      getMapScaleProvider in interface ILspLayer
      Returns:
      a map scale provider, not null. The default map scale provider takes the map scale directly from the view and can be created with ILspMapScaleProvider.fromView().
    • setMapScaleProvider

      public 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. This impacts stylers that select their style by map scale, such as an SLD styler or a 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.

      Parameters:
      aMapScaleProvider - a map scale provider, must not be null. The default provider can be created with ILspMapScaleProvider.fromView()
      Since:
      2022.0
    • getPaintRepresentations

      public Collection<TLspPaintRepresentation> getPaintRepresentations()
      By default the 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.
      Specified by:
      getPaintRepresentations in interface ILspLayer
      Overrides:
      getPaintRepresentations in class ALspLayer
      Returns:
      a collection of PaintRepresentations, never null
    • addPaintRepresentation

      public void addPaintRepresentation(TLspPaintRepresentation aPaintRepresentation)
      Adds a new paint representation.
      Overrides:
      addPaintRepresentation in class ALspLayer
      Parameters:
      aPaintRepresentation - the paint representation
      See Also:
    • removePaintRepresentation

      public void removePaintRepresentation(TLspPaintRepresentation aPaintRepresentation)
      Removes a paint representation.
      Overrides:
      removePaintRepresentation in class ALspLayer
      Parameters:
      aPaintRepresentation - the paint representation
      See Also:
    • getPainters

      public Collection<ILspPainter> getPainters()
      Returns all painters currently registered on this layer.
      Returns:
      all painters currently registered on this layer
    • getEditors

      public Collection<ILspEditor> getEditors()
      Returns all editors currently registered on this layer.
      Returns:
      all editors currently registered on this layer
    • setModel

      public void setModel(ILcdModel aModel)
      Description copied from class: ALspLayer
      Sets the ILcdModel to this layer.

      This method is not thread safe, it is recommended to synchronize on the layer instance if needed.

      Overrides:
      setModel in class ALspLayer
      Parameters:
      aModel - the model that contains the objects that should be displayed in this layer.
    • 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 an 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.

      Specified by:
      paint in interface ILspPaintableLayer
      Parameters:
      aGLDrawable - the access point to OpenGL
      aPhase - describes the phase that the view repaint process is currently in
      aPaintRepresentationState - identifies which paint representation state the layer should render into the view
      aView - 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 implement 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.

      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

      Description copied from class: ALspLayer
      Returns the bounds of the layer in world coordinates. The world reference system returned by 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.

      Specified by:
      getBounds in interface ILspLayer
      Overrides:
      getBounds in class ALspLayer
      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

      public void registerView(ILspView aView)
      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 invokes 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.
      Specified by:
      registerView in interface ILspLayer
      Overrides:
      registerView in class ALspLayer
      Parameters:
      aView - the view to which this layer has been added
    • unregisterView

      public void unregisterView(ILspView aView)
      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 with ILspLayer.registerView(com.luciad.view.lightspeed.ILspView), this method determines the result of ILspLayer.getCurrentViews().
      Specified by:
      unregisterView in interface ILspLayer
      Overrides:
      unregisterView in class ALspLayer
      Parameters:
      aView - the view from which this layer has been removed
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 range
      aMaxHeight - the maximum height in meters above the terrain of the scale range
      aW2V - 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 range
      aMinHeight - the minimum height in meters of the scale range
      aMaxWidth - the maximum width in meters of the scale range
      aMaxHeight - the maximum height in meters of the scale range
      aW2V - the world-to-view transformation
      Returns:
      a scale range represented in pixels / meters
      See Also:
    • query

      public <T> T query(ALspPaintQuery<T> aQuery, TLspContext aContext)
      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 interface ILspInteractivePaintableLayer
      Type Parameters:
      T - the type of the return value of ALspPaintQuery.getResult()
      Parameters:
      aQuery - the query
      aContext - the context
      Returns:
      the value returned by ALspPaintQuery.getResult() after processing is finished
    • getStyler

      public ILspStyler getStyler(TLspPaintRepresentationState aPaintRepresentationState)
      Returns the styler of the painter for the given TLspPaintRepresentationState.
      Specified by:
      getStyler in interface ILspStyledLayer
      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 - if aPaintRepresentationState.getPaintRepresentation() is not supported
      See Also:
    • setStyler

      public void setStyler(TLspPaintRepresentationState aPaintRepresentationState, ILspStyler aStyler)
      Sets the styler of the 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.
      Specified by:
      setStyler in interface ILspEditableStyledLayer
      Parameters:
      aPaintRepresentationState - The paint representation state for which the styler should be set.
      aStyler - the new styler for the layer
      Throws:
      IllegalArgumentException - if aPaintRepresentationState.getPaintRepresentation() is not supported
      See Also:
    • getModelQueryConfiguration

      public final 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. 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

      public final void setModelQueryConfiguration(TLcdModelQueryConfiguration aModelQueryConfiguration)
      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

      public final void configureForSLDStyling(TLcdSLDFeatureTypeStyle aSLDFeatureTypeStyle)

      Style this layer using the specified SLD style. This method is a utility method, which is the equivalent of:

      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: