Results 1 to 2 of 2

Thread: QwtCurveFitter::fitCurve called only for "Lines" style QwtPlotCurves -- not "Steps".

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QwtCurveFitter::fitCurve called only for "Lines" style QwtPlotCurves -- not "Steps".

    I'm finding, and seeing in Qwt 6.1.3 code, that the QPolygonF QwtCurveFitter::fitCurve(const QPolygonF&) const virtual method is being called only for QwtPlotCurves having the QwtPlotCurve::Lines curve style, and not for the QwtPlotCurve::Steps curve style.

    I am seeing a call to fitCurve() in QwtPlotCurve::drawLines (QPainter* ..), but not in QwtPlotCurve::drawSteps (QPainter* ..).

    I believe QwtWeedingCurveFitter would work for us in the Steps style, and we do kinda need it. Is there a fundamental reason why the algorithm ("Douglas and Peucker") or this implementation would be fundamentally unworkable for stepped curves?

    If I'm seeing this correctly, I think we would have to modify QwtPlotCurve::drawSteps (QPainter* ..) to try this. Yes? But I'm wondering if that's an entirely arithmetically foolish thing to even be trying.

    -----

    FWIW ... I created a QwtWeedingCurveFitter subclass to do some of our own caching of the QwtWeedingCurveFitter results (also to dynamically track instance life-cycle) -- though I'm finding cache hits to not be especially successful, for apparent reasons.

    Qt Code:
    1. class WeedFitter : public QwtWeedingCurveFitter
    2. {
    3. private:
    4. static int _instanceCnt;
    5. const int _instanceNum;
    6.  
    7. QwtPlotCurve* _clientCurve;
    8. mutable QPolygonF _cachedInpPoints;
    9. mutable QPolygonF _cachedFiltPoints;
    10.  
    11. public:
    12. WeedFitter (QwtPlotCurve* clientCurve);
    13. virtual ~WeedFitter();
    14.  
    15. // virtual from QwtWeedingCurveFitter
    16. virtual QPolygonF fitCurve (const QPolygonF&) const override;
    17. };
    To copy to clipboard, switch view to plain text mode 
    This is coming up in my attempt to address the problem described in this other post ... http://www.qtcentre.org/threads/68094 ("Dense Qwt curves with dotted or dashed line style generally look solid").

  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: QwtCurveFitter::fitCurve called only for "Lines" style QwtPlotCurves -- not "Step

    You have 2 options for how to do any type of point weeding:


    1. weeding the original points, passing the result as curve points
    2. weeding points after being translated into paint device coordinates ( setCurveFitter )


    2) seems to be what you want to do, but as this is done inside every replot cycle it might slow down your performance - depending on the number of points and the order of the weeding algo heavily. In case of Douglas Peucker I recommend to do 1) depending on QwtScaleWidget::scaleDivChanged signals. It should be possible to define a reasonable level of details to limit how often weeding needs to be done.

    But as your real motivation is about creating distances between 2 adjacent points, that is above the length of a dot/dash you could consider writing your own type of fitter using a simpler interpolation algo, that takes specific characteristics of your data into count.

    Uwe

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 11:02
  2. QSqlError("", "Parameter count mismatch", "")
    By Alberto7 in forum Newbie
    Replies: 2
    Last Post: 9th October 2015, 23:09
  3. Replies: 3
    Last Post: 16th March 2015, 08:31
  4. Replies: 3
    Last Post: 8th July 2008, 20:37
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 20:05

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.