Class TLspParameterizedLineStyle

java.lang.Object
com.luciad.view.lightspeed.style.ALspStyle
com.luciad.view.lightspeed.style.TLspParameterizedLineStyle
All Implemented Interfaces:
ILspEffectsHintStyle, ILspWorldElevationStyle, ILspStyler

public final class TLspParameterizedLineStyle extends ALspStyle implements ILspWorldElevationStyle, ILspEffectsHintStyle
Style used to style ILcdPolyline. Most properties of this style can be controlled through expressions.

Construction of this style is done through its TLspParameterizedLineStyle.Builder.

The following properties of this style are calculated by an expression:

  • Visibility: determines whether the object is displayed or not
  • Color: the color of the line
  • Opacity: transparency of the line
Additionally, you can enable other behavior:
  • Width: determines the width of the line in pixels

For defaults, see TLspParameterizedLineStyle.Builder.

Example:
   ILcdExpression color = attribute("ColorAttribute", Color.class, new TLcdExpressionFactory.AttributeValueProvider() {
      @Override
      public Color getValue(Object aDomainObject, Object aGeometry) {
         throw new RuntimeException("Not used for lines");
      }

      @Override
      public Color getValue(Object aDomainObject, Object aGeometry, int aIndex) {
        return aIndex % 2 == 0 ? Color.green : Color.blue;
      }
   });
     TLspParameterizedLineStyle style = TLspParameterizedLineStyle.newBuilder()
                                                                  .color(color)
                                                                  .width(5)
                                                                  .build();
 
In this example, the even vertices will be assigned a green color, while uneven will be blue. Between vertices the color will be interpolated between green and blue.

Note: -When using TLcdExpressionFactory.viewPositionAttribute(), the view position is calculated for each vertex of the line. - TLcdExpressionFactory.viewPositionAttribute() must not be used when the elevation mode is set to ILspWorldElevationStyle.ElevationMode.ON_TERRAIN or when the elevation mode is ILspWorldElevationStyle.ElevationMode.OBJECT_DEPENDENT and all z-values of the geometry are 0.
Since:
2018.0
  • Method Details

    • newBuilder

      public static TLspParameterizedLineStyle.Builder<?> newBuilder()
      Creates a new builder with the default values.
      Returns:
      the new builder.
    • asBuilder

      public TLspParameterizedLineStyle.Builder<?> asBuilder()
      Creates a new builder initialized with all the properties of this style.
      Specified by:
      asBuilder in class ALspStyle
      Returns:
      the new builder.
    • getColor

      public ILcdExpression<Color> getColor()
      Gets the color expression.
      Returns:
      the color
    • getOpacity

      public ILcdExpression<Float> getOpacity()
      Returns the expression that determines transparency of the line.
      Returns:
      The expression
    • getVisibility

      public ILcdExpression<Boolean> getVisibility()
      Returns the expression that determines whether the object should be displayed or not.
      Returns:
      The expression
    • isTransparent

      public boolean isTransparent()
      Description copied from class: ALspStyle
      Determines whether this style is transparent.

      Shapes that are transparent can be painted in a different paint phase than shapes that are not transparent.

      Specified by:
      isTransparent in class ALspStyle
      Returns:
      whether or not this style is transparent
    • getWidth

      public double getWidth()
      Gets the line width (pixels). The returned value is always strictly positive.
      Returns:
      the line width
    • getDashPattern

      public TLspLineStyle.DashPattern getDashPattern()
      Gets the dash pattern.
      Returns:
      the dash pattern
      Since:
      2018.1
    • getElevationMode

      public ILspWorldElevationStyle.ElevationMode getElevationMode()
      Description copied from interface: ILspWorldElevationStyle
      Returns the elevation mode of this style.
      Specified by:
      getElevationMode in interface ILspWorldElevationStyle
      Returns:
      The elevation mode.
    • getEffectsHints

      public Collection<ILspEffectsHintStyle.EffectsHint> getEffectsHints()
      Description copied from interface: ILspEffectsHintStyle
      Returns the effects hints specified for this style.
      Specified by:
      getEffectsHints in interface ILspEffectsHintStyle
      Returns:
      the effects hints specified for this style
    • isCompatible

      public boolean isCompatible(TLspPaintPass aPaintPass)
      Description copied from class: ALspStyle
      Utility method to determine whether the style is compatible with the given paint pass.

      A style and paint pass are compatible if they use or request the same terrain and transparency properties.

      Overrides:
      isCompatible in class ALspStyle
      Parameters:
      aPaintPass - the paint pass
      Returns:
      true if the style can be used in the given paint pass, false otherwise.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class ALspStyle
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ALspStyle
    • toString

      public String toString()
      Overrides:
      toString in class Object