Class LonLatGrid.Builder

java.lang.Object
com.luciad.layers.grids.lonlat.LonLatGrid.Builder
All Implemented Interfaces:
AutoCloseable
Enclosing class:
LonLatGrid

public static final class LonLatGrid.Builder extends Object implements AutoCloseable
Builder for a LonLat grid.

Creates a LonLat grid with predefined scale ranges and default (customizable) styling.

Since:
2023.1
  • Constructor Details

  • Method Details

    • finalize

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

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

      @NotNull public LonLatGrid build() throws IllegalStateException
      Returns the LonLat grid.

      See LonLatGrid for information on the constraints for a LonLat grid.

      Returns:
      the LonLat grid.
      Throws:
      IllegalStateException - when the settings are invalid.
    • originLon

      @NotNull public LonLatGrid.Builder originLon(double originLon) throws IllegalArgumentException
      Indicates the origin longitude.

      This is optional. Defaults to 0.

      Parameters:
      originLon - the origin longitude.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - when the origin longitude is smaller than -180 or larger than 180.
    • originLat

      @NotNull public LonLatGrid.Builder originLat(double originLat) throws IllegalArgumentException
      Indicates the origin latitude.

      This is optional. Defaults to 0.

      Parameters:
      originLat - the origin latitude.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - when the origin latitude is smaller than -90 or larger than 90.
    • scaleMultiplier

      @NotNull public LonLatGrid.Builder scaleMultiplier(double scaleMultiplier) throws IllegalArgumentException
      Indicates the scale multiplier to use for the LonLat grid scale ranges.

      The value must be within the range [0.1, 10.0].

      A value larger than 1 makes the grid lines appear later when zooming in. This results in a coarser grid. A value below 1 makes the grid lines appear sooner when zooming in. This results in a finer grid.

      Parameters:
      scaleMultiplier - the scale multiplier.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - when an invalid value is passed.
    • lineStyle

      @NotNull public LonLatGrid.Builder lineStyle(@NotNull LineStyle lineStyle)
      Indicates the line style to use for the LonLat grid.
      Parameters:
      lineStyle - the line style.
      Returns:
      this builder.
    • originLineStyle

      @NotNull public LonLatGrid.Builder originLineStyle(@NotNull LineStyle lineStyle)
      Indicates the origin line style to use for the LonLat grid.
      Parameters:
      lineStyle - the line style.
      Returns:
      this builder.
    • labelStyle

      @NotNull public LonLatGrid.Builder labelStyle(@NotNull TextStyle labelStyle)
      Indicates the label style to use for the LonLat grid.
      Parameters:
      labelStyle - the label style.
      Returns:
      this builder.
    • originLabelStyle

      @NotNull public LonLatGrid.Builder originLabelStyle(@NotNull TextStyle labelStyle)
      Indicates the origin label style to use for the LonLat grid.
      Parameters:
      labelStyle - the label style.
      Returns:
      this builder.
    • labelEdgeOffset

      @NotNull public LonLatGrid.Builder labelEdgeOffset(double labelEdgeOffset) throws IllegalArgumentException
      This specifies the offset of the label, away from the edges of the view, in device independent pixels.

      This is applied to all style settings in the grid.

      This is optional. Defaults to 6.

      Parameters:
      labelEdgeOffset - the edge offset value. Must be >= 0.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - when an invalid value is passed.
      See Also:
    • labelGridOffset

      @NotNull public LonLatGrid.Builder labelGridOffset(double labelGridOffset) throws IllegalArgumentException
      This specifies the offset of the label, in device independent pixels, away from the grid line to which it is attached.

      This is applied to all style settings in the grid.

      This is optional. Defaults to 3.

      Parameters:
      labelGridOffset - the grid offset value. Must be >= 0.
      Returns:
      this builder.
      Throws:
      IllegalArgumentException - when an invalid value is passed.
      See Also:
    • lineLabelPosition

      @NotNull public LonLatGrid.Builder lineLabelPosition(@NotNull GridLineLabelPosition lineLabelPosition)
      This specifies the label position (with respect to the line) to use for the line labels.

      They can for example be placed at the left or at the right of the line.

      This is applied to all style settings in the grid.

      This is optional. Defaults to AboveOrLeft.

      Parameters:
      lineLabelPosition - the line label position.
      Returns:
      this builder.
      See Also:
    • labelOrientation

      @NotNull public LonLatGrid.Builder labelOrientation(@NotNull GridLabelOrientation labelOrientation)
      This specifies the label orientation with respect to the line.

      This is applied to all style settings in the grid.

      This is optional. Defaults to AlongLine.

      Parameters:
      labelOrientation - the label orientation.
      Returns:
      this builder.
      See Also:
    • labelPosition

      @NotNull public LonLatGrid.Builder labelPosition(@NotNull LonLatGridLabelPosition labelPosition)
      This specifies the label position with respect to the view.

      They can for example be placed at the left or at the right edge of the view. For example, when a label is placed at the east or south side of a line, it is placed at the left or lower edge of the view when using a rectangular projection like Mercator.

      This is applied to all style settings in the grid.

      This is optional. Defaults to AllSides.

      Parameters:
      labelPosition - the label position.
      Returns:
      this builder.
      See Also: