public abstract class ALcdGXYLabelStamp extends Object implements 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.
TLcdGXYStampLabelPainter
Constructor and Description |
---|
ALcdGXYLabelStamp() |
Modifier and Type | Method and Description |
---|---|
protected Object |
clone() |
abstract void |
dimensionSFCT(Graphics aGraphics,
Object aObject,
int aLabelIndex,
int aSubLabelIndex,
int aMode,
ILcdGXYContext aContext,
Dimension aDimensionSFCT)
Adjusts
aDimensionSFCT 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.
|
protected Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
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.
aGraphics
- The Graphics
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. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
for more information.aContext
- The ILcdGXYContext
instance containing the contextual
information about the label, such as the layer and the view.aDimensionSFCT
- The Dimension
that should be updated with the requested
stamp size.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.About the label- and sublabel-index
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
Graphics
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
aGraphics
- The Graphics
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. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
for more information.aContext
- The ILcdGXYContext
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 the
Graphics
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 the
Graphics
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 the Graphics
instance is already
configured to take this rotation into account. It is optional to take
this information into account when painting.About the label- and sublabel-index
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, and true
for those within the circle.
The location is specified by the getX()
and getY()
methods of
aContext
. This location is relative to the Rectangle
defined by
dimensionSFCT
aGraphics
- The Graphics
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. See ILcdGXYLabelPainter2.paintLabel(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
for more information.aContext
- The ILcdGXYContext
instance containing the location where we
want to know if the label is present. This location can be retrieved with
the getX()
and getY()
methods of this
ILcdGXYContext
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 when paint
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 when paint
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.true
if the label is touched at the specified location, false
otherwise.