Class LonLatGrid.Builder
- All Implemented Interfaces:
AutoCloseable
- Enclosing class:
LonLatGrid
Creates a LonLat grid with predefined scale ranges and default (customizable) styling.
- Since:
- 2023.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns the LonLat grid.void
close()
protected void
finalize()
labelEdgeOffset
(double labelEdgeOffset) This specifies the offset of the label, away from the edges of the view, in device independent pixels.labelGridOffset
(double labelGridOffset) This specifies the offset of the label, in device independent pixels, away from the grid line to which it is attached.labelOrientation
(GridLabelOrientation labelOrientation) This specifies the label orientation with respect to the line.labelPosition
(LonLatGridLabelPosition labelPosition) This specifies the label position with respect to the view.labelStyle
(TextStyle labelStyle) Indicates the label style to use for the LonLat grid.lineLabelPosition
(GridLineLabelPosition lineLabelPosition) This specifies the label position (with respect to the line) to use for the line labels.Indicates the line style to use for the LonLat grid.originLabelStyle
(TextStyle labelStyle) Indicates the origin label style to use for the LonLat grid.originLat
(double originLat) Indicates the origin latitude.originLineStyle
(LineStyle lineStyle) Indicates the origin line style to use for the LonLat grid.originLon
(double originLon) Indicates the origin longitude.scaleMultiplier
(double scaleMultiplier) Indicates the scale multiplier to use for the LonLat grid scale ranges.
-
Constructor Details
-
Builder
-
-
Method Details
-
finalize
protected void finalize() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
build
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
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
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
Indicates the line style to use for the LonLat grid.- Parameters:
lineStyle
- the line style.- Returns:
- this builder.
-
originLineStyle
Indicates the origin line style to use for the LonLat grid.- Parameters:
lineStyle
- the line style.- Returns:
- this builder.
-
labelStyle
Indicates the label style to use for the LonLat grid.- Parameters:
labelStyle
- the label style.- Returns:
- this builder.
-
originLabelStyle
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
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
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:
-