Class MoveToolEventHandler

java.lang.Object
qupath.lib.gui.viewer.tools.handlers.MoveToolEventHandler
All Implemented Interfaces:
EventListener, EventHandler<MouseEvent>

public class MoveToolEventHandler extends Object
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)
Author:
Pete Bankhead
  • Constructor Details

    • MoveToolEventHandler

      public MoveToolEventHandler()
  • Method Details

    • mousePressed

      public void mousePressed(MouseEvent e)
    • mouseDragged

      public void mouseDragged(MouseEvent e)
    • mouseReleased

      public void mouseReleased(MouseEvent e)
    • mouseMoved

      public void mouseMoved(MouseEvent e)
    • ensureCursorType

      protected void ensureCursorType(Cursor cursor)
      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

      protected QuPathViewer getViewer()
    • mouseLocationToImage

      protected Point2D mouseLocationToImage(MouseEvent e, boolean constrainToBounds, boolean snapToPixel)
    • requestParentClipping

      protected boolean requestParentClipping(MouseEvent e)
      Query whether parent clipping should be applied.

      This might depend upon the MouseEvent.

      Parameters:
      e -
      Returns:
    • refineROIByParent

      protected ROI refineROIByParent(ROI currentROI)
      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

      protected Geometry refineGeometryByParent(Geometry geometry)
    • 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 objects
      xx - x-coordinate in the image space of the starting point for the new object
      yy - y-coordinate in the image space of the starting point for the new object
      exclusions - 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

      protected PathObject getCurrentParent()
    • mouseClicked

      public void mouseClicked(MouseEvent e)
    • mouseEntered

      public void mouseEntered(MouseEvent e)
    • mouseExited

      public void mouseExited(MouseEvent e)
    • handle

      public void handle(MouseEvent event)
      Specified by:
      handle in interface EventHandler<MouseEvent>