Login  Register

Segmented Line Tool

Posted by lechristophe on Jan 11, 2007; 4:25pm
URL: http://imagej.273.s1.nabble.com/Segmented-Line-Tool-tp3700625.html

Dear all,

I'm trying to replicate the Segmented Line Tool with a Macro Tool using
getcursorLoc().

(So the Tool should do the following : once pressed, draw a segmented
line from the first point clicked, with a new segment each time a
location is clicked, exactly the behavior of the Segmented Line tool).

The problems are :

- I can't find a condition for a "while" loop that draws a line from the
last clicked position to the current location until the left button is
pressed.

- How to detect if the left button pressing inside this "while" loop, to
end the segment.

- After the button is pressed, how to go on with a new segment.

Why am I trying to do that ? Because I want then to replace the straight
segment by whatever I want between the two points (for exemple, a
macro-defined LIveWire tracing between the two points, or a straight
line if "shift" is pressed...)


Would anybody be kind enough to help me on that, or even better give me
the piece of macro code that replicates the Segmented Line tool, so that
I just have to replace the makeLine(x1,y1,x2,y2) by whatever I want ?



Thank you in advance,