Class TLspIconStyle.Builder<B extends TLspIconStyle.Builder<B>>

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

public static class TLspIconStyle.Builder<B extends TLspIconStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspWorldElevationStyle.Builder, ILspEffectsHintStyle.Builder
Builder for icon styles. The default icon style has a white color and scale factor 1, offsets 0, and uses ILspWorldElevationStyle.ElevationMode.OBJECT_DEPENDENT.

Use the icon(com.luciad.gui.ILcdIcon) method to set a valid icon.

Example usages:

To create an icon style using an image as an icon:
TLspIconStyle iconStyle = TLspIconStyle.newBuilder().icon(new TLcdImageIcon(pathToImage)).build();

To create an icon style using a symbol as an icon:
TLspIconStyle iconStyle = TLspIconStyle.newBuilder().icon(new TLcdSymbol(TLcdSymbol.CIRCLE)).build();

To style objects based its properties use TLspParameterizedIconStyle

Since:
2012.0
  • Constructor Details

    • Builder

      public Builder()
  • 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
    • icon

      public B icon(ILcdIcon aIcon)
      Sets the icon.

      If the icon is an ILcdAnchoredIcon, the anchor point will automatically become the point of rotation, as well as the anchor point of the icon in the view.

      This icon should never be modified. To change the icon you should create a new style with a different icon instance.

      This method throws an exception when the given icon is null.

      Useful implementations are for example TLcdSymbol, or TLcdImageIcon.

      Parameters:
      aIcon - the icon
      Returns:
      this
    • useOrientation

      public B useOrientation(boolean aOrientationEnabled)
      Sets whether the icon should respect its orientation. By default, this is set to false.

      The actual orientation that is applied to the icon will be retrieved from the ILcdOriented interface. Either the geometry returned by the ALspStyleTargetProvider or the model object should implement this interface. The geometry takes precedence if both objects implement this interface. The orientation is interpreted as an azimuth.

      Parameters:
      aOrientationEnabled - a flag indicating whether or not the icon should respect its orientation
      Returns:
      this
    • scale

      public B scale(double aScaleFactor)
      Sets the scale factor.
      Parameters:
      aScaleFactor - the scale factor
      Returns:
      this
    • offset

      public B offset(double aOffsetX, double aOffsetY)

      Sets icon offsets in 2D view coordinates. This offset is applied after all other transformations have been applied. In other words: Scaling and rotation are applied first. Then this offset is done as a post-effect.

      To support anchored icons, and rotations of icons around a specific point in the icon, please supply the icon(com.luciad.gui.ILcdIcon) method with an ILcdAnchoredIcon.

      Parameters:
      aOffsetX - the offset in X direction
      aOffsetY - the offset in Y direction
      Returns:
      this;
      See Also:
    • modulationColor

      public B modulationColor(Color aColor)
      Sets the color that is modulated with the icon. For example using an icon with gray-scale colors and a red modulation color will result in a resulting painted icon with red hues.

      Using a white color has no effect.

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

      public B worldSize(double aWorldSize)
      Sets the icon size in meters. This size only affects the style if the scaling mode is set to ScalingMode.WORLD_SCALING or ScalingMode.WORLD_SCALING_CLAMPED.

      The world size is applied to the width of the icon. I.e. when the icon is not square, the width will correspond to this world size, but the height will not.

      By default this is set to 50000m.

      Parameters:
      aWorldSize - a positive number expressing the icon size in meters.
      Returns:
      this
    • scalingMode

      public B scalingMode(TLspIconStyle.ScalingMode aScalingMode)
      Sets the scaling mode of the icons. By default this is set to ScalingMode.VIEW_SCALING.
      Parameters:
      aScalingMode - a scaling mode
      Returns:
      this
    • opacity

      public B opacity(float aOpacity)
      Sets the opacity of the modulation color. This can also be achieved by setting the 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
    • elevationMode

      public B elevationMode(ILspWorldElevationStyle.ElevationMode aMode)
      Description copied from interface: ILspWorldElevationStyle.Builder
      Specifies the elevation mode. The default mode depends on the specific implementation.
      Specified by:
      elevationMode in interface ILspWorldElevationStyle.Builder
      Parameters:
      aMode -
      Returns:
      this
    • 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
    • minimumPixelSize

      public B minimumPixelSize(int aMinimumPixelSize)
      Sets the minimum icon pixel size. This size only affects the style if the scaling mode is set to ScalingMode.WORLD_SCALING_CLAMPED or ScalingMode.WORLD_SCALING. As soon as the largest dimension (i.e. width or height) of the icon is smaller than this minimum pixel size, the icon will be scaled to satisfy this minimum size.

      By default this value is set to 0, which indicates that no minimum size will be enforced.

      Parameters:
      aMinimumPixelSize - the minimum pixel size
      Returns:
      this
    • all

      public B all(ALspStyle aStyle)
      Sets all builder parameters to the properties of the provided style.
      Specified by:
      all in class ALspStyle.Builder<B extends TLspIconStyle.Builder<B>>
      Parameters:
      aStyle - the style to copy
      Returns:
      this
    • build

      public TLspIconStyle build()
      Builds the icon style with the set parameters.
      Specified by:
      build in class ALspStyle.Builder<B extends TLspIconStyle.Builder<B>>
      Returns:
      the resulting icon style
    • toString

      public String toString()
      Overrides:
      toString in class Object