public class TLcdGXYRoutePainter extends TLcdGXYShapeListPainter
TLcdGXYShapeListPainter
paints ILcdShapeList
objects whose shapes are themselves ILcdPointList
implementations.
Optionally, an icon can be painted on each point in the point lists.
Painting of the icons is delegated to another painter, which can be set
using the setPointPainter()
method.FIRST_POSSIBLE_SHAPE_ANCHOR_POINT, FOCUS_POINT, fShapeGXYEditorProvider, fShapeGXYPainterProvider, MIDDLE_OF_BOUNDS, ONE_SHAPE_ANCHOR_POINT
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
CREATING, END_CREATION, RESHAPED, START_CREATION, TRANSLATED
Constructor and Description |
---|
TLcdGXYRoutePainter()
Constructs a new
TLcdGXYRoutePainter object. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Makes
Object.clone() public. |
ILcdGXYPainter |
getGXYPainter(Object aObject)
Finds an
ILcdGXYPainter that can be used to paint or locate the object passed. |
ILcdGXYPainterStyle |
getLineStyle()
Returns the line style of this painter.
|
ILcdGXYPainter |
getPointPainter()
Returns the painter used to paint icons on the points of a route.
|
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 |
setLineStyle(ILcdGXYPainterStyle aStyle)
Sets the line style of this painter.
|
void |
setPointPainter(ILcdGXYPainter aPainter)
Sets the painter used to paint icons on the points of a route.
|
acceptSnapTarget, anchorPointSFCT, appendAWTPath, appendGeneralPath, boundsSFCT, clone, edit, editShape, getAnchorPointLocation, getCreationClickCount, getCursor, getGXYEditor, getObject, getShapeGXYEditorProvider, getShapeGXYPainterProvider, isEditTouchedOnly, isTouched, retrieveShapeEditor, retrieveShapePainter, setAnchorPointLocation, setEditTouchedOnly, setObject, setShapeGXYEditorProvider, setShapeGXYPainterProvider, snapTarget, supportSnap
addPropertyChangeListener, firePropertyChangeEvent, firePropertyChangeEvent, getDisplayName, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
addPropertyChangeListener, removePropertyChangeListener
getDisplayName
public TLcdGXYRoutePainter()
TLcdGXYRoutePainter
object.
A TLcdGXYPointListPainter
is initialized to paint the routes as polylines
and set to be the editor provider and the painter provider of this TLcdGXYShapeListPainter.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 TLcdGXYShapeListPainter
Object.clone()
public ILcdGXYPainterStyle getLineStyle()
public void setLineStyle(ILcdGXYPainterStyle aStyle)
aStyle
- the line style of this painter.public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
TLcdGXYShapeListPainter
This implementation will retrieve a painter for all ILcdShape
objects inside the
ILcdShapeList
object using the retrieveShapePainter
method and will use that painter to paint the corresponding shape.
paint
in interface ILcdGXYPainter
paint
in class TLcdGXYShapeListPainter
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 ILcdGXYPainter getGXYPainter(Object aObject)
ILcdGXYPainterProvider
ILcdGXYPainter
that can be used to paint or locate the object passed.
The painter provider is responsible for setting the object to the painter before returning the painter. An implementation should therefore have the following structure:
public ILcdGXYPainter getGXYPainter(Object aObject) {
ILcdGXYPainter painter = ... // find the painter for the object
if (painter != null) {
painter.setObject(aObject);
}
return painter;
}
getGXYPainter
in interface ILcdGXYPainterProvider
getGXYPainter
in class ALcdGXYPainter
aObject
- the object to find a painter forpublic void setPointPainter(ILcdGXYPainter aPainter)
aPainter
- an ILcdGXYPainter
that must be able to paint ILcdPoint
objects.public ILcdGXYPainter getPointPainter()
ILcdGXYPainter
used to paint the points of a route.