# qwt_curve_fitter.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_CURVE_FITTER_H
    00011 #define QWT_CURVE_FITTER_H
    00012
    00013 #include "qwt_global.h"
    00014 #include "qwt_double_rect.h"
    00015
    00016 class QwtSpline;
    00017
    00018 #if QT_VERSION >= 0x040000
    00019 #include <QPolygonF>
    00020 #else
    00021 #include "qwt_array.h"
    00022 #endif
    00023
    00024 // MOC_SKIP_BEGIN
    00025
    00026 #if defined(QWT_TEMPLATEDLL)
    00027
    00028 #if QT_VERSION < 0x040000
    00029 #ifndef QWTARRAY_TEMPLATE_QWTDOUBLEPOINT // by mjo3
    00030 #define QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
    00031 template class QWT_EXPORT QwtArray<QwtDoublePoint>;
    00032 #endif //end of QWTARRAY_TEMPLATE_QWTDOUBLEPOINT
    00033 #endif
    00034
    00035 #endif
    00036
    00037 // MOC_SKIP_END
    00038
    00042 class QWT_EXPORT QwtCurveFitter
    00043 {
    00044 public:
    00045     virtual ~QwtCurveFitter();
    00046
    00047 #if QT_VERSION < 0x040000
    00048     virtual QwtArray<QwtDoublePoint> fitCurve(
    00049         const QwtArray<QwtDoublePoint>&) const = 0;
    00050 #else
    00051     virtual QPolygonF fitCurve(const QPolygonF &) const = 0;
    00052 #endif
    00053
    00054 protected:
    00055     QwtCurveFitter();
    00056
    00057 private:
    00058     QwtCurveFitter( const QwtCurveFitter & );
    00059     QwtCurveFitter &operator=( const QwtCurveFitter & );
    00060 };
    00061
    00065 class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
    00066 {
    00067 public:
    00068     enum FitMode
    00069     {
    00070         Auto,
    00071         Spline,
    00072         ParametricSpline
    00073     };
    00074
    00075     QwtSplineCurveFitter();
    00076     virtual ~QwtSplineCurveFitter();
    00077
    00078     void setFitMode(FitMode);
    00079     FitMode fitMode() const;
    00080
    00081     void setSpline(const QwtSpline&);
    00082     const QwtSpline &spline() const;
    00083     QwtSpline &spline();
    00084
    00085     void setSplineSize(int size);
    00086     int splineSize() const;
    00087
    00088 #if QT_VERSION < 0x040000
    00089     virtual QwtArray<QwtDoublePoint> fitCurve(
    00090         const QwtArray<QwtDoublePoint> &) const;
    00091 #else
    00092     virtual QPolygonF fitCurve(const QPolygonF &) const;
    00093 #endif
    00094
    00095 private:
    00096 #if QT_VERSION < 0x040000
    00097     QwtArray<QwtDoublePoint> fitSpline(
    00098         const QwtArray<QwtDoublePoint> &) const;
    00099     QwtArray<QwtDoublePoint> fitParametric(
    00100         const QwtArray<QwtDoublePoint> &) const;
    00101 #else
    00102     QPolygonF fitSpline(const QPolygonF &) const;
    00103     QPolygonF fitParametric(const QPolygonF &) const;
    00104 #endif
    00105
    00106     class PrivateData;
    00107     PrivateData *d_data;
    00108 };
    00109
    00110 #endif