comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Line-Mouse widget tool
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Line-Mouse widget tool [message #43234] Thu, 24 March 2005 08:11 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Howard S. Cohl writes:

> Oh, one more thing, if it's not too difficult, is to build into the
> widget the capability to use curved line segments (splines, or polynomials
> perhaps) as well as straight lines and be able to output either the
> equation of the curve or output a the numerical set of N values for the
> curved line segment.

Oh, well, a little more than an hour, then. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Line-Mouse widget tool [message #43235 is a reply to message #43234] Thu, 24 March 2005 08:04 Go to previous messageGo to next message
Howie[1] is currently offline  Howie[1]
Messages: 3
Registered: May 2004
Junior Member
On Thu, 24 Mar 2005 15:30:15 +0000, Howard S. Cohl wrote:

> I would like to build or use a simple pre-developed tool which
> wouuld draw a plot with data points in a certain set of x-y
> (possibly completely different) axes with specific units set by
> the user and is able to interactively draw a "moveable" lines
> on that plot with mouse clicks and notify the user of the positions
> in the data-space of the endpoints of the lines. This widget tool
> should then allow the user to to slightly alter the positions of
> the endpoints of the drawn lines and to tell the user specifically
> (to within a a user specified number of decimal places) where in
> the data space the endpoints are currently located, in real time.
> I would like this tool to be able to work with two separate lines,
> but I guess one would be enough if only that was possible.
>
> It would basically allow me to more easliy determine positions
> in a data space which I have been having to do interactively
> which takes a long time. Any ideas anybody?
>
> cheers, Howie


Oh, one more thing, if it's not too difficult, is to build into the
widget the capability to use curved line segments (splines, or polynomials
perhaps) as well as straight lines and be able to output either the
equation of the curve or output a the numerical set of N values for the
curved line segment.
Re: Line-Mouse widget tool [message #43236 is a reply to message #43235] Thu, 24 March 2005 07:50 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Howard S. Cohl writes:

> I would like to build or use a simple pre-developed tool which
> wouuld draw a plot with data points in a certain set of x-y
> (possibly completely different) axes with specific units set by
> the user and is able to interactively draw a "moveable" lines
> on that plot with mouse clicks and notify the user of the positions
> in the data-space of the endpoints of the lines. This widget tool
> should then allow the user to to slightly alter the positions of
> the endpoints of the drawn lines and to tell the user specifically
> (to within a a user specified number of decimal places) where in
> the data space the endpoints are currently located, in real time.
> I would like this tool to be able to work with two separate lines,
> but I guess one would be enough if only that was possible.
>
> It would basically allow me to more easliy determine positions
> in a data space which I have been having to do interactively
> which takes a long time. Any ideas anybody?

Well, as it happens, my Catalyst Library has this functionality
built into it. It would take perhaps an hour to throw this
type of application together, I think. Call me if you are
interested. It wouldn't be free, but it wouldn't be expensive,
either. :-)

You can learn more about the Catalyst Library here and download
an example program. The Arrow annotation tool (on the last tab)
does what you want. Right click on an arrow after you draw it,
and choose "Other Properties". Now you can observe the arrow
endpoints as you draw the arrow and its endpoints in the window.
This arrow uses a normalized coordinate system, but any object
in the Catalyst Library can use whatever coordinate system you
like. All we have to do it attach the arrow to the coordinate
system of your plot.

http://www.dfanning.com/tips/catlib.html

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Line-Mouse widget tool [message #43256 is a reply to message #43234] Tue, 29 March 2005 14:42 Go to previous message
Robert Barnett is currently offline  Robert Barnett
Messages: 70
Registered: May 2004
Member
David,

I render a direct graphics plot onto a widget_draw.
How do you transform a mouse click event which is specified in pixels to
data-space when using direct graphics? I can compute it from the
xmargin, ymargin, xtick_get, ytick_get, xsize and ysize. But, surely
there must be an easier way?

Here is an excerpt from my code:

; ev - The event struct
; draw_id - The Widget_Draw
; return_kewyords - Keywords returned from plot

xcharsize = 6.0
ycharsize = 10.0

geometry = widget_info(self.draw_id, /geometry)

; Calculate the corresponding x,y value coordinate on the plot
evx = ev.x - xmargin[0] * xcharsize
evy = ev.y - ymargin[0] * ycharsize
evwidth = geometry.xsize - total(xmargin) * xcharsize
evheight = geometry.ysize - total(ymargin) * ycharsize

xtickget = *return_keywords.xtick_get
ytickget = *return_keywords.ytick_get

xmaxtick = N_ELEMENTS(xtickget) - 1
ymaxtick = N_ELEMENTS(ytickget) - 1
x = xtickget[0] + (xtickget[xmaxtick] - xtickget[0]) * evx / evwidth
y = ytickget[0] + (ytickget[ymaxtick] - ytickget[0]) * evy / evheight

return, [x, y]




David Fanning wrote:

> Howard S. Cohl writes:
>
>
>> Oh, one more thing, if it's not too difficult, is to build into the
>> widget the capability to use curved line segments (splines, or polynomials
>> perhaps) as well as straight lines and be able to output either the
>> equation of the curve or output a the numerical set of N values for the
>> curved line segment.
>>
>
> Oh, well, a little more than an hour, then. :-)
>
> Cheers,
>
> David
>
>


--

nrb@
Robbie Barnett
imag
Research Assistant
wsahs
Nuclear Medicine & Ultrasound
nsw
Westmead Hospital
gov
Sydney Australia
au
+61 2 9845 7223
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: idl images and EXIF header
Next Topic: Line-Mouse widget tool

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:34:57 PDT 2025

Total time taken to generate the page: 0.00854 seconds