Class AbstractCursorTool
- java.lang.Object
-
- org.locationtech.jts.jump.workbench.ui.cursortool.AbstractCursorTool
-
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener,CursorTool
- Direct Known Subclasses:
DragTool,MultiClickTool,SnapIndicatorTool
public abstract class AbstractCursorTool extends Object implements CursorTool
A tool that draws an XOR visual indicator. Subclasses need not keep track of the XOR state of the indicator -- that logic is all handled by this class. Even if the LayerViewPanel is repainted while the XOR indicator is on-screen.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractCursorTool.Listener
-
Constructor Summary
Constructors Constructor Description AbstractCursorTool()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivate(LayerViewPanel layerViewPanel)voidadd(AbstractCursorTool.Listener listener)voidallowSnapping()Makes this CursorTool obey the snapping settings in the Options dialog.voidcancelGesture()Notifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.protected booleancheck(EnableCheck check)protected voidcleanup(Graphics2D graphics)protected voidclearShape()static CursorcreateCursor(Image image)The cursor will look best if the image is a 32 x 32 transparent GIF.static CursorcreateCursor(Image image, Point hotSpot)static ListcreateStandardSnappingPolicies(Blackboard blackboard)voiddeactivate()protected voiddrawShapeXOR(Graphics2D g)protected voiddrawShapeXOR(Shape shape, Graphics2D graphics)protected voidexecute(UndoableCommand command)Optional means of execution, with undoability.protected voidfireGestureFinished()protected abstract voidgestureFinished()ColorgetColor()CursorgetCursor()StringgetName()Returns a very brief description of this CursorTool.protected LayerViewPanelgetPanel()protected abstract ShapegetShape()SnapManagergetSnapManager()protected TaskFramegetTaskFrame()JUMPWorkbenchgetWorkbench()booleanisGestureInProgress()Used by OrCompositeTool to determine whether a CursorTool is busy interacting with the user.booleanisRightMouseButtonUsed()protected booleanisRollingBackInvalidEdits()booleanisShapeOnScreen()Important for XOR drawing.voidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)voidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)voidmouseReleased(MouseEvent e)static Stringname(CursorTool tool)protected voidredrawShape()protected voidreportNothingToUndoYet()Notifies the UndoManager that this PlugIn did not modify any model states, and therefore the undo history should remain unchanged.voidsetColor(Color color)protected voidsetFilling(boolean filling)protected voidsetStroke(Stroke stroke)protected voidsetStrokeWidth(int strokeWidth)Deprecated.Use #setStroke instead.protected voidsetup(Graphics2D graphics)protected org.locationtech.jts.geom.Coordinatesnap(Point2D viewPoint)protected org.locationtech.jts.geom.Coordinatesnap(org.locationtech.jts.geom.Coordinate modelCoordinate)StringtoString()protected booleanwasControlPressed()protected booleanwasShiftPressed()static JUMPWorkbenchworkbench(LayerViewPanel panel)static WorkbenchFrameworkbenchFrame(LayerViewPanel layerViewPanel)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.locationtech.jts.jump.workbench.ui.cursortool.CursorTool
getIcon
-
-
-
-
Method Detail
-
allowSnapping
public void allowSnapping()
Makes this CursorTool obey the snapping settings in the Options dialog.
-
wasShiftPressed
protected boolean wasShiftPressed()
-
wasControlPressed
protected boolean wasControlPressed()
-
createCursor
public static Cursor createCursor(Image image)
The cursor will look best if the image is a 32 x 32 transparent GIF.
-
getCursor
public Cursor getCursor()
- Specified by:
getCursorin interfaceCursorTool
-
isGestureInProgress
public boolean isGestureInProgress()
Used by OrCompositeTool to determine whether a CursorTool is busy interacting with the user.- Specified by:
isGestureInProgressin interfaceCursorTool
-
isRightMouseButtonUsed
public boolean isRightMouseButtonUsed()
- Specified by:
isRightMouseButtonUsedin interfaceCursorTool- Returns:
- true if this CursorTool uses the right mouse button; false to allow the panel to show a popup-menu on right-clicks
-
isShapeOnScreen
public boolean isShapeOnScreen()
Important for XOR drawing. Even if #getShape returns null, this method will return true between calls of #redrawShape and #clearShape.
-
activate
public void activate(LayerViewPanel layerViewPanel)
- Specified by:
activatein interfaceCursorTool
-
workbenchFrame
public static WorkbenchFrame workbenchFrame(LayerViewPanel layerViewPanel)
-
createStandardSnappingPolicies
public static List createStandardSnappingPolicies(Blackboard blackboard)
-
isRollingBackInvalidEdits
protected boolean isRollingBackInvalidEdits()
-
deactivate
public void deactivate()
- Specified by:
deactivatein interfaceCursorTool
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleasedin interfaceMouseListener
-
setColor
public void setColor(Color color)
-
setFilling
protected void setFilling(boolean filling)
-
setStrokeWidth
protected void setStrokeWidth(int strokeWidth)
Deprecated.Use #setStroke instead.
-
setStroke
protected void setStroke(Stroke stroke)
-
setup
protected void setup(Graphics2D graphics)
-
getPanel
protected LayerViewPanel getPanel()
-
getShape
protected abstract Shape getShape() throws Exception
- Returns:
- null if nothing should be drawn
- Throws:
Exception
-
cleanup
protected void cleanup(Graphics2D graphics)
-
clearShape
protected void clearShape()
-
cancelGesture
public void cancelGesture()
Description copied from interface:CursorToolNotifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.- Specified by:
cancelGesturein interfaceCursorTool
-
drawShapeXOR
protected void drawShapeXOR(Graphics2D g) throws Exception
- Throws:
Exception
-
drawShapeXOR
protected void drawShapeXOR(Shape shape, Graphics2D graphics)
-
snap
protected org.locationtech.jts.geom.Coordinate snap(Point2D viewPoint) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
snap
protected org.locationtech.jts.geom.Coordinate snap(org.locationtech.jts.geom.Coordinate modelCoordinate)
-
getTaskFrame
protected TaskFrame getTaskFrame()
- Returns:
- null if the LayerViewPanel is not inside a TaskFrame
-
getWorkbench
public JUMPWorkbench getWorkbench()
-
workbench
public static JUMPWorkbench workbench(LayerViewPanel panel)
-
add
public void add(AbstractCursorTool.Listener listener)
-
execute
protected void execute(UndoableCommand command)
Optional means of execution, with undoability.
-
reportNothingToUndoYet
protected void reportNothingToUndoYet()
Notifies the UndoManager that this PlugIn did not modify any model states, and therefore the undo history should remain unchanged. Call this method inside #execute(PlugInContext).
-
getName
public String getName()
Description copied from interface:CursorToolReturns a very brief description of this CursorTool.- Specified by:
getNamein interfaceCursorTool- Returns:
- the name of this CursorTool
-
name
public static String name(CursorTool tool)
-
check
protected boolean check(EnableCheck check)
-
getSnapManager
public SnapManager getSnapManager()
-
getColor
public Color getColor()
-
-