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

Home » Public Forums » archive » Re: Zooming in Object Graphics
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: Zooming in Object Graphics [message #22935] Thu, 21 December 2000 14:32
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Thank you, Mark. My 9th Level Mac OS is so entirely undoubtedly superior
to any of them puny Unix flavors that it found the plain case name, too,
through the mixed case link. The file name originally *was* mixed case,
but when I posted the URL I realized that IDL on some inferior OSes
might not find the mixed-case method, so I renamed the file, but not the
link :-)

Cheers,
Pavel

Disclaimer : for those who fail to see it, the above statements about
OSes are a *joke*, not an invitation for the OS fight!

Mark Hadfield wrote:
>
> "Pavel A. Romashkin" <pavel.romashkin@noaa.gov> wrote in message
> news:3A425B40.D3115BB@noaa.gov...
>> ...It can be found at
>> http://spot.colorado.edu/~romashki/idl/IDLgrPlot__zoom.pro (talking
>> about exclusively named methods! :-).
>
> Hi Pavel
>
> That URL should be all lower-case, i.e.
>
> http://spot.colorado.edu/~romashki/idl/idlgrplot__zoom.pro
>
> Remember that some of the more primitive OSes have case-sensitive file
> systems!
Re: Zooming in Object Graphics [message #22937 is a reply to message #22935] Thu, 21 December 2000 13:38 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> wrote in message
news:3A425B40.D3115BB@noaa.gov...
> ...It can be found at
> http://spot.colorado.edu/~romashki/idl/IDLgrPlot__zoom.pro (talking
> about exclusively named methods! :-).

Hi Pavel

That URL should be all lower-case, i.e.

http://spot.colorado.edu/~romashki/idl/idlgrplot__zoom.pro

Remember that some of the more primitive OSes have case-sensitive file
systems!

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: Zooming in Object Graphics [message #22944 is a reply to message #22937] Thu, 21 December 2000 11:34 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
I am not helping with keeping the can of worms open, I hope. After all,
I am always open for an ig-nock. Anyway, I have tried both messing with
viewplane rectangle and with coord_conv, and for my degree of dumbness,
the coord conversion was much easier. With the Viewplane_rect approach I
finally zoomed to where I did not see anything at all in my Display, and
could not bring the contents back even manually. I am planning to dive
into Direct Coordinate Object Graphics realm, but for now the coord_conv works.
In fact, for the 2D case I have written a simple IDLgrPlot method that
zooms in and out, and all you have to do is give it the mouse press and
relase coordinates. It can be found at
http://spot.colorado.edu/~romashki/idl/IDLgrPlot__zoom.pro (talking
about exclusively named methods! :-).
I am not trying to say its good, but its fast and short. All you have to
do is get mouse click coords and call ZOOM method on any of the
IDLgrPlots in the current Model. Everything that pertains to the Plot
(axes, other plots) gets rescaled appropriately, new Coord_convs are
returned to you, etc.

Cheers,
Pavel
Re: Zooming in Object Graphics [message #22972 is a reply to message #22944] Wed, 20 December 2000 13:12 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"David Fanning" <davidf@dfanning.com> wrote in message
news:MPG.14aab41f9ee42b1c989cc6@news.frii.com...
> Well, I'm not convinched. But, Im' shure sober Mark
> Hatfield alreaady hash somethin like thish already...

"sober Mark Hatfield"? What!?

As a matter of fact, I am sober. It's 10 am here & I haven't had time to
drink any egg nog yet. Egg nog isn't all that appealing in the middle of
summer anyway.

Yeah I do have something like thish, it's called an MGH_Plot.

The basic idea is that when the user selects a new data range in the X
direction, the X axes are recalculated so that they span the new data range,
but with no change in the normalised range. This requires a change in
XCOORD_CONV and this new value is passed on to all the atoms that are
associated with that X axis. Pretty much what you said, David (before the
egg nog) and there's no changing the viewplane rectangle.

It's just a prejudice of mine, but I like to keep the viewplane rectangle
dimensions close to 2 x 2 and also try to ensure that a square in normalised
coordinates on the viewplane is square on the window or printer page.

Those who have looked at any of my code will not be surprised to hear that
MGH_Plot calls on a whole heap of other classes in my object library and
there's some really neat stuff in there with "master-slave" relationships
between the axes and atoms that I won't explain because I've forgotten how
it works. But if you want to take a look go to:

http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/

This URL looks a bit odd right now because the sysadmin fiddled with the
Apache settings.

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield/
National Institute for Water and Atmospheric Research
PO Box 14-901, Wellington, New Zealand
Re: Zooming in Object Graphics [message #22975 is a reply to message #22972] Wed, 20 December 2000 11:19 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Ben Tupper (btupper@bigelow.org) writes:

> I don't think so... the data should fit within the viewing rectangle and
> have a nice border around it.
>
> I wish that I could speak with more authority on the issue (eshpeciilay
> the igg-nog). I think I have to see it stepwise to see it.
>
> If Kellie had an original xrange of [0,100] and wanted to zoom into
> xrange = [50,75]...

Well, I'm not convinched. But, Im' shure sober Mark
Hatfield alreaady hash somethin like thish already...

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Zooming in Object Graphics [message #22976 is a reply to message #22975] Wed, 20 December 2000 10:55 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
David Fanning wrote:

>
> I don't know. Maybe with a couple more egg-nogs I could
> see it, but I don't understand how this will *zoom* anything.
> If you change *both* the viewport rectangle *and* the axes
> endpoints, aren't you just back to where you started!?
>

I don't think so... the data should fit within the viewing rectangle and
have a nice border around it.

I wish that I could speak with more authority on the issue (eshpeciilay
the igg-nog). I think I have to see it stepwise to see it.

If Kellie had an original xrange of [0,100] and wanted to zoom into
xrange = [50,75]...

> oView->SetProperty, ViewPlane_Rect = [xMin-0.2*xSpan, yMin-0.2*ySpan,
xSpan*1.4, ySpan*1.4]

ViewPlane_Rect = [50-0.2*25, yMin-0.2*ySpan, 25*1.4, ySpan*1.4]
ViewPlane_Rect = [45 , yMin-0.2*ySpan, 35 , ySpan*1.4]

oView->SetProperty, ViewPlane_Rect = [45 , yMin-0.2*ySpan, 35 , ySpan*1.4]
oGrAtom->SetProperty, xRange = [50,75], yRange = [yMin,yMax]

oXaxis->Location = [50,yMin,0], Range = [50,75]

oYaxis->Location = [50,yMin,0], Range = [yMin,yMax]


So I would keep track of in normalized values is the *location* of the
graphics atoms relative to the viewplane. The viewplane would then flex
to maintain that same relative location for the graphics atoms.

In normalized terms, the data occupies 0.71 of the viewport (1.0/1.4) of
the viewplane in the x direction. The left and right borders occupy
0.14 of the view plane each.

I'll have to write a routine to test it out (just as long as it works on
my monochrome display - I'm giving up on color!)

Ben

--
Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575
btupper@bigelow.org
Re: Zooming in Object Graphics [message #22979 is a reply to message #22976] Wed, 20 December 2000 10:23 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Ben Tupper (btupper@bigelow.org) writes:

> I don't want to open a can of worms, but...
>
> This topic always reminds me of Randall Frank's recommendation to use
> natural data coordinates rather than normalized data coordinates. I have
> only done the graphics in natural coordinates a couple of times, so I'm
> skating on thin ice with wobbly ankles. Zooming seems like a place where
> it might be especially useful; of course, it's just a hunch and I've yet
> to try it.
>
> The ViewPlane_Rect would have to change as well as the location of the
> axes/annotations (unless you didn't care to see them when zooming, kind
> of like zooming on a bitmap.) The data ranges can be controlled by the
> [XYZ]RANGE keywords. The tricky part is setting up the ViewPlane_Rect
> so there will be enough room for the axes, etc. I know I build in the
> border when making object graphics in normalized coordinates
> (ViewPlane_Rect = [-.2,-.2, 1.4,1.4] or some such thing.) In natural
> coordinates maybe the following could be done:
>
> xMin = Min(ZoomedDataX, Max = xMax)
> yMin = Min(ZoomedDataY, Max = yMax)
>
> xSpan = xMax-xMin
> ySpan = yMax-yMin
>
> oView->SetProperty, ViewPlane_Rect = [xMin-0.2*xSpan, yMin-0.2*ySpan,
> xSpan*1.4, ySpan*1.4]
>
> oGrAtom->SetProperty, xRange = [xMin,yMin], yRange = [yMin,yMax]
>
> oXaxis->Location = [xMin,yMin,0], Range = [xMin,xMax]
>
> oYaxis->Location = [xMin,yMin,0], Range = [yMin,yMax]
>
>
> Well, it's the holiday season, perhaps I'm having visions of sugared plums...

I don't know. Maybe with a couple more egg-nogs I could
see it, but I don't understand how this will *zoom* anything.
If you change *both* the viewport rectangle *and* the axes
endpoints, aren't you just back to where you started!?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Zooming in Object Graphics [message #22981 is a reply to message #22979] Wed, 20 December 2000 10:08 Go to previous message
btt is currently offline  btt
Messages: 345
Registered: December 2000
Senior Member
Hello,

I don't want to open a can of worms, but...

This topic always reminds me of Randall Frank's recommendation to use
natural data coordinates rather than normalized data coordinates. I have
only done the graphics in natural coordinates a couple of times, so I'm
skating on thin ice with wobbly ankles. Zooming seems like a place where
it might be especially useful; of course, it's just a hunch and I've yet
to try it.

The ViewPlane_Rect would have to change as well as the location of the
axes/annotations (unless you didn't care to see them when zooming, kind
of like zooming on a bitmap.) The data ranges can be controlled by the
[XYZ]RANGE keywords. The tricky part is setting up the ViewPlane_Rect
so there will be enough room for the axes, etc. I know I build in the
border when making object graphics in normalized coordinates
(ViewPlane_Rect = [-.2,-.2, 1.4,1.4] or some such thing.) In natural
coordinates maybe the following could be done:

xMin = Min(ZoomedDataX, Max = xMax)
yMin = Min(ZoomedDataY, Max = yMax)

xSpan = xMax-xMin
ySpan = yMax-yMin

oView->SetProperty, ViewPlane_Rect = [xMin-0.2*xSpan, yMin-0.2*ySpan,
xSpan*1.4, ySpan*1.4]

oGrAtom->SetProperty, xRange = [xMin,yMin], yRange = [yMin,yMax]

oXaxis->Location = [xMin,yMin,0], Range = [xMin,xMax]

oYaxis->Location = [xMin,yMin,0], Range = [yMin,yMax]


Well, it's the holiday season, perhaps I'm having visions of sugared plums...


Ben

--
Ben Tupper
Bigelow Laboratory for Ocean Sciences
180 McKown Point Rd.
W. Boothbay Harbor, ME 04575
btupper@bigelow.org
Re: Zooming in Object Graphics [message #22984 is a reply to message #22981] Wed, 20 December 2000 08:59 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kellie Brown (mcnaronbrowk@saic.com) writes:

> I'm pretty new to object graphics and have a problem I'm trying to
> figure out. I have a plot object that I allow a simple zooming
> capability. To zoom, I change the value of the viewplane_rect property
> of the IDLgrView. I also track the plot coordinates (translated to data
> space) as I move the mouse within my object graphic window.
>
> The problem: After I zoom in (for example) and change the viewplane_rect
> property, the coordinates that are returned to me are the same values as
> before I zoom. For example, I have a scatter plot of points and I want
> to display the coordinate of a point when I put the cursor over it. If
> the graphic has been zoomed in, then the data range shown in my 400x400
> graphics window has changed, and I'm not getting the same coordinate
> value as before for the same point.
>
> I assume this is because I have not changed the [xyz]coord_conv value of
> the graphic object, but I don't know what to do to change the value. My
> guess is I need to find out the new data range actually displayed in my
> window, but how do I do that based on the new value of viewplane_rect?
> I figure that once I determine this new data range, I can re-calculate
> the [xyz]coord_conv and, therefore, retrieve the same data coordinate
> for a point, even when it's in zoom mode.
>
> Am I on the right track? If so, can anyone help me figure out how to do
> this?

After giving this quite a bit of thought (and after looking
again at how my ZPLOT program works), I'm beginning to think
you may NOT be on the right track. In fact, I think you
may have gotten on the North bound train instead of
the South bound. (This happened to my son and I as we
were traipsing around Europe together last summer. In our
case it didn't matter because wherever we ended up was
fine with us, but it might matter to you.)

I say this because it occurs to me that changing the
Viewport rectangle is exactly what you would do if you
wanted to zoom into a plot and NOT change the data coordinate
space. In fact, NOT changing the data coordinate space is
what *makes* this technique a zooming technique. In other
words, if the data space remains the same, and you map
less of it into the window, you have, effectively, zoomed
into the data space.

But I would argue that you want just the opposite. You want
to leave the viewport rectangle alone, but display less of
the data coordinate space in *it*. In other words, you want
to change the amount of data space that is shown in the
window, thereby zooming into the data space. The latter
is simply a matter of calculating the end-points of the
relevant axis (perhaps with a rubberband box or something
similar), and then rescaling the axis end-points into the
viewplane rectangle space. This is a simple COORD_CONV
operation.

The advantage of doing this is that data points on
the plot will now maintain their real data coordinate
values, because they will be scaled appropriately.

This little stream-of-consciousness diatribe would require
a couple more passes to make intelligible, probably. But
I think this would put you back on the right track if you
could decipher it. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Polygon hull
Next Topic: New book on Calling C from IDL

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

Current Time: Wed Oct 08 14:01:37 PDT 2025

Total time taken to generate the page: 0.01086 seconds