Class Handle

java.lang.Object
java.awt.geom.Point2D
java.awt.Point
com.xinapse.multisliceimage.roi.Handle
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
AxisHandle, CentreHandle, CornerHandle, EdgeHandle, EndHandle, InsertionPointHandle, VertexHandle

public abstract class Handle extends Point
A Class representing an ROI Handle, used for changing the shape of an ROI.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.awt.geom.Point2D

    Point2D.Double, Point2D.Float
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.
    static final int
    The design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling.
    static final int
    The design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.
    static final int
    The design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling.

    Fields inherited from class java.awt.Point

    x, y
  • Constructor Summary

    Constructors
    Constructor
    Description
    Handle(int x, int y, int size)
    Creates a new Handle at the location (x,y) with the given size in screen pixels.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    Draws this Handle using the given Graphics context.
    static Color
    Returns the Color with which ROI Handle borders are to be drawn.
    static Color
    Returns the Color with which ROI Handles are to be drawn.
    final int
    Returns the size of this ROI in screen pixels.
    static int
    getSize(int separation)
    Returns a suitable size of Handle for drawing an ROI of the given size.
    static int
    getSize(int objectWidth, int objectHeight)
    Returns a suitable size of Handle for drawing an ROI of the given width and height.
    boolean
    Returns true if the specified point is over this handle; false otherwise.
    static void
    Sets the Color with which ROI Handle borders are to be drawn.
    static void
    Sets the Color with which ROI Handles are to be drawn.
    final void
    setSize(int size)
    Sets the size of this ROI in screen pixels.
    abstract String
    Returns a java.lang.String describing this Handle.

    Methods inherited from class java.awt.Point

    equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translate

    Methods inherited from class java.awt.geom.Point2D

    distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DESIGN_SIZE_SMALL

      public static final int DESIGN_SIZE_SMALL
      The design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling.
      See Also:
    • DESIGN_SIZE_LARGE

      public static final int DESIGN_SIZE_LARGE
      The design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.
      See Also:
    • SIZE_SMALL

      public static final int SIZE_SMALL
      The design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling.
    • SIZE_LARGE

      public static final int SIZE_LARGE
      The design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.
  • Constructor Details

    • Handle

      public Handle(int x, int y, int size)
      Creates a new Handle at the location (x,y) with the given size in screen pixels.
      Parameters:
      x - the x location of the Handle in screen coords.
      y - the y location of the Handle in screen coords.
      size - the size of the Handle in screen pixels.
  • Method Details

    • setSize

      public final void setSize(int size)
      Sets the size of this ROI in screen pixels.
      Parameters:
      size - the new size of this ROI in screen pixels.
    • getSize

      public final int getSize()
      Returns the size of this ROI in screen pixels.
      Returns:
      the size of this ROI in screen pixels.
    • pointOver

      public boolean pointOver(Point point)
      Returns true if the specified point is over this handle; false otherwise.
      Parameters:
      point - the Point to test.
      Returns:
      true if the specified point is over this handle; false otherwise.
    • draw

      public void draw(Graphics g)
      Draws this Handle using the given Graphics context.
      Parameters:
      g - the Graphics object on which the drawing operation is to be peformed.
    • getSize

      public static int getSize(int objectWidth, int objectHeight)
      Returns a suitable size of Handle for drawing an ROI of the given width and height.
      Parameters:
      objectWidth - the width of the ROI to which this handle is to be attached in screen pixels.
      objectHeight - the height of the ROI to which this handle is to be attached in screen pixels.
      Returns:
      a Handle size in screen pixels.
    • getSize

      public static int getSize(int separation)
      Returns a suitable size of Handle for drawing an ROI of the given size.
      Parameters:
      separation - the distance in screen pixels bewtween adjacent vertices of an ROI.
      Returns:
      a Handle size in screen pixels.
    • getColor

      public static Color getColor()
      Returns the Color with which ROI Handles are to be drawn.
      Returns:
      the Color with which ROI Handles are to be drawn.
    • getBorderColor

      public static Color getBorderColor()
      Returns the Color with which ROI Handle borders are to be drawn.
      Returns:
      the Color with which ROI Handle borders are to be drawn.
    • setColor

      public static void setColor(Color c)
      Sets the Color with which ROI Handles are to be drawn.
      Parameters:
      c - the new Color with which ROI Handles are to be drawn.
    • setBorderColor

      public static void setBorderColor(Color c)
      Sets the Color with which ROI Handle borders are to be drawn.
      Parameters:
      c - the new Color with which ROI Handle borders are to be drawn.
    • clone

      public Handle clone()
      Overrides:
      clone in class Point2D
    • toString

      public abstract String toString()
      Returns a java.lang.String describing this Handle.
      Overrides:
      toString in class Point
      Returns:
      a String describing this Handle.