# 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
    00057     virtual QPolygonF fitCurve(const QPolygonF &polygon) const = 0;
    00058 #endif
    00059
    00060 protected:
    00061     QwtCurveFitter();
    00062
    00063 private:
    00064     QwtCurveFitter( const QwtCurveFitter & );
    00065     QwtCurveFitter &operator=( const QwtCurveFitter & );
    00066 };
    00067
    00071 class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
    00072 {
    00073 public:
    00074     enum FitMode
    00075     {
    00076         Auto,
    00077         Spline,
    00078         ParametricSpline
    00079     };
    00080
    00081     QwtSplineCurveFitter();
    00082     virtual ~QwtSplineCurveFitter();
    00083
    00084     void setFitMode(FitMode);
    00085     FitMode fitMode() const;
    00086
    00087     void setSpline(const QwtSpline&);
    00088     const QwtSpline &spline() const;
    00089     QwtSpline &spline();
    00090
    00091     void setSplineSize(int size);
    00092     int splineSize() const;
    00093
    00094 #if QT_VERSION < 0x040000
    00095     virtual QwtArray<QwtDoublePoint> fitCurve(
    00096         const QwtArray<QwtDoublePoint> &) const;
    00097 #else
    00098     virtual QPolygonF fitCurve(const QPolygonF &) const;
    00099 #endif
    00100
    00101 private:
    00102 #if QT_VERSION < 0x040000
    00103     QwtArray<QwtDoublePoint> fitSpline(
    00104         const QwtArray<QwtDoublePoint> &) const;
    00105     QwtArray<QwtDoublePoint> fitParametric(
    00106         const QwtArray<QwtDoublePoint> &) const;
    00107 #else
    00108     QPolygonF fitSpline(const QPolygonF &) const;
    00109     QPolygonF fitParametric(const QPolygonF &) const;
    00110 #endif
    00111
    00112     class PrivateData;
    00113     PrivateData *d_data;
    00114 };
    00115
    00116 #endif