Class ALspStyle
- All Implemented Interfaces:
ILspStyler
- Direct Known Subclasses:
ALspDensityStyle
,ALspLabelTextProviderStyle
,TLsp3DIconStyle
,TLsp3DMeshStyle
,TLspAPP6ASymbolStyle
,TLspColorLookupTableFilterStyle
,TLspComplexStrokedLineStyle
,TLspFillStyle
,TLspHypsometricShadingStyle
,TLspIconStyle
,TLspImageProcessingStyle
,TLspImageProjectionStyle
,TLspIndexColorModelStyle
,TLspLabelBoxStyle
,TLspLabelOpacityStyle
,TLspLineStyle
,TLspLOSCoverageStyle
,TLspMS2525bSymbolStyle
,TLspParameterizedFillStyle
,TLspParameterizedIconStyle
,TLspParameterizedLineStyle
,TLspParameterizedRasterIconStyle
,TLspPlotStyle
,TLspPointCloudStyle
,TLspRadarVideoStyle
,TLspRasterStyle
,TLspStrokedLineStyle
,TLspTextStyle
,TLspVerticalLineStyle
,TLspViewDisplacementStyle
,TLspWorldSizedLineStyle
ILspStyler
.
For convenience, this class also implements ILspStyler
by styling all
objects using itself. This makes it very easy to configure a layer or painter
with only one style. Do note that it will never fire style change events,
because styles are immutable.
Subclasses introducing state should override the equals
and
hashCode
methods, check their own state, and delegate to this
class.- Since:
- 2012.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ALspStyle.Builder<B extends ALspStyle.Builder<B>>
Builder for styles. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStyleChangeListener
(ILspStyleChangeListener aListener) Registers a style change listener with this styler.abstract ALspStyle.Builder
<?> Creates a new builder initialized with all the properties of this style.boolean
int
Returns the Z-order of this style.int
hashCode()
boolean
isCompatible
(TLspPaintPass aPaintPass) Utility method to determine whether the style is compatible with the given paint pass.abstract boolean
Determines whether this style is transparent.void
removeStyleChangeListener
(ILspStyleChangeListener aListener) Unregisters a style change listener from this styler.void
style
(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) Styles the objects or labels contained inaObjects
using the methods provided byALspStyleCollector
.
-
Constructor Details
-
ALspStyle
protected ALspStyle(int aZOrder) Constructs a style.- Parameters:
aZOrder
- defines the relative ordering of this style with respect to other styles in the same layer
-
-
Method Details
-
isTransparent
public abstract boolean isTransparent()Determines whether this style is transparent. Shapes that are transparent can be painted in a different paint phase than shapes that are not transparent.- Returns:
- whether or not this style is transparent
-
hashCode
public int hashCode() -
equals
-
addStyleChangeListener
Description copied from interface:ILspStyler
Registers a style change listener with this styler. Appropriate events will be passed to this listener whenever a style changes.- Specified by:
addStyleChangeListener
in interfaceILspStyler
- Parameters:
aListener
- the style change listener to add
-
removeStyleChangeListener
Description copied from interface:ILspStyler
Unregisters a style change listener from this styler.- Specified by:
removeStyleChangeListener
in interfaceILspStyler
- Parameters:
aListener
- the style change listener to remove
-
style
Description copied from interface:ILspStyler
Styles the objects or labels contained in
aObjects
using the methods provided byALspStyleCollector
.Example usages for object styling:
// Same style for all objects: aStyleCollector.objects(aObjects).style(myStyle).submit(); // Object specific styling: aStyleCollector.object(myObject1).style(myStyle1).submit(); aStyleCollector.object(myObject2).style(myStyle2).submit();
Example usages for label styling:
if (aStyleCollector instanceof ALspLabelStyleCollector) { ALspLabelStyleCollector labelStyleCollector = (ALspLabelStyleCollector)aStyleCollector; // Specify a priority for all labels of all objects: labelStyleCollector.objects(aDomainObjects).allLabels().priority(3).styles(...).submit(); // Specify an algorithm for a specific label: labelStyleCollector.object(myObject1).label(123).algorithm(...).styles(...).submit(); }
The objects that are provided to
aStyleCollector
must be objects that are contained inaObjects
. Note that not all objects have to be styled. Objects that are not submitted inaStyleCollector
will not be painted.This method can be called very frequently, depending on the (amount of) data. If this method is not implemented efficiently, painting performance may be affected.
- Specified by:
style
in interfaceILspStyler
- 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.
-
isCompatible
Utility method to determine whether the style is compatible with the given paint pass. A style and paint pass are compatible if they use or request the same terrain and transparency properties.- Parameters:
aPaintPass
- the paint pass- Returns:
true
if the style can be used in the given paint pass,false otherwise
.
-
getZOrder
public int getZOrder()Returns the Z-order of this style. Styles of the same type should be painted from lowest to highest Z-order. This means that styles with the highest Z-order will be painted on top.
For optimal results, use values between 0 and 100.
Increasing the number of different Z-orders can negatively impact painting performance. By default, it is set to 0.
- Returns:
- the Z-Order
-
asBuilder
Creates a new builder initialized with all the properties of this style.- Returns:
- the new builder.
-