Class TLspRasterLayer

java.lang.Object
com.luciad.view.lightspeed.layer.ALspLayer
com.luciad.view.lightspeed.layer.raster.TLspRasterLayer
All Implemented Interfaces:
ILcdPropertyChangeSource, ILcdSelection<Object>, ILcdLayer, ILspEditableStyledLayer, ILspLayer, ILspStyledLayer, Serializable

public class TLspRasterLayer extends ALspLayer implements ILspEditableStyledLayer
Layer implementation that can visualize raster data in an ILspView.

Supported data

The following object types and models are supported:

This means that either the domain objects in the model should match one of the above types or the styler should provide a geometry of one of the supported types.

Styling color and elevation data

By default, color data is visualized using the image's own color model. Elevation data is visualized with a DTED color mapping.
The level switch factor applies to multi-leveled data. By default, multi-level images uses a level switch factor of 0.3. For multi-level image mosaics, the default depends on the mosaic tile size. A mosaic tile size of 256x256 or larger results in a level switch factor of 0.3. For smaller mosaic tile sizes, the level switch factor is reduced correspondingly. By reducing the level switch, we aim for an equal amount of tiles needed to fill a view. To compensate for pixelation effects due to a reduced level switch factor, linear interpolation is enabled by default.
The visualization of the raster data can be configured by setting a styler. The styler can submit the following styles:

  • a TLspRasterStyle instance: mandatory, this controls the visualization of the raster values
  • a TLspImageProcessingStyle instance: an image processing operator chain applied to the raster
  • a TLspLineStyle instance: this controls the style of the outline of the bounds of the raster
  • a TLspFillStyle instance: this controls the style of the fill of the bounds of the raster
The raster values are only painted if the pixel density of the raster is not too high (depending on the TLspRasterStyle.getStartResolutionFactor()). Otherwise the bounds of the raster are painted instead.

Styling parameterized raster data

One dimensional parameterized data from Earth tilesets is visualized depending on the parameter and unit:

  • for angles, an arrow icon grid is used
  • for Kelvin (K), Celsius (C), Percentage (%), and proportion, a specific color mapping is chosen
Two-dimensional Earth tileset data is either visualized using a wind icon grid or an arrow icon grid. The builder supports several data types, such as wind, currents and waves.

The visualization of the this data can be configured by setting a TLspParameterizedRasterIconStyle as the styler.

Interactive layers

The behavior of the raster layer may also be influenced by the layer type that is set:

It is recommended to keep background layers at the bottom of the view as this allows the view to optimized memory usage and performance by combining multiple background layers.

Limitations

The most important limitations are:
  • When changing a raster layer, may temporarily not paint anything in the view until the change has been processed in the following situations:
  • You can track the layer's status to know when it is processing changes.
  • Style target providers are not supported for layers of type background.
Since:
2012.0
See Also:
  • Constructor Details

    • TLspRasterLayer

      public TLspRasterLayer(ILcdModel aModel)
      Constructs a new raster layer for the given model. The display name of the model's descriptor is used as the layer label.
      Parameters:
      aModel - the model to be assigned to this raster layer
    • TLspRasterLayer

      public TLspRasterLayer(ILcdModel aModel, String aLabel)
      Constructs a new raster layer with the given model and label.
      Parameters:
      aModel - the model to be assigned to this raster layer
      aLabel - the label to be assigned to this raster layer
    • TLspRasterLayer

      public TLspRasterLayer(ILcdModel aModel, ILspLayer.LayerType aLayerType)
      Constructs a new raster layer with the given model and layer type.

      Note that not all layer types are supported.

      Parameters:
      aModel - the model to be assigned to this raster layer
      aLayerType - the layer type to be assigned to this raster layer
    • TLspRasterLayer

      public TLspRasterLayer(ILcdModel aModel, String aLabel, ILspLayer.LayerType aLayerType)
      Constructs a new raster layer with the given model, label and layer type.

      Note that not all layer types are supported.

      Parameters:
      aModel - the model to be assigned to this raster layer
      aLabel - the label to be assigned to this raster layer
      aLayerType - the layer type
  • Method Details

    • getPaintRepresentations

      public Collection<TLspPaintRepresentation> getPaintRepresentations()
      The raster layer only supports the TLspPaintRepresentation.BODY paint representation.
      Specified by:
      getPaintRepresentations in interface ILspLayer
      Overrides:
      getPaintRepresentations in class ALspLayer
      Returns:
      a collection of PaintRepresentations, never null
    • isEditableSupported

      public boolean isEditableSupported()
      Returns true if the layer supports editing its objects.
      Specified by:
      isEditableSupported in interface ILcdLayer
      Overrides:
      isEditableSupported in class ALspLayer
      Returns:
      false
      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:
      false
      See Also:
    • setLayerType

      public void setLayerType(ILspLayer.LayerType aLayerType)
      Sets the layer type for this layer.

      The layer type should be one of the following:

      It is recommended to keep background layers at the bottom of the view as this allows the view to optimized memory usage and performance by combining multiple background layers.

      The default layer type is ILspLayer.LayerType.BACKGROUND for models with an ILcdEarthTileSet and ILspLayer.LayerType.INTERACTIVE otherwise.

      Parameters:
      aLayerType - the layer type
    • getLayerType

      public ILspLayer.LayerType getLayerType()
      Returns the layer type.

      The default layer type

      Specified by:
      getLayerType in interface ILspLayer
      Overrides:
      getLayerType in class ALspLayer
      Returns:
      the layer type
      See Also:
    • isUseSharedCache

      public boolean isUseSharedCache()
      Returns:
      true if the shared cache is used to cache raster data
      See Also:
    • setUseSharedCache

      public void setUseSharedCache(boolean aUseSharedCache)
      Sets whether the shared cache is used to cache raster data. Otherwise a private cache will be used.

      The shared cache is used by default.

      Parameters:
      aUseSharedCache - true if the shared cache is used
      See Also:
    • getCacheSize

      public long getCacheSize()
      Returns the size of the private cache.
      Returns:
      the size of the private cache (in bytes)
      See Also:
    • setCacheSize

      public void setCacheSize(long aCacheSize)
      Sets the size of the private cache.

      The size is not relevant if the shared cache is used. If the shared cache is not used, data that is not strictly needed for the current view will be cache as long as the total cached data (that is including the data that is needed for the current view) does not exceed the specified number of bytes. Data that is needed for the current view will always be cached, even if it exceeds the specified number of bytes.

      Parameters:
      aCacheSize - the size of the private cache (in bytes)
      See Also:
    • getBorderFactor

      public double getBorderFactor()
      Returns the size of the surplus border that is processed, relative to the view.
      Returns:
      the relative amount by which the view is enlarged on each side
      See Also:
    • setBorderFactor

      public void setBorderFactor(double aBorderFactor)
      Returns the size of the surplus border that is processed, relative to the view.

      A high value increases the memory usage and cpu usage, but will often give faster updates for small pan and zoom operations.

      The default value is 0.25 which results in 25% extra data on all sides, so the total processed area is 2.25x the area when using no surplus border.

      Note that, by default, texture loading is not included in the surplus processing. Including it increases the memory and cpu usage even more, but will often give faster updates for small pan and zoom operations. To include it, see setLoadTexturesInBorder(boolean).

      Parameters:
      aBorderFactor - the relative amount by which the view is enlarged on each side
    • isLoadTexturesInBorder

      public boolean isLoadTexturesInBorder()
      Returns whether the surplus processing indicated by the border factor includes texture data loading.
      Returns:
      whether texture data loading should be included in the surplus processing.
      Since:
      2018.2
      See Also:
    • setLoadTexturesInBorder

      public void setLoadTexturesInBorder(boolean aLoadTexturesInBorder)
      Sets whether the surplus processing indicated by the border factor should also include texture data loading.

      By default, texture loading is not included in the surplus processing. Including it increases the memory and cpu usage even more than a border factor that does not include texture loading, but will often give faster updates for small pan and zoom operations.

      Parameters:
      aLoadTexturesInBorder - whether texture data loading should be included in the surplus border processing.
      Since:
      2018.2
      See Also:
    • isIncrementalPainting

      public boolean isIncrementalPainting()
      Returns whether this layer is repainted as soon as a tile becomes available.
      Returns:
      whether this layer is repainted as soon as a tile becomes available.
      Since:
      2018.1
      See Also:
    • setIncrementalPainting

      public void setIncrementalPainting(boolean aIncrementalPainting)
      Sets whether this layer is repainted as soon as a tile becomes available. When set to false, this layer is not updated until all tiles are ready.

      By default, this property is set to true.

      Parameters:
      aIncrementalPainting - boolean indicating whether this layer is repainted as soon as a tile becomes available.
      Since:
      2018.1
    • getStyler

      public ILspStyler getStyler(TLspPaintRepresentationState aPaintRepresentationState)
      Description copied from interface: ILspStyledLayer
      Returns the styler that is used for the given paint representation state.
      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
    • setStyler

      public void setStyler(TLspPaintRepresentationState aPaintRepresentationState, ILspStyler aStyler)
      Sets the styler used to style the rasters contained by this layer.

      Only the TLspPaintRepresentation.BODY affects the style of the raster.

      The styler should submit:

      • a TLspRasterStyle instance: mandatory, this controls the style of the raster values
      • a TLspImageProcessingStyle instance: a image processing operator chain applied to the raster
      • a TLspLineStyle instance: this controls the style of the outline of the bounds of the raster
      • a TLspFillStyle instance: this controls the style of the fill of the bounds of the raster
      The raster values are only painted if the pixel density of the raster is not too high (depending on the TLspRasterStyle.getStartResolutionFactor() ). Otherwise the bounds of the raster are painted instead.

      The default styler drapes the raster data on top of the view's terrain and paints a red hatched rectangle when zoom out too far. For a raster with color data you can reproduce its behavior with the following styler:

       new TLspStyler(
         TLspLineStyle.newBuilder().color(Color.RED).build(),
         TLspFillStyle.newBuilder().color(Color.RED).stipplePattern(TLspFillStyle.StipplePattern.HATCHED).build(),
         TLspRasterStyle.newBuilder().build()
       );
       
      Note that some additional configuration is needed for non-color data (ex. elevation data). See TLspRasterStyle.Builder for details.
      Specified by:
      setStyler in interface ILspEditableStyledLayer
      Parameters:
      aPaintRepresentationState - the paint representation state
      aStyler - the styler
    • query

      public <T> T query(ALspPaintQuery<T> aQuery, TLspContext aContext)
      Retrieves a set of domain objects and data based on the parameters given by the query.

      The following queries are supported:

      Layers that are combined with the view's terrain are not included in this query. You can use ILspTerrainSupport instead to query these.

      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
      Throws:
      UnsupportedOperationException - if an aspect of the query is not supported by this layer
    • fireStatusEvent

      public void fireStatusEvent(TLcdStatusEvent<ILspLayer> aStatusEvent)
      Description copied from class: ALspLayer
      Fires a status event.
      Overrides:
      fireStatusEvent in class ALspLayer
      Parameters:
      aStatusEvent - the status event
    • 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
    • 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:

      • Setting a TLspSLDStyler for the specified SLD style as body styler.

      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:
    • toString

      public String toString()
      Overrides:
      toString in class Object