Class DragTool
java.lang.Object
com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
com.vividsolutions.jump.workbench.ui.cursortool.DragTool
- All Implemented Interfaces:
CursorTool, MouseListener, MouseMotionListener, EventListener
- Direct Known Subclasses:
AbstractZoomTool, MoveSelectedItemsTool, MoveVertexTool, RectangleTool, RotateSelectedItemTool, ScaleSelectedItemsTool, SelectItemsByCircleTool, SelectTool, SpecifyFeaturesTool, SuperZoomPanTool
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 AbstractCursorTool
AbstractCursorTool.Listener -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected org.locationtech.jts.geom.CoordinateModify using #setDestinationprotected org.locationtech.jts.geom.CoordinateModify using #setSourceFields inherited from class AbstractCursorTool
isLinuxOS, panel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected org.locationtech.jts.geom.Envelopeprotected org.locationtech.jts.geom.Coordinateprotected org.locationtech.jts.geom.Coordinateprotected ShapegetShape()protected Shapeprotected Point2Dprotected Point2Dprotected doublevoidvoidBegins handling of the drag.voidprotected voidsetModelDestination(org.locationtech.jts.geom.Coordinate destination) 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 voidsetViewDestination(Point2D destination) protected voidsetViewSource(Point2D source) protected booleanwasClick()Methods inherited from class AbstractCursorTool
activate, add, allowSnapping, cancelGesture, check, cleanup, clearImage, clearShape, componentWithFocusIsHandledByCursorTools, createCursor, createCursor, createCursor, createStandardSnappingPolicies, 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, wasShiftPressedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CursorTool
getIcon
-
Field Details
-
DEFAULT_VIEW_CLICK_BUFFER
public static final int DEFAULT_VIEW_CLICK_BUFFER- See Also:
-
modelSource
protected org.locationtech.jts.geom.Coordinate modelSourceModify using #setSource -
modelDestination
protected org.locationtech.jts.geom.Coordinate modelDestinationModify using #setDestination
-
-
Constructor Details
-
DragTool
-
-
Method Details
-
deactivate
public void deactivate()- Specified by:
deactivatein interfaceCursorTool- Overrides:
deactivatein classAbstractCursorTool
-
mousePressed
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.- Parameters:
clickBuffer- buffer size in view coordinates
-
wasClick
protected boolean wasClick() -
getBoxInModelCoordinates
protected org.locationtech.jts.geom.Envelope getBoxInModelCoordinates() throws NoninvertibleTransformException- Throws:
NoninvertibleTransformException
-
modelClickBuffer
protected double modelClickBuffer() -
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classAbstractCursorTool
-
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
- Throws:
NoninvertibleTransformException
-
setViewDestination
- Throws:
NoninvertibleTransformException
-
setModelDestination
protected void setModelDestination(org.locationtech.jts.geom.Coordinate destination) -
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classAbstractCursorTool
-
getShape
- Specified by:
getShapein classAbstractCursorTool- Returns:
- null if nothing should be drawn
- Throws:
Exception- if an Exception occurs during Shape construction
-
getViewSource
- Throws:
NoninvertibleTransformException
-
getViewDestination
- Throws:
NoninvertibleTransformException
-
getShape
- Parameters:
source- initial positiondestination- final position- Returns:
- a Rectangle defined by the initial and final position or null if nothing should be drawn
- Throws:
Exception- if an Exception occurs during the Rectangle construction
-