Class TLspLineStyle.Builder<B extends TLspLineStyle.Builder<B>>

java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle.Builder<B>
com.luciad.view.lightspeed.style.TLspLineStyle.Builder<B>
All Implemented Interfaces:
ILspEffectsHintStyle.Builder, ILspTexturedStyle.Builder, ILspWorldElevationStyle.Builder
Direct Known Subclasses:
TLspPinLineStyle.Builder
Enclosing class:
TLspLineStyle

public static class TLspLineStyle.Builder<B extends TLspLineStyle.Builder<B>> extends ALspStyle.Builder<B> implements ILspTexturedStyle.Builder, ILspEffectsHintStyle.Builder, ILspWorldElevationStyle.Builder
Builder for line styles. The default line style is a slightly transparent white 1-pixel wide line that uses ILspWorldElevationStyle.ElevationMode.OBJECT_DEPENDENT and not blended together when multiple lines overlap.

Example usages:

To create the default line style:
TLspLineStyle whiteOnePixelNotDraped = TLspLineStyle.newBuilder().build();

To create a 4-pixel wide red line style for shapes that are draped:
TLspLineStyle redFourPixelsDraped = TLspLineStyle.newBuilder().color(Color.red).lineWidth(4f).elevationMode(ON_TERRAIN).build();

To style objects based its properties use TLspParameterizedLineStyle

Since:
2012.0
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor.
  • Method Details

    • color

      public B color(Color aColor)
      Sets the color. Should not be null.
      Parameters:
      aColor - the color
      Returns:
      this
      Throws:
      IllegalArgumentException - if aColor==null
    • opacity

      public B opacity(float aOpacity)
      Sets the opacity (alpha) value for the color.

      This is a convenience method: One could equally well use the color(...) method. However, this method leaves the RGB values intact and only modifies the alpha value. Note that, the other way around, the color(...) method does override the set alpha value.

      Parameters:
      aOpacity - the alpha value. Must be contained in the [0,1] interval (0 is fully transparent, 1 is fully opaque).
      Returns:
      this
    • width

      public B width(double aLineWidth)
      Sets the line width (pixels). Should be greater than 0.
      Parameters:
      aLineWidth - the line width
      Returns:
      this
    • 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
    • pixelOffset

      public B pixelOffset(double aPixels)
      Sets the offset in pixels. The line will be drawn at a distance of aPixels from the original geometry. By default, no offset is used.

      A positive offset will result in a line that is painted to the left of the original line, or on the outside of the original polygon/ring. A negative offset will paint the line to the right or on the inside.

      Parameters:
      aPixels - an offset in pixels.
      Returns:
      this
      Since:
      2012.1
    • blendOverlap

      @Deprecated public B blendOverlap(boolean aBlendOverlap)
      Sets whether different lines that are painted with the same style and that cover the same pixels are blended together or not.

      When set to false, all pixels covered will receive the same color, even if this color is transparent and if multiple lines cover the same pixel. If set to true, overlapping (transparent) lines will be blended together resulting in a less transparent color at their crossings.

      For example, when painting street data, you do not want the color to change at a crossroad. In that case, you would set this parameter to false to ensure that different streets are not blended together.

      When painting 3D trajectories however, you do want to accumulate the transparent color of overlapping trajectories. In that case, set this parameter to true.

      The default value is false.

      Parameters:
      aBlendOverlap - whether or not overlapping lines are blended together
      Returns:
      this
    • blendOverlap

      public B blendOverlap(TLspLineStyle.BlendOverlapMode aBlendOverlap)
      Sets whether different lines that are painted with the same style and that cover the same pixels are blended together or not.

      When set to BlendOverlapMode#NEVER, all pixels covered will receive the same color, even if this color is transparent and if multiple lines cover the same pixel. If set to BlendOverlapMode#ALWAYS, overlapping (transparent) lines will be blended together resulting in a less transparent color at their crossings.

      Finally the BlendOverlapMode#AUTO chooses the mode that gives the best results depending on the context. For instance, lines that are not draped in a 3D view should be blended. Lines that are draped, or painted in a 2D view will not be blended.

      For example, when painting street data, you do not want the color to change at a crossroad. In that case, you would set this parameter to BlendOverlapMode#NEVER to ensure that different streets are not blended together.

      When painting 3D trajectories however, you do want to accumulate the transparent color of overlapping trajectories. In that case, set this parameter to BlendOverlapMode#ALWAYS.

      In both cases, you can also use BlendOverlapMode#AUTO. You only need to explicitly set the mode in case the automatic mode does not produce the desired result.

      The default value is BlendOverlapMode#AUTO.

      Parameters:
      aBlendOverlap - whether or not overlapping lines are blended together
      Returns:
      this
      Since:
      2012.1
    • 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
    • texture

      public B texture(RenderedImage aTexture)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies the image to be used as a texture map. A new texture will be created for the specified image. For reusing an existing texture ILspTexturedStyle.Builder.textureObject(ALsp2DTextureObject) can be used.

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

      If a texture object was set via ILspTexturedStyle.Builder.textureObject(ALsp2DTextureObject) before calling this, it will be replaced by a texture created from the image.

      Specified by:
      texture in interface ILspTexturedStyle.Builder
      Parameters:
      aTexture - the image to be used as a texture map
      Returns:
      this
    • textureObject

      public B textureObject(ALsp2DTextureObject aTextureObject)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies the texture object to be used. This can be used to reuse already existing textures. When a new texture needs to be created for an image ILspTexturedStyle.Builder.texture(RenderedImage) can be used.

      To change the texture you should create a new style with a different texture object instance.

      If an image to be used as a texture was set via ILspTexturedStyle.Builder.texture(RenderedImage) before calling this, it will be replaced by this texture.

      Specified by:
      textureObject in interface ILspTexturedStyle.Builder
      Parameters:
      aTextureObject - the texture object.
      Returns:
      this
    • repeatTexture

      public B repeatTexture(boolean aRepeatTexture)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies whether the texture map should be repeated (tiled) or not.
      Specified by:
      repeatTexture in interface ILspTexturedStyle.Builder
      Parameters:
      aRepeatTexture - whether the texture map should be repeated (tiled) or not
      Returns:
      this
    • textureInterpolationType

      public B textureInterpolationType(ELcdInterpolationType aInterpolationType)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies whether linear or nearest neighbor interpolation should be used for the texture. The default is linear.
      Specified by:
      textureInterpolationType in interface ILspTexturedStyle.Builder
      Parameters:
      aInterpolationType - the interpolation method to use for the texture (note that CUBIC is not currently supported)
      Returns:
      this
    • textureCoordinatesMode

      public B textureCoordinatesMode(ILspTexturedStyle.TextureCoordinatesMode aMode)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies whether the texture coordinates computed to apply the texture map should be relative to the bounds of the object or not. In the former case, the map is scaled and offset such that it fills the bounds (in model coordinates) of the object. In the latter case, the model coordinates of the object are used as texture coordinates unmodified.
      Specified by:
      textureCoordinatesMode in interface ILspTexturedStyle.Builder
      Parameters:
      aMode - specifies whether the texture coordinates computed to apply the texture map should be relative to the bounds of the object or correspond to the object's model coordinates.
      Returns:
      this
    • scaleTexture

      public B scaleTexture(double aSX, double aSY, double aSZ)
      Description copied from interface: ILspTexturedStyle.Builder
      Scales the texture.
      Specified by:
      scaleTexture in interface ILspTexturedStyle.Builder
      Parameters:
      aSX - amount by which the x-coordinates of the texture are scaled
      aSY - amount by which the x-coordinates of the texture are scaled
      aSZ - amount by which the x-coordinates of the texture are scaled
      Returns:
      this
    • rotateTexture

      public B rotateTexture(double aAlpha)
      Description copied from interface: ILspTexturedStyle.Builder
      Rotates the texture.
      Specified by:
      rotateTexture in interface ILspTexturedStyle.Builder
      Parameters:
      aAlpha - the amount by which the texture is rotated, in radians.
      Returns:
      this
    • translateTexture

      public B translateTexture(double aDX, double aDY, double aDZ)
      Description copied from interface: ILspTexturedStyle.Builder
      Translates the textures.
      Specified by:
      translateTexture in interface ILspTexturedStyle.Builder
      Parameters:
      aDX - amount by which the x-coordinates of the texture are translated
      aDY - amount by which the y-coordinates of the texture are translated
      aDZ - amount by which the z-coordinates of the texture are translated
      Returns:
      this
    • textureMatrix

      public B textureMatrix(double[] aTextureMatrix)
      Description copied from interface: ILspTexturedStyle.Builder
      Specifies the 4x4 matrix that should be applied to the texture coordinates when mapping the texture given by this style. This can be used to scale, rotate or otherwise transform the texture.

      This matrix will override any previously set transformation. This interface also provides a number of convenience methods to specify common texture coordinate transformations.

      Specified by:
      textureMatrix in interface ILspTexturedStyle.Builder
      Parameters:
      aTextureMatrix - Specifies the 4x4 matrix that should be applied to the texture coordinates when mapping the texture given by this style
      Returns:
      this
      See Also:
    • dashPattern

      public B dashPattern(TLspLineStyle.DashPattern aDashPattern)
      Sets the dash pattern.
      Parameters:
      aDashPattern - a dash pattern. Must not be null
      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
    • all

      public B all(ALspStyle aLineStyle)
      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 TLspLineStyle.Builder<B>>
      Parameters:
      aLineStyle - the style to copy
      Returns:
      this
    • build

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

      public String toString()
      Overrides:
      toString in class Object