Results 1 to 6 of 6

Thread: Qwt spectrogram with dashed contour

  1. #1
    Join Date
    Feb 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Qwt spectrogram with dashed contour

    Hi,

    I'm trying to display contour line of a qwt spectrogramm as dashed line.
    Thus I sligthly modified the spectrogram exemple
    Qt Code:
    1. void Plot::showContour( bool on )
    2. {
    3. d_spectrogram->setDisplayMode( QwtPlotSpectrogram::ContourMode, on );
    4. d_spectrogram->setDefaultContourPen(QColor(Qt::yellow),3, Qt::DashLine);
    5. replot();
    6. }
    7.  
    8. void Plot::showSpectrogram( bool on )
    9. {
    10. d_spectrogram->setDisplayMode( QwtPlotSpectrogram::ImageMode, on );
    11. //d_spectrogram->setDefaultContourPen(
    12. // on ? QPen( Qt::black, 0 ) : QPen( Qt::NoPen ) );
    13.  
    14. replot();
    15. }
    To copy to clipboard, switch view to plain text mode 

    and here's the result:
    spectro.jpg

    any idea on how I can handle this?

    thanks for your attention

    regards

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

    Default Re: Qwt spectrogram with dashed contour

    The CONREC algo returns many, many small lines that look like a being connected.

    There is another algo that calculates real polygons ( what could be interesting option for drawing a spectrogram in a different way - being composed of vector graphics ) but I never implemented this one.

    Uwe

  3. #3
    Join Date
    Feb 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt spectrogram with dashed contour

    Thanks a lot for your answer Uwe,

    is there a simple way to get access to the contour lines? In that way I could perhaps decimate them to archieve the desired effect.

    Pierrick

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

    Default Re: Qwt spectrogram with dashed contour

    You could overload QwtRasterData::contourLines() or QwtPlotSpectrogram::renderContourLines and store the result somewhere.

    For creating vector shapes or bezier paths you could have a look at: http://apptree.net/conrec.htm. If you want to go this direction ( or you have any other vectorizer in mind ) I would be very happy if you would contribute some code.

    Uwe

  5. #5
    Join Date
    Feb 2014
    Posts
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qwt spectrogram with dashed contour

    I overloaded the QwtRasterData::contourLines() to see the result and now (thanks to you Uwe) I can see the problem which is the number of polylines.

    I have no time yet to resolve that but I think this link can help : http://bost.ocks.org/mike/simplify/ it shows the use of the Visvalingam’s algorithm which can simplify shapes.

    I'll try to do something as soon as I got times

    Pierrick

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

    Default Re: Qwt spectrogram with dashed contour

    Quote Originally Posted by Pierrick View Post
    it shows the use of the Visvalingam’s algorithm which can simplify shapes.
    This is an alternative for Douglas Peucker ( already implemented as QwtWeedingCurveFitter ) what is about reducing the number of points of a polygon. What you need is to build a polygon from an "unordered" set of single lines - what is something very different.

    But nevertheless I will check the algo as it seems to be a "less quality but faster" thing. But I'm not sure as by reducing the chunk size you already have an easy way to speed to Douglas Peucker heavily.

    Uwe

Similar Threads

  1. Dashed frame around QGraphicsTextItem
    By minimoog in forum Qt Programming
    Replies: 7
    Last Post: 20th November 2009, 18:18
  2. Why there are always dashed-line rectangle on QToolButton?
    By FinderCheng in forum Qt Programming
    Replies: 5
    Last Post: 24th October 2009, 23:56
  3. How to hide the dashed frame outside the QGraphicsItem .
    By robertkun in forum Qt Programming
    Replies: 7
    Last Post: 7th August 2009, 17:06
  4. Replies: 0
    Last Post: 13th February 2009, 08:26
  5. Replies: 3
    Last Post: 10th November 2008, 12:14

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.