Class TLspMGRSGridStyle.Builder<B extends TLspMGRSGridStyle.Builder<B>>
- Enclosing class:
TLspMGRSGridStyle
- Since:
- 2012.1
-
Method Summary
Modifier and TypeMethodDescriptionall
(TLspMGRSGridStyle aMGRSStyle) Sets all parameters on the builder based on the given MGRS style.axes
(EnumSet<TLspMGRSGridStyle.Axis> aAxes) This method specifies to which axes the subsequent calls, related to styling, are applied.body()
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines.body
(TLspMGRSGridStyle.MGRSLevel aMGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given level.body
(TLspMGRSGridStyle.MGRSType aMgrsType) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given type (UTM or UPS).body
(TLspMGRSGridStyle.MGRSType aMgrsType, TLspMGRSGridStyle.MGRSLevel aMGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given type/level combination.build()
Creates a newTLspMGRSGridStyle
from this builder.customizableStyles
(TLspCustomizableStyle... aStyles) This method specifies the customizable styles to use for the current MGRS type/level/interval combination.This method specifies the customizable styles to use for the current MGRS type/level/interval combination.Returns a defaultTLspMGRSGridStyle
that uses MGRS label formatting.Returns a defaultTLspMGRSGridStyle
that uses UTM/UPS label formatting.This method specifies the format pattern to use for the labels of the current MGRS type/level/interval combination.interval
(double aMin, double aMax) After calling this method, all subsequentstyles()
,customizableStyles()
, … calls will only apply to the given scale interval.keepLabelsInView
(boolean aKeepLabelsInView) This method specifies that the labeling algorithm attempts to keep all labels inside the view.label()
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels.label
(TLspMGRSGridStyle.MGRSLevel aMGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given level.label
(TLspMGRSGridStyle.MGRSType aMgrsType) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given type (UTM or UPS).label
(TLspMGRSGridStyle.MGRSType aMgrsType, TLspMGRSGridStyle.MGRSLevel aMGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given type/level combination.labelEdgeOffset
(double aEdgeOffset) This method specifies the offset of the label, away from the edge of the view.labelEdgeOffset
(double aEdgeOffsetLeft, double aEdgeOffsetRight, double aEdgeOffsetBottom, double aEdgeOffsetTop) This method specifies the offsets of the label, away from the edges of the view, one offset for each side of the view.labelGridOffset
(double aGridOffset) This method specifies the offset of the label, away from the grid line to which it is attached.labelLinePosition
(TLspMGRSGridStyle.LinePosition aLinePosition) This method specifies the position of the line labels of the current spacing/interval combination with respect to the line.labelOrientation
(TLspMGRSGridStyle.Orientation aOrientation) This method specifies the orientation to use for the labels of the current MGRS type/level/interval combination.labelPosition
(TLspMGRSGridStyle.LabelPosition aLabelPosition) This method specifies the position of the line labels of the current spacing/interval combination with respect to the view.overlay()
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will only apply to all overlay labels.This method specifies the styles to use for the current MGRS type/level/interval combination.styles
(Collection<ALspStyle> aStyles) This method specifies the styles to use for the current MGRS type/level/interval combination.
-
Method Details
-
defaultMGRSGridStyle
Returns a defaultTLspMGRSGridStyle
that uses MGRS label formatting.- Returns:
- a default
TLspMGRSGridStyle
that uses MGRS label formatting.
-
defaultUtmUpsGridStyle
Returns a defaultTLspMGRSGridStyle
that uses UTM/UPS label formatting.- Returns:
- a default
TLspMGRSGridStyle
that uses UTM/UPS label formatting.
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines. I.e. UTM as well as UPS, and all grid levels. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Returns:
- this builder
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given type (UTM or UPS). When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMgrsType
- the MGRS type (UPS or UTM)- Returns:
- this builder
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given level. E.g. to all UTM 100K lines, and to all UPS 100K lines. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMGRSLevel
- the MGRS level- Returns:
- this builder
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given type/level combination. E.g. to all UTM 100K lines. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMgrsType
- the MGRS type (UTM or UPS)aMGRSLevel
- the MGRS level- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels. I.e. UTM as well as UPS, and all grid levels. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given type (UTM or UPS). When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMgrsType
- the MGRS type (UPS or UTM)- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given level. E.g. to all UTM 100K labels, and to all UPS 100K labels. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMGRSLevel
- the MGRS level- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given type/level combination. E.g. to all UTM 100K labels. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. Note that the default interval might not be a good default. Seeinterval
for more information. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMgrsType
- the MGRS type (UTM or UPS)aMGRSLevel
- the MGRS level- Returns:
- this builder
-
overlay
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will only apply to all overlay labels. See alsoTLspMGRSGridOverlayLabelBuilder
. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. For an example of how to use this method, seeTLspMGRSGridStyle
.- Returns:
- this builder
-
interval
After calling this method, all subsequentstyles()
,customizableStyles()
, … calls will only apply to the given scale interval. It is possible to define multiple scale intervals for every line or label type/level. In order to do this, the interval method (and its subsequent calls) can be called multiple times. When not calling this method after calling one of thebody
orlabel
methods, an interval from0
(completely zoomed out) toDouble.MAX_VALUE
(completely zoomed in) is used. So if you want to use the same styles for every scale, this method should not be called. Note that it is important to choose realistic scales for each level. Not doing so may cause the grid to switch to a less detailed level. For example when specifying an interval from0
(completely zoomed out) toDouble.MAX_VALUE
(completely zoomed in) for the 1 meter square level, too much geometry would need to be generated when zoomed out. To prevent this, the grid layer may switch to a less detailed level. This problem should be prevented by choosing a higher minimum scale. When specifying overlapping intervals, it's not specified, which styles will be used. It is advised to only specify non-overlapping intervals for the same (mgrs type/level/body or label) combination. For an example of how to use this method, seeTLspMGRSGridStyle
.- Parameters:
aMin
- the minimum scaleaMax
- the maximum scale- Returns:
- this builder
-
axes
This method specifies to which axes the subsequent calls, related to styling, are applied. It can be used to specify different styles, label formats, ... for each axis. This method only affects calls that are done after this method call.
Examples:
// For the X axis, the labels will be formatted and styled differently from the Y axis. TLspMGRSGridStyle.Builder builder = TLspMGRSGridStyle.newBuilder(); builder.label(SQUARES_10000M).interval(interval); builder.axis(EnumSet.of(Axis.X)).styles(styles1).format(formatX); builder.axis(EnumSet.of(Axis.Y)).styles(styles2).format(formatY);
// For the X axis, the labels will be formatted differently from the Y axis labels. // Both axes will use the same styles. TLspMGRSGridStyle.Builder builder = TLspMGRSGridStyle.newBuilder(); builder.label(SQUARES_10000M).interval(interval); builder.styles(style1, style2); builder.axis(EnumSet.of(Axis.X)).format(formatX); builder.axis(EnumSet.of(Axis.Y)).format(formatY);
- Parameters:
aAxes
- the axes for which the subsequent calls are applied.- Returns:
- this builder.
- Since:
- 2018.0
-
styles
This method specifies the styles to use for the current MGRS type/level/interval combination. Keep in mind that not all styles are supported (seeTLspMGRSGridStyle
for more information). For an example of how to use this method, seeTLspMGRSGridStyle
. Either this method or thecustomizableStyles
method should be called at least once after calling one of thebody
,label
orinterval
methods. Otherwise, default styling is used. The difference between thestyles()
andcustomizableStyles()
method is that the latter acceptsTLspCustomizableStyle
instances which will be exposed through theILspStyler
which is set on the resulting layer. That styler will implement theILspCustomizableStyler
interface and expose those customizable styles. The styles passed in thestyles()
method will not be exposed. The benefit of thecustomizableStyles()
method is that it is possible to customize the styles later on (for example through a user interface). If no customization is needed afterwards, thestyles()
method has the advantage to skip the overhead of creatingTLspCustomizableStyle
instances.- Parameters:
aStyles
- the styles to use.- Returns:
- this builder
-
styles
This method specifies the styles to use for the current MGRS type/level/interval combination. For more information, seestyles(Collection)
.- Parameters:
aStyles
- the styles to use- Returns:
- this builder
-
customizableStyles
This method specifies the customizable styles to use for the current MGRS type/level/interval combination. Keep in mind that not all styles are supported (seeTLspMGRSGridStyle
for more information). For an example of how to use this method, seeTLspMGRSGridStyle
. Either this method or thestyles
method should be called at least once after calling one of thebody
,label
orinterval
methods. Otherwise, default styling is used. The difference between thestyles()
andcustomizableStyles()
method is that the latter acceptsTLspCustomizableStyle
instances which will be exposed through theILspStyler
which is set on the resulting layer. That styler will implement theILspCustomizableStyler
interface and expose those customizable styles. The styles passed in thestyles()
method will not be exposed. The benefit of thecustomizableStyles()
method is that it is possible to customize the styles later on (for example through a user interface). If no customization is needed afterwards, thestyles()
method has the advantage to skip the overhead of creatingTLspCustomizableStyle
instances.- Parameters:
aStyles
- the styles to use.- Returns:
- this builder
-
customizableStyles
This method specifies the customizable styles to use for the current MGRS type/level/interval combination. For more information, seecustomizableStyles(Collection)
.- Parameters:
aStyles
- the styles to use- Returns:
- this builder
-
format
This method specifies the format pattern to use for the labels of the current MGRS type/level/interval combination. This method has no effect for bodies. This pattern can be used to specify MGRS coordinates or UTM/UPS coordinates. If this method is not called, a default format is used. 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:- "33UES 12345 54321" has format "ZBS X5 Y5"
- "33U 123456 7654321" has format "ZB U6 V7"
"12345"
or"1234"
is displayed).- Parameters:
aCoordinatePattern
- the pattern used to format the label text- Returns:
- this builder.
-
labelOrientation
This method specifies the orientation to use for the labels of the current MGRS type/level/interval combination. This method will only work when it is called after one of thelabel()
methods. It will throw an exception otherwise. If this method is not called, a default orientation is used,ALONG_LINE
.- Parameters:
aOrientation
- the orientation to use.- Returns:
- this builder.
-
labelPosition
This method specifies the position of the line labels of the current spacing/interval combination with respect to the view. They can for example be placed at the left or at the right edge of the view, or both. For example, when a label is placed at the east or south side of a line, it will be placed at the left or lower edge of the view when using a rectangular projection like mercator.
If this method is not called, a default label position is used,
WEST_AND_SOUTH
.- Parameters:
aLabelPosition
- the label position to use.- Returns:
- this builder
- Since:
- 2017.0
-
labelLinePosition
This method specifies the position of the line labels of the current spacing/interval combination with respect to the line. They can for example be placed at the left or at the right of the line.
If this method is not called, a default label position is used,
ABOVE_OR_LEFT
.- Parameters:
aLinePosition
- the line position to use.- Returns:
- this builder
- Since:
- 2017.0
-
labelGridOffset
This method specifies the offset of the label, away from the grid line to which it is attached. It is applied for the labels of the current MGRS type/level/interval combination. This method will only work when it is called after one of thelabel()
methods. It will throw an exception otherwise. If this method is not called, a default offset is used,3.0
.- Parameters:
aGridOffset
- the line offset to use.- Returns:
- this builder
-
labelEdgeOffset
This method specifies the offset of the label, away from the edge of the view. It is applied for the labels of the current MGRS type/level/interval combination. This method will only work when it is called after one of thelabel()
methods. It will throw an exception otherwise. If this method is not called, a default offset is used,6.0
.- Parameters:
aEdgeOffset
- the border offset to use.- Returns:
- this builder
-
labelEdgeOffset
public B labelEdgeOffset(double aEdgeOffsetLeft, double aEdgeOffsetRight, double aEdgeOffsetBottom, double aEdgeOffsetTop) This method specifies the offsets of the label, away from the edges of the view, one offset for each side of the view. It is applied for the labels of the current MGRS type/level/interval combination. This method will only work when it is called after one of thelabel()
methods. It will throw an exception otherwise. If this method is not called, a default offset is used,6.0
.- Parameters:
aEdgeOffsetLeft
- the offset of the label from the left edge of the view.aEdgeOffsetRight
- the offset of the label from the right edge of the view.aEdgeOffsetBottom
- the offset of the label from the bottom edge of the view.aEdgeOffsetTop
- the offset of the label from the top edge of the view.- Returns:
- this builder
- Since:
- 2018.0
-
keepLabelsInView
This method specifies that the labeling algorithm attempts to keep all labels inside the view. This happens automatically for many labels, but not for some. For example: by default, the 100k labels are placed in the middle of their square. If the middle of the square is outside the view, its label is not visible. By passing
true
to this method, the 100k square labels will be placed inside the square, and inside the view.By default, this parameter is set to false.
- Parameters:
aKeepLabelsInView
- to keep all labels inside the view.- Returns:
- this builder
- Since:
- 2018.0
-
all
Sets all parameters on the builder based on the given MGRS style. This is useful for example to create a new style that has almost all properties equal to another style.- Parameters:
aMGRSStyle
- the MGRS style to copy- Returns:
- this styler
-
build
Creates a newTLspMGRSGridStyle
from this builder.- Returns:
- a new
TLspMGRSGridStyle
-