Interface ILspLayer

All Superinterfaces:
ILcdLayer, ILcdPropertyChangeSource, ILcdSelection<Object>, Serializable
All Known Subinterfaces:
ILspEditableStyledLayer, ILspImageProjectionLayer, ILspInteractivePaintableLayer, ILspPaintableLayer, ILspStyledLayer
All Known Implementing Classes:
ALspLayer, TLspGXYLayerAdapter, TLspGXYLayerTreeNodeAdapter, TLspLayer, TLspLayerTreeNode, TLspRasterLayer

public interface ILspLayer extends ILcdLayer
Root interface for all layers in an ILspView.

This interface introduces the concept of "paint representations": each layer can define any number of ways to visually represent the contents of its model. These representations are rendered into the view in separate passes, and each of them can be toggled on and off individually. The two commonly used representations are the geometries of objects (TLspPaintRepresentation.BODY) and textual representations (TLspPaintRepresentation.LABEL). This layer does not specify any mechanism for visualization of the layer's model; this is done in derived interfaces.

This interface extends the basic ILcdLayer interface with:

Since:
2012.0
See Also:
  • Method Details

    • getLayerType

      ILspLayer.LayerType getLayerType()
      Returns the layer type of this layer.

      This layer type can be used to choose the optimal strategy for a certain operation. For example painting a layer might be done differently for dynamic and static layers.

      Returns:
      the layer type of this layer
      See Also:
    • getPaintRepresentations

      Collection<TLspPaintRepresentation> getPaintRepresentations()
      Returns all PaintRepresentations that are supported by this layer.
      Returns:
      a collection of PaintRepresentations, never null
    • setVisible

      void setVisible(boolean aVisible)
      Description copied from interface: ILcdLayer
      Sets whether or not the layer's content is painted.
      Specified by:
      setVisible in interface ILcdLayer
      Parameters:
      aVisible - true if the layer should be visible, false otherwise.
      See Also:
    • setVisible

      void setVisible(TLspPaintRepresentation aPaintRepresentation, boolean aVisible)
      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).

      Parameters:
      aPaintRepresentation - the representation to enable or disable
      aVisible - true to enable the representations or false to disable it
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • isVisible

      boolean isVisible(TLspPaintRepresentation aPaintRepresentation)
      Returns whether one of the TLspPaintRepresentationStates of the the specified TLspPaintRepresentation is enabled.
      Parameters:
      aPaintRepresentation - the paint representation to check
      Returns:
      whether the specified PaintRepresentation is enabled or not
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • setVisible

      void setVisible(TLspPaintRepresentationState aPaintRepresentationState, boolean aVisible)
      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.

      Parameters:
      aPaintRepresentationState - the representations to enable or disable
      aVisible - true to enable the representations or false to disable it
      Throws:
      IllegalArgumentException - if aPaintRepresentationState is not supported
      See Also:
    • isVisible

      boolean isVisible(TLspPaintRepresentationState aPaintRepresentationState)
      Returns whether the specified PaintRepresentationState is enabled or not.
      Parameters:
      aPaintRepresentationState - the paint representation to check
      Returns:
      whether the specified PaintRepresentationState is enabled or not
      Throws:
      IllegalArgumentException - if aPaintRepresentationState is not supported
      See Also:
    • setEditable

      void setEditable(boolean aEditable)
      Description copied from interface: ILcdLayer
      Sets whether the layer should allow editing the content that it visualizes. Check isEditableSupported to see if the layer supports editing.
      Specified by:
      setEditable in interface ILcdLayer
      Parameters:
      aEditable - true if the layer content can be edited
      See Also:
    • setEditable

      void setEditable(TLspPaintRepresentation aPaintRepresentation, boolean aEditable)
      Enables or disables the editable property of a paint representation.

      This can be used to quickly switch editing for representations (e.g. labels) on and off without having to remove its related properties (ex. a painter).

      Note that this method is independent of the layer editability. So paint representation will only be editable when both the layer and the paint representation are editable and editing is supported.

      Parameters:
      aPaintRepresentation - the representation to enable or disable
      aEditable - true to enable the representations or false to disable it
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • isEditable

      boolean isEditable(TLspPaintRepresentation aPaintRepresentation)
      Returns whether the specified PaintRepresentation is editable or not.
      Parameters:
      aPaintRepresentation - the paint representation to check
      Returns:
      whether the specified PaintRepresentation is editable or not
      Throws:
      IllegalArgumentException - if aPaintRepresentation is not supported
      See Also:
    • registerView

      void registerView(ILspView aView)
      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 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.
      Parameters:
      aView - the view to which this layer has been added
    • unregisterView

      void unregisterView(ILspView aView)
      Unregisters a view from this layer. This method is called by the view when this layer is removed from it. Along with registerView(com.luciad.view.lightspeed.ILspView), this method determines the result of getCurrentViews().
      Parameters:
      aView - the view from which this layer has been removed
    • getCurrentViews

      Collection<ILspView> getCurrentViews()

      Returns a collection of all the views in which this layer is currently present. This list is kept up-to-date via the view's invocations of registerView(com.luciad.view.lightspeed.ILspView) and unregisterView(com.luciad.view.lightspeed.ILspView).

      The returned collection should not be modified.

      Returns:
      a collection of views in which this layer is currently present
      See Also:
    • getModelXYZWorldTransformation

      ILcdModelXYZWorldTransformation getModelXYZWorldTransformation(ILspView aView)

      Returns the transformation that will be used to transform coordinates of the objects in the model to world coordinates of the given view.

      In order for this method to be thread-safe, the model-world transformation should not be modified after it is returned by this method. In practice this means that this method and its callers should treat the model-world transformation as an immutable object. So it shouldn't reuse the same ILcdModelXYZWorldTransformation for different ILcdModelReferences or ILcdXYZWorldReference.

      Parameters:
      aView - the view
      Returns:
      the transformation that will be used to transform coordinates of the objects in the model to world coordinates of the given view
    • addLayerStateListener

      void addLayerStateListener(ILspLayerStateListener aListener)
      Adds a state change listener to this layer. The layer must notify this listener when any of its state for a specific TLspPaintRepresentation or TLspPaintRepresentationState is changed. This state change is described respectively by a TLspLayerStateEvent or a TLspLayerPaintStateEvent.
      Parameters:
      aListener - the state change listener to be registered on this layer
    • removeLayerStateListener

      void removeLayerStateListener(ILspLayerStateListener aListener)
      Removes the specified state listener from this layer.
      Parameters:
      aListener - the listener to be removed from the layer
      See Also:
    • addStatusListener

      void addStatusListener(ILcdStatusListener<ILspLayer> aListener)
      Adds a status listener to this layer that is notified when the layer starts work asynchronously, when it is in progress, and when it is finished.
      Parameters:
      aListener - a status listener
    • removeStatusListener

      void removeStatusListener(ILcdStatusListener<ILspLayer> aListener)
      Removes a previously added status listener from this layer. The listener will no longer be notified of changes in layer progress
      Parameters:
      aListener - a status listener
    • invalidate

      void invalidate()
      Marks the contents of this layer as invalid, indicating that a repaint is required.
    • getBounds

      Returns the bounds of the layer in world coordinates. The world reference system returned by TLspContext.getXYZWorldReference() is used.
      Parameters:
      aContext - The context that defines the reference system for the bounds to be returned.
      Returns:
      The bounds of the layer in the reference system specified by aContext.
      Throws:
      TLcdNoBoundsException - If the layer has no bounds in the reference system. For instance, if the layer paints directly in the view.
      TLcdOutOfBoundsException - If the bounds can not be represented in the specified reference system.
    • getLayerStyle

      TLspLayerStyle getLayerStyle()
      Gets the current layer style. You can reset the layer style like this:
         layer.setLayerStyle(TLspLayerStyle.newBuilder().build());
       
      Returns:
      the layer style. Never null.
      Since:
      2017.0
    • setLayerStyle

      void setLayerStyle(TLspLayerStyle aLayerStyle)
      Sets a layer style to this layer. Layer style can for example modify the transparency of a layer as a whole.

      You can reset the layer style like this:

         layer.setLayerStyle(TLspLayerStyle.newBuilder().build());
       
      Parameters:
      aLayerStyle - the layer style. must not be null.
      Since:
      2017.0
    • getMapScaleProvider

      default 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. This impacts stylers that select their style by map scale, such as an SLD styler or a TLspScaleBasedStyler.
      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().
      Since:
      2022.0