public class EllipseBehavior extends Behavior
Behavior that allows user to draw a polyline by its vertexes on the image of
the associated MapControl using a
EllipseListener.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.lang.Double> |
arrayX
The abscissa coordinate of all vertexes of the polyline.
|
protected java.util.List<java.lang.Double> |
arrayY
The ordinate coordinate of all vertexes of the polyline.
|
protected boolean |
isClicked
Determines if user is setting the vertexes (with one click of the button
1 of the mouse), or not.
|
protected EllipseListener |
listener
Tool listener used to work with the
MapControl object. |
BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, geomManager, LOG| Constructor and Description |
|---|
EllipseBehavior(EllipseListener mli)
Creates a new behavior for drawing a polyline by its vertexes.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPoint(java.awt.geom.Point2D p)
Adds a new point to the polyline.
|
protected void |
changeLastPoint(java.awt.geom.Point2D p)
Changes the last point added of the polyline.
|
protected void |
drawCircle(MapControlDrawer mapControlDrawer) |
protected void |
drawEllipseLine(MapControlDrawer mapControlDrawer)
Draws the polyline in the
Graphics2D of the associated
MapControl. |
ToolListener |
getListener()
Gets the
ToolListener used by this behavior to perform actions on the
associated MapControl object. |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
paintComponent(MapControlDrawer mapControlDrawer)
Method executed in real-time, when user is working with a tool on the associated
MapControl
object, repainting the MapControl's image. |
void |
setListener(ToolListener listener)
Sets a tool listener to work with the
MapControl using this
behavior. |
clean, createArc, createArc, createArc, createCircle, createEllipse, createPoint, createPoint, getImageCursor, getMapControl, getUseSnapping, isMyButton, isMyButton, mouseClicked, mouseEntered, mouseExited, mouseReleased, mouseWheelMoved, paintComponent, resetMyButton, setMapControl, setUseSnappingprotected java.util.List<java.lang.Double> arrayX
protected java.util.List<java.lang.Double> arrayY
protected boolean isClicked
protected EllipseListener listener
MapControl object.getListener(),
setListener(ToolListener)public EllipseBehavior(EllipseListener mli)
Creates a new behavior for drawing a polyline by its vertexes.
mli - listener used to permit this object to work with the
associated MapControlpublic void paintComponent(MapControlDrawer mapControlDrawer)
IBehaviorMethod executed in real-time, when user is working with a tool on the associated MapControl
object, repainting the MapControl's image.
Returns immediately in all cases, even if the complete image has not yet been loaded.
This method will be implemented according to the specific nature of each behavior, and its extra and particular features.
paintComponent in interface IBehaviorpaintComponent in class BehaviorGraphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)public void mousePressed(java.awt.event.MouseEvent e)
throws BehaviorException
mousePressed in interface IBehaviormousePressed in class BehaviorBehaviorException - any exception processing the action associated to a mouse pressed event, by the IBehavior objectMouseListener.mousePressed(java.awt.event.MouseEvent)public void mouseDragged(java.awt.event.MouseEvent e)
throws BehaviorException
mouseDragged in interface IBehaviormouseDragged in class BehaviorBehaviorException - any exception processing the action associated to a mouse dragged event, by the IBehavior objectMouseMotionListener.mouseDragged(java.awt.event.MouseEvent)protected void changeLastPoint(java.awt.geom.Point2D p)
Changes the last point added of the polyline.
p - a point which will replace the last added to the polylinepublic void mouseMoved(java.awt.event.MouseEvent e)
throws BehaviorException
mouseMoved in interface IBehaviormouseMoved in class BehaviorBehaviorException - any exception processing the action associated to a mouse moved event, by the IBehavior objectMouseMotionListener.mouseMoved(java.awt.event.MouseEvent)protected void drawEllipseLine(MapControlDrawer mapControlDrawer)
Draws the polyline in the Graphics2D of the associated
MapControl.
mapControlDrawer - protected void drawCircle(MapControlDrawer mapControlDrawer)
protected void addPoint(java.awt.geom.Point2D p)
Adds a new point to the polyline.
p - a new point to the polylinepublic void setListener(ToolListener listener)
Sets a tool listener to work with the MapControl using this
behavior.
listener - a EllipseListener object for this behaviorpublic ToolListener getListener()
IBehaviorGets the ToolListener used by this behavior to perform actions on the
associated MapControl object.
getListener in interface IBehaviorgetListener in class BehaviorToolListener used by this behavior