public class TLspLonLatGridStyler extends ALspLabelStyler implements ILspCustomizableStyler
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:
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:
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. }
Modifier and Type | Class and Description |
---|---|
static class |
TLspLonLatGridStyler.LabelPosition
Defines the position of the labels with respect to the view.
|
static class |
TLspLonLatGridStyler.Orientation
Defines how the labels should be oriented.
|
static class |
TLspLonLatGridStyler.Position
Defines where the labels should be positioned with respect to the line.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT |
static String |
MERIDIAN |
static String |
PARALLEL |
Constructor and Description |
---|
TLspLonLatGridStyler()
Create 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.
|
Modifier and Type | Method and Description |
---|---|
Collection<TLspCustomizableStyle> |
getStyles()
Returns 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 |
setLabelLinePosition(TLspLonLatGridStyler.Position aPosition)
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,
ALspStyle... aStyles)
Override styles for a certain category.
|
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,
TLspCustomizableStyle... aStyles)
Override styles for a certain category using customizable styles.
|
void |
style(Collection<?> aObjects,
ALspLabelStyleCollector aStyleCollector,
TLspContext aContext)
Convenience method that takes an
ALspLabelStyleCollector as argument instead of
an ALspStyleCollector . |
void |
style(Collection<?> aObjects,
ALspStyleCollector aStyleCollector,
TLspContext aContext)
Implementation of
ILspStyler.style that either casts the ALspStyleCollector
to ALspLabelStyleCollector if possible, or adapts it otherwise. |
addStyleChangeListener, fireStyleChangeEvent, fireStyleChangeEvent, removeStyleChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStyleChangeListener, removeStyleChangeListener
public static final String DEFAULT
public static final String PARALLEL
public static final String MERIDIAN
public TLspLonLatGridStyler()
public TLspLonLatGridStyler(TLspLineStyle aLineStyle)
This styler can be used for body representations.
aLineStyle
- The default line style.public TLspLonLatGridStyler(TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter)
This styler can be used for label representations.
aTextStyle
- The default text style.aLabelBoxStyle
- The label style.aOpacityStyle
- The opacity style.aFormatter
- The default coordinate formatter.public TLspLonLatGridStyler(TLspLineStyle aLineStyle, TLspTextStyle aTextStyle, TLspLabelBoxStyle aLabelBoxStyle, TLspLabelOpacityStyle aOpacityStyle, ILcdLonLatFormatter aFormatter)
This styler can be used for label or body representations.
aLineStyle
- The default line style.aTextStyle
- The default text style.aLabelBoxStyle
- The label style.aOpacityStyle
- The opacity style.aFormatter
- The default coordinate formatter.public Collection<TLspCustomizableStyle> getStyles()
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:
ALspStyle
in the TLspCustomizableStyle
may be replacedidentifier
of the
TLspCustomizableStyle
to recognize and order the styles.getStyles
in interface ILspCustomizableStyler
style
methodpublic void setStyles(ILspLonLatGridLine.Category aCategory, double aDegrees, ALspStyle... aStyles)
When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
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.setStyles(ILspLonLatGridLine.Category, ALspStyle...)
,
setDefaultStyles(ALspStyle...)
public void setStyles(ILspLonLatGridLine.Category aCategory, double aDegrees, TLspCustomizableStyle... aStyles)
When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
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.setStyles(ILspLonLatGridLine.Category, TLspCustomizableStyle...)
,
setDefaultStyles(TLspCustomizableStyle...)
public void setStyles(ILspLonLatGridLine.Category aCategory, ALspStyle... aStyles)
When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
aCategory
- The category to set the line style for.aStyles
- a set of styles.setStyles(ILspLonLatGridLine.Category, double, ALspStyle...)
,
setDefaultStyles(ALspStyle...)
public void setStyles(ILspLonLatGridLine.Category aCategory, TLspCustomizableStyle... aStyles)
When this styler has a style for both a grid line and its Category, the style for the grid line has precedence.
aCategory
- The category to set the line style for.aStyles
- a set of customizable styles.setStyles(ILspLonLatGridLine.Category, double, TLspCustomizableStyle...)
,
setDefaultStyles(TLspCustomizableStyle...)
public void setDefaultStyles(ALspStyle... aStyles)
aStyles
- a set of styles.setStyles(ILspLonLatGridLine.Category, double, ALspStyle...)
,
setStyles(ILspLonLatGridLine.Category, ALspStyle...)
public void setDefaultStyles(TLspCustomizableStyle... aStyles)
aStyles
- a set of customizable styles.setStyles(ILspLonLatGridLine.Category, double, TLspCustomizableStyle...)
,
setStyles(ILspLonLatGridLine.Category, TLspCustomizableStyle...)
public void setCoordinateFormatter(int aDecimals, ILcdLonLatFormatter aFormatter)
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 with formatter1
, while a grid line
at 13.25 would be formatted with formatter2
.
aDecimals
- The decimals to use this formatter for.aFormatter
- The formatter.public void setPosition(TLspLonLatGridStyler.Position aPosition, int aGridOffset)
setLabelLinePosition(Position)
, setLabelLineOffset
or setLabelEdgeOffsets
.Set the position of the labels with respect to the line.
The default value is "ABOVE"
and 4
.
aPosition
- The desired position.aGridOffset
- The offset in pixels from the line.public void setLabelLinePosition(TLspLonLatGridStyler.Position aPosition)
Sets the position of the labels with respect to the grid line.
The default value is "ABOVE"
.
aPosition
- the position of the label with respect to the linepublic 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
.
aLineOffset
- the label line offset with respect to the grid line.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
.
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 viewpublic void setOrientation(TLspLonLatGridStyler.Orientation aOrientation)
Sets the orientation of the labels.
The default value is "ALONG_LINE"
.
aOrientation
- the desired orientation.public void setLabelPosition(TLspLonLatGridStyler.LabelPosition aLabelPosition)
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"
.
aLabelPosition
- the position of the labels with respect to the view.public void style(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext)
ALspLabelStyler
Implementation of ILspStyler.style
that either casts the ALspStyleCollector
to ALspLabelStyleCollector
if possible, or adapts it otherwise. In the latter case, the labeling-specific
calls (label
, anchorLabel
,
algorithm
, ...) are ignored. The ALspLabelStyleCollector
is then
passed to the style(Collection,ALspLabelStyleCollector,TLspContext)
method.
style
in interface ILspStyler
style
in class ALspLabelStyler
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.public void style(Collection<?> aObjects, ALspLabelStyleCollector aStyleCollector, TLspContext aContext)
ALspLabelStyler
Convenience method that takes an ALspLabelStyleCollector
as argument instead of
an ALspStyleCollector
. This method is called from
ALspLabelStyler.style(Collection, ALspStyleCollector, TLspContext)
.
style
in class ALspLabelStyler
aObjects
- The set of domain objects to provide information foraStyleCollector
- The label style collector to submit the information to.aContext
- The contextALspLabelStyleCollector
,
ILspStyler