Class TLspCGRSGridStyle.Builder<B extends TLspCGRSGridStyle.Builder<B>>
java.lang.Object
com.luciad.view.lightspeed.painter.grid.cgrs.TLspCGRSGridStyle.Builder<B>
- Enclosing class:
TLspCGRSGridStyle
public static class TLspCGRSGridStyle.Builder<B extends TLspCGRSGridStyle.Builder<B>>
extends Object
Builder for CGRS styles.
- Since:
- 2021.1
-
Method Summary
Modifier and TypeMethodDescriptionall
(TLspCGRSGridStyle aCGRSStyle) Sets all parameters on the builder based on the given CGRS style.axes
(EnumSet<TLspCGRSGridStyle.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
(TLspCGRSGridStyle.CGRSLevel aCGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given level, such as all 30 minute square lines.build()
Creates a newTLspCGRSGridStyle
from this builder.customizableStyles
(TLspCustomizableStyle... aStyles) This method specifies the customizable styles to use for the current CGRS level/interval combination.This method specifies the customizable styles to use for the current CGRS level/interval combination.Configures this builder with a default CGRS grid style.Specifies the format pattern to use for the labels of the current CGRS level/interval combination.interval
(double aMin, double aMax) After calling this method, all subsequentstyles()
,customizableStyles()
, … calls will only apply to the given scale interval.label()
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels.label
(TLspCGRSGridStyle.CGRSLevel aCGRSLevel) After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given level, such as all 30 minute square labels.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 CGRS level/interval combination.styles
(Collection<ALspStyle> aStyles) This method specifies the styles to use for the current CGRS level/interval combination.
-
Method Details
-
defaultCGRSGridStyle
Configures this builder with a default CGRS grid style.- Returns:
- this builder.
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines. I.e. 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, seeTLspCGRSGridStyle
.- Returns:
- this builder
-
body
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid lines of the given level, such as all 30 minute square 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, seeTLspCGRSGridStyle
.- Parameters:
aCGRSLevel
- the CGRS level- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels. I.e. 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, seeTLspCGRSGridStyle
.- Returns:
- this builder
-
label
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will apply to all grid labels of the given level, such as all 30 minute square 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, seeTLspCGRSGridStyle
.- Parameters:
aCGRSLevel
- the CGRS level- Returns:
- this builder
-
overlay
After calling this method, all subsequentinterval()
,styles()
,customizableStyles()
, … calls will only apply to all overlay labels. See alsoTLspCGRSGridOverlayLabelBuilder
. When no subsequentinterval()
orstyles()
call is done, a default interval and default styles are chosen. For an example of how to use this method, seeTLspCGRSGridStyle
.- 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 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 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 (CGRS level/body or label) combination.- 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. TLspCGRSGridStyle.Builder builder = TLspCGRSGridStyle.newBuilder(); builder.label(CELLS_30_MINUTES).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. TLspCGRSGridStyle.Builder builder = TLspCGRSGridStyle.newBuilder(); builder.label(CELLS_30_MINUTES).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.
-
styles
This method specifies the styles to use for the current CGRS level/interval combination. Keep in mind that not all styles are supported (seeTLspCGRSGridStyle
for more information). 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 CGRS 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 CGRS level/interval combination. Keep in mind that not all styles are supported (seeTLspCGRSGridStyle
for more information). 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 CGRS level/interval combination. For more information, seecustomizableStyles(Collection)
.- Parameters:
aStyles
- the styles to use- Returns:
- this builder
-
format
Specifies the format pattern to use for the labels of the current CGRS level/interval combination. This method has no effect for bodies. If this method is not called, a default format is used. You can find more information about the EBNF notation and example format Strings in TLcdCGRSFormat. Depending on the label, only some parts of the format string will be used.- Parameters:
aCoordinatePattern
- the pattern used to format the label text- Returns:
- this builder.
-
all
Sets all parameters on the builder based on the given CGRS style. This is useful for example to create a new style that has almost all properties equal to another style.- Parameters:
aCGRSStyle
- the CGRS style to copy- Returns:
- this styler
-
build
Creates a newTLspCGRSGridStyle
from this builder.- Returns:
- a new
TLspCGRSGridStyle
-