Class ALcdGXYLabelStamp
- All Implemented Interfaces:
Cloneable
An ALcdGXYLabelStamp is an object that performs the actual painting of a
label. It contains only the logic of what to draw and leaves the decision of
where to draw to the client of this class.
- Since:
- 7.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectclone()abstract voiddimensionSFCT(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, Dimension aDimensionSFCT) AdjustsaDimensionSFCTto contain the dimension of the specified label.booleanisTouched(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, int aX, int aY, double aRotation) Determines whether the label is present at the specified location.abstract voidpaint(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, int aX, int aY, double aRotation) Paints the specified label at the specified location with the specified rotation.
-
Constructor Details
-
ALcdGXYLabelStamp
public ALcdGXYLabelStamp()
-
-
Method Details
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
dimensionSFCT
public abstract void dimensionSFCT(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, Dimension aDimensionSFCT) throws TLcdNoBoundsException Adjusts
aDimensionSFCTto contain the dimension of the specified label.Because this dimension should be independent of the label location and rotation, this information is not passed in as parameter.
- Parameters:
aGraphics- TheGraphicsinstance on which the label would be painted.aObject- The object for which the label bounds are requested.aLabelIndex- The index of the label whose bounds are requested.aSubLabelIndex- The index of the sublabel whose bounds are requested.aMode- The mode for which the label bounds are requested. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aContext- TheILcdGXYContextinstance containing the contextual information about the label, such as the layer and the view.aDimensionSFCT- TheDimensionthat should be updated with the requested stamp size.- Throws:
TLcdNoBoundsException- When the stamp could not determine the bounds for the specified label. For instance, when a certain property is set on the object that specifies the label cannot be drawn, the stamp can throw this exception.- See Also:
-
paint
public abstract void paint(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, int aX, int aY, double aRotation) Paints the specified label at the specified location with the specified rotation. The
This method should only paint in the bounds it returnedGraphicsinstance has been rotated or translated to the correct position, ie. this stamp can start painting from (0,0) to the width and height it returned in dimensionSFCT- Parameters:
aGraphics- TheGraphicsinstance on which to paint the label.aObject- The domain object for which to paint the label.aLabelIndex- The index of the label that should be painted.aSubLabelIndex- The index of the sublabel that should be painted.aMode- The mode in which the label should be painted. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aContext- TheILcdGXYContextinstance containing the contextual information about the label, such as the layer and the view.aX- The x-coordinate where the label is painted. This is the x-coordinate of the upper left corner. This is information is purely contextual, as theGraphicsinstance is already configured to take the position into account. It is optional to take this information into account when painting.aY- The y-coordinate where the label is painted. This is the y-coordinate of the upper left corner. This is information is purely contextual, as theGraphicsinstance is already configured to take the position into account. It is optional to take this information into account when painting.aRotation- The rotation with which the label should be painted. This is information is purely contextual, as theGraphicsinstance is already configured to take this rotation into account. It is optional to take this information into account when painting.- See Also:
-
isTouched
public boolean isTouched(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, int aX, int aY, double aRotation) Determines whether the label is present at the specified location. The default implementation works for rectangular labels, by using the label dimension.
This method needs to be redefined for non-rectangular labels. For instance, when the label is circular, the bounds of that label, which, by definition, are rectangular, cover more area than is actually used by the label. This method would then return
falsefor points that fall outside of the circle, andtruefor those within the circle.The location is specified by the
getX()andgetY()methods ofaContext. This location is relative to theRectangledefined bydimensionSFCT- Parameters:
aGraphics- TheGraphicsinstance on which the label is painted.aObject- The domain object for which to paint the label.aLabelIndex- The index of the label.aSubLabelIndex- The index of the sublabel.aMode- The mode in which the label should be present or not. SeeILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)for more information.aContext- TheILcdGXYContextinstance containing the location where we want to know if the label is present. This location can be retrieved with thegetX()andgetY()methods of thisILcdGXYContextinstance. (0,0) is at the top left of the label.aX- The x-coordinate where the label is painted. This is the x-coordinate of the upper left corner. This information is needed only whenpainttakes this parameter into account.aY- The y-coordinate where the label is painted. This is the y-coordinate of the upper left corner. This information is needed only whenpainttakes this parameter into account.aRotation- The rotation with which the label should be painted. This information is purely contextual, it is optional to take this information into account when painting.- Returns:
trueif the label is touched at the specified location,falseotherwise.
-