public static class TLspGeorefGridStyle.Builder<B extends TLspGeorefGridStyle.Builder<B>> extends Object
Modifier and Type | Method and Description |
---|---|
B |
all(TLspGeorefGridStyle aGeorefStyle)
Sets all parameters on the builder based on the given georef style.
|
B |
axes(EnumSet<TLspGeorefGridStyle.Axis> aAxes)
This method specifies to which axes the subsequent calls, related to styling, are applied.
|
B |
body()
After calling this method, all subsequent
interval() , styles() ,
customizableStyles() , … calls will apply to all grid lines. |
B |
body(TLspGeorefGridStyle.GeorefLevel aGeorefLevel)
After calling this method, all subsequent
interval() , styles() ,
customizableStyles() , … calls will apply to all grid lines of the
given level. |
TLspGeorefGridStyle |
build()
Creates a new
TLspGeorefGridStyle from this builder. |
B |
customizableStyles(Collection<TLspCustomizableStyle> aStyles)
This method specifies the customizable styles to use for the current georef level/interval
combination.
|
B |
customizableStyles(TLspCustomizableStyle... aStyles)
This method specifies the customizable styles to use for the current georef level/interval
combination.
|
B |
defaultGeorefGridStyle()
Configures this builder with a default georef grid style.
|
B |
format(String aCoordinatePattern)
This method specifies the format pattern to use for the labels of the current georef
level/interval combination.
|
B |
interval(double aMin,
double aMax)
After calling this method, all subsequent
styles() , customizableStyles() , … calls will only apply to the given scale interval. |
B |
label()
After calling this method, all subsequent
interval() , styles() ,
customizableStyles() , … calls will apply to all grid labels. |
B |
label(TLspGeorefGridStyle.GeorefLevel aGeorefLevel)
After calling this method, all subsequent
interval() , styles() ,
customizableStyles() , … calls will apply to all grid labels of the
given level. |
B |
labelEdgeOffset(double aEdgeOffset)
This method specifies the offset of the label, away from the edge of the view.
|
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.
|
B |
labelGridOffset(double aGridOffset)
This method specifies the offset of the label, away from the grid line to which it is attached.
|
B |
labelLinePosition(TLspGeorefGridStyle.LinePosition aLinePosition)
This method specifies the position of the line labels of the current spacing/interval combination with
respect to the line.
|
B |
labelOrientation(TLspGeorefGridStyle.Orientation aOrientation)
This method specifies the orientation to use for the labels of the current level/interval combination.
|
B |
labelPosition(TLspGeorefGridStyle.LabelPosition aLabelPosition)
This method specifies the position of the line labels of the current spacing/interval combination with
respect to the view.
|
B |
overlay()
After calling this method, all subsequent
interval() , styles() ,
customizableStyles() , … calls will only apply to all overlay
labels. |
B |
styles(ALspStyle... aStyles)
This method specifies the styles to use for the current georef level/interval
combination.
|
B |
styles(Collection<ALspStyle> aStyles)
This method specifies the styles to use for the current georef level/interval
combination.
|
public B defaultGeorefGridStyle()
public B body()
interval()
, styles()
,
customizableStyles()
, … calls will apply to all grid lines. I.e. all grid
levels.
When no subsequent interval()
or styles()
call is done, a default interval
and default styles are chosen. Note that the default interval might not be a good default. See interval
for more information.
For an example of how to use this method, see TLspGeorefGridStyle
.public B body(TLspGeorefGridStyle.GeorefLevel aGeorefLevel)
interval()
, styles()
,
customizableStyles()
, … calls will apply to all grid lines of the
given level. E.g. to all 15 or 1 degree square lines.
When no subsequent interval()
or styles()
call is done, a default interval
and default styles are chosen. Note that the default interval might not be a good default. See interval
for more information.
For an example of how to use this method, see TLspGeorefGridStyle
.aGeorefLevel
- the georef levelpublic B label()
interval()
, styles()
,
customizableStyles()
, … calls will apply to all grid labels. I.e.
all grid levels.
When no subsequent interval()
or styles()
call is done, a default interval
and default styles are chosen. Note that the default interval might not be a good default. See interval
for more information.
For an example of how to use this method, see TLspGeorefGridStyle
.public B label(TLspGeorefGridStyle.GeorefLevel aGeorefLevel)
interval()
, styles()
,
customizableStyles()
, … calls will apply to all grid labels of the
given level. E.g. to all 15 or 1 degree square labels.
When no subsequent interval()
or styles()
call is done, a default interval
and default styles are chosen. Note that the default interval might not be a good default. See interval
for more information.
For an example of how to use this method, see TLspGeorefGridStyle
.aGeorefLevel
- the georef levelpublic B overlay()
interval()
, styles()
,
customizableStyles()
, … calls will only apply to all overlay
labels. See also TLspGeorefGridOverlayLabelBuilder
.
When no subsequent interval()
or styles()
call is done, a default interval
and default styles are chosen.
For an example of how to use this method, see TLspGeorefGridStyle
.public B interval(double aMin, double aMax)
styles()
, customizableStyles()
, … calls will only apply to the given scale interval. It is possible
to define multiple scale intervals for every line or label 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 the body
or label
methods, an interval from 0
(completely zoomed out) to Double.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 from 0
(completely zoomed out) to Double.MAX_VALUE
(completely zoomed in) for the 1 minute 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
(georef level/body or label) combination.
For an example of how to use this method, see TLspGeorefGridStyle
.aMin
- the minimum scaleaMax
- the maximum scalepublic B axes(EnumSet<TLspGeorefGridStyle.Axis> aAxes)
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.
TLspGeorefGridStyle.Builder builder = TLspGeorefGridStyle.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.
TLspGeorefGridStyle.Builder builder = TLspGeorefGridStyle.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);
aAxes
- the axes for which the subsequent calls are applied.public B styles(Collection<ALspStyle> aStyles)
TLspGeorefGridStyle
for more information).
For an example of how to use this method, see TLspGeorefGridStyle
.
Either this method or the customizableStyles
method should be
called at least once after calling one of the body
, label
or interval
methods. Otherwise, default styling is used.
The difference between the styles()
and customizableStyles()
method is that the
latter accepts TLspCustomizableStyle
instances which will be exposed through the ILspStyler
which is set on the resulting layer. That styler will implement the ILspCustomizableStyler
interface and expose those customizable styles. The styles passed in the styles()
method will not be exposed. The benefit of the customizableStyles()
method is that it
is possible to customize the styles later on (for example through a user interface). If no
customization is needed afterwards, the styles()
method has the advantage to skip the
overhead of creating TLspCustomizableStyle
instances.aStyles
- the styles to use.public B styles(ALspStyle... aStyles)
styles(Collection)
.aStyles
- the styles to usepublic B customizableStyles(Collection<TLspCustomizableStyle> aStyles)
TLspGeorefGridStyle
for more information).
For an example of how to use this method, see TLspGeorefGridStyle
.
Either this method or the styles
method should be called at least once
after calling one of the body
, label
or interval
methods.
Otherwise, default styling is used.
The difference between the styles()
and customizableStyles()
method is that the
latter accepts TLspCustomizableStyle
instances which will be exposed through the ILspStyler
which is set on the resulting layer. That styler will implement the ILspCustomizableStyler
interface and expose those customizable styles. The styles passed in the styles()
method will not be exposed. The benefit of the customizableStyles()
method is that it
is possible to customize the styles later on (for example through a user interface). If no
customization is needed afterwards, the styles()
method has the advantage to skip the
overhead of creating TLspCustomizableStyle
instances.aStyles
- the styles to use.public B customizableStyles(TLspCustomizableStyle... aStyles)
customizableStyles(Collection)
.aStyles
- the styles to usepublic B format(String aCoordinatePattern)
This method specifies the format pattern to use for the labels of the current georef level/interval combination. This method has no effect for bodies.
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> ::= [<degrees15>] [<separator> <degrees>] [<minutes>] <degrees15> ::= "D" <degrees> ::= "d" <minutes> ::= [<separator> <x> <separator> <y>] <x> ::= "X" <minutes_precision> <y> ::= "Y" <minutes_precision> <minutes_precision> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" <separator> ::= { ? any character ? }When specifying the minutes precision, the value of 2 corresponds with a precision of 1 minute (can be represented by 2 digits, e.g. 37'). A value of 3 corresponds with a precision of 0.1 minute, etc... For example:
aCoordinatePattern
- the pattern used to format the label textpublic B labelOrientation(TLspGeorefGridStyle.Orientation aOrientation)
This method specifies the orientation to use for the labels of the current level/interval combination.
This method will only work when it is called after one of the label()
methods. The given format
is only applied to grid labels with the spacing defined in a previous label
call. It is also only used when the view scale lies within the scale interval defined in
a previous interval
call. This method has no effect for bodies.
This method only has effect for labels that are painted along a line.
If this method is not called, a default orientation is used, ALONG_LINE
.
aOrientation
- the orientation to use.public B labelPosition(TLspGeorefGridStyle.LabelPosition aLabelPosition)
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
.
aLabelPosition
- the label position to use.public B labelLinePosition(TLspGeorefGridStyle.LinePosition aLinePosition)
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
.
aLinePosition
- the line position to use.public B labelGridOffset(double aGridOffset)
label()
methods. It will throw an exception otherwise.
If this method is not called, a default offset is used, 3.0
.aGridOffset
- the line offset to use.public B labelEdgeOffset(double aEdgeOffset)
label()
methods. It will throw an exception otherwise.
If this method is not called, a default offset is used, 6.0
.aEdgeOffset
- the border offset to use.public B labelEdgeOffset(double aEdgeOffsetLeft, double aEdgeOffsetRight, double aEdgeOffsetBottom, double aEdgeOffsetTop)
label()
methods. It will throw an exception otherwise.
If this method is not called, a default offset is used, 6.0
.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.public B all(TLspGeorefGridStyle aGeorefStyle)
aGeorefStyle
- the georef style to copypublic TLspGeorefGridStyle build()
TLspGeorefGridStyle
from this builder.TLspGeorefGridStyle