Class TLspLonLatGridStyler
- All Implemented Interfaces:
ILspCustomizableStyler
,ILspStyler
Convenience styler that can be used to style lon-lat grids. This styler can be used both for the grid labels and lines.
It can separately style meridians and parallels, and it can separately style specific meridians and parallels. Both the line styles and text styles can be specified: see setStyles(com.luciad.view.lightspeed.painter.grid.ILspLonLatGridLine.Category, double, com.luciad.view.lightspeed.style.ALspStyle...).
The possible styles are:
- TLspLineStyle: to specify line width, color etc.
- TLspTextStyle: to specify font, font color, size, halo etc.
- TLspLabelBoxStyle: to specify fill color, frames and transparency of the label
The most specific style for a grid line will be used, e.g. the style for a ILspLonLatGridLine
will have precedence on a style for a Category
. When
no style can be found, a default style is used.
The format of the coordinates can be specified using setCoordinateFormatter(int, ILcdLonLatFormatter).
The positions of the labels relative to the grid line can be specified using
setPosition
.
Note: this styler is a ILspCustomizableStyler, so you can adapt its styles in a generic way using the following style identifiers:
- DEFAULT: fallback if no more specific styles are present
- PARALLEL: default styles for parallel lines
- MERIDIAN: default styles for meridian lines
for ( TLspCustomizableStyle customizableStyle : lonLatGridStyler.getStyles() ) { if ( customizableStyle.getIdentifier().equals( "PARALLEL" ) ) { customizableStyle.setStyle( TLspLineStyle.newBuilder() .color( Color.BLACK ) .width( 2.0F ) .build() ); } // Rest of code omitted. }
- Since:
- 2012.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Defines the position of the labels with respect to the view.static enum
Defines how the labels should be oriented.static enum
Defines where the labels should be positioned with respect to the line. -
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a styler with some default styling.TLspLonLatGridStyler
(TLspLineStyle aLineStyle) Create a styler with a default line style, text style and coordinate formatter.TLspLonLatGridStyler
(TLspLineStyle aLineStyle, TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter) Create a styler with a default line style, text style and coordinate formatter.TLspLonLatGridStyler
(TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter) Create a styler with a default text style and coordinate formatter. -
Method Summary
Modifier and TypeMethodDescriptionReturns the styler's customizable styles.void
setCoordinateFormatter
(int aDecimals, ILcdLonLatFormatter aFormatter) Set the coordinate formatter for the given amount of decimals.void
setDefaultStyles
(ALspStyle... aStyles) Override styles for the default category.void
setDefaultStyles
(TLspCustomizableStyle... aStyles) Override styles for the default category using customizable styles.void
setLabelEdgeOffsets
(double aEdgeOffsetLeft, double aEdgeOffsetRight, double aEdgeOffsetBottom, double aEdgeOffsetTop) Sets the offset of the label with repsect to the view edges.void
setLabelLineOffset
(double aLineOffset) Sets the offset of the label with respect to its line.void
Sets the position of the labels with respect to the grid line.void
setLabelPosition
(TLspLonLatGridStyler.LabelPosition aLabelPosition) Sets the position of the labels with respect to the view.void
setOrientation
(TLspLonLatGridStyler.Orientation aOrientation) Sets the orientation of the labels.void
setPosition
(TLspLonLatGridStyler.Position aPosition, int aGridOffset) Deprecated.void
setStyles
(ILspLonLatGridLine.Category aCategory, double aDegrees, ALspStyle... aStyles) Override styles for the given grid line.void
setStyles
(ILspLonLatGridLine.Category aCategory, double aDegrees, TLspCustomizableStyle... aStyles) Override styles for the given grid line using customizable styles.void
setStyles
(ILspLonLatGridLine.Category aCategory, ALspStyle... aStyles) Override styles for a certain category.void
setStyles
(ILspLonLatGridLine.Category aCategory, TLspCustomizableStyle... aStyles) Override styles for a certain category using customizable styles.void
style
(Collection<?> aObjects, ALspLabelStyleCollector aStyleCollector, TLspContext aContext) Convenience method that takes anALspLabelStyleCollector
as argument instead of anALspStyleCollector
.void
style
(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) Implementation ofILspStyler.style
that either casts theALspStyleCollector
toALspLabelStyleCollector
if possible, or adapts it otherwise.Methods inherited from class com.luciad.view.lightspeed.style.styler.ALspStyler
addStyleChangeListener, fireStyleChangeEvent, fireStyleChangeEvent, removeStyleChangeListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.lightspeed.style.styler.ILspStyler
addStyleChangeListener, removeStyleChangeListener
-
Field Details
-
DEFAULT
- See Also:
-
PARALLEL
-
MERIDIAN
-
-
Constructor Details
-
TLspLonLatGridStyler
public TLspLonLatGridStyler()Create a styler with some default styling. -
TLspLonLatGridStyler
Create a styler with a default line style, text style and coordinate formatter.This styler can be used for body representations.
- Parameters:
aLineStyle
- The default line style.
-
TLspLonLatGridStyler
public TLspLonLatGridStyler(TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter) Create a styler with a default text style and coordinate formatter.This styler can be used for label representations.
- Parameters:
aTextStyle
- The default text style.aLabelBoxStyle
- The label style.aOpacityStyle
- The opacity style.aFormatter
- The default coordinate formatter.
-
TLspLonLatGridStyler
public TLspLonLatGridStyler(TLspLineStyle aLineStyle, TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter) Create a styler with a default line style, text style and coordinate formatter.This styler can be used for label or body representations.
- Parameters:
aLineStyle
- The default line style.aTextStyle
- The default text style.aLabelBoxStyle
- The label style.aOpacityStyle
- The opacity style.aFormatter
- The default coordinate formatter.
-
-
Method Details
-
getStyles
Description copied from interface:ILspCustomizableStyler
Returns the styler's customizable styles. When modifications are made to the styles, the styler will automatically inform its listeners about the change. The following changes can be made:
- Styles can be enabled or disabled. Only the enabled styles will be set in the style method.
- The
ALspStyle
in theTLspCustomizableStyle
may be replaced
identifier
of theTLspCustomizableStyle
to recognize and order the styles.- Specified by:
getStyles
in interfaceILspCustomizableStyler
- Returns:
- An immutable collection containing all styles which will be set in the
style
method
-
setStyles
Override styles for the given grid line.When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
- Parameters:
aCategory
- The category to set the line style for.aDegrees
- The specific degrees of the line to set the styles for.aStyles
- a set of styles.- See Also:
-
setStyles
public void setStyles(ILspLonLatGridLine.Category aCategory, double aDegrees, TLspCustomizableStyle... aStyles) Override styles for the given grid line using customizable styles.When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
- Parameters:
aCategory
- The category to set the line style for.aDegrees
- The specific degrees of the line to set the styles for.aStyles
- a set of customizable styles.- See Also:
-
setStyles
Override styles for a certain category.When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
- Parameters:
aCategory
- The category to set the line style for.aStyles
- a set of styles.- See Also:
-
setStyles
Override styles for a certain category using customizable styles.When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
- Parameters:
aCategory
- The category to set the line style for.aStyles
- a set of customizable styles.- See Also:
-
setDefaultStyles
Override styles for the default category.- Parameters:
aStyles
- a set of styles.- See Also:
-
setDefaultStyles
Override styles for the default category using customizable styles.- Parameters:
aStyles
- a set of customizable styles.- See Also:
-
setCoordinateFormatter
Set the coordinate formatter for the given amount of decimals.The formatter will be used to format the degrees for lines correspond to the amount of decimals. For example, after settings:
setCoordinateFormatter(1, formatter1);
setCoordinateFormatter(2, formatter2);
a grid line at 13.5 degrees would be formatted withformatter1
, while a grid line at 13.25 would be formatted withformatter2
.- Parameters:
aDecimals
- The decimals to use this formatter for.aFormatter
- The formatter.
-
setPosition
Deprecated.Set the position of the labels with respect to the line.
The default value is
"ABOVE"
and4
.- Parameters:
aPosition
- The desired position.aGridOffset
- The offset in pixels from the line.
-
setLabelLinePosition
Sets the position of the labels with respect to the grid line.
The default value is
"ABOVE"
.- Parameters:
aPosition
- the position of the label with respect to the line- Since:
- 2018.0
-
setLabelLineOffset
public void setLabelLineOffset(double aLineOffset) Sets the offset of the label with respect to its line. Note: changing this value has no effect when using
TLspLonLatGridStyler.Position.CENTER
.The default value is
2
.- Parameters:
aLineOffset
- the label line offset with respect to the grid line.- Since:
- 2018.0
-
setLabelEdgeOffsets
public void setLabelEdgeOffsets(double aEdgeOffsetLeft, double aEdgeOffsetRight, double aEdgeOffsetBottom, double aEdgeOffsetTop) Sets the offset of the label with repsect to the view edges.
The default value for each edge is
4
.- Parameters:
aEdgeOffsetLeft
- the offset of the labels from the left edge of the viewaEdgeOffsetRight
- the offset of the labels from the right edge of the viewaEdgeOffsetBottom
- the offset of the labels from the bottom edge of the viewaEdgeOffsetTop
- the offset of the labels from the top edge of the view- Since:
- 2018.0
-
setOrientation
Sets the orientation of the labels.
The default value is
"ALONG_LINE"
.- Parameters:
aOrientation
- the desired orientation.
-
setLabelPosition
Sets the position of the labels with respect to the view. They can for example be placed at the left or at the right edge of the view, or both. Note that this should more be considered as a hint. For example, when the view is rotated 180 degrees, the labels may end up at the opposite edges.
The default value is
"WEST_AND_SOUTH"
.- Parameters:
aLabelPosition
- the position of the labels with respect to the view.
-
style
Description copied from class:ALspLabelStyler
Implementation of
ILspStyler.style
that either casts theALspStyleCollector
toALspLabelStyleCollector
if possible, or adapts it otherwise. In the latter case, the labeling-specific calls (label
,anchorLabel
,algorithm
, ...) are ignored. TheALspLabelStyleCollector
is then passed to thestyle(Collection,ALspLabelStyleCollector,TLspContext)
method.- Specified by:
style
in interfaceILspStyler
- Overrides:
style
in classALspLabelStyler
- Parameters:
aObjects
- The objects to be styled.aStyleCollector
- A style collector to which all styling information should be passed, this collector is only valid within this method call, and can no longer be used afterwards.aContext
- Provides context information that may affect styling, such as view specific properties.
-
style
public void style(Collection<?> aObjects, ALspLabelStyleCollector aStyleCollector, TLspContext aContext) Description copied from class:ALspLabelStyler
Convenience method that takes an
ALspLabelStyleCollector
as argument instead of anALspStyleCollector
. This method is called fromALspLabelStyler.style(Collection, ALspStyleCollector, TLspContext)
.- Specified by:
style
in classALspLabelStyler
- Parameters:
aObjects
- The set of domain objects to provide information foraStyleCollector
- The label style collector to submit the information to.aContext
- The context- See Also:
-
setLabelLinePosition(Position)
,setLabelLineOffset
orsetLabelEdgeOffsets
.