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 Listcoordinatesstatic intDEFAULT_VIEW_CLICK_BUFFERprotected org.locationtech.jts.geom.CoordinatemodelDestinationModify using #setDestinationprotected org.locationtech.jts.geom.CoordinatemodelSourceModify 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 voidactivate(LayerViewPanel layerViewPanel)protected org.locationtech.jts.geom.CoordinatedoConstraint(MouseEvent e)protected org.locationtech.jts.geom.EnvelopegetBoxInModelCoordinates()ListgetCoordinates()protected org.locationtech.jts.geom.CoordinategetModelDestination()protected org.locationtech.jts.geom.CoordinategetModelSource()protected ShapegetShape()protected ShapegetShape(Point2D source, Point2D destination)protected Point2DgetViewDestination()protected Point2DgetViewSource()protected doublemodelClickBuffer()voidmouseDragged(MouseEvent e)protected voidmouseLocationChanged(MouseEvent e)voidmousePressed(MouseEvent e)Begins handling of the drag.voidmouseReleased(MouseEvent e)protected voidsetModelSource(org.locationtech.jts.geom.Coordinate source)protected voidsetViewClickBuffer(int clickBuffer)A click is converted into a box by being expanded by this amount in the four directions.protected voidsetViewSource(Point2D source)protected booleanwasClick()-
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, 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:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin 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:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin 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:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classAbstractCursorTool
-
getShape
protected Shape getShape() throws Exception
- Specified by:
getShapein 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:
activatein interfaceCursorTool- Overrides:
activatein classAbstractCursorTool
-
-