Class Behavior
- All Implemented Interfaces:
IBehavior
- Direct Known Subclasses:
CircleBehavior,CompoundBehavior,DraggerBehavior,EllipseBehavior,FreehandBehavior,MouseMovementBehavior,MouseWheelBehavior,MoveBehavior,PointBehavior,PolylineBehavior,RectangleBehavior
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.
- Author:
- Luis W. Sevilla
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intprotected org.gvsig.fmap.geom.GeometryManagerprotected static final org.slf4j.Loggerprotected static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclean(MapControlDrawer mapControlDrawer) protected org.gvsig.fmap.geom.primitive.ArccreateArc(double centerX, double centerY, double radious, double angleStart, double angleExtent) Create an arc.protected org.gvsig.fmap.geom.primitive.ArcCreate an Arc.protected org.gvsig.fmap.geom.primitive.ArccreateArc(org.gvsig.fmap.geom.primitive.Point p1, org.gvsig.fmap.geom.primitive.Point p2, org.gvsig.fmap.geom.primitive.Point p3) Create an arc.protected org.gvsig.fmap.geom.primitive.CirclecreateCircle(double centerX, double centerY, double radious) Create an circle.protected org.gvsig.fmap.geom.primitive.EllipsecreateEllipse(Point2D p1, Point2D p2, Point2D p3) protected org.gvsig.fmap.geom.primitive.PointcreatePoint(double x, double y) Create point.protected org.gvsig.fmap.geom.primitive.PointcreatePoint(Point2D p1) Create a curve point.Gets the mouse cursor of the tool listener associated to this behavior.abstract ToolListenerGets theToolListenerused by this behavior to perform actions on the associatedMapControlobject.Returns the reference to theMapControlobject that this behavior uses.booleanbooleanbooleanvoidvoidvoidvoidvoidvoidvoidvoidvoidpaintComponent(MapControlDrawer mapControlDrawer) Method executed in real-time, when user is working with a tool on the associatedMapControlobject, repainting theMapControl's image.voidpaintComponent(MapControlDrawer mapControlDrawer, boolean clean) voidvoidAssociates this behavior to aMapControlobject.voidsetUseSnapping(boolean useSnapping)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
BUTTON_LEFT
public static final int BUTTON_LEFT- See Also:
-
BUTTON_MIDDLE
public static final int BUTTON_MIDDLE- See Also:
-
BUTTON_RIGHT
public static final int BUTTON_RIGHT- See Also:
-
LOG
protected static final org.slf4j.Logger LOG -
geomManager
protected org.gvsig.fmap.geom.GeometryManager geomManager
-
-
Constructor Details
-
Behavior
public Behavior() -
Behavior
public Behavior(int mouseButton)
-
-
Method Details
-
getListener
Description copied from interface:IBehaviorGets the
ToolListenerused by this behavior to perform actions on the associatedMapControlobject.- Specified by:
getListenerin interfaceIBehavior- Returns:
- the
ToolListenerused by this behavior
-
paintComponent
Description copied from interface:IBehaviorMethod executed in real-time, when user is working with a tool on the associated
MapControlobject, repainting theMapControl'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.
- Specified by:
paintComponentin interfaceIBehavior- See Also:
-
paintComponent
-
clean
-
setMapControl
Description copied from interface:IBehaviorAssociates this behavior to a
MapControlobject.- Specified by:
setMapControlin interfaceIBehavior- Parameters:
mc- theMapControlobject to associate- See Also:
-
getImageCursor
Description copied from interface:IBehaviorGets the mouse cursor of the tool listener associated to this behavior.
- Specified by:
getImageCursorin interfaceIBehavior- Returns:
- the mouse cursor of the tool listener associated
-
getMapControl
Description copied from interface:IBehaviorReturns the reference to the
MapControlobject that this behavior uses.- Specified by:
getMapControlin interfaceIBehavior- Returns:
- the
MapControlobject used this behavior - See Also:
-
mouseClicked
- Specified by:
mouseClickedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse clicked event, by theIBehaviorobject- See Also:
-
mouseEntered
- Specified by:
mouseEnteredin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse entered event, by theIBehaviorobject- See Also:
-
mouseExited
- Specified by:
mouseExitedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse exited event, by theIBehaviorobject- See Also:
-
mousePressed
- Specified by:
mousePressedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse pressed event, by theIBehaviorobject- See Also:
-
mouseReleased
- Specified by:
mouseReleasedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse released event, by theIBehaviorobject- See Also:
-
mouseDragged
- Specified by:
mouseDraggedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse dragged event, by theIBehaviorobject- See Also:
-
mouseMoved
- Specified by:
mouseMovedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse moved event, by theIBehaviorobject- See Also:
-
mouseWheelMoved
- Specified by:
mouseWheelMovedin interfaceIBehavior- Throws:
BehaviorException- any exception processing the action associated to a mouse wheel event, by theIBehaviorobject- See Also:
-
createPoint
protected org.gvsig.fmap.geom.primitive.Point createPoint(double x, double y) Create point. If there is an error returnnulland add the error to the log- Parameters:
x- The X coordinatey- The y coordinate- Returns:
- The Point
-
createArc
Create an Arc. If there is an error returnnulland add the error to the log- Parameters:
p1-p2-p3-- Returns:
- The arc
-
createArc
protected org.gvsig.fmap.geom.primitive.Arc createArc(org.gvsig.fmap.geom.primitive.Point p1, org.gvsig.fmap.geom.primitive.Point p2, org.gvsig.fmap.geom.primitive.Point p3) Create an arc. If there is an error returnnulland add the error to the log- Parameters:
p1-p2-p3-- Returns:
- The arc
-
createPoint
Create a curve point. If there is an error returnnulland add the error to the log- Parameters:
p1- The AWT point- Returns:
- The gvSIG point
-
createArc
protected org.gvsig.fmap.geom.primitive.Arc createArc(double centerX, double centerY, double radious, double angleStart, double angleExtent) Create an arc. If there is an error returnnulland add the error to the log- Parameters:
centerX-centerY-radious-angleStart-angleExtent-- Returns:
- The arc
-
createCircle
protected org.gvsig.fmap.geom.primitive.Circle createCircle(double centerX, double centerY, double radious) Create an circle. If there is an error returnnulland add the error to the log- Parameters:
centerX-centerY-radious-- Returns:
- The arc
-
createEllipse
-
resetMyButton
public void resetMyButton() -
isMyButton
-
isMyButton
public boolean isMyButton() -
getUseSnapping
public boolean getUseSnapping() -
setUseSnapping
public void setUseSnapping(boolean useSnapping)
-