Re: IDLgrWindow zoomIn bug? [message #59744 is a reply to message #59697] |
Wed, 09 April 2008 03:29  |
Erik[1]
Messages: 23 Registered: December 2006
|
Junior Member |
|
|
On 8 apr, 17:47, Rick Towler <rick.tow...@nomail.noaa.gov> wrote:
> Erik wrote:
>> On 8 apr, 06:02, David Fanning wrote:
>>> I've never used the ZoomIn/ZoomOut features before. But
>>> I just put it into a program that was zooming in a different
>>> way. For me, when I zoom in, the draw widget gets twice its
>>> current size!! Zoom out, it shrinks down again.
>
>>> I don't know about you, but that is not what I expected
>>> at all. (IDL 6.4 on Windows). I was sort of hoping the
>>> view would zoom in and out. Why would you want the draw
>>> widget changing size!?
>> Wow that isn't what I expected either and I was hoping the same thing
>> as you! I can't check it in 6.4, but in 6.3 it didn't work that way.
>> Well, it seems that I have to continue writing my own zoom code and
>> that it wasn't a waste of time writing it. Only some minor issues I
>> have to face (like re-drawing the ROI's in the same proportion as the
>> zoomed image) ;-)
>
> Erik, How are you zooming? I never use ROI's, but I would think that
> if you are zooming by changing your viewplane rectangle that the ROI's
> would "zoom" too. Here's the zoom method from my camera code:
>
> pro Camera::Zoom, zoom
> ; Zoom the camera view by the specified zoom factor.
>
> compile_opt idl2
>
> if (N_ELEMENTS(zoom) eq 1) then begin
> case 1 of
> (zoom lt -1.0) : self.zoom = (-1.0D / zoom)
> (zoom gt 1.0) : self.zoom = zoom
> else : self.zoom = 1.0D
> endcase
>
> viewplaneRect = dblarr(4, /NOZERO)
> viewplaneRect[0:1] = self.viewcoord[0:1] - $
> (self.viewRect[2:3] / (2.0D * self.zoom))
> viewplaneRect[2:3] = self.viewRect[2:3] / self.zoom
>
> self -> IDLgrView::SetProperty, VIEWPLANE_RECT= viewplaneRect
> endif
>
> end
>
> Set up the vars that store the initial state once, after you have set up
> your initial view:
>
> self -> IDLgrView::GetProperty, VIEWPLANE_RECT=viewplaneRect
> self.viewRect = viewplaneRect
> self.viewcoord[0] = ((2. * self.viewRect[0]) + $
> self.viewRect[2]) / 2.
> self.viewcoord[1] = ((2. * self.viewRect[1]) + $
> self.viewRect[3]) / 2.
>
> -Rick
Hi Rick,
Thank you very much! Altering the viewplane_rect property does the
trick for me. Great!
Regards,
Erik
|
|
|