public static final class MgrsGridSetting.Builder extends Object implements AutoCloseable
Constructor and Description |
---|
Builder(MgrsGridSetting.Builder other) |
Modifier and Type | Method and Description |
---|---|
MgrsGridSetting |
build()
Returns the MGRS grid setting.
|
void |
close() |
protected void |
finalize() |
MgrsGridSetting.Builder |
labelEdgeOffset(double labelEdgeOffset)
This specifies the offset of the label, away from the edges of the view, in device independent pixels.
|
MgrsGridSetting.Builder |
labelFormat(String labelFormat)
The format pattern to use for the labels of the current MGRS.
|
MgrsGridSetting.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.
|
MgrsGridSetting.Builder |
labelOrientation(GridLabelOrientation labelOrientation)
This specifies the label orientation with respect to the line.
|
MgrsGridSetting.Builder |
labelPosition(GridLabelPosition labelPosition)
This specifies the label position with respect to the view.
|
MgrsGridSetting.Builder |
labelStyle(TextStyle labelStyle)
Indicates the label style to use for this setting.
|
MgrsGridSetting.Builder |
level(MgrsLevel level)
Indicates the MGRS level for which this setting applies.
|
MgrsGridSetting.Builder |
lineLabelPosition(GridLineLabelPosition lineLabelPosition)
This specifies the label position (with respect to the line) to use for the line labels of the current MGRS type/level/interval combination.
|
MgrsGridSetting.Builder |
lineStyle(LineStyle lineStyle)
Indicates the line style to use for this setting.
|
MgrsGridSetting.Builder |
scaleRange(MapScale minScale,
MapScale maxScale)
Indicates the scale range for which this setting applies.
|
MgrsGridSetting.Builder |
type(MgrsType type)
Indicates the MGRS type for which this setting applies.
|
public Builder(@NotNull MgrsGridSetting.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public MgrsGridSetting build() throws IllegalStateException
Mandatory parameters:
Other parameters are optional.
IllegalStateException
- when not all mandatory parameters are set.@NotNull public MgrsGridSetting.Builder level(@NotNull MgrsLevel level)
This is mandatory.
level
- the MGRS level.@NotNull public MgrsGridSetting.Builder type(@NotNull MgrsType type)
This is optional. When not called this setting applies to both MGRS types.
type
- the MGRS type.@NotNull public MgrsGridSetting.Builder scaleRange(@NotNull MapScale minScale, @NotNull MapScale maxScale) throws IllegalArgumentException
This is mandatory.
minScale
- the min scale (most zoomed out).maxScale
- the max scale (most zoomed in).IllegalArgumentException
- when the min scale is larger than or equal to the max scale.@NotNull public MgrsGridSetting.Builder lineStyle(@NotNull LineStyle lineStyle)
This is optional. Defaults to a white line style with width 1.
lineStyle
- the line style.@NotNull public MgrsGridSetting.Builder labelStyle(@NotNull TextStyle labelStyle)
This is optional. Defaults to a white text style with font size 14 and a black halo.
labelStyle
- the label style.@NotNull public MgrsGridSetting.Builder labelEdgeOffset(double labelEdgeOffset) throws IllegalArgumentException
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. Defaults to 6
.
labelEdgeOffset
- the edge offset value. Must be >= 0.IllegalArgumentException
- when an invalid value is passed.@NotNull public MgrsGridSetting.Builder labelGridOffset(double labelGridOffset) throws IllegalArgumentException
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. Defaults to 3
.
labelGridOffset
- the grid offset value. Must be >= 0.IllegalArgumentException
- when an invalid value is passed.@NotNull public MgrsGridSetting.Builder lineLabelPosition(@NotNull GridLineLabelPosition lineLabelPosition)
They can for example be placed at the left or at the right of the line.
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. Defaults to AboveOrLeft
.
lineLabelPosition
- the line label position.@NotNull public MgrsGridSetting.Builder labelOrientation(@NotNull GridLabelOrientation labelOrientation)
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. Defaults to AlongLine
.
labelOrientation
- the label orientation.@NotNull public MgrsGridSetting.Builder labelPosition(@NotNull GridLabelPosition 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.
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. Defaults to WestAndSouth
.
labelPosition
- the label position.@NotNull public MgrsGridSetting.Builder labelFormat(@NotNull String labelFormat) throws IllegalArgumentException
This pattern can be used to specify MGRS coordinates or UTM/UPS coordinates.
The format in BNF notation (expressions enclosed in []
brackets are optional, expressions enclosed in {}
brackets may be omitted or repeated):
<pattern> ::= [<zone>] [<separator> <band>] [<coordinates>] <zone> ::= "Z" <band> ::= "B" <coordinates> ::= <mgrs_coordinates> | <utm_coordinates> <mgrs_coordinates> ::= [<separator> <id100k>] [<separator> <x> <separator> <y>] <utm_coordinates> ::= [<separator> <u> <separator> <v>] <id100k> ::= "S" <x> ::= "X" <mgrs_precision> <y> ::= "Y" <mgrs_precision> <mgrs_precision> ::= "0" | "1" | "2" | "3" | "4" | "5" <u> ::= "U" <utm_precision> <v> ::= "V" <utm_precision> <utm_precision> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" <separator> ::= { ? any character ? }For example:
Depending on the label, only some parts of the format string will be used. For example, when displaying grid line labels, only the X or Y part of the format string will be used (e.g. it can be used to specify if "12345"
or "1234"
is displayed).
It is applied for the labels of the current MGRS type/level/interval combination.
This is optional. When not specified a default label format is used, depending on the level.
labelFormat
- the label format.IllegalArgumentException
- when an invalid value is passed.