public static final class LonLatGrid.Builder extends Object implements AutoCloseable
Creates a LonLat grid with predefined scale ranges and default (customizable) styling.
Constructor and Description |
---|
Builder(LonLatGrid.Builder other) |
Modifier and Type | Method and Description |
---|---|
LonLatGrid |
build()
Returns the LonLat grid.
|
void |
close() |
protected void |
finalize() |
LonLatGrid.Builder |
labelEdgeOffset(double labelEdgeOffset)
This specifies the offset of the label, away from the edges of the view, in device independent pixels.
|
LonLatGrid.Builder |
labelGridOffset(double labelGridOffset)
This specifies the offset of the label, in device independent pixels, away from the grid line to which it is attached.
|
LonLatGrid.Builder |
labelOrientation(GridLabelOrientation labelOrientation)
This specifies the label orientation with respect to the line.
|
LonLatGrid.Builder |
labelPosition(LonLatGridLabelPosition labelPosition)
This specifies the label position with respect to the view.
|
LonLatGrid.Builder |
labelStyle(TextStyle labelStyle)
Indicates the label style to use for the LonLat grid.
|
LonLatGrid.Builder |
lineLabelPosition(GridLineLabelPosition lineLabelPosition)
This specifies the label position (with respect to the line) to use for the line labels.
|
LonLatGrid.Builder |
lineStyle(LineStyle lineStyle)
Indicates the line style to use for the LonLat grid.
|
LonLatGrid.Builder |
originLabelStyle(TextStyle labelStyle)
Indicates the origin label style to use for the LonLat grid.
|
LonLatGrid.Builder |
originLat(double originLat)
Indicates the origin latitude.
|
LonLatGrid.Builder |
originLineStyle(LineStyle lineStyle)
Indicates the origin line style to use for the LonLat grid.
|
LonLatGrid.Builder |
originLon(double originLon)
Indicates the origin longitude.
|
LonLatGrid.Builder |
scaleMultiplier(double scaleMultiplier)
Indicates the scale multiplier to use for the LonLat grid scale ranges.
|
public Builder(@NotNull LonLatGrid.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public LonLatGrid build() throws IllegalStateException
IllegalStateException
- when the settings are invalid.LonLatGrid
@NotNull public LonLatGrid.Builder originLon(double originLon) throws IllegalArgumentException
This is optional. Defaults to 0.
originLon
- the origin longitude.IllegalArgumentException
- when the origin longitude is smaller than -180 or larger than 180.@NotNull public LonLatGrid.Builder originLat(double originLat) throws IllegalArgumentException
This is optional. Defaults to 0.
originLat
- the origin latitude.IllegalArgumentException
- when the origin latitude is smaller than -90 or larger than 90.@NotNull public LonLatGrid.Builder scaleMultiplier(double scaleMultiplier) throws IllegalArgumentException
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.
scaleMultiplier
- the scale multiplier.IllegalArgumentException
- when an invalid value is passed.@NotNull public LonLatGrid.Builder lineStyle(@NotNull LineStyle lineStyle)
lineStyle
- the line style.@NotNull public LonLatGrid.Builder originLineStyle(@NotNull LineStyle lineStyle)
lineStyle
- the line style.@NotNull public LonLatGrid.Builder labelStyle(@NotNull TextStyle labelStyle)
labelStyle
- the label style.@NotNull public LonLatGrid.Builder originLabelStyle(@NotNull TextStyle labelStyle)
labelStyle
- the label style.@NotNull public LonLatGrid.Builder labelEdgeOffset(double labelEdgeOffset) throws IllegalArgumentException
This is applied to all style settings in the grid.
This is optional. Defaults to 6
.
labelEdgeOffset
- the edge offset value. Must be >= 0.IllegalArgumentException
- when an invalid value is passed.LonLatGridSetting.Builder#labelEdgeOffset
@NotNull public LonLatGrid.Builder labelGridOffset(double labelGridOffset) throws IllegalArgumentException
This is applied to all style settings in the grid.
This is optional. Defaults to 3
.
labelGridOffset
- the grid offset value. Must be >= 0.IllegalArgumentException
- when an invalid value is passed.LonLatGridSetting.Builder#labelGridOffset
@NotNull public LonLatGrid.Builder lineLabelPosition(@NotNull GridLineLabelPosition lineLabelPosition)
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
.
lineLabelPosition
- the line label position.LonLatGridSetting.Builder#lineLabelPosition
@NotNull public LonLatGrid.Builder labelOrientation(@NotNull GridLabelOrientation labelOrientation)
This is applied to all style settings in the grid.
This is optional. Defaults to AlongLine
.
labelOrientation
- the label orientation.LonLatGridSetting.Builder#labelOrientation
@NotNull public LonLatGrid.Builder labelPosition(@NotNull LonLatGridLabelPosition labelPosition)
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
.
labelPosition
- the label position.LonLatGridSetting.Builder#labelPosition