Class ConstrainedDragTool
- java.lang.Object
-
- com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
-
- org.openjump.core.ui.plugin.edittoolbox.cursortools.ConstrainedDragTool
-
- All Implemented Interfaces:
CursorTool
,MouseListener
,MouseMotionListener
,EventListener
- Direct Known Subclasses:
ConstrainedMoveVertexTool
public abstract class ConstrainedDragTool extends AbstractCursorTool
The default implementation draws a selection box, but this can be overridden (even to draw nothing).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
AbstractCursorTool.Listener
-
-
Field Summary
Fields Modifier and Type Field Description protected List
coordinates
static int
DEFAULT_VIEW_CLICK_BUFFER
protected org.locationtech.jts.geom.Coordinate
modelDestination
Modify using #setDestinationprotected org.locationtech.jts.geom.Coordinate
modelSource
Modify using #setSource-
Fields inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
isLinuxOS, panel
-
-
Constructor Summary
Constructors Constructor Description ConstrainedDragTool(WorkbenchContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(LayerViewPanel layerViewPanel)
protected org.locationtech.jts.geom.Coordinate
doConstraint(MouseEvent e)
protected org.locationtech.jts.geom.Envelope
getBoxInModelCoordinates()
List
getCoordinates()
protected org.locationtech.jts.geom.Coordinate
getModelDestination()
protected org.locationtech.jts.geom.Coordinate
getModelSource()
protected Shape
getShape()
protected Shape
getShape(Point2D source, Point2D destination)
protected Point2D
getViewDestination()
protected Point2D
getViewSource()
protected double
modelClickBuffer()
void
mouseDragged(MouseEvent e)
protected void
mouseLocationChanged(MouseEvent e)
void
mousePressed(MouseEvent e)
Begins handling of the drag.void
mouseReleased(MouseEvent e)
protected void
setModelSource(org.locationtech.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
setViewSource(Point2D source)
protected boolean
wasClick()
-
Methods inherited from class com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
add, allowSnapping, cancelGesture, check, cleanup, clearImage, clearShape, componentWithFocusIsHandledByCursorTools, createCursor, createCursor, createCursor, createStandardSnappingPolicies, deactivate, drawImageXOR, drawImageXOR, drawShapeXOR, drawShapeXOR, execute, fireGestureFinished, gestureFinished, getColor, getCursor, getImage, getImagePosition, getName, getPanel, getPanel, getSnapManager, getStroke, getTaskFrame, getWorkbench, getWorkbenchContext, isGestureInProgress, isRightMouseButtonUsed, isRollingBackInvalidEdits, isShapeOnScreen, mouseClicked, mouseEntered, mouseExited, mouseMoved, name, prohibitSnapping, redrawImage, redrawShape, reportNothingToUndoYet, setColor, setControlPressed, setFilling, setPanel, setShiftPressed, setStroke, setup, snap, snap, supportsSnapping, toString, wasControlPressed, wasShiftPressed
-
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 org.locationtech.jts.geom.Coordinate modelSource
Modify using #setSource
-
modelDestination
protected org.locationtech.jts.geom.Coordinate modelDestination
Modify using #setDestination
-
coordinates
protected List coordinates
-
-
Constructor Detail
-
ConstrainedDragTool
public ConstrainedDragTool(WorkbenchContext context)
-
-
Method Detail
-
mousePressed
public void mousePressed(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 interfaceMouseListener
- Overrides:
mousePressed
in classAbstractCursorTool
-
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 org.locationtech.jts.geom.Envelope getBoxInModelCoordinates() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
modelClickBuffer
protected double modelClickBuffer()
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classAbstractCursorTool
-
doConstraint
protected org.locationtech.jts.geom.Coordinate doConstraint(MouseEvent e) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getCoordinates
public List getCoordinates()
-
mouseLocationChanged
protected void mouseLocationChanged(MouseEvent e)
-
getModelSource
protected org.locationtech.jts.geom.Coordinate getModelSource()
-
getModelDestination
protected org.locationtech.jts.geom.Coordinate getModelDestination()
-
setModelSource
protected void setModelSource(org.locationtech.jts.geom.Coordinate source)
-
setViewSource
protected void setViewSource(Point2D source) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classAbstractCursorTool
-
getShape
protected Shape getShape() throws Exception
- Specified by:
getShape
in classAbstractCursorTool
- Returns:
- null if nothing should be drawn
- Throws:
Exception
- if an Exception occurs during Shape construction
-
getViewSource
protected Point2D getViewSource() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getViewDestination
protected Point2D getViewDestination() throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
getShape
protected Shape getShape(Point2D source, Point2D destination) throws Exception
- Returns:
- null if nothing should be drawn
- Throws:
Exception
-
activate
public void activate(LayerViewPanel layerViewPanel)
- Specified by:
activate
in interfaceCursorTool
- Overrides:
activate
in classAbstractCursorTool
-
-