[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: convert_coord problem
- Subject: Re: convert_coord problem
- From: Ben Tupper <btupper(at)bigelow.org>
- Date: Thu, 27 Jul 2000 08:54:50 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Bigelow Laboratory for Ocean Science
- References: <8lp5ab$8kf$1@news.tuwien.ac.at>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:20447
Hello,
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
window.)
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
2
!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.
Ben
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
btupper@bigelow.org
note: email address new as of 25JULY2000