Class TLsp3DIconStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>

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

public static class TLsp3DIconStyle.Builder<B extends TLsp3DIconStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspEffectsHintStyle.Builder, ILspWorldElevationStyle.Builder
Builder for 3D icon styles.

The default 3D icon style uses icon size mode ScalingMode.SCALE_FACTOR, with scale factor (icon size) 1. Transparency is set to false. The default elevation mode is ILspWorldElevationStyle.ElevationMode.ABOVE_ELLIPSOID

If no icon is set using the icon(com.luciad.view.lightspeed.painter.mesh.ILsp3DIcon) method, a default arrow icon is used (pointing along the positive Y axis, with a length of 10,000 units).

Examples

Icons with a minimum size when zooming out

When you have 3D icons representing real world objects like for example aircrafts, you typically want:
  • That the icons have the real-world size of the object when zooming in.
  • That the icons remain visible when zooming out so that you can still see the data
This is achieved by using the minimumPixelSize(int) method:
    TLsp3DIconStyle iconStyle =
        TLsp3DIconStyle.newBuilder()
                       .icon(aPathToIcon)
                       .iconSizeMode(TLsp3DIconStyle.ScalingMode.WORLD_SCALING)
                       .worldSize(aWorldSize)//Specify the real dimension of the icon
                       .minimumPixelSize(10)//ensure that the icon is rendered with at least 10 pixels
                       .build();
Since:
2012.0
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • icon

      public B icon(ILsp3DIcon aIcon)

      Sets the icon.

      LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of TLsp3DIconStyle.
      When the rotation is incorrect, you can adjust it using the rotate(double, double, double) method. In case of a Collada file, you can also opt to adjust the rotation directly in the Collada file. Consult the com.luciad.format.object3d package documentation for more information.

      Parameters:
      aIcon - the icon to be used
      Returns:
      this
    • icon

      public B icon(String aPathToIconFile) throws IllegalArgumentException

      Sets the icon by providing the path to the source file of an icon. The accepted type of files are Collada (.dae), OBJ (.obj) or OpenFlight (.flt) files.

      Note that this method will block until the file is decoded. The decoding takes place on the calling thread. As such, it is strongly suggested to not call this method on the Event Dispatch Thread (EDT). Calling it on the EDT would freeze your UI until the decoding is done.

      LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of TLsp3DIconStyle.

      Parameters:
      aPathToIconFile - The path to the icon file
      Returns:
      this
      Throws:
      IllegalArgumentException - in case of an I/O exception during the decoding of the icon file. In such case, the IOException is wrapped in an IllegalArgumentException. The IllegalArgumentException is also thrown when aPathToIconFile does not refer to one of the supported file types.
      Since:
      2015.1
      See Also:
    • icon

      public B icon(String aPathToIconFile, ILcdInputStreamFactory aInputStreamFactory) throws IllegalArgumentException

      Sets the icon by providing the path to the source file of an icon. The accepted type of files are Collada (.dae), OBJ (.obj) or OpenFlight (.flt) files.

      Only a subset of the features of those formats are supported.

      • Collada data: consult the package documentation of com.luciad.format.object3d for more information on the supported Collada features.
      • OBJ data: consult the class javadoc of TLcdOBJMeshDecoder for more information on the supported OBJ features.
      • OpenFlight data: consult the class javadoc of TLcdOpenFlightFileDecoder for more information on the supported OpenFlight features.

      Note that this method will block until the file is decoded. The decoding takes place on the calling thread. As such, it is strongly suggested to not call this method on the Event Dispatch Thread (EDT). Calling it on the EDT would freeze your UI until the decoding is done.

      LuciadLightspeed assumes that the icon is oriented in a certain way. This is explained in the class javadoc of TLsp3DIconStyle.

      Parameters:
      aPathToIconFile - The path to the icon file
      aInputStreamFactory - the input stream factory to convert the file path to an input stream.
      Returns:
      this
      Throws:
      IllegalArgumentException - in case of an I/O exception during the decoding of the icon file. In such case, the IOException is wrapped in an IllegalArgumentException. The IllegalArgumentException is also thrown when aPathToIconFile does not refer to one of the supported file types.
      Since:
      2015.1
    • scale

      public B scale(double aScaleFactor)
      Sets the scale factor of the icon on all the axis. This factor will only be applied if the icon's scaling mode is set to TLsp3DIconStyle.ScalingMode.SCALE_FACTOR.
      Parameters:
      aScaleFactor - the scale factor
      Returns:
      this
      See Also:
    • scale

      public B scale(double aScaleX, double aScaleY, double aScaleZ)
      Sets the scale factor of the icon for each axis separately. This factor will only be applied if the icon's scaling mode is set to TLsp3DIconStyle.ScalingMode.SCALE_FACTOR.
      Parameters:
      aScaleX - the scale factor on the X axis.
      aScaleY - the scale factor on the Y axis.
      aScaleZ - the scale factor on the Z axis.
      Returns:
      this
    • rotate

      public B rotate(double aRotationX, double aRotationY, double aRotationZ)
      Sets the rotation of the icon around each axis separately. Each angle is expressed in degrees.
      Parameters:
      aRotationX - the counterclockwise rotation angle around the X axis
      aRotationY - the counterclockwise rotation angle around the Y axis
      aRotationZ - the counterclockwise rotation angle around the Z axis
      Returns:
      this
      See Also:
    • translate

      public B translate(double aTranslationX, double aTranslationY, double aTranslationZ)
      Sets the translation of the icon via each axis.
      Parameters:
      aTranslationX - the translation in the direction of the X axis.
      aTranslationY - the translation in the direction of the Y axis.
      aTranslationZ - the translation in the direction of the Z axis.
    • worldSize

      public B worldSize(double aWorldSize)
      Sets the world size of the icon. This factor will only be applied if the icon's scaling mode is set to TLsp3DIconStyle.ScalingMode.WORLD_SCALING.
      Parameters:
      aWorldSize - the world size in meters. This size is the maximum of the width, height and length of the icon.
      Returns:
      this
      See Also:
    • pixelSize

      public B pixelSize(int aPixelSize)
      Sets the pixel size of the icon. This factor will only be applied if the icon's scaling mode is set to TLsp3DIconStyle.ScalingMode.VIEW_SCALING.

      By default this value is set to 32.

      Parameters:
      aPixelSize - the pixel size
      Returns:
      this
      See Also:
    • 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 TLsp3DIconStyle.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
    • verticalOffsetFactor

      public B verticalOffsetFactor(double aVerticalOffsetFactor)
      Sets the vertical offset factor of the icon.

      Note: the default value is 0.0.

      Parameters:
      aVerticalOffsetFactor - a vertical offset factor
      Returns:
      this
      See Also:
    • iconSizeMode

      public B iconSizeMode(TLsp3DIconStyle.ScalingMode aScalingMode)
      Sets the icon size mode that defines how the icon size should be interpreted.
      Parameters:
      aScalingMode - the icon size mode
      Returns:
      this
    • transparent

      public B transparent(boolean aTransparent)
      Sets whether or not the icon is transparent.
      Parameters:
      aTransparent - whether or not the icon is transparent
      Returns:
      this
      See Also:
    • recenterIcon

      public B recenterIcon(boolean aRecenterIcon)
      Sets whether or not the icon is recentered at its location.

      Note: default value is true.

      Parameters:
      aRecenterIcon - true to enable recentering, false to disable
      Returns:
      this
      See Also:
    • opacity

      public B opacity(float aOpacity)
      Sets the opacity (alpha) value for 3D icon.
      Parameters:
      aOpacity - the alpha value. Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).
      Returns:
      this
    • modulationColor

      public B modulationColor(Color aColor)
      Sets the color that is modulated with the 3D 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. The alpha value of the color is also used to determine the opacity of the icon.

      Using a white color has no effect.

      Parameters:
      aColor - the modulation color
      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
    • 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
    • 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 TLsp3DIconStyle.Builder<B>>
      Parameters:
      aStyle - the style to copy
      Returns:
      this
    • build

      public TLsp3DIconStyle build()
      Builds the resulting 3D icon style.
      Specified by:
      build in class ALspStyle.Builder<B extends TLsp3DIconStyle.Builder<B>>
      Returns:
      the resulting 3D icon style using the set parameters