public abstract class Behavior extends java.lang.Object implements IBehavior
When user is working with a tool on a MapControl instance,
Behavior defines the basic ways of interacting: selecting a
point, a circle, a rectangle, or ...
All events generated will be MouseEvent, and will depend on the
nature of the behavior, like the kind of tool for applying the
changes.
Behavior defines the common and basic functionality for all
kinds of interacting ways with the MapControl object.
IBehavior| Modifier and Type | Field and Description |
|---|---|
static int |
BUTTON_LEFT |
static int |
BUTTON_MIDDLE |
static int |
BUTTON_RIGHT |
protected GeometryManager |
geomManager |
protected static Logger |
LOG |
| Modifier and Type | Method and Description |
|---|---|
void |
clean(MapControlDrawer mapControlDrawer) |
protected Arc |
createArc(double centerX,
double centerY,
double radious,
double angleStart,
double angleExtent)
Create an arc.
|
protected Arc |
createArc(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2,
java.awt.geom.Point2D p3)
Create an Arc.
|
protected Arc |
createArc(Point p1,
Point p2,
Point p3)
Create an arc.
|
protected Circle |
createCircle(double centerX,
double centerY,
double radious)
Create an circle.
|
protected Ellipse |
createEllipse(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2,
java.awt.geom.Point2D p3) |
protected Point |
createPoint(double x,
double y)
Create point.
|
protected Point |
createPoint(java.awt.geom.Point2D p1)
Create a curve point.
|
java.awt.Image |
getImageCursor()
Gets the mouse cursor of the tool listener associated to this behavior.
|
abstract ToolListener |
getListener()
Gets the
ToolListener used by this behavior to perform actions on the
associated MapControl object. |
MapControl |
getMapControl()
Returns the reference to the
MapControl object that this behavior uses. |
boolean |
getUseSnapping() |
boolean |
isMyButton() |
boolean |
isMyButton(java.awt.event.MouseEvent e) |
void |
mouseClicked(java.awt.event.MouseEvent e) |
void |
mouseDragged(java.awt.event.MouseEvent e) |
void |
mouseEntered(java.awt.event.MouseEvent e) |
void |
mouseExited(java.awt.event.MouseEvent e) |
void |
mouseMoved(java.awt.event.MouseEvent e) |
void |
mousePressed(java.awt.event.MouseEvent e) |
void |
mouseReleased(java.awt.event.MouseEvent e) |
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent 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 |
paintComponent(MapControlDrawer mapControlDrawer,
boolean clean) |
void |
resetMyButton() |
void |
setMapControl(MapControl mc)
Associates this behavior to a
MapControl object. |
void |
setUseSnapping(boolean useSnapping) |
public static final int BUTTON_LEFT
public static final int BUTTON_MIDDLE
public static final int BUTTON_RIGHT
protected static final Logger LOG
protected GeometryManager geomManager
public abstract ToolListener getListener()
IBehaviorGets the ToolListener used by this behavior to perform actions on the
associated MapControl object.
getListener in interface IBehaviorToolListener used by this behaviorpublic 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 IBehaviorGraphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)public void paintComponent(MapControlDrawer mapControlDrawer, boolean clean)
public void clean(MapControlDrawer mapControlDrawer)
public void setMapControl(MapControl mc)
IBehaviorAssociates this behavior to a MapControl object.
setMapControl in interface IBehaviormc - the MapControl object to associateIBehavior.getMapControl()public java.awt.Image getImageCursor()
IBehaviorGets the mouse cursor of the tool listener associated to this behavior.
getImageCursor in interface IBehaviorpublic MapControl getMapControl()
IBehaviorReturns the reference to the MapControl object that this behavior uses.
getMapControl in interface IBehaviorMapControl object used this behaviorIBehavior.setMapControl(MapControl)public void mouseClicked(java.awt.event.MouseEvent e)
throws BehaviorException
mouseClicked in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse clicked event, by the IBehavior objectMouseListener.mouseClicked(java.awt.event.MouseEvent)public void mouseEntered(java.awt.event.MouseEvent e)
throws BehaviorException
mouseEntered in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse entered event, by the IBehavior objectMouseListener.mouseEntered(java.awt.event.MouseEvent)public void mouseExited(java.awt.event.MouseEvent e)
throws BehaviorException
mouseExited in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse exited event, by the IBehavior objectMouseListener.mouseExited(java.awt.event.MouseEvent)public void mousePressed(java.awt.event.MouseEvent e)
throws BehaviorException
mousePressed in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse pressed event, by the IBehavior objectMouseListener.mousePressed(java.awt.event.MouseEvent)public void mouseReleased(java.awt.event.MouseEvent e)
throws BehaviorException
mouseReleased in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse released event, by the IBehavior objectMouseListener.mouseReleased(java.awt.event.MouseEvent)public void mouseDragged(java.awt.event.MouseEvent e)
throws BehaviorException
mouseDragged in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse dragged event, by the IBehavior objectMouseMotionListener.mouseDragged(java.awt.event.MouseEvent)public void mouseMoved(java.awt.event.MouseEvent e)
throws BehaviorException
mouseMoved in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse moved event, by the IBehavior objectMouseMotionListener.mouseMoved(java.awt.event.MouseEvent)public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
throws BehaviorException
mouseWheelMoved in interface IBehaviorBehaviorException - any exception processing the action associated to a mouse wheel event, by the IBehavior objectMouseWheelListener.mouseWheelMoved(java.awt.event.MouseWheelEvent)protected Point createPoint(double x, double y)
null and add the error
to the logx - The X coordinatey - The y coordinateprotected Arc createArc(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3)
null and add the error
to the logp1 - p2 - p3 - protected Arc createArc(Point p1, Point p2, Point p3)
null and add the error
to the logp1 - p2 - p3 - protected Point createPoint(java.awt.geom.Point2D p1)
null and add the error
to the logp1 - The AWT pointprotected Arc createArc(double centerX, double centerY, double radious, double angleStart, double angleExtent)
null and add the error
to the logcenterX - centerY - radious - angleStart - angleExtent - protected Circle createCircle(double centerX, double centerY, double radious)
null and add the error
to the logcenterX - centerY - radious - protected Ellipse createEllipse(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.geom.Point2D p3)
public void resetMyButton()
public boolean isMyButton(java.awt.event.MouseEvent e)
public boolean isMyButton()
public boolean getUseSnapping()
public void setUseSnapping(boolean useSnapping)