Class ALspStyleCollector
java.lang.Object
com.luciad.view.lightspeed.style.styler.ALspStyleCollector
- Direct Known Subclasses:
ALspLabelStyleCollector
,ALspStyleCollectorWrapper
This class is used in combination with an
ILspStyler
to define the
style of a group of objects. It offers the implementer of ILspStyler
a variety of methods that can be used to define styling. Users that wish to
retrieve the style for a given object from an ILspStyler
need to
create a custom extension of this class specific to their needs.
The documentation of ILspStyler
provides more information for users
who wish to apply styling to objects.
- Since:
- 2012.0
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ALspStyleCollector
(Collection<? extends Object> aObjectsToStyle) Default constructor, the objects to be styled are provided, which allows the collector to do basic error checking. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
destroy()
Cleanup method for style collector.Specifies the geometry on which the style should be applied.geometry
(ALspStyleTargetProvider aStyleTargetProvider) Specifies anALspStyleTargetProvider
that should be used to convert objects into a collection of objects on which the style can be applied.protected Collection
<? extends Object> Returns the objects that have already been provided.Returns the styles that have been specified for the current set of objects.protected ALspStyleTargetProvider
Returns the style target provider that has been provided together with the current set of objects.hide()
Hides the specified objects.Specifies a singleObject
to be styled.objects
(Collection<? extends Object> aObjects) Specifies a collection of objects to be styled.Applies the given style to the specified objects.Applies the given list of styles to the specified objects.Applies the given list of styles to the specified objects.void
submit()
Submits the currently specified objects and styles.protected abstract void
This method is called by thesubmit()
method.
-
Constructor Details
-
ALspStyleCollector
Default constructor, the objects to be styled are provided, which allows the collector to do basic error checking.- Parameters:
aObjectsToStyle
- The collection of objects for which this style collector will be used. This has to be the collection of objects that is passed toILspStyler.style(Collection, ALspStyleCollector, TLspContext)
-
-
Method Details
-
destroy
protected void destroy()Cleanup method for style collector. Specific implementations are encouraged to call this method when styling is done. This allows to check whether the style collector was used correctly by theILspStyler
. -
getObjects
Returns the objects that have already been provided. Can be called from withinsubmitImpl()
. ThisCollection
is reset after each call tosubmit()
.- Returns:
- The collection of objects for which style has been specified.
-
getStyleTargetProvider
Returns the style target provider that has been provided together with the current set of objects. Can be called from within
submitImpl()
. This will be cleared after every call tosubmit()
.It is possible that this method returns
null
. In that case the domain object itself is used as the style target.Null by default.
- Returns:
- The current style target provider or null.
-
getStyles
Returns the styles that have been specified for the current set of objects. Can be called from withinsubmitImpl()
. ThisList
is reset after each call tosubmit()
.- Returns:
- A list of styles, can be empty if the given objects should not be visualized.
-
submitImpl
protected abstract void submitImpl()This method is called by thesubmit()
method. Implementers of this class should not overridesubmit()
directly, but should implement this method instead. The information that has been specified before callingsubmit()
, is provided through a number of protected getters of this class. After the call tosubmit()
, this information will be cleared.- See Also:
-
object
Specifies a singleObject
to be styled. Preferably, this method should only be used if the given object uses a unique style, that is different from the style of all other objects. Example usage:
myCollector.object(myILcdPoint).style(myIconStyle).submit()
The object must be an object that is part of the collection that has been passed as an argument inILspStyler.style(Collection, ALspStyleCollector, TLspContext)
. Specifying other objects after a call to this method will invalidate the result of this call.- Parameters:
aObject
- The object to style.- Returns:
- this style collector
-
objects
Specifies a collection of objects to be styled. This method can be used if multiple objects share the same style. Example usage:
myCollector.objects(Arrays.asList(myILcdPoint1,myILcdPoint2)).style(myIconStyle).submit()
The objects must all be contained in the collection that has been passed as an argument inILspStyler.style(Collection, ALspStyleCollector, TLspContext)
. Specifying other objects after a call to this method will invalidate the result of this call.- Parameters:
aObjects
- The objects to style.- Returns:
- this style collector
-
geometry
Specifies the geometry on which the style should be applied. Preferably, this method should only be used if the domain object uses a unique style, that is different from the style of all other objects. TheaGeometry
argument allows you to specify a particular geometry to which the styling should be applied, that is different from the object itself. Example usage:
myCollector.object(myObject).geometry(myObjectAsILcdPoint).style(myIconStyle).submit()
- Parameters:
aGeometry
- The geometry to which the styling should be applied- Returns:
- this style collector
-
geometry
Specifies anALspStyleTargetProvider
that should be used to convert objects into a collection of objects on which the style can be applied. This method can be used if multiple objects share the same style. TheALspStyleTargetProvider
can be used in a number of cases:- Styling of objects that do not implement a known interface
- Styling of particular parts of an object, such as a specific shape in an ILcdShapeList, or a point of a point list.
- Conversion of the geometry of the object into a geometry that is more appropriate to achieve the desired visualization.
myCollector.objects(Arrays.asList(myObject1,myObject2)).geometry(myObjectToPointConverter).style(myIconStyle).submit()
- Parameters:
aStyleTargetProvider
- The target provider.- Returns:
- this style collector
-
hide
Hides the specified objects. A call to this method has to be preceded by a call that specifies objects such asobject(Object)
orobjects(Collection)
. Example usage:
myCollector.object(myObject).hide().submit()
- Returns:
- This style collector
-
style
Applies the given style to the specified objects. A call to this method has to be preceded by a call that specifies objects such asobject(Object)
orobjects(Collection)
. Example usage:
myCollector.object(myILcdPoint).style(myIconStyle).submit()
Specifying other styles after a call to this method will invalidate the result of this call.- Parameters:
aStyle
- The style to apply.- Returns:
- This style collector.
-
styles
Applies the given list of styles to the specified objects. A call to this method has to be preceded by a call that specifies objects such asobject(Object)
orobjects(Collection)
. Example usage:
myCollector.object(myILcdPoint).styles(Arrays.asList(myIconStyle,myVerticalLineStyle)).submit()
Specifying other styles after a call to this method will invalidate the result of this call.- Parameters:
aStyles
- The styles to apply. This list should not be modified after using it as an argument in this method.- Returns:
- This style collector.
-
styles
Applies the given list of styles to the specified objects. A call to this method has to be preceded by a call that specifies objects such asobject(Object)
orobjects(Collection)
. Example usage:
myCollector.object(myILcdPoint).styles(myIconStyle,myVerticalLineStyle).submit()
Specifying other styles after a call to this method will invalidate the result of this call.- Parameters:
aStyles
- The style to apply.- Returns:
- This style collector.
-
submit
public void submit()Submits the currently specified objects and styles. A call to this method has to be preceded by a call that specifies styles such asstyle(ALspStyle)
orhide()
. This mandatory method submits a part of the styling before specifying new objects and styles. Example usage:
myCollector.object(myILcdPoint1).style(myIconStyle1).submit();
When this method is called multiple times for the same objects, all specified styles from the different calls will be applied. Example to apply a line style to all objects and an additional fill style to one specific object:
myCollector.object(myILcdPoint2).style(myIconStyle2).submit();
myCollector.objects(myObjects).style(myLineStyle).submit();
Not calling this method will result in no styles being specified at all. Calling any other method after already having provided objects and/or styles will result in invalidating those previous calls.
myCollector.object(myFirstObject).style(myFillStyle).submit();
-