Class MoveToolEventHandler
java.lang.Object
qupath.lib.gui.viewer.tools.handlers.MoveToolEventHandler
- All Implemented Interfaces:
EventListener,EventHandler<MouseEvent>
The MoveTool is used for quite a lot of things, movement-related:
movement around an image (panning), moving ROIs (translating) and moving individual
'handles' of ROIs (resizing/reshaping)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classHelper class for panning aQuPathViewer(reasonably) smoothly. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidensureCursorType(Cursor cursor) Ensure that the specified cursor is set in the current viewer.protected PathObjectprotected QuPathViewervoidhandle(MouseEvent event) voidvoidvoidvoidprotected Point2DmouseLocationToImage(MouseEvent e, boolean constrainToBounds, boolean snapToPixel) voidvoidvoidprotected GeometryrefineGeometryByParent(Geometry geometry) protected ROIrefineROIByParent(ROI currentROI) Apply clipping based on the current parent object.protected booleanQuery whether parent clipping should be applied.protected booleanReturns true if the tool requests that pixel coordinates be snapped to integer values.protected voidReset the constraining objects.protected voidupdatingConstrainingObjects(QuPathViewer viewer, double xx, double yy, Collection<PathObject> exclusions) New annotations can be constrained while they are being drawn, to avoid overlaps with existing annotations or to ensure they are drawn within a parent annotation.
-
Constructor Details
-
MoveToolEventHandler
public MoveToolEventHandler()
-
-
Method Details
-
mousePressed
-
mouseDragged
-
mouseReleased
-
mouseMoved
-
ensureCursorType
Ensure that the specified cursor is set in the current viewer.- Parameters:
cursor-
-
requestPixelSnapping
protected boolean requestPixelSnapping()Returns true if the tool requests that pixel coordinates be snapped to integer values. Default returns true.- Returns:
-
getViewer
-
mouseLocationToImage
protected Point2D mouseLocationToImage(MouseEvent e, boolean constrainToBounds, boolean snapToPixel) -
requestParentClipping
Query whether parent clipping should be applied.This might depend upon the MouseEvent.
- Parameters:
e-- Returns:
-
refineROIByParent
Apply clipping based on the current parent object.Returns an empty ROI if this result of the clipping is an empty area.
- Parameters:
currentROI-- Returns:
-
refineGeometryByParent
-
updatingConstrainingObjects
protected void updatingConstrainingObjects(QuPathViewer viewer, double xx, double yy, Collection<PathObject> exclusions) New annotations can be constrained while they are being drawn, to avoid overlaps with existing annotations or to ensure they are drawn within a parent annotation.This method requests that the constraining objects are identified now based upon the specified mouse position. It is useful when starting to draw with a tool that makes use of constraining objects.
- Parameters:
viewer- the viewer that may contain potential constraining objectsxx- x-coordinate in the image space of the starting point for the new objectyy- y-coordinate in the image space of the starting point for the new objectexclusions- objects not to consider (e.g. the new ROI being created)
-
resetConstrainingObjects
protected void resetConstrainingObjects()Reset the constraining objects. These should be done as soon as they are no longer required, to prevent a memory leak by inadvertently holding on to an object hierarchy too long. -
getCurrentParent
-
mouseClicked
-
mouseEntered
-
mouseExited
-
handle
- Specified by:
handlein interfaceEventHandler<MouseEvent>
-