public class FreeformTool extends OverlayTool
Modifier and Type | Class and Description |
---|---|
protected class |
FreeformTool.DistanceQuery
Wraps information about the distance from a point to a freeform object.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
CHILL
Constant for "wait" mode.
|
protected float |
downX
Point at which mouseDown occurs.
|
protected float |
downY
Point at which mouseDown occurs.
|
protected static int |
DRAW
Consant for "draw" mode.
|
protected static double |
DRAW_THRESH
When drawing or editing, how far mouse must be dragged before new node is
added.
|
protected static int |
EDIT
Constant for "edit" mode.
|
protected static double |
EDIT_THRESH
Threshhold within which click must occur to invoke edit mode.
|
protected static int |
ERASE
Constant for "erase" mode.
|
protected static double |
ERASE_THRESH
How close a mouseDrag event must be to a node in order to erase it.
|
protected OverlayFreeform |
freeform
Curve currently being drawn or modified.
|
protected FreeformExtension |
freeformExtension
FreeformExtension wraps info about an edit to a curve.
|
protected static int |
INIT
Constant for "init" mode.
|
protected int |
mode
Stores the current mode (INIT, ERASE, CHILL, DRAW, EDIT).
|
protected Vector |
otherFreefs
Other freeforms on the canvas.
|
protected static double |
RECONNECT_THRESH
Threshhold within which click must occur to invoke extend mode or reconnect
a freeformExtension.
|
protected static double |
RESUME_THRESH
How close mouse must be to end node to resume drawing.
|
protected static float |
S
Smoothing factor for "single exponential smoothing".
|
icon, name, overlay, tip
Constructor and Description |
---|
FreeformTool(OverlayTransform overlay)
Constructs a freeform creation tool.
|
Modifier and Type | Method and Description |
---|---|
protected void |
eraseNearestNodeWithin(float thresh,
float x,
float y)
Erases the nearest node of freeforms nearby.
|
protected FreeformTool.DistanceQuery |
getClosestFreeform(DisplayImpl display,
double dpx,
double dpy,
double thresh)
Returns the closest (subject to a threshhold) OverlayFreeform object to the
given point.
|
protected Vector |
getFreeforms(boolean includeThis)
Compiles a list of other freeforms at the current dimensional position.
|
void |
mouseDown(DisplayEvent e,
int px,
int py,
float dx,
float dy,
int[] pos,
int mods)
Instructs this tool to respond to a mouse press.
|
void |
mouseDrag(DisplayEvent e,
int px,
int py,
float dx,
float dy,
int[] pos,
int mods)
Instructs this tool to respond to a mouse drag.
|
void |
mouseUp(DisplayEvent e,
int px,
int py,
float dx,
float dy,
int[] pos,
int mods)
Instructs this tool to respond to a mouse release.
|
void |
print(String methodName,
String message)
Prints a message for debugging.
|
protected void |
removeEmptyFreeforms(OverlayFreeform[] objs)
Removes any freeforms with one or fewer nodes.
|
deselectAll, getIcon, getName, getTip, getTransform, keyPressed, keyReleased, mouseMoved
protected static final double DRAW_THRESH
protected static final double ERASE_THRESH
protected static final double EDIT_THRESH
protected static final double RECONNECT_THRESH
protected static final double RESUME_THRESH
protected static final float S
protected static final int ERASE
protected static final int CHILL
protected static final int DRAW
protected static final int EDIT
protected static final int INIT
protected OverlayFreeform freeform
protected Vector otherFreefs
protected FreeformExtension freeformExtension
protected int mode
protected float downX
protected float downY
public FreeformTool(OverlayTransform overlay)
public void mouseDown(DisplayEvent e, int px, int py, float dx, float dy, int[] pos, int mods)
mouseDown
in class OverlayTool
e
- DisplayEvent corresponding to this mouse press.px
- X coordinate of mouse press in pixel coordinate system.py
- Y coordinate of mouse press in pixel coordinate system.dx
- X coordinate of mouse press in data coordinate system.dy
- Y coordinate of mouse press in data coordinate system.pos
- Dimensional position of mouse press.mods
- Modifiers of mouse press.public void mouseDrag(DisplayEvent e, int px, int py, float dx, float dy, int[] pos, int mods)
mouseDrag
in class OverlayTool
e
- DisplayEvent corresponding to this mouse drag.px
- X coordinate of mouse drag in pixel coordinate system.py
- Y coordinate of mouse drag in pixel coordinate system.dx
- X coordinate of mouse drag in data coordinate system.dy
- Y coordinate of mouse drag in data coordinate system.pos
- Dimensional position of mouse drag.mods
- Modifiers of mouse drag.public void mouseUp(DisplayEvent e, int px, int py, float dx, float dy, int[] pos, int mods)
mouseUp
in class OverlayTool
e
- DisplayEvent corresponding to this mouse release.px
- X coordinate of mouse release in pixel coordinate system.py
- Y coordinate of mouse release in pixel coordinate system.dx
- X coordinate of mouse release in data coordinate system.dy
- Y coordinate of mouse release in data coordinate system.pos
- Dimensional position of mouse release.mods
- Modifiers of mouse release.protected Vector getFreeforms(boolean includeThis)
protected void eraseNearestNodeWithin(float thresh, float x, float y)
protected void removeEmptyFreeforms(OverlayFreeform[] objs)
protected FreeformTool.DistanceQuery getClosestFreeform(DisplayImpl display, double dpx, double dpy, double thresh)
Copyright © 2015–2022 SciJava. All rights reserved.