Class TLspComplexStrokedLineStyle

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

public class TLspComplexStrokedLineStyle extends ALspStyle implements ILspWorldElevationStyle

Style that can be used to apply complex strokes to a shape's outline. A stroked line style is essentially a series of strokes, which are positioned in a pattern along the line to which the style is applied, or which are positioned once at a specific location.

A TLspComplexStrokedLineStyle consists of ALspComplexStrokes, along with a few properties that affect the visualization, such as the elevation mode and halo settings.

A TLspComplexStrokedLineStyle defines how a line is painted. It combines a number of stroke patterns, that are for example repeated along the line, or added as a decoration at the start or end. It is possible to combine decorations and regular of fallback strokes by using ALspComplexStroke.combineWithRegularStroking or ALspComplexStroke.combineWithFallbackStroking.

Decorations, regular repeated patterns and fallback patterns can be created using ALspComplexStroke. These patterns can be composed to form more complex strokes patterns.

In 3D, non-draped complex stroke lines are painted using an area that either faces the camera, or that is positioned parallel to the earth surface. By default, it faces the camera. This works well for simple and narrow strokes, but for more complex patterns, this may introduces some unwanted effects, such as:

  • Your pattern is squeezed or stretched along the line.
  • Your line width is smaller or wider than usual.

This can be improved by modifying the orientation of the complex stroked line to be parallel with the earth surface.

Example code:


 #import static com.luciad.view.lightspeed.style.complexstroke.ALspComplexStroke.*;

 // Create a complex stroked line style
 TLspComplexStrokedLineStyle style = TLspComplexStrokedLineStyle.newBuilder()
   // Blue arrow consisting of two lines
   .decoration( 0.0f, combineWithRegularStroking(
                          compose( line( 10, 0, 0, 5, 1, Color.blue ),
                                   line( 10, 0, 0, -5, 1, Color.blue ) )
                      ) )
   // Dashed line
   .regular( append( parallelLine( 6, 0, 1, 0, Color.black ),
                     gap( 6 ),
                     parallelLine( 3, 0, 1, 0, Color.red ),
                     gap( 6 ) ) )
   .build();
 

Since:
2013.1
See Also:
  • Method Details Link icon

    • newBuilder Link icon

      public static TLspComplexStrokedLineStyle.Builder<?> newBuilder()
      Creates a new stroked line style builder with the default values.
      Returns:
      the new builder.
    • asBuilder Link icon

      public TLspComplexStrokedLineStyle.Builder<?> asBuilder()
      Description copied from class: ALspStyle
      Creates a new builder initialized with all the properties of this style.
      Specified by:
      asBuilder in class ALspStyle
      Returns:
      the new builder.
    • isTransparent Link icon

      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
    • getElevationMode Link icon

      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.
    • getScale Link icon

      public double getScale()

      Returns the stroke pattern scale factor. For example, when a scale factor is 2, the size of the stroke patterns is doubled.

      This style parameter makes it easier to dynamically switch between view and world scaling. I can for example be needed to use view scaled strokes when zoomed out, and to switch to world scaled strokes when zooming in. When the switch should be made at a scale of 0.01, this means that at that scale level, 1 pixel should correspond to 100 world units. So when switching to world scaling, you can use a scale factor of 100.

       TLspComplexStrokedLineStyle style = ...;
       TLspComplexStrokedLineStyle newStyle = style.asBuilder()
           .scalingMode( WORLD_SCALING )
           .scale( 100.0 )
           .build();
       
      Returns:
      the scale factor.
    • getSharpAngleThreshold Link icon

      public double getSharpAngleThreshold()
      Returns the sharp angle threshold for complex stroked lines. See TLspComplexStrokedLineStyle.Builder.sharpAngleThreshold(double) for more information.
      Returns:
      the sharp angle threshold for complex stroked lines.
      See Also:
    • getScalingMode Link icon

      public TLspComplexStrokedLineStyle.ScalingMode getScalingMode()
      Returns the scaling mode.
      Returns:
      the scaling mode.
      See Also:
    • getHaloThickness Link icon

      public int getHaloThickness()
      Returns the halo thickness.
      Returns:
      the halo thickness.
    • getHaloColor Link icon

      public Color getHaloColor()
      Returns the halo color.
      Returns:
      the halo color.
    • getModulationColor Link icon

      public Color getModulationColor()
      Gets the color that is modulated with the stroke. For example using a stroke with gray-scale colors and a red modulation color will result in a resulting stroke painted with red hues. The alpha value of the color is also used to determine the opacity of the stroke. The opacity indicates how transparent an object will be rendered.
      Returns:
      the modulation color
      Since:
      2016.1
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class ALspStyle
    • hashCode Link icon

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

      public String toString()
      Overrides:
      toString in class Object