com.vividsolutions.jump.workbench.ui.cursortool
Class DragTool

java.lang.Object
  extended bycom.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
      extended bycom.vividsolutions.jump.workbench.ui.cursortool.DragTool
All Implemented Interfaces:
CursorTool, java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Direct Known Subclasses:
EditDelineationTool, MoveSelectedItemsTool, MoveVertexTool, PanTool, RectangleTool, SelectTool, SpecifyFeaturesTool, ZoomTool

public abstract class DragTool
extends AbstractCursorTool

The default implementation draws a selection box, but this can be overridden (even to draw nothing).


Nested Class Summary
 
Nested classes inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
AbstractCursorTool.Listener
 
Field Summary
static int DEFAULT_VIEW_CLICK_BUFFER
           
protected  com.vividsolutions.jts.geom.Coordinate modelDestination
          Modify using #setDestination
protected  com.vividsolutions.jts.geom.Coordinate modelSource
          Modify using #setSource
 
Constructor Summary
DragTool()
           
 
Method Summary
protected  com.vividsolutions.jts.geom.Envelope getBoxInModelCoordinates()
           
protected  com.vividsolutions.jts.geom.Coordinate getModelDestination()
           
protected  com.vividsolutions.jts.geom.Coordinate getModelSource()
           
protected  java.awt.Shape getShape()
           
protected  java.awt.Shape getShape(java.awt.geom.Point2D source, java.awt.geom.Point2D destination)
           
protected  java.awt.geom.Point2D getViewDestination()
           
protected  java.awt.geom.Point2D getViewSource()
           
protected  double modelClickBuffer()
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Begins handling of the drag.
 void mouseReleased(java.awt.event.MouseEvent e)
           
protected  void setModelDestination(com.vividsolutions.jts.geom.Coordinate destination)
           
protected  void setModelSource(com.vividsolutions.jts.geom.Coordinate source)
           
protected  void setViewClickBuffer(int clickBuffer)
          A click is converted into a box by being expanded by this amount in the four directions.
protected  void setViewDestination(java.awt.geom.Point2D destination)
           
protected  void setViewSource(java.awt.geom.Point2D source)
           
protected  boolean wasClick()
           
 
Methods inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
activate, add, allowSnapping, cancelGesture, check, cleanup, clearShape, createCursor, createCursor, createStandardSnappingPolicies, deactivate, drawShapeXOR, drawShapeXOR, execute, fireGestureFinished, gestureFinished, getColor, getCursor, getName, getPanel, getSnapManager, getTaskFrame, getWorkbench, isGestureInProgress, isRightMouseButtonUsed, isRollingBackInvalidEdits, isShapeOnScreen, mouseClicked, mouseEntered, mouseExited, mouseMoved, name, redrawShape, reportNothingToUndoYet, setColor, setFilling, setStroke, setStrokeWidth, setup, snap, snap, toString, wasControlPressed, wasShiftPressed, workbench, workbenchFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vividsolutions.jump.workbench.ui.cursortool.CursorTool
getIcon
 

Field Detail

DEFAULT_VIEW_CLICK_BUFFER

public static final int DEFAULT_VIEW_CLICK_BUFFER
See Also:
Constant Field Values

modelSource

protected com.vividsolutions.jts.geom.Coordinate modelSource
Modify using #setSource


modelDestination

protected com.vividsolutions.jts.geom.Coordinate modelDestination
Modify using #setDestination

Constructor Detail

DragTool

public DragTool()
Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Begins handling of the drag. Subclasses can prevent handling of the drag by overriding this method and not calling it.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class AbstractCursorTool

setViewClickBuffer

protected void setViewClickBuffer(int clickBuffer)
A click is converted into a box by being expanded by this amount in the four directions.


wasClick

protected boolean wasClick()

getBoxInModelCoordinates

protected com.vividsolutions.jts.geom.Envelope getBoxInModelCoordinates()
                                                                 throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

modelClickBuffer

protected double modelClickBuffer()

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class AbstractCursorTool

getModelSource

protected com.vividsolutions.jts.geom.Coordinate getModelSource()

getModelDestination

protected com.vividsolutions.jts.geom.Coordinate getModelDestination()

setModelSource

protected void setModelSource(com.vividsolutions.jts.geom.Coordinate source)

setViewSource

protected void setViewSource(java.awt.geom.Point2D source)
                      throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

setViewDestination

protected void setViewDestination(java.awt.geom.Point2D destination)
                           throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

setModelDestination

protected void setModelDestination(com.vividsolutions.jts.geom.Coordinate destination)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class AbstractCursorTool

getShape

protected java.awt.Shape getShape()
                           throws java.lang.Exception
Specified by:
getShape in class AbstractCursorTool
Returns:
null if nothing should be drawn
Throws:
java.lang.Exception

getViewSource

protected java.awt.geom.Point2D getViewSource()
                                       throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

getViewDestination

protected java.awt.geom.Point2D getViewDestination()
                                            throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

getShape

protected java.awt.Shape getShape(java.awt.geom.Point2D source,
                                  java.awt.geom.Point2D destination)
                           throws java.lang.Exception
Returns:
null if nothing should be drawn
Throws:
java.lang.Exception