Class IconPatternBuilder

java.lang.Object
com.luciad.layers.styles.complexstrokes.builders.IconPatternBuilder
All Implemented Interfaces:
AutoCloseable

public final class IconPatternBuilder extends Object implements AutoCloseable
Creates a pattern containing an icon.

The icon must be set by calling the icon method before calling build. All other methods are optional.

Since:
2023.1
See Also:
  • Method Details

    • finalize

      protected void finalize()
      Overrides:
      finalize in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • build

      @NotNull public ComplexStrokePattern build() throws IllegalStateException
      Build the icon pattern as configured.
      Returns:
      the ComplexStrokePattern.
      Throws:
      IllegalStateException - when the icon has not been set.
    • icon

      @NotNull public IconPatternBuilder icon(@NotNull IIcon icon) throws IllegalArgumentException
      Sets the icon to be displayed.

      May not be null.

      Parameters:
      icon - the icon to be displayed.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - icon may not be null.
    • rotateUp

      @NotNull public IconPatternBuilder rotateUp(boolean rotateUp)
      Indicates if the icon should be flipped when it is turned upside down.

      Defaults to false.

      Parameters:
      rotateUp - Indicates if the icon should be flipped when it is turned upside down.
      Returns:
      this builder.
    • offset

      @NotNull public IconPatternBuilder offset(double offset)
      Sets the offset of the icon, relative to the base line, in pixels.

      Defaults to 0.

      Parameters:
      offset - the offset of the icon.
      Returns:
      this builder.
    • scale

      @NotNull public IconPatternBuilder scale(double scale) throws IllegalArgumentException
      Sets the factor by which the icon will be scaled.

      Defaults to 1 (no scaling).

      Parameters:
      scale - the scale factor.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - scale must be >0.
    • opacity

      @NotNull public IconPatternBuilder opacity(double opacity) throws IllegalArgumentException
      The opacity of the icon, determines how transparent an icon will be painted.

      It needs to be specified between 0 and 1. 0 indicates that the icon is painted completely transparent and 1 indicates that the original opacity of the icon is used.

      Parameters:
      opacity - the icon's opacity in the [0,1] interval, defaults to 1.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - opacity must be in range [0,1].
    • rotation

      @NotNull public IconPatternBuilder rotation(@NotNull Angle rotation)
      The rotation angle around the center of the icon's image, specified in degrees.

      Rotations are applied in a clock-wise fashion relatively to the direction of the underlying line. When rotateUp is set to true, the flipping occurs on the already rotated icon. The default is 0, which implies the icon is not rotated.

      Parameters:
      rotation - the rotation, defaults to 0 degrees.
      Returns:
      this builder.