Results 1 to 6 of 6

Thread: Clip existing ContourLines of QwtPlotSpectrogram

  1. #1
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    1

    Default Clip existing ContourLines of QwtPlotSpectrogram

    Greetings,
    how do I crop/clip/erase those contours, that are outside of data?
    Attached Images Attached Images

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

    Default Re: Clip existing ContourLines of QwtPlotSpectrogram

    The contour lines are calculated from your data - so they can't be outside.

    Are spectrogram and contour lines displayed from the same data object and the same plot item ?
    Is your image a screenshot or something you generated with QwtPlot::print.
    How did you limit the area of your spectrogram ?

    Uwe

  3. #3
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    1

    Default Re: Clip existing ContourLines of QwtPlotSpectrogram

    Qt Code:
    1. setBoundingRect(QwtDoubleRect(xmin,ymin,xmax-xmin,ymax-ymin));
    To copy to clipboard, switch view to plain text mode 
    within SpectrogramData:QwtRasterData. The spectrogram itself is bounded correctly.
    regarding the raster data and contour data -
    Qt Code:
    1. SpectrogramData D(fopen("in.txt","r"));
    2. S->setData(D);
    3. S->attach(Plot);
    4. QwtValueList contourLevels;
    5. ...calculating contourlevels...
    6. S->setContourLevels(contourLevels);
    7. S->setDisplayMode(QwtPlotSpectrogram::ContourMode, true);
    8. Plot->replot();
    To copy to clipboard, switch view to plain text mode 

    Screenshot is taken by pressing PRINT SCREEN, cropping with mspaint and posting as jpeg.
    Last edited by Keir; 17th February 2009 at 09:10.

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

    Default Re: Clip existing ContourLines of QwtPlotSpectrogram

    This is a bug in Qwt, but you can work around it easily:

    Qt Code:
    1. virtual ContourLines YourRasterData::contourLines(
    2. const QwtDoubleRect &rect,
    3. const QSize &raster, const QList<double> &levels,
    4. int flags) const
    5. {
    6. QwtDoubleRect area = rect;
    7. if ( boundingRect().isValid() )
    8. area &= boundingRect();
    9.  
    10. return QwtRasterData::contourLines(area, raster, levels flags);
    11. }
    To copy to clipboard, switch view to plain text mode 

    Or you can use the code from SVN ( 5.2 branch ).

    Uwe

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

    Keir (20th February 2009)

  6. #5
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    1

    Default Re: Clip existing ContourLines of QwtPlotSpectrogram

    Superb! Thank you.

  7. #6
    Join Date
    Feb 2009
    Posts
    51
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Clip existing ContourLines of QwtPlotSpectrogram

    Hi,

    I am also trying to use contour in my program and confused about the qwt contour program. Do I need to implement some contour algorithm to fill my data with points of (x, y, v) or those points have been figured out by the qwt library? I mean, I have a set of (x, y, v) points but the number of those points is just a few and cannot certainly fill up all the display. And if I am to enter the data, where in the Qwt structure should I enter them?

    Any help is greatly appreciated.
    Sincerely,

    Wieland J.

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.