Qwt User's Guide 5.2.2

qwt_spline.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_SPLINE_H
00011 #define QWT_SPLINE_H
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_double_rect.h"
00015 
00016 #if QT_VERSION >= 0x040000
00017 #include <QPolygonF>
00018 #else
00019 #include "qwt_array.h"
00020 #endif
00021 
00022 // MOC_SKIP_BEGIN
00023 
00024 #if defined(QWT_TEMPLATEDLL)
00025 
00026 #if QT_VERSION < 0x040000
00027 #ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
00028 #define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
00029 template class QWT_EXPORT QwtArray<QwtDoublePoint>;
00030 #endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
00031 #endif
00032 
00033 #endif
00034 
00035 // MOC_SKIP_END
00036 
00077 class QWT_EXPORT QwtSpline
00078 {
00079 public:
00081     enum SplineType
00082     {
00083         Natural,
00084         Periodic
00085     };
00086 
00087     QwtSpline();
00088     QwtSpline( const QwtSpline & );
00089 
00090     ~QwtSpline();
00091 
00092     QwtSpline &operator=( const QwtSpline & );
00093 
00094     void setSplineType(SplineType);
00095     SplineType splineType() const;
00096 
00097 #if QT_VERSION < 0x040000
00098     bool setPoints(const QwtArray<QwtDoublePoint>& points);
00099     QwtArray<QwtDoublePoint> points() const;
00100 #else
00101     bool setPoints(const QPolygonF& points);
00102     QPolygonF points() const;
00103 #endif
00104 
00105     void reset();
00106 
00107     bool isValid() const;
00108     double value(double x) const;
00109 
00110     const QwtArray<double> &coefficientsA() const;
00111     const QwtArray<double> &coefficientsB() const;
00112     const QwtArray<double> &coefficientsC() const;
00113 
00114 protected:
00115 
00116 #if QT_VERSION < 0x040000
00117     bool buildNaturalSpline(
00118         const QwtArray<QwtDoublePoint> &);
00119     bool buildPeriodicSpline(
00120         const QwtArray<QwtDoublePoint> &);
00121 #else
00122     bool buildNaturalSpline(const QPolygonF &);
00123     bool buildPeriodicSpline(const QPolygonF &);
00124 #endif
00125 
00126     class PrivateData;
00127     PrivateData *d_data;
00128 };
00129 
00130 #endif