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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
clone()
abstract void
dimensionSFCT
(Graphics aGraphics, Object aObject, int aLabelIndex, int aSubLabelIndex, int aMode, ILcdGXYContext aContext, Dimension aDimensionSFCT) AdjustsaDimensionSFCT
to contain the dimension of the specified label.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.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.
-
Constructor Details
-
ALcdGXYLabelStamp
public ALcdGXYLabelStamp()
-
-
Method Details
-
clone
- Overrides:
clone
in 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
aDimensionSFCT
to 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
- TheGraphics
instance 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
- TheILcdGXYContext
instance containing the contextual information about the label, such as the layer and the view.aDimensionSFCT
- TheDimension
that 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 returnedGraphics
instance 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
- TheGraphics
instance 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
- TheILcdGXYContext
instance 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 theGraphics
instance 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 theGraphics
instance 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 theGraphics
instance 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
false
for points that fall outside of the circle, andtrue
for those within the circle.The location is specified by the
getX()
andgetY()
methods ofaContext
. This location is relative to theRectangle
defined bydimensionSFCT
- Parameters:
aGraphics
- TheGraphics
instance 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
- TheILcdGXYContext
instance containing the location where we want to know if the label is present. This location can be retrieved with thegetX()
andgetY()
methods of thisILcdGXYContext
instance. (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 whenpaint
takes 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 whenpaint
takes 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:
true
if the label is touched at the specified location,false
otherwise.
-