Interface ILspLabelPainter
- All Superinterfaces:
ILspPainter
,ILspPaintGroupsChangeListener
- All Known Subinterfaces:
ILspPathLocationLabelPainter
,ILspStampLocationLabelPainter
- All Known Implementing Classes:
TLspLabelPainter
This
ILspPainter
paints and locates a label for an object in a
view. Labels can be any visual
item that is drawn in view space rather than world space. The labelAnchorPointSFCT
and labelBoundsSFCT
methods give an indication of where
the visual representation of an object will be painted. These methods
return information in view coordinates.- Since:
- 2012.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.view.lightspeed.layer.paintgroup.ILspPaintGroupsChangeListener
ILspPaintGroupsChangeListener.Callback
-
Method Summary
Modifier and TypeMethodDescriptiongetAnchorObject
(TLspLabelID aLabel, TLspPaintState aPaintState, TLspContext aContext) Returns the anchor object of the given label.getLabelIDs
(Object aObject, TLspPaintRepresentationState aPaintRepresentationState, TLspContext aContext) Enumerates all the desired labels associated with a domain object.void
labelAnchorPointSFCT
(TLspLabelID aLabel, ALspLabelLocation aLabelLocation, ALspLabelLocations aLabelLocations, TLspPaintState aPaintState, TLspContext aContext, ILcd3DEditablePoint aAnchorPointSFCT) Retrieves the anchor point of the given label.double
labelBoundsSFCT
(TLspLabelID aLabel, ALspLabelLocation aLabelLocation, ALspLabelLocations aLocations, TLspPaintState aPaintState, TLspContext aContext, ILcd3DEditableBounds aBoundsSFCT) Calculates the bounds of the given label for the given label location.Methods inherited from interface com.luciad.view.lightspeed.painter.ILspPainter
addPropertyChangeListener, getRequiredOpenGLProfile, getStyler, paintObjects, query, registerLayer, removePropertyChangeListener, unregisterLayer
Methods inherited from interface com.luciad.view.lightspeed.layer.paintgroup.ILspPaintGroupsChangeListener
commitChanges, prepareChanges
-
Method Details
-
getLabelIDs
Iterable<TLspLabelID> getLabelIDs(Object aObject, TLspPaintRepresentationState aPaintRepresentationState, TLspContext aContext) Enumerates all the desired labels associated with a domain object.- Parameters:
aObject
- the domain objectaPaintRepresentationState
- the paint representationaContext
- the context- Returns:
- the label identifiers associated with the given domain object.
-
labelBoundsSFCT
double labelBoundsSFCT(TLspLabelID aLabel, ALspLabelLocation aLabelLocation, ALspLabelLocations aLocations, TLspPaintState aPaintState, TLspContext aContext, ILcd3DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Calculates the bounds of the given label for the given label location.
This method returns the axis aligned bounds using
aBoundsSFCT
and returns a rotation. This rotation rotates the bounds around its origin. The rotation of the bounds is defined in radians, clockwise, with 0 at 3 'o clock.It is possible that the bounds of this label depends on the location of an other label. In that case, it is possible to use the given view locations to retrieve an other location. Note that the given
ALspLabelLocations
should not be modified in this method.- Parameters:
aLabel
- the label for which to calculate the bounds.aLabelLocation
- the location of the label.aLocations
- possible context information. This object can for example be used when these bounds depend on bounds of an other label.aPaintState
- the paint state.aContext
- the context.aBoundsSFCT
- the object in which to store the axis aligned bounds.- Returns:
- the rotation of the bounds in radians, clockwise, with 0 at 3 'o clock.
- Throws:
TLcdNoBoundsException
- when the bounds could not be calculated.
-
labelAnchorPointSFCT
void labelAnchorPointSFCT(TLspLabelID aLabel, ALspLabelLocation aLabelLocation, ALspLabelLocations aLabelLocations, TLspPaintState aPaintState, TLspContext aContext, ILcd3DEditablePoint aAnchorPointSFCT) throws TLcdNoBoundsException Retrieves the anchor point of the given label. This point is usually a point on the label, e.g. in the middle of the bounds.- Parameters:
aLabel
- the label for which to calculate the bounds.aLabelLocation
- the location of the label.aLabelLocations
- possible context information. This object can for example be used when these bounds depend on bounds of an other label.aPaintState
- the paint state.aContext
- the context.aAnchorPointSFCT
- the point in which to store the anchor point.- Throws:
TLcdNoBoundsException
- when the anchor point could not be calculated.
-
getAnchorObject
Object getAnchorObject(TLspLabelID aLabel, TLspPaintState aPaintState, TLspContext aContext) throws TLcdNoBoundsException Returns the anchor object of the given label. This can either be an otherTLspLabelID
, anILcdShape
, andALspStyleTargetProvider
ornull
. In the latter case, the painter interprets the anchor itself, i.e. by using the focus point of the domain object. In the latter case, the domain object must be anILcdShape
or it must have a shape.The various labeling algorithms use this anchor object to determine the label's location.
You can specify this anchor object using a
ALspLabelStyler
:- Use
ALspLabelStyleCollector.anchorLabel(java.lang.Object)
to make place label relative to another label. - Use
ALspLabelStyleCollector.geometry(ILcdShape)
to specify a specific geometry to be used. - Use
ALspLabelStyleCollector.geometry(ALspStyleTargetProvider)
to specify a style target provider to be used. Using this method has the advantage that it is possible to specify a different shape reference than the model reference. - If neither is used, this method returns
null
, and the algorithms use the domain object itself to determine the location.
- Parameters:
aLabel
- the label.aPaintState
- the paint state.aContext
- the context.- Returns:
- the anchor object of the given label.
- Throws:
TLcdNoBoundsException
- if there is no anchor object for the given label.
- Use
-