public class TLcdGXYAISPointListPainter extends TLcdGXYPointListPainter
TLcdGXYPointListPainter
, but paints an
icon if the point list contains only a single point.
By default, the points are painted by a TLcdGXYAISIconProviderPainter
.
The symbology usage can be changed in two ways:
setPointPainter
method can be used to define another painter,getPointPainter
method can be used to retrieve the default
painter. The TLcdGXYAISIconProviderPainter
class provides a setSymbolProvider
method to change its symbol provider.
Like its super class, this painter accepts instances of any implementation
of the ILcdPointList
interface.
AREA, COORDINATES_AVERAGE, END_OF_CURVE, FILLED, FIRST_POSSIBLE_POINT, FOCUS_POINT, INSIDE_POLYGON, MEDIAN_POINT, MIDDLE_OF_BOUNDS, MIDDLE_OF_CURVE, OUTLINE_AREA, OUTLINED_FILLED, POINT, POLYGON, POLYLINE, START_OF_CURVE
OUTLINED
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
BODY, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdGXYAISPointListPainter()
Constructs a new
TLcdGXYAISPointListPainter object. |
Modifier and Type | Method and Description |
---|---|
void |
boundsSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds a2DEditableBounds)
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object
in the given mode taking into account the given context.
|
Object |
clone()
Makes
Object.clone() public. |
Cursor |
getCursor(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Returns a
Cursor that clarifies the render mode and context this painter is operating
in. |
ILcdGXYPainter |
getPointPainter()
Returns the painter that will be used to paint pointLists
consisting of only one point.
|
boolean |
isTouched(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Depending on the render mode and paint mode, returns whether one of the handles (the source point list),
the painted point list or the interior of the point list is touched.
|
void |
paint(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext)
Displays the representation of the object in the given mode on the Graphics passed, taking into
account the context passed.
|
void |
setObject(Object aObject)
Specifies the object to be painted.
|
void |
setPointPainter(ILcdGXYPainter aPointPainter)
Specifies a painter that is able to paint instances of implementations of
the
ILcdPoint and the ILcdShape interface. |
Object |
snapTarget(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Returns a point of the
ILcdPointList object if the point is touched. |
boolean |
supportSnap(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Supports snapping when the
ILcdPointList object set to this painter contains at least
one point. |
acceptSnapTarget, anchorPointSFCT, append2DPoint, appendAWTPath, appendGeneralPath, edit, getAnchorPointLocation, getCreationClickCount, getFillSelection, getGXYEditor, getMinimumEditDelta, getMode, getModeName, getObject, getPaintCache, getSnapIcon, getTouchedPoint, getTouchedSegment, getTouchedSegment, getWindingRule, insert2DPoint, insidePolygon, isMoveOnlyOnEdit, isTraceOn, linkToSnapTarget, move2DPoint, removePointAt, retrieveMinimalPointcount, retrievePointList, setAnchorPointLocation, setFillSelection, setMinimumEditDelta, setMode, setModelModelTransformationClass, setMoveOnlyOnEdit, setPaintCache, setSnapIcon, setTraceOn, setupGraphicsForFill, setupGraphicsForLine, setupGraphicsForPoint, setWindingRule, translate2D, translate2DPoint
getEditMode, getFillStyle, getLineStyle, getSelectionMode, setEditMode, setFillStyle, setLineStyle, setSelectionMode
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, getGXYPainter, removePropertyChangeListener, setClassTraceOn, setDisplayName
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
getDisplayName
addPropertyChangeListener, removePropertyChangeListener
public TLcdGXYAISPointListPainter()
TLcdGXYAISPointListPainter
object.
By default, pointLists will be drawn as polygons, unless they contain only one point.
In the latter case, an instance of the TLcdGXYAISIconProviderPainter
class will be
used to draw an icon at the location of the single point.
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in interface ILcdGXYEditorProvider
clone
in interface ILcdGXYPainterProvider
clone
in class TLcdGXYPointListPainter
Object.clone()
public void setObject(Object aObject)
The specified object should be an instance of an implementation
of the ILcdPointList
interface.
setObject
in interface ILcdGXYEditor
setObject
in interface ILcdGXYPainter
setObject
in class TLcdGXYPointListPainter
aObject
- the object to be paintedTLcdGXYPointListPainter.getObject()
public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
This implementation will use the specified render mode to determine how the object needs to be
rendered. In ILcdGXYPainter.TRANSLATING
mode, the ILcdPointList
object is rendered as if
all points were moved along the same distance in view coordinates as passed in the context. In
ILcdGXYPainter.RESHAPING
mode, the object is painted with one point moved as defined in the context.
In ILcdGXYPainter.CREATING
mode, the object is painted as if the current mouse position is the last
point of the ILcdPointList
. In the above render modes, the object is painted using
the edit paint mode (ALcdGXYAreaPainter.getEditMode()
).
In the render mode ILcdGXYPainter.SELECTED
, the object is painted using the selection paint mode
(ALcdGXYAreaPainter.getSelectionMode()
). In all other render modes, the paint mode (TLcdGXYPointListPainter.getMode()
)
is used.
Note: when the paint mode is set to TLcdGXYPointListPainter.POINT
or TLcdGXYPointListPainter.POLYLINE
, the objects will
be painted as, respectively points and polylines. The selectionMode and editMode property are not
taken into account when finding the mode in which the object should be painted.
paint
in interface ILcdGXYPainter
paint
in class TLcdGXYPointListPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.public boolean isTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
This implementation will use the specified paint mode
to determine how
the object is represented. Depending on the representation of the ILcdPointList
object,
the object is touched when
TLcdGXYPointListPainter.FILLED
,
ILcdGXYPainter.SELECTED
.
The method insidePolygon
determines whether the current mouse position
is located inside the ILcdPointList
object or not.
It is not possible to derive from this method which part of the point list has been touched.
To determine which part of the ILcdPointList
object is touched, the methods getTouchedPoint
and getTouchedSegment
will return
the required information.
isTouched
in interface ILcdGXYPainter
isTouched
in class TLcdGXYPointListPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.TLcdGXYPointListPainter.getMode()
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds a2DEditableBounds) throws TLcdNoBoundsException
TLcdGXYPointListPainter
If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model
space for ILcdBounded
objects.
boundsSFCT
in interface ILcdGXYPainter
boundsSFCT
in class TLcdGXYPointListPainter
aGraphics
- The graphics to paint the object on.aMode
- The mode to render the object in.aGXYContext
- The context to render the object in.a2DEditableBounds
- The bounds to update.TLcdNoBoundsException
- if no bounds can be determined for the representation of the object.
This can happen when the object does not have a representation in the given context, for example when it is located
in a part of the world which is not visible in the current view.isTouched
public boolean supportSnap(Graphics aGraphics, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
Supports snapping when the ILcdPointList
object set to this painter contains at least
one point.
supportSnap
in interface ILcdGXYPainter
supportSnap
in class TLcdGXYPointListPainter
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.true
if the ILcdPointList
object contains at least one point,
false
otherwise.public Object snapTarget(Graphics aGraphics, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
Returns a point of the ILcdPointList
object if the point is touched. If no point was
touched, null
will be returned.
snapTarget
in interface ILcdGXYPainter
snapTarget
in class TLcdGXYPointListPainter
aGraphics
- the graphics on which is worked.aGXYContext
- the context of the snapping.ILcdPointList
object if the point is touched, null
otherwise.supportSnap
public Cursor getCursor(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYPointListPainter
Cursor
that clarifies the render mode and context this painter is operating
in. When no specific Cursor
is required, null
is returned.getCursor
in interface ILcdGXYPainter
getCursor
in class TLcdGXYPointListPainter
aGraphics
- The graphics on which the object is painted.aMode
- The mode to render the object in.aGXYContext
- The context in which the object is rendered.null
if
no particular cursor is required.public ILcdGXYPainter getPointPainter()
This painter is able to paint instances of implementations of
the ILcdPoint
and the ILcdShape
interface.
It will paint an icon at the location of the point or at the location of
the focus point of the shape.
public void setPointPainter(ILcdGXYPainter aPointPainter)
ILcdPoint
and the ILcdShape
interface. It
should paint an icon at the location of the point or at the location of
the focus point of the shape.
The given painter will be used to paint pointLists consisting of only one point.
aPointPainter
- a painter that is able to paint an icon at the
location of a point or at the location of the focus point of a shape