# 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:
    00080     enum SplineType
    00081     {
    00082         Natural,
    00083         Periodic
    00084     };
    00085
    00086     QwtSpline();
    00087     QwtSpline( const QwtSpline & );
    00088
    00089     ~QwtSpline();
    00090
    00091     QwtSpline &operator=( const QwtSpline & );
    00092
    00093     void setSplineType(SplineType);
    00094     SplineType splineType() const;
    00095
    00096 #if QT_VERSION < 0x040000
    00097     bool setPoints(const QwtArray<QwtDoublePoint>& points);
    00098     QwtArray<QwtDoublePoint> points() const;
    00099 #else
    00100     bool setPoints(const QPolygonF& points);
    00101     QPolygonF points() const;
    00102 #endif
    00103
    00104     void reset();
    00105
    00106     bool isValid() const;
    00107     double value(double x) const;
    00108
    00109 protected:
    00110
    00111 #if QT_VERSION < 0x040000
    00112     bool buildNaturalSpline(
    00113         const QwtArray<QwtDoublePoint> &);
    00114     bool buildPeriodicSpline(
    00115         const QwtArray<QwtDoublePoint> &);
    00116 #else
    00117     bool buildNaturalSpline(const QPolygonF &);
    00118     bool buildPeriodicSpline(const QPolygonF &);
    00119 #endif
    00120
    00121     class PrivateData;
    00122     PrivateData *d_data;
    00123 };
    00124
    00125 #endif