org.openjump.core.ui.plugin.edittoolbox.cursortools
Class ConstrainedMultiClickTool

java.lang.Object
  extended by com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
      extended by org.openjump.core.ui.plugin.edittoolbox.cursortools.ConstrainedMultiClickTool
All Implemented Interfaces:
CursorTool, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
Direct Known Subclasses:
ConstrainedMultiClickArcTool, ConstrainedNClickTool, ConstrainedPolygonTool, DrawConstrainedCircleTool, DrawConstrainedLineStringTool

public abstract class ConstrainedMultiClickTool
extends AbstractCursorTool

A VisualIndicatorTool that allows the user to draw shapes with multiple vertices. Double-clicking ends the gesture.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
AbstractCursorTool.Listener
 
Field Summary
protected  java.util.List coordinates
           
protected  boolean drawClosed
           
protected  com.vividsolutions.jts.geom.Coordinate tentativeCoordinate
           
 
Constructor Summary
ConstrainedMultiClickTool()
           
 
Method Summary
 void activate(LayerViewPanel layerViewPanel)
           
protected  void add(com.vividsolutions.jts.geom.Coordinate c)
           
 void cancelGesture()
          Notifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.
 void deactivate()
           
protected  com.vividsolutions.jts.geom.Coordinate doConstraint(java.awt.event.MouseEvent e)
           
protected  void finishGesture()
           
 java.util.List getCoordinates()
          Will return an empty List once the shape is cleared.
protected  com.vividsolutions.jts.geom.Coordinate getIntersection(com.vividsolutions.jts.geom.Coordinate p1, com.vividsolutions.jts.geom.Coordinate p2, com.vividsolutions.jts.geom.Coordinate p3, com.vividsolutions.jts.geom.Coordinate p4)
           
protected  java.awt.Shape getShape()
           
protected  boolean isFinishingRelease(java.awt.event.MouseEvent e)
           
 boolean isRightMouseButtonUsed()
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
protected  void mouseLocationChanged(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)
           
protected  com.vividsolutions.jts.geom.Coordinate[] toArray(java.util.List coordinates)
           
 
Methods inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
add, allowSnapping, check, cleanup, clearShape, createCursor, createCursor, createStandardSnappingPolicies, drawShapeXOR, drawShapeXOR, execute, fireGestureFinished, gestureFinished, getColor, getCursor, getName, getPanel, getSnapManager, getTaskFrame, getWorkbench, isGestureInProgress, isRollingBackInvalidEdits, isShapeOnScreen, mouseClicked, mouseEntered, mouseExited, 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

coordinates

protected java.util.List coordinates

tentativeCoordinate

protected com.vividsolutions.jts.geom.Coordinate tentativeCoordinate

drawClosed

protected boolean drawClosed
Constructor Detail

ConstrainedMultiClickTool

public ConstrainedMultiClickTool()
Method Detail

isRightMouseButtonUsed

public boolean isRightMouseButtonUsed()
Specified by:
isRightMouseButtonUsed in interface CursorTool
Overrides:
isRightMouseButtonUsed in class AbstractCursorTool
Returns:
true if this CursorTool uses the right mouse button; false to allow the panel to show a popup-menu on right-clicks

getCoordinates

public java.util.List getCoordinates()
Will return an empty List once the shape is cleared.

See Also:
AbstractCursorTool.clearShape()

cancelGesture

public void cancelGesture()
Description copied from interface: CursorTool
Notifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.

Specified by:
cancelGesture in interface CursorTool
Overrides:
cancelGesture in class AbstractCursorTool

mouseReleased

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

doConstraint

protected com.vividsolutions.jts.geom.Coordinate doConstraint(java.awt.event.MouseEvent e)
                                                       throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

mouseLocationChanged

protected void mouseLocationChanged(java.awt.event.MouseEvent e)

mouseMoved

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

mouseDragged

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

add

protected void add(com.vividsolutions.jts.geom.Coordinate c)

mousePressed

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

getShape

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

isFinishingRelease

protected boolean isFinishingRelease(java.awt.event.MouseEvent e)

toArray

protected com.vividsolutions.jts.geom.Coordinate[] toArray(java.util.List coordinates)

finishGesture

protected void finishGesture()
                      throws java.lang.Exception
Throws:
java.lang.Exception

deactivate

public void deactivate()
Specified by:
deactivate in interface CursorTool
Overrides:
deactivate in class AbstractCursorTool

getIntersection

protected com.vividsolutions.jts.geom.Coordinate getIntersection(com.vividsolutions.jts.geom.Coordinate p1,
                                                                 com.vividsolutions.jts.geom.Coordinate p2,
                                                                 com.vividsolutions.jts.geom.Coordinate p3,
                                                                 com.vividsolutions.jts.geom.Coordinate p4)

activate

public void activate(LayerViewPanel layerViewPanel)
Specified by:
activate in interface CursorTool
Overrides:
activate in class AbstractCursorTool