Qwt User's Guide: qwt_curve_fitter.h Source File

Qwt User's Guide 6.1.5

qwt_curve_fitter.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_CURVE_FITTER_H
11 #define QWT_CURVE_FITTER_H
12
13 #include "qwt_global.h"
14 #include <qpolygon.h>
15 #include <qrect.h>
16
17 class QwtSpline;
18
22 class QWT_EXPORT QwtCurveFitter
23 {
24 public:
25 virtual ~QwtCurveFitter();
26
33 virtual QPolygonF fitCurve( const QPolygonF &polygon ) const = 0;
34
35 protected:
36 QwtCurveFitter();
37
38 private:
39 QwtCurveFitter( const QwtCurveFitter & );
40 QwtCurveFitter &operator=( const QwtCurveFitter & );
41 };
42
46 class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
47 {
48 public:
54 enum FitMode
55 {
61 Auto,
62
64 Spline,
65
67 ParametricSpline
68 };
69
70 QwtSplineCurveFitter();
71 virtual ~QwtSplineCurveFitter();
72
73 void setFitMode( FitMode );
74 FitMode fitMode() const;
75
76 void setSpline( const QwtSpline& );
77 const QwtSpline &spline() const;
78 QwtSpline &spline();
79
80 void setSplineSize( int );
81 int splineSize() const;
82
83 virtual QPolygonF fitCurve( const QPolygonF & ) const;
84
85 private:
86 QPolygonF fitSpline( const QPolygonF & ) const;
87 QPolygonF fitParametric( const QPolygonF & ) const;
88
89 class PrivateData;
90 PrivateData *d_data;
91 };
92
116 class QWT_EXPORT QwtWeedingCurveFitter: public QwtCurveFitter
117 {
118 public:
119 QwtWeedingCurveFitter( double tolerance = 1.0 );
120 virtual ~QwtWeedingCurveFitter();
121
122 void setTolerance( double );
123 double tolerance() const;
124
125 void setChunkSize( uint );
126 uint chunkSize() const;
127
128 virtual QPolygonF fitCurve( const QPolygonF & ) const;
129
130 private:
131 virtual QPolygonF simplify( const QPolygonF & ) const;
132
133 class Line;
134
135 class PrivateData;
136 PrivateData *d_data;
137 };
138
139 #endif
QwtCurveFitter::fitCurve
virtual QPolygonF fitCurve(const QPolygonF &polygon) const =0
QwtCurveFitter
Abstract base class for a curve fitter.
Definition: qwt_curve_fitter.h:22
QwtSplineCurveFitter::FitMode
FitMode
Definition: qwt_curve_fitter.h:54
QwtSplineCurveFitter::Auto
Definition: qwt_curve_fitter.h:61
QwtSplineCurveFitter
A curve fitter using cubic splines.
Definition: qwt_curve_fitter.h:46
QwtWeedingCurveFitter
A curve fitter implementing Douglas and Peucker algorithm.
Definition: qwt_curve_fitter.h:116
QwtSplineCurveFitter::Spline
Use a default spline algorithm.
Definition: qwt_curve_fitter.h:64
QwtSpline
A class for spline interpolation.
Definition: qwt_spline.h:57