Matthias Pospiech | 27 Apr 14:48
Picon
Picon

Zoomer always zooms to absolute maximum zoom

I am using the example code form the spectrogramm example.
I changed in such a way that it excepts data arrays, which works good 
and has been discussed here as well.

Now I experience that any zoom done in the running programm zoom 
automatically step by step to the maximum zoom, which is basically a 
singel pixel of the data array. The zoom therefore is practically usedless.

Any ideas how to debug this are welcome.

Matthias

Here the code

class MyZoomer: public QwtPlotZoomer
{
public:
    MyZoomer(QwtPlotCanvas* canvas): QwtPlotZoomer(canvas)
    {
        setTrackerMode(QwtPicker::AlwaysOn);
    }

protected:
    virtual QwtText trackerText( const QwtDoublePoint& p ) const
    {
        QwtText t( QwtPlotPicker::trackerText( p ));

        QColor c(Qt::white);
        c.setAlpha(180);
        t.setBackgroundBrush( QBrush(c) );
(Continue reading)

Matthias Reich | 28 Apr 09:32
Picon

Re: Zoomer always zooms to absolute maximum zoom

Matthias Pospiech wrote:
> I am using the example code form the spectrogramm example.
> I changed in such a way that it excepts data arrays, which works good 
> and has been discussed here as well.
> 
> Now I experience that any zoom done in the running programm zoom 
> automatically step by step to the maximum zoom, which is basically a 
> singel pixel of the data array. The zoom therefore is practically usedless.

If anyone cares to answer to this...

The zoomer still gives me headaches, even (or especially) when I look 
into the example(s). Maybe it's just me or the zoomer has been made 
super powerful, but I just don't seem to understand its workings, 
especially the interaction with axes and how to get the canvas right.

I could get away with using setZoomBase to get the behavior I wanted, 
but I'm fairly sure this isn't the intended use for it.

Is it to much to ask for a little tutorial ?
(only if someone spends time anyway)

Thanks,
Matthias

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
(Continue reading)

Uwe Rathmann | 28 Apr 20:50
Picon

Re: Zoomer always zooms to absolute maximum zoom

On Monday 28 April 2008 09:32, Matthias Reich wrote:

> The zoomer still gives me headaches, even (or especially) when I look
> into the example(s). Maybe it's just me or the zoomer has been made
> super powerful, but I just don't seem to understand its workings,
> especially the interaction with axes and how to get the canvas right.

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

> Is it to much to ask for a little tutorial ?

Obviously Qwt needs more documentation than examples and the class APIs only. 
Of course I have thought about this before and know how it could look like. 
But I have already started too many things, so it is not realistic, that it 
will happen.

But if someone is willing to take this job I can support her/him with a 
initial document structure and text snippets.

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Matthias Reich | 14 May 15:26
Picon

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.
(Continue reading)

Matthias Reich | 14 May 17:39
Picon

Re: Zoomer always zooms to absolute maximum zoom

I have figured out, that the new ZoomBase seems to be indeed unified 
intentionally with the current ScaleRect. The question remains then, 
however, why this mechanism is not effective when there hasn't been any 
zoom action, but becomes relevant after that initial zoom happens...

Cheers,
Matthias

Matthias Reich wrote:
> 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.
(Continue reading)

Uwe Rathmann | 15 May 06:07
Picon

Re: Zoomer always zooms to absolute maximum zoom

On Wednesday 14 May 2008 17:39, Matthias Reich wrote:

> I have figured out, that the new ZoomBase seems to be indeed unified
> intentionally with the current ScaleRect. The question remains then,
> however, why this mechanism is not effective when there hasn't been any
> zoom action, but becomes relevant after that initial zoom happens...

The zoomer maintains a stack of rectangles. With setZoomBase you clear this 
stack and assign a rectangle as first element. With zoom(QwtDoubleRect) you 
can push a rectangle and with zoom(int) you navigate on the stack. With both 
calls the scales of the plot are adjusted to the corrsponding rect.

If something weird is happening I recommend to debug the rectangles, that are 
pushed/popped to the stack.

Uwe

-------------------------------------------------------------------------
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/
Matthias Reich | 15 May 10:37
Picon

Re: Zoomer always zooms to absolute maximum zoom

Uwe Rathmann wrote:
> On Wednesday 14 May 2008 17:39, Matthias Reich wrote:
> 
>> I have figured out, that the new ZoomBase seems to be indeed unified
>> intentionally with the current ScaleRect. The question remains then,
>> however, why this mechanism is not effective when there hasn't been any
>> zoom action, but becomes relevant after that initial zoom happens...
> 
> The zoomer maintains a stack of rectangles. With setZoomBase you clear this 
> stack and assign a rectangle as first element. With zoom(QwtDoubleRect) you 
> can push a rectangle and with zoom(int) you navigate on the stack. With both 
> calls the scales of the plot are adjusted to the corrsponding rect.
> 
> If something weird is happening I recommend to debug the rectangles, that are 
> pushed/popped to the stack.

Thanks for the explanation. In the meantime I have added a few necessary 
(not understood, why, though) lines and get the behavior I wanted in the 
first place.

this->boundingBox() iterates over all attached curves and gets the 
envelope: That's the moving target (as I remove and attach curves along 
the way).

----

QwtDoubleRect qdr = this->boundingBox();

if (!zoomer->isEnabled()) {
	zoomer->zoom(qdr.normalized());
(Continue reading)

Uwe Rathmann | 28 Apr 20:30
Picon

Re: Zoomer always zooms to absolute maximum zoom

On Sunday 27 April 2008 14:48, Matthias Pospiech wrote:

> Now I experience that any zoom done in the running programm zoom
> automatically step by step to the maximum zoom, which is basically a
> singel pixel of the data array. The zoom therefore is practically usedless.

I'm afraid I didn't understand your problem, but QwtPlotZoomer zooms exactly 
to the rectangle, that has been selected by the rubberband. You can overload 
QwtPlotZoomer::minZoomSize() to limit the depth of the zoom operation.

If this what you need ?

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane