[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convert_coord problem


it sounds like you are using direct graphics.

The CONVERT_COORD function makes the conversions using the scaling factors in
!X .Sand !Y.S from the _most_recent_ plot.   So the conversion will work
properly in the most recent plot, but it will produce garbage for any of the
earlier ones.   You could do a couple of things to get around this limitation.

(1) Save the values !X.S and !Y.S for each plot window (these are originally
stored after the graphic command that sets up the coordinate system for each

   Win1_XS = !X.S   &   Win1_YS = !Y.S
   Win2_XS = !X.S   &    Win2_YS = !Y.S

Later, when a mouse event arrives, assign the appropriate values to !X.S and
!Y.S and make the neccessary conversions.   So if an event arrives from window

   !X.S = WidgetInfoStructure.Win1_XS
   !Y.S = WidgetInfoStructure.Win2_YS

    DataCoord = CONVERT_COORD(Event.X, Event.Y,/Device,/To_Data)

(2)  You could save the values of !X.S and !Y.S and write your own conversion
routine using the conversion formulas described in the online help.  (See
Coordinate Conversion for Direct Graphics)

(3) You might check out Liam Gumley's Frame Tools (you can find them through
David Fanning's links web page.)  I don't know if these tools will solve your
problem, but it sounds like the might help.


Klaus Scipal wrote:

> Hi
> I have a widget with several graphic windows. On of it returns the
> co-ordinates of the mouse button if pressed. These co-ordinates are then
> converted from device to data (longitude, latitude) using the convert_coord
> routine, and some data is plotted in the other windows. Now comes my
> problem: the convert_coord routine gives the correct co-ordinates only in
> its first call. when I try to convert another pair of co-ordinates the
> result is flawed. What can be wrong???
> Klaus
> p.s.: I use IDL 5.2 under Windows NT

Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
     note: email address new as of 25JULY2000