org.gvsig.fmap.mapcontrol.tools.Behavior
Class Behavior

java.lang.Object
  extended by org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior
All Implemented Interfaces:
IBehavior
Direct Known Subclasses:
CircleBehavior, CompoundBehavior, DraggerBehavior, MouseMovementBehavior, MouseWheelBehavior, MoveBehavior, PointBehavior, PolylineBehavior, RectangleBehavior

public abstract class Behavior
extends 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.

Author:
Luis W. Sevilla
See Also:
IBehavior

Field Summary
protected  org.gvsig.fmap.geom.GeometryManager geomManager
           
 
Constructor Summary
Behavior()
           
 
Method Summary
protected  org.gvsig.fmap.geom.primitive.Arc createArc(double centerX, double centerY, double radious, double angleStart, double angleExtent)
          Create an arc.
protected  org.gvsig.fmap.geom.primitive.Arc createArc(Point2D p1, Point2D p2, Point2D p3)
          Create an Arc.
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.
protected  org.gvsig.fmap.geom.primitive.Circle createCircle(double centerX, double centerY, double radious)
          Create an circle.
protected  org.gvsig.fmap.geom.primitive.Curve createLineString(org.gvsig.fmap.geom.primitive.GeneralPathX gpx)
          Create a lineString from a GeneralPath.
protected  org.gvsig.fmap.geom.primitive.Point createPoint(double x, double y)
          Create point.
protected  org.gvsig.fmap.geom.primitive.Point createPoint(Point2D p1)
          Create a curve point.
 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.
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void mouseWheelMoved(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 setMapControl(MapControl mc)
          Associates this behavior to a MapControl object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

geomManager

protected org.gvsig.fmap.geom.GeometryManager geomManager
Constructor Detail

Behavior

public Behavior()
Method Detail

getListener

public abstract ToolListener getListener()
Description copied from interface: IBehavior

Gets the ToolListener used by this behavior to perform actions on the associated MapControl object.

Specified by:
getListener in interface IBehavior
Returns:
the ToolListener used by this behavior

paintComponent

public void paintComponent(MapControlDrawer mapControlDrawer)
Description copied from interface: IBehavior

Method 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.

Specified by:
paintComponent in interface IBehavior
See Also:
Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver)

setMapControl

public void setMapControl(MapControl mc)
Description copied from interface: IBehavior

Associates this behavior to a MapControl object.

Specified by:
setMapControl in interface IBehavior
Parameters:
mc - the MapControl object to associate
See Also:
IBehavior.getMapControl()

getImageCursor

public Image getImageCursor()
Description copied from interface: IBehavior

Gets the mouse cursor of the tool listener associated to this behavior.

Specified by:
getImageCursor in interface IBehavior
Returns:
the mouse cursor of the tool listener associated

getMapControl

public MapControl getMapControl()
Description copied from interface: IBehavior

Returns the reference to the MapControl object that this behavior uses.

Specified by:
getMapControl in interface IBehavior
Returns:
the MapControl object used this behavior
See Also:
IBehavior.setMapControl(MapControl)

mouseClicked

public void mouseClicked(MouseEvent e)
                  throws BehaviorException
Specified by:
mouseClicked in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse clicked event, by the IBehavior object
See Also:
MouseListener.mouseClicked(java.awt.event.MouseEvent)

mouseEntered

public void mouseEntered(MouseEvent e)
                  throws BehaviorException
Specified by:
mouseEntered in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse entered event, by the IBehavior object
See Also:
MouseListener.mouseEntered(java.awt.event.MouseEvent)

mouseExited

public void mouseExited(MouseEvent e)
                 throws BehaviorException
Specified by:
mouseExited in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse exited event, by the IBehavior object
See Also:
MouseListener.mouseExited(java.awt.event.MouseEvent)

mousePressed

public void mousePressed(MouseEvent e)
                  throws BehaviorException
Specified by:
mousePressed in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse pressed event, by the IBehavior object
See Also:
MouseListener.mousePressed(java.awt.event.MouseEvent)

mouseReleased

public void mouseReleased(MouseEvent e)
                   throws BehaviorException
Specified by:
mouseReleased in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse released event, by the IBehavior object
See Also:
MouseListener.mouseReleased(java.awt.event.MouseEvent)

mouseDragged

public void mouseDragged(MouseEvent e)
                  throws BehaviorException
Specified by:
mouseDragged in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse dragged event, by the IBehavior object
See Also:
MouseMotionListener.mouseDragged(java.awt.event.MouseEvent)

mouseMoved

public void mouseMoved(MouseEvent e)
                throws BehaviorException
Specified by:
mouseMoved in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse moved event, by the IBehavior object
See Also:
MouseMotionListener.mouseMoved(java.awt.event.MouseEvent)

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
                     throws BehaviorException
Specified by:
mouseWheelMoved in interface IBehavior
Throws:
BehaviorException - any exception processing the action associated to a mouse wheel event, by the IBehavior object
See Also:
MouseWheelListener.mouseWheelMoved(java.awt.event.MouseWheelEvent)

createPoint

protected org.gvsig.fmap.geom.primitive.Point createPoint(double x,
                                                          double y)
Create point. If there is an error return null and add the error to the log

Parameters:
x - The X coordinate
y - The y coordinate
Returns:
The Point

createArc

protected org.gvsig.fmap.geom.primitive.Arc createArc(Point2D p1,
                                                      Point2D p2,
                                                      Point2D p3)
Create an Arc. If there is an error return null and 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 return null and add the error to the log

Parameters:
p1 -
p2 -
p3 -
Returns:
The arc

createPoint

protected org.gvsig.fmap.geom.primitive.Point createPoint(Point2D p1)
Create a curve point. If there is an error return null and 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 return null and add the error to the log

Parameters:
centerX -
centerY -
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 return null and add the error to the log

Parameters:
centerX -
centerY -
Returns:
The arc

createLineString

protected org.gvsig.fmap.geom.primitive.Curve createLineString(org.gvsig.fmap.geom.primitive.GeneralPathX gpx)
Create a lineString from a GeneralPath. If there is an error return null and add the error to the log

Parameters:
gpx - The GeneralPath
Returns:
The LineString


Copyright © 2004-2013 gvSIG. All Rights Reserved.