public class TLspShapePainter extends Object implements ILspEditableStyledPainter
ILspShapeDiscretizeris used to create a discretized representation of the shape's geometry. By default,
TLspShapeDiscretizeris used. By consequence, this painter supports all shapes supported by this discretizer. Adding support for additional shape types will usually be done by extending the shape discretizer, and calling
setShapeDiscretizer. The geometry that is painted for a given style is retrieved using the corresponding
ALspStyleTargetProvider. If a style target provider is not available, the object will be passed to the shape discretizer directly, which supports most
ILcdShapeimplementations by default. Geo-referenced meshes are not passed to the discretizer, as the meshes are assumed to be discretized. Styling of the painted shapes and meshes is performed through the set
ILspStyler. Separate stylers can be configured depending on the
TLspPaintState. This allows different styles for, regular, selected, or edited objects. Note that you should avoid using this painter directly, have a look at
TLspShapeLayerBuilderinstead. In all cases, the painting is conditional based on the presence of an appropriate style in the output of the
ILspStyler. The following styles are supported:
TLspFillStyle: can be applied to closed shapes such as circles or polygons
TLspLineStyle: can be applied to closed and non-closed shapes such as arcs and polylines
TLspLineStyle: can be applied to polylines
TLspComplexStrokedLineStyle: can be applied to closed and non-closed shapes such as arcs and polylines
TLspWorldSizedLineStyle: can be applied to closed and non-closed shapes such as arcs and polylines
TLspIconStyle: can be applied to point shapes and point lists
TLspIconStyle: can be applied to point shapes and point lists
TLsp3DIconStyle: can be applied to point shapes and point lists
TLspVerticalLineStyle: can be applied to point shapes and point lists
TLsp3DMeshStyle: can be applied to geo-referenced meshes
TLsp3DMeshStyle. You can for instance specify two icon styles for a point, in which case both icons will be shown on top of each other.
This painter can also be used to visualize density plots.
This is done by letting the styler submit
The colors used for the density plot can be controlled by also passing a
TLspIndexColorModelStylecan be used for the whole density plot. Submitting multiple ones in the styler will have no effect. Note that the same
TLspIndexColorModelStylemust be submitted for each object.
ALspDensityStyleinstances with regular styles is not supported and will throw exceptions. When painting density plots, the styler should only submit
ALspDensityStyleinstances and optionally a single
|Constructor and Description|
Constructs a shape painter that will be initialized with default styling that allows basic visualization of most geometries supported by this painter.
Creates a new shape painter using the given styler for default styles.
|Modifier and Type||Method and Description|
Called when the changes for a specified event should be committed.
Returns the current set of performance/quality hints used by the painter.
Returns the minimum required OpenGL profile that a view must support in order to be compatible with this painter.
Gets the shape discretizer.
Returns the styler used by this painter for the given
Paints the specified groups of objects into a view.
Called when the paint groups will change.
Retrieves a set of domain objects and data based on the parameters given by the query.
Registers a layer with this painter.
Sets the performance/quality hints to be used by the painter.
Sets the shape discretizer.
Sets the styler used by this object for the given
Unregisters a layer from this painter.
public TLspShapePainter(ILspStyler aDefaultStyler)
aDefaultStyler- The styler that will be used for
ILspCustomizableStyleris used, so the default styles can be enabled/disabled or replaced.
public ILspStyler getStyler(TLspPaintState aPaintState)
PaintState. Can return null in case the painter does not use or expose a styler.
aPaintState- the paint state for which a styler is requested
public void registerLayer(ILspInteractivePaintableLayer aLayer, TLspPaintRepresentation aPaintRepresentation)
aLayer- A layer with which this painter will be used.
aPaintRepresentation- The paint representation for which this painter will be used.
public void unregisterLayer(ILspInteractivePaintableLayer aLayer, TLspPaintRepresentation aPaintRepresentation)
aLayer- A layer that needs to be unregistered
aPaintRepresentation- The paint representation for which this painter was used with aLayer
public void setStyler(TLspPaintState aPaintState, ILspStyler aStyler)
aPaintState- the paint state for which to set a styler
aStyler- the new styler for the painter
public void addPropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListenerto the list of listeners that must be notified when any of the properties of this
aListener- the listener that from now on will be notified of all changes to properties of this painter
public void removePropertyChangeListener(PropertyChangeListener aListener)
PropertyChangeListenerfrom the list of listeners. This listener will no longer be notified of any changes to the properties of this
aListener- the listener that no longer will be notified of any changes to properties of this painter
public TLspPaintProgress paintObjects(ILcdGLDrawable aGLDrawable, List<TLspPaintGroup> aPaintGroups, TLspPaintPass aPass, TLspContext aContext)
Paints the specified groups of objects into a view. The objects are partitioned into
TLspPaintGroups, which are created by the layer which invoked this painter.
Painters are advised to also implement
which allows them to keep track of changes to the supplied list of paint groups. This
way, the painter can exploit temporal coherence and perform its work in the most optimal
This method returns a
TLspPaintProgress which describes the completeness of the
paint operation. If the painter scheduled one or more tasks to be executed asynchronously,
it may return from its
paintObjects() method before having rendered all the objects
it was given. In this case, the returned progress object can describe the amount of work that
has been done and the work that is still remaining.
ILcdGLDrawablein which the objects are to be painted
aPaintGroups- the objects to be painted
aPass- the current paint pass
aContext- provides context information to the painter
TLspPaintProgressobject describing the completeness of the paint operation
public ILspShapeDiscretizer getShapeDiscretizer()
public void setShapeDiscretizer(ILspShapeDiscretizer aShapeDiscretizer)
aShapeDiscretizershould express the discretized positions int world coordinates.
aShapeDiscretizer- the shape discretizer
ILspShapeDiscretizer.discretizeSFCT(Object, com.luciad.view.lightspeed.geometry.discretization.TLspShapeDiscretizationParameters, com.luciad.view.lightspeed.TLspContext, com.luciad.view.lightspeed.geometry.discretization.ALspEditable3DMesh)
public TLspOpenGLProfile getRequiredOpenGLProfile()
public void prepareChanges(List<TLspPaintGroupsChangedEvent> aEvents, Object aEventId, ILspPaintGroupsChangeListener.Callback aCallback)
ILspPaintGroupsChangeListener.Callback.changesReady(java.lang.Object)method must be invoked when the listener is ready to commit the changes. If
nullthen the changes may be committed immediately. In this case there will be no call to
Note that it is not mandatory to do this two-phased commit cycle. You may commit or apply the changes immediately, but you still must invoke the callback.
aEvents- the changes
aEventId- the event id or
aCallback- the callback or
public void commitChanges(Object aEventId)
aEventId- the event id
public <T> boolean query(List<TLspPaintGroup> aPaintGroups, ALspPaintQuery<T> aQuery, TLspPaintRepresentationState aPaintRepresentationState, TLspContext aContext)
aPaintGroups- the paint groups
aQuery- the query
aPaintRepresentationState- the paint representation state for which the query should be performed
aContext- the context
trueif the query completed,
falseif it was aborted.
public void setHints(TLspShapePaintingHints aHints)
aHints- the shape painting hints
public TLspShapePaintingHints getHints()