Results 1 to 6 of 6

Thread: a few questions about using QwtMatrixRasterData (and other classes)

  1. #1
    Join Date
    Mar 2012
    Posts
    11
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Question a few questions about using QwtMatrixRasterData (and other classes)

    this component is very useful for my circle of tasks
    but I need to change something and don't know how to do that exactly.

    1. we have z-(color)-scale with gradient
    z-color-scale.jpg
    I have 4 colors.
    in my case it's very necessary to have only clear colors without smooth gradient between each color.
    can I achieve it with this component? and how... may be try another alternative?


    2. Also got it from example - possibility of hint
    coordinates.jpg

    code:
    Qt Code:
    1. class MyZoomer: public QwtPlotZoomer {
    2.  
    3. public:
    4. MyZoomer( QwtPlotCanvas *canvas ):
    5. QwtPlotZoomer(canvas) {
    6. setTrackerMode(AlwaysOn);
    7. }
    8.  
    9. virtual QwtText trackerTextF(const QPointF &pos) const {
    10. QColor bg(Qt::white);
    11. bg.setAlpha(200);
    12.  
    13. QwtText text = QwtPlotZoomer::trackerTextF(pos);
    14. text.setBackgroundBrush(QBrush(bg));
    15. return text;
    16. }
    17. };
    To copy to clipboard, switch view to plain text mode 

    hereby we have coordinates in the hint near cursor (x, y)
    how to add here the third value of z axis?


    3. How to disable zooming out below a certain value (for example when the pic fit to width)?
    example:
    here in the picture good variant
    zoom_out_ok.jpg

    and here - not appropriate
    zoom_out_not_ok.jpg


    thanks a lot!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a few questions about using QwtMatrixRasterData (and other classes)

    I have 4 colors. in my case it's very necessary to have only clear colors without smooth gradient between each color.
    can I achieve it with this component? and how... may be try another alternative?
    How to map values to colors is the job of the color map. You can write your own one, but I guess setting QwtLinearColorMap::FixedColors mode is all what needs to be done.
    hereby we have coordinates in the hint near cursor (x, y)
    how to add here the third value of z axis?
    pos is the position in plot coordinates. All you need to do is to ask the matrix raster data object for the z value at the position.
    How to disable zooming out below a certain value (for example when the pic fit to width)?
    Depends on how you have implemented zooming.

    F.e. QwtPlotZoomer never zooms out of the initial scale ranges, that have been set by the application. Here the answer would be simply: don't assign scale ranges you don't want to have.

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    layer (7th March 2013)

  4. #3
    Join Date
    Mar 2012
    Posts
    11
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a few questions about using QwtMatrixRasterData (and other classes)

    setting QwtLinearColorMap::FixedColors mode is all what needs to be done.
    oh, sorry, didn't noticed, right that's what I need!

    the second: I got it (z value) through the value() method of QwtMatrixRasterData as you told me, thanks!

    and the third:

    class MyZoomer - that's all I have about implemented zooming.
    and it seems I didn't assign scale ranges anywhere at all.
    how can I do it?
    is the method setZoomBase() helpful in this case?

  5. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a few questions about using QwtMatrixRasterData (and other classes)

    Quote Originally Posted by layer View Post
    and it seems I didn't assign scale ranges anywhere at all.
    how can I do it?
    QwtPlot::setAxisScale().

    Uwe

  6. #5
    Join Date
    Mar 2012
    Posts
    11
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a few questions about using QwtMatrixRasterData (and other classes)

    thank you Uwe!

  7. #6
    Join Date
    Mar 2012
    Posts
    11
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: a few questions about using QwtMatrixRasterData (and other classes)

    all that I needed to do for the last question is write these few lines:
    Qt Code:
    1. QwtPlotMagnifier *magnifier = new QwtPlotMagnifier(canvas());
    2. magnifier->setAxisEnabled(QwtPlot::xBottom, false);
    To copy to clipboard, switch view to plain text mode 
    forbid zooming for x-axis, such pretty simple.
    great Lib

Similar Threads

  1. Replies: 3
    Last Post: 11th July 2012, 07:56
  2. Replies: 8
    Last Post: 2nd November 2011, 17:31
  3. Replies: 13
    Last Post: 22nd August 2011, 21:12
  4. Bugs in QwtMatrixRasterData?
    By alex_sh in forum Qwt
    Replies: 13
    Last Post: 23rd January 2011, 12:59
  5. construction of classes within classes
    By mobucl in forum Newbie
    Replies: 8
    Last Post: 10th January 2011, 14:51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.