Interface ILspStyler
- All Known Subinterfaces:
ILspCustomizableStyler
- All Known Implementing Classes:
ALspCustomizableStyler
,ALspDensityStyle
,ALspLabelStyler
,ALspLabelTextProviderStyle
,ALspSoftDensityStyle
,ALspStyle
,ALspStyler
,ALspSwingLabelStyler
,ALspToggleStyler
,TLsp3DIconStyle
,TLsp3DMeshStyle
,TLspAISStyler
,TLspAIXMStyler
,TLspAPP6ASymbolStyle
,TLspAPP6ASymbolStyler
,TLspCGMStyler
,TLspColorLookupTableFilterStyle
,TLspComplexStrokedLineStyle
,TLspCustomizableStyler
,TLspDataObjectLabelTextProviderStyle
,TLspDensityFillStyle
,TLspDensityLineStyle
,TLspDensityPointStyle
,TLspDrapingToggleStyler
,TLspEditableStyler
,TLspEditHandleStyler
,TLspFillStyle
,TLspHypsometricShadingStyle
,TLspIconStyle
,TLspImageProcessingStyle
,TLspImageProjectionStyle
,TLspIndexColorModelStyle
,TLspLabelBoxStyle
,TLspLabelOpacityStyle
,TLspLabelStyler
,TLspLineStyle
,TLspLonLatGridStyler
,TLspLOSCoverageStyle
,TLspMIFStyler
,TLspMS2525bSymbolStyle
,TLspMS2525bSymbolStyler
,TLspNVGStyler
,TLspParameterizedFillStyle
,TLspParameterizedIconStyle
,TLspParameterizedLineStyle
,TLspParameterizedRasterIconStyle
,TLspPinLineStyle
,TLspPlotStyle
,TLspPlotStyle
,TLspPointCloudStyle
,TLspPOLStyler
,TLspRadarVideoStyle
,TLspRasterStyle
,TLspRegularOrExtrudedStyler
,TLspRulerDistanceFormatStyle
,TLspRulerLabelStyler
,TLspRulerSegmentLabelContentStyle
,TLspScaleBasedStyler
,TLspSLDStyler
,TLspSnapperStyler
,TLspStrokedLineStyle
,TLspStyler
,TLspTextStyle
,TLspVerticalLineStyle
,TLspViewDisplacementStyle
,TLspVPFGeoSymLabelStyler
,TLspVPFGeoSymStyler
,TLspWorldSizedLineStyle
This interface can specify styling information for objects or labels that are being visualized. To avoid the overhead of having to perform this query for each object and for each repaint, this interface also defines a listener mechanism through which painters can ask to be notified when changes to the style occur.
Note that it is mandatory for a styler implementation to correctly fire style change events. Otherwise, the view might not be updated correctly. For instance, if the style depends on a view dependent property, such as the scale, the styler is responsible for firing a style changed event whenever the view scale changes, (or changes in a way that may affect styling).
When labels are styled, an ALspLabelStyleCollector
is passed in the
style
method. In that case it is possible (but not mandatory) to cast the style collector to
ALspLabelStyleCollector
which allows to specify extra labeling information:
- Labeling algorithm or
direct locations
- Declutter group
- Priority
- Relative labels
- Alternate anchor geometry
TLspLabelStyler
or
ALspLabelStyler
convenience classes
can be used to style labels.
Implementors of this class should ensure thread safety, as any of its methods can be called from any thread.
This interface does not provide direct access to the styles that are used, nor does
it allow changing those styles. To support this, ILspCustomizableStyler
can be used.
- Since:
- 2012.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStyleChangeListener
(ILspStyleChangeListener aListener) Registers a style change listener with this styler.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
.
-
Method Details
-
style
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.
- 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.
-
addStyleChangeListener
Registers a style change listener with this styler. Appropriate events will be passed to this listener whenever a style changes.- Parameters:
aListener
- the style change listener to add
-
removeStyleChangeListener
Unregisters a style change listener from this styler.- Parameters:
aListener
- the style change listener to remove
-