Class TLspRasterStyle.Builder<B extends TLspRasterStyle.Builder<B>>

java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle.Builder<B>
com.luciad.view.lightspeed.style.TLspRasterStyle.Builder<B>
All Implemented Interfaces:
ILspEffectsHintStyle.Builder, ILspWorldElevationStyle.Builder
Enclosing class:
TLspRasterStyle

public static class TLspRasterStyle.Builder<B extends TLspRasterStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspWorldElevationStyle.Builder, ILspEffectsHintStyle.Builder
Builder for raster styles. The default raster style has a white color, with brightness, contrast and transparency values all equal to 1, and it indicates that it should be draped on terrain. The quality parameters are set to quality-performance trade-off that is good for most rasters.

Example usages:

To create a raster style with 0.5 brightness and 0.7 contrast:

 TLspRasterStyle style = TLspRasterStyle.newBuilder().brightness(0.5f).contrast(0.7f).build();
 

Note that you either need to set the colorMap(com.luciad.util.TLcdColorMap)/colorModel(java.awt.image.ColorModel) or combine this style with a TLspImageProcessingStyle if the data is not color data (for example elevation data or hyperspectral data). So a minimal style for elevation data would look like this:

 TLspRasterStyle style = TLspRasterStyle.newBuilder().
   colorMap(TLcdColorModelFactory.createElevationColorMap())
   build();
 
For more complex non-color data (for example hyperspectral data) you can use an image processing style to control the conversion to colors. Typically this can be done by selecting bands and either interpreting them as color bands or mapping values to colors. By default the painter maps the first band to gray-scale values.
Since:
2012.0
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor.
  • Method Details

    • zOrder

      public B zOrder(int aZOrder)
      Sets the Z-order of this style. Styles should be painted from lowest to highest Z-order.

      Increasing the number of different Z-orders can negatively impact painting performance. By default, it is set to 0.

      Parameters:
      aZOrder - the z order
      Returns:
      this
    • modulationColor

      public B modulationColor(Color aColor)

      Sets the color that is modulated with the raster. For example using a raster with gray-scale colors and a red modulation color will result in a resulting painted raster with red hues.

      Using a white color has no effect.

      Parameters:
      aColor - the modulation color
      Returns:
      this
    • opacity

      public B opacity(float aOpacity)
      Sets the opacity of the raster. This can also be achieved by setting a modulation color with opacity directly.
      Parameters:
      aOpacity - the alpha value. Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).
      Returns:
      this
    • brightness

      public B brightness(float aBrightness)
      Sets the brightness.

      The brightness is a value in [0, 2]. A value of 1 (the default) leaves the brightness unchanged. Values larger than 1 makes the colors brighter, while a value smaller than 1 makes the colors less bright.

      Parameters:
      aBrightness - the brightness
      Returns:
      this
    • contrast

      public B contrast(float aContrast)
      Sets the contrast.

      The contrast is a value in [0, 2]. A value of 1 (the default) leaves the contrast unchanged. A value larger than 1 enhances the contrast of dark colors by making them brighter, while a value smaller than 1 enhances the contrast of bright colors by making them darker.

      Parameters:
      aContrast - the contrast
      Returns:
      this
    • startResolutionFactor

      public B startResolutionFactor(double aStartResolutionFactor)
      Sets the highest pixel density (number of raster pixels per screen pixel) at which data will be used. This can be used to avoid having to load a large raster to fill a relatively small view: the smaller the value delays the more the loading of data is delayed.

      The default value is 10.0.

      Parameters:
      aStartResolutionFactor - the new start resolution factor
      Returns:
      this
      See Also:
    • levelSwitchFactor

      public B levelSwitchFactor(double aLevelSwitchFactor)
      Sets the lowest pixel density (number of raster pixels per screen pixel) at which a raster level is used. If the value is 1.0 a raster level is chosen such that a single raster pixel will project to at most 1 screen pixel, if such a level exists. This way, the highest practical raster quality is chosen. A value smaller than 1.0 delays the level switching: a single raster pixel may project to multiple screen pixels. Such a value may cause pixelating effects, but it reduces the amount of data that needs to be loaded.

      Note that this factor does not influence when the least detailed level is used, this is controlled using the start resolution factor.

      The default value is 0.3.

      Parameters:
      aLevelSwitchFactor - the new level switch factor
      Returns:
      this
      See Also:
    • colorModel

      public B colorModel(ColorModel aColorModel)
      Sets the color model.

      When both a color model and a color map are set, the color map has precedence over the color model. Using a color map is generally preferred for signed or non-integer data.

      A color map or color model should be set if the raster does not have a native color model.

      The color model should never be modified. To change the color model you should create a new style with a different color model instance.

      Parameters:
      aColorModel - the color model
      Returns:
      this
      See Also:
    • colorMap

      public B colorMap(TLcdColorMap aColorMap)
      Sets the color map.

      When both a color model and a color map are set, the color map has precedence over the color model. Using a color map is generally preferred for signed or non-integer data.

      The color map should be set if the raster does not have a native color map (this is typically the case for elevation data).

      The color map should never be modified. To change the color map you should create a new style with a different color map instance.

      Parameters:
      aColorMap - the color map
      Returns:
      this
    • elevationMode

      public B elevationMode(ILspWorldElevationStyle.ElevationMode aElevationMode)
      Sets the elevation mode used for the raster data.

      The following modes are supported:

      Specified by:
      elevationMode in interface ILspWorldElevationStyle.Builder
      Parameters:
      aElevationMode - the elevation mode
      Returns:
      this builder
    • interpolation

      public B interpolation(ELcdInterpolationType aInterpolationType)
      Sets the interpolation type used for the raster data. NONE, LINEAR and CUBIC are supported.

      A null interpolation type indicates the default (implementation specific) value should be used.

      Parameters:
      aInterpolationType - the interpolation type or null
      Returns:
      this builder
    • effectsHints

      public B effectsHints(ILspEffectsHintStyle.EffectsHint... aEffectsHints)
      Description copied from interface: ILspEffectsHintStyle.Builder
      Specifies the effects hints to be added to the style.
      Specified by:
      effectsHints in interface ILspEffectsHintStyle.Builder
      Parameters:
      aEffectsHints - the effects hints to be added to the style
      Returns:
      this
    • all

      public B all(ALspStyle aRasterStyle)
      Description copied from class: ALspStyle.Builder
      Sets all parameters on the builder based on the given style.

      This is useful for example to create a new style that has almost all properties equal to another style.

      Specified by:
      all in class ALspStyle.Builder<B extends TLspRasterStyle.Builder<B>>
      Parameters:
      aRasterStyle - the style to copy
      Returns:
      this
    • build

      public TLspRasterStyle build()
      Description copied from class: ALspStyle.Builder
      Builds the style with the set parameters.
      Specified by:
      build in class ALspStyle.Builder<B extends TLspRasterStyle.Builder<B>>
      Returns:
      the resulting style