Qwt User's Guide  5.2.3
qwt_spline.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_SPLINE_H
11 #define QWT_SPLINE_H
12 
13 #include "qwt_global.h"
14 #include "qwt_double_rect.h"
15 
16 #if QT_VERSION >= 0x040000
17 #include <QPolygonF>
18 #else
19 #include "qwt_array.h"
20 #endif
21 
22 // MOC_SKIP_BEGIN
23 
24 #if defined(QWT_TEMPLATEDLL)
25 
26 #if QT_VERSION < 0x040000
27 #ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
28 #define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
29 template class QWT_EXPORT QwtArray<QwtDoublePoint>;
30 #endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
31 #endif
32 
33 #endif
34 
35 // MOC_SKIP_END
36 
77 class QWT_EXPORT QwtSpline
78 {
79 public:
82  {
83  Natural,
84  Periodic
85  };
86 
87  QwtSpline();
88  QwtSpline( const QwtSpline & );
89 
90  ~QwtSpline();
91 
92  QwtSpline &operator=( const QwtSpline & );
93 
94  void setSplineType(SplineType);
95  SplineType splineType() const;
96 
97 #if QT_VERSION < 0x040000
98  bool setPoints(const QwtArray<QwtDoublePoint>& points);
99  QwtArray<QwtDoublePoint> points() const;
100 #else
101  bool setPoints(const QPolygonF& points);
102  QPolygonF points() const;
103 #endif
104 
105  void reset();
106 
107  bool isValid() const;
108  double value(double x) const;
109 
110  const QwtArray<double> &coefficientsA() const;
111  const QwtArray<double> &coefficientsB() const;
112  const QwtArray<double> &coefficientsC() const;
113 
114 protected:
115 
116 #if QT_VERSION < 0x040000
117  bool buildNaturalSpline(
118  const QwtArray<QwtDoublePoint> &);
119  bool buildPeriodicSpline(
120  const QwtArray<QwtDoublePoint> &);
121 #else
122  bool buildNaturalSpline(const QPolygonF &);
123  bool buildPeriodicSpline(const QPolygonF &);
124 #endif
125 
126  class PrivateData;
127  PrivateData *d_data;
128 };
129 
130 #endif