Results 1 to 12 of 12

Thread: Selecting QwtPlotCurve from QwtPlot

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Selecting QwtPlotCurve from QwtPlot

    You are also right, but still this finds only when the user clicks on a point. I'd like to select the line between the points as well

  2. #2
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Selecting QwtPlotCurve from QwtPlot

    well, this way its all depends :
    - the Distance Between different Points on a curve(DBP),
    - the Distance Between the different Curves(DBCs).

    you may just need to use better tolerance distance to meet your needs. (if DBP is less than the DBCs ).

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

    Default Re: Selecting QwtPlotCurve from QwtPlot

    Also have a look at the curvetracker example - maybe you find some interesting code snippet there too.

    Uwe

  4. #4

    Default Re: Selecting QwtPlotCurve from QwtPlot

    Thank you for your answers, I used a mathematical equation that finds if the mouse point is on the line between the curves

  5. #5
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Selecting QwtPlotCurve from QwtPlot

    I have looked into the curvetracker example and practiced . However , it can only locate the point on a straight line between two points without deviation . Deviation comes while the curve is set myplot->setCurveAttribute(QwtPlotCurve::Fitted) .

    Any idea to fix this problem?
    Thanks in advance !!

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

    Default Re: Selecting QwtPlotCurve from QwtPlot

    Well, the fitter creates temporary points in paint device coordinates, that are not known to the picker. What you could do is to apply the spline interpolation to your points in plot coordinates ( using QwtSplineCurveFitter::fitCurve() manually ) passing the interpolated points instead. The curvetracker code works out of the box - but of course this is a different type of interpolation.

    If you don't want to do this you could overload QwtSplineFitter::fitCurve() and store the interpolated points:

    Qt Code:
    1. class YourSplineFitter: public QwtSplineFitter
    2. {
    3. public:
    4. virtual QPolygonF fitCurve( const QPolygonF &points ) const
    5. {
    6. mInterpolatedPoints = QwtSplineFitter::fitCurve( points );
    7. return mInterpolatedPoints;
    8. }
    9.  
    10. ...
    11. private:
    12. QPolygonF mInterpolatedPoints;
    13. };
    To copy to clipboard, switch view to plain text mode 

    Then the CurveTracker can be implemented using mInterpolatePoints.

    HTH,
    Uwe

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

    lwz (23rd July 2013)

  8. #7
    Join Date
    Jul 2013
    Posts
    72
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Selecting QwtPlotCurve from QwtPlot

    Thanks ,it works much better

Similar Threads

  1. Replies: 8
    Last Post: 9th February 2014, 12:37
  2. Replies: 1
    Last Post: 11th May 2012, 08:02
  3. Replies: 1
    Last Post: 13th July 2011, 08:55
  4. Selecting a QwtPlotCurve object.
    By mah_singh1 in forum Qwt
    Replies: 1
    Last Post: 21st April 2009, 07:12
  5. Replies: 2
    Last Post: 25th March 2008, 14:36

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
  •  
Qt is a trademark of The Qt Company.