Package com.xinapse.multisliceimage.roi
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
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
FieldsModifier and TypeFieldDescriptionstatic final intThe design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.static final intThe design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling.static final intThe design size of Handles (in screen pixels) when they are drawn large, with no HiDPI scaling.static final intThe design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling. -
Constructor Summary
ConstructorsConstructorDescriptionHandle(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 TypeMethodDescriptionclone()voidDraws this Handle using the given Graphics context.static ColorReturns the Color with which ROI Handle borders are to be drawn.static ColorgetColor()Returns the Color with which ROI Handles are to be drawn.final intgetSize()Returns the size of this ROI in screen pixels.static intgetSize(int separation) Returns a suitable size of Handle for drawing an ROI of the given size.static intgetSize(int objectWidth, int objectHeight) Returns a suitable size of Handle for drawing an ROI of the given width and height.booleanReturns true if the specified point is over this handle; false otherwise.static voidSets the Color with which ROI Handle borders are to be drawn.static voidSets the Color with which ROI Handles are to be drawn.final voidsetSize(int size) Sets the size of this ROI in screen pixels.abstract StringtoString()Returns a java.lang.String describing this Handle.Methods inherited from class java.awt.Point
equals, getLocation, getX, getY, move, setLocation, setLocation, setLocation, translateMethods inherited from class java.awt.geom.Point2D
distance, distance, distance, distanceSq, distanceSq, distanceSq, hashCode, setLocation
-
Field Details
-
DESIGN_SIZE_SMALL
public static final int DESIGN_SIZE_SMALLThe 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_LARGEThe 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_SMALLThe design size of Handles (in screen pixels) when they are drawn small, with no HiDPI scaling. -
SIZE_LARGE
public static final int SIZE_LARGEThe 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
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
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
Returns the Color with which ROI Handles are to be drawn.- Returns:
- the Color with which ROI Handles are to be drawn.
-
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
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
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
-
toString
Returns a java.lang.String describing this Handle.
-