Class ALspToggleStyler
java.lang.Object
com.luciad.view.lightspeed.style.styler.ALspStyler
com.luciad.view.lightspeed.style.styler.ALspToggleStyler
- All Implemented Interfaces:
ILspStyler
- Direct Known Subclasses:
TLspDrapingToggleStyler,TLspRegularOrExtrudedStyler
Styler wrapper that delegates to one of two stylers.
The first styler is denoted the 'regular' one, the second the
'special' one.
Both stylers are provided in the constructor, the implementor should provide
an implementation of the
isUseSpecialStyler(Object, TLspContext) method
that returns true or false based on the given object. This will allow the implementation
to delegate to the appropriate styler.- Since:
- 2012.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedALspToggleStyler(ILspStyler aRegularStyler, ILspStyler aSpecialStyler) Creates anALspToggleStyler -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStyleChangeListener(ILspStyleChangeListener aListener) Registers a style change listener with this styler.Returns the 'regular' styler instance which was passed in the constructorReturns the 'special' styler instance which was passed in the constructorprotected abstract booleanisUseSpecialStyler(Object aObject, TLspContext aContext) Determines whether the special styler should be used.voidremoveStyleChangeListener(ILspStyleChangeListener aListener) Unregisters a style change listener from this styler.voidstyle(Collection<?> aObjects, ALspStyleCollector aStyleCollector, TLspContext aContext) Styles the objects or labels contained inaObjectsusing the methods provided byALspStyleCollector.Methods inherited from class com.luciad.view.lightspeed.style.styler.ALspStyler
fireStyleChangeEvent, fireStyleChangeEvent
-
Constructor Details
-
ALspToggleStyler
Creates anALspToggleStyler- Parameters:
aRegularStyler- The styler that will be used ifisUseSpecialStyler(Object, TLspContext)returns false.aSpecialStyler- The styler that will be used ifisUseSpecialStyler(Object, TLspContext)returns true.
-
-
Method Details
-
addStyleChangeListener
Description copied from interface:ILspStylerRegisters a style change listener with this styler. Appropriate events will be passed to this listener whenever a style changes.- Specified by:
addStyleChangeListenerin interfaceILspStyler- Overrides:
addStyleChangeListenerin classALspStyler- Parameters:
aListener- the style change listener to add
-
removeStyleChangeListener
Description copied from interface:ILspStylerUnregisters a style change listener from this styler.- Specified by:
removeStyleChangeListenerin interfaceILspStyler- Overrides:
removeStyleChangeListenerin classALspStyler- Parameters:
aListener- the style change listener to remove
-
style
Description copied from interface:ILspStylerStyles the objects or labels contained in
aObjectsusing 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
aStyleCollectormust be objects that are contained inaObjects. Note that not all objects have to be styled. Objects that are not submitted inaStyleCollectorwill 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.
-
isUseSpecialStyler
Determines whether the special styler should be used.- Parameters:
aObject- the objectaContext- provides context information- Returns:
- whether or not the special styler should be used
-
getSpecialStyler
Returns the 'special' styler instance which was passed in the constructor- Returns:
- the 'special' styler instance which was passed in the constructor
-
getRegularStyler
Returns the 'regular' styler instance which was passed in the constructor- Returns:
- the 'regular' styler instance which was passed in the constructor
-