Matthias Reich | 14 May 15:26

Re: Zoomer always zooms to absolute maximum zoom

Uwe Rathmann wrote:

> If you tell us, what your intentions are chances are better to get a useful 
> answer.

Ok. Here we go.

I'm trying to code a generic qwt_plot that has an inherent zoomer 
implemented. After receiving a call to setZoomEnable (similar to Bode) 
the plot can be zoomed as needed.

At the same time the plot is supposed to stick around while curves with 
different bounding boxes are added and removed to/from it. On every 
removeCurve and addCurve, the plot should adjust its zoomBase so that it 
is the envelope of all boundingRects of the attached curves.

Currently, it seems the adding and removing of curves works ok. The 
scales are adjusted and the (auto?)replot sends the full glory to the 
screen. I use setZoomBase(boundingRect) and then zoom(0) to achieve this.

So far so good.

But this is before I actually use the zoomMode.

Enabling zoom mode and disabling it straight without doing a zoom is 
fine. Everything still works as advertised above. But if I do a zoom and 
then switch around curves by removing and reattaching curves with 
smaller y-bounds, the zoom base somehow resists being reset to a smaller 
rectangle than it had at some point before. The x-axis likely would do 
the same, but I have identical x-axis lengths, so the issue doesn't surface.

That's the problem:
-------------------
Setting zoomBase with a smaller Rectangle than was set before fails for 
the y-direction, if the zoomStack was used before. All my x-axis are 
identical, so I can't relly tell whether x-axis does the same.

Further observations:
Before I actually zoom, the zoomBase() reports (using cerr<<) integer 
bounds, although the data does not have integer bounds (1.9504 instead 
of 2). As soon as the first zoomRect has been added to the zoomStack, 
the zoomBase reports double values identical to the data and doesn't 
shrink anymore, unless I zoom and replot while zoomed.

Esentially, it looks like the setZoomBase() doesn't allow smaller 
y-values than are present in its current zoomRect. Is this intentional ? 
If so, how can I elgantly get around it (I don't want to have to delete 
the zoomer and allocate a new one, for instance).

I can supply code, if that helps to sort out the problem. A nudge in the 
right direction could already help, though.

Cheers,
Matthias

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane