Re: Widgets and contour plots [message #42165 is a reply to message #42164] |
Tue, 11 January 2005 09:09   |
clive_cook59
Messages: 6 Registered: January 2005
|
Junior Member |
|
|
Ben Tupper wrote:
> Clive Cook wrote:
>> Hi,
>>
>> I am trying to write a widget program were buy passing the cursor
over a
>> contour plot a varying 2d plot changes according to the value where
the
>> cursor lies. I have a contour window with two boxes below that
display the
>> corresponding x and y values from the cursor location. So, i want
to take
>> the x value to produce a corresponding plot of the contour values
against
>> the y value.
>>
>> How do i take the x value and use that to generate a new plot?
>>
>
> Hi,
>
> I'm not sure I completely understand what your needs are. In
general, you can
> transform your mouse location into data space location using
CONVERT_COORD.
> From there you have to have some way of 'getting' the interpolated
values of
> your contour for that location. You can use the well known
Fanningistic
> approach to storing valuable program info in the the top level base's
UVALUE
> property.
>
> Is that close?
>
> Ben
>
> ***START***
> MyDrawEvent, ev
>
> ;get your valuable info
> Widget_Control, ev.top, GET_UVALUE = info, /NO_COPY
> ;set the current device state to match the draw widget's
> Widget_Control, ev.ID, GET_VALUE = winNum
> Wset, winNum
>
> ;convert from cursor coords to data coords
> xy = CONVERT_COORD(ev.x, ev.y, /DEVICE, /TO_DATA)
>
> ;pass your favorite routine to 'get' you contour data
> theseContourValues = GetMyContourValues(info.ContourData, xy)
>
> ;set the current window to you other window for plotting
> Widget_Control, info.myOtherDrawWidget, GET_VALUE = myOtherWinNum
> Wset, myOtherWindowNumber
> ;plot 'contour values against the y value.'
> Plot, XY[1], theseContourValues
>
> ;put your valuable info back in a safe place
> Widget_Control, ev.top, SET_UVALUE = info, /NO_COPY
>
> End ;myDrawEvent
>
>
> ****FINI***
Hi Ben,
Thanks for the advice. My problem now is that i seem to have problems
locating the value of my draw widget (the 2d line plot window)so that
i can
set that as the active window. When i configure my widget base i draw 1
large widget and then thecontour window in the top left in a new widget
base, followed by a second draw widget to the left in a new widget base
(contains the 2d line plot), followed my a widget below containing test
boxes that display the values of the data at the points of the cursor.
I am
getting confused as to how to obtain the values of my various draw
widgets,
any help would be useful.
I have tried using Dave Fannings methods but i am a little confused
with
this.
many thanks
Clive Cook
|
|
|