public class ArrowTool extends AbstractTool implements ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, ToolWithOptions
Clicking and dragging near the arrow base or head drags them individually. Clicking and dragging near the line drags the whole arrow.
Hold the SHIFT key to constrain the arrow direction to multiples of PI/4.
Double-click on the toolbar icon to display an option panel, on which the arrow head length, the line thickness and the arrow style can be changed.
For backward compatibility with the
previous
Arrow_.java
, if there is a Line
ROI
on the image when this plugin is called, we draw an arrow non-interactively.
ArrowTool
is the plugin class, that controls the arrow shape and position and deals with
user interactions.
AbstractTool
, which is an abstract tool aimed at standardizing future
ROI tools. It has the mechanisms to register the tool to windows and to the toolbar.
ArrowShape
is the arrow class that has the mechanism to draw the arrow, according to a
given style, head length, ... For convenience, it is wrapped in ArrowShapeRoi
that extends
ShapeRoi
.
ArrowOptionPanel
is the option panel displayed when the toolbar icon is double-clicked.
AbstractTool.KeyProxy, AbstractTool.KeyProxyIfNotConsumed, AbstractTool.MouseMotionProxy, AbstractTool.MouseMotionProxyIfNotConsumed, AbstractTool.MouseProxy, AbstractTool.MouseWheelProxy, AbstractTool.MouseWheelProxyIfNotConsumed, AbstractTool.ToolbarMouseAdapter
clearToolsIfNecessary, ijKeyProxy, keyProxy, mouseMotionProxy, mouseProxy, mouseWheelProxy, savedToolName, sliceListener, sliceObservers, toolActive, toolbar, toolbarMouseListener, toolID, toolToggleListener
Constructor and Description |
---|
ArrowTool() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Is called when the user change a property using the option panel.
|
String |
getToolIcon()
Return the string encoding of the tool icon as it will appear in the
toolbar.
|
String |
getToolName()
Return the tool name.
|
protected void |
handleRecording() |
static Roi |
makeRoi(ArrowShape.ArrowStyle style,
double x1,
double y1,
double x2,
double y2,
float width,
double headLength) |
void |
mouseClicked(MouseEvent e) |
void |
mouseDragged(MouseEvent e) |
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e)
If the mouse is released near the base AND if we are not dragging the base, then we want
to delete the tool.
|
void |
mouseWheelMoved(MouseWheelEvent e)
SHIFT key + MouseWheelEvent are used to change the arrow field.
|
void |
run(String arg) |
static void |
select(ArrowShape.ArrowStyle style,
double x1,
double y1,
double x2,
double y2,
float width,
double headLength) |
static void |
select(String style,
String x1,
String y1,
String x2,
String y2,
String width,
String headLength) |
void |
showOptionDialog()
When called, this method displays the configuration panel for the concrete
implementation of this tool.
|
addKeyListener, addMouseMotionListener, addMouseWheelListener, getImageCanvas, getImagePlus, getImageWindow, getOffscreenX, getOffscreenXDouble, getOffscreenY, getOffscreenYDouble, getToolID, imageClosed, imageOpened, imageUpdated, isThisTool, maybeUnregister, registerTool, registerTool, registerTool, unregisterTool, unregisterTool, unregisterTool, wasToolbarCleared, windowGainedFocus, windowLostFocus
public void run(String arg)
run
in interface ij.plugin.PlugIn
run
in class AbstractTool
public String getToolName()
AbstractTool
getToolName
in class AbstractTool
public String getToolIcon()
AbstractTool
getToolIcon
in class AbstractTool
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseWheelMoved(MouseWheelEvent e)
mouseWheelMoved
in interface MouseWheelListener
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
public void showOptionDialog()
ToolWithOptions
showOptionDialog
in interface ToolWithOptions
public void actionPerformed(ActionEvent e)
paint()
method draw it.actionPerformed
in interface ActionListener
protected void handleRecording()
public static void select(String style, String x1, String y1, String x2, String y2, String width, String headLength)
public static void select(ArrowShape.ArrowStyle style, double x1, double y1, double x2, double y2, float width, double headLength)
public static Roi makeRoi(ArrowShape.ArrowStyle style, double x1, double y1, double x2, double y2, float width, double headLength)
Copyright © 2015–2021 Fiji. All rights reserved.