qwt_curve_fitter.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_CURVE_FITTER_H
#define QWT_CURVE_FITTER_H
#include "qwt_global.h"
#include <qpolygon.h>
#include <qrect.h>
class QwtSpline;
class QWT_EXPORT QwtCurveFitter
{
public:
virtual ~QwtCurveFitter();
virtual QPolygonF fitCurve( const QPolygonF &polygon ) const = 0;
protected:
QwtCurveFitter();
private:
QwtCurveFitter( const QwtCurveFitter & );
QwtCurveFitter &operator=( const QwtCurveFitter & );
};
class QWT_EXPORT QwtSplineCurveFitter: public QwtCurveFitter
{
public:
enum FitMode
{
Auto,
Spline,
ParametricSpline
};
QwtSplineCurveFitter();
virtual ~QwtSplineCurveFitter();
void setFitMode( FitMode );
FitMode fitMode() const;
void setSpline( const QwtSpline& );
const QwtSpline &spline() const;
QwtSpline &spline();
void setSplineSize( int size );
int splineSize() const;
virtual QPolygonF fitCurve( const QPolygonF & ) const;
private:
QPolygonF fitSpline( const QPolygonF & ) const;
QPolygonF fitParametric( const QPolygonF & ) const;
class PrivateData;
PrivateData *d_data;
};
class QWT_EXPORT QwtWeedingCurveFitter: public QwtCurveFitter
{
public:
QwtWeedingCurveFitter( double tolerance = 1.0 );
virtual ~QwtWeedingCurveFitter();
void setTolerance( double );
double tolerance() const;
void setChunkSize( uint );
uint chunkSize() const;
virtual QPolygonF fitCurve( const QPolygonF & ) const;
private:
virtual QPolygonF simplify( const QPolygonF & ) const;
class Line;
class PrivateData;
PrivateData *d_data;
};
#endif
QwtCurveFitter
Abstract base class for a curve fitter.
Definition: qwt_curve_fitter.h:22
QwtSplineCurveFitter
A curve fitter using cubic splines.
Definition: qwt_curve_fitter.h:46
QwtSplineCurveFitter::Spline
Use a default spline algorithm.
Definition: qwt_curve_fitter.h:64
QwtSpline
A class for spline interpolation.
Definition: qwt_spline.h:57
QwtCurveFitter::fitCurve
virtual QPolygonF fitCurve(const QPolygonF &polygon) const =0
QwtWeedingCurveFitter
A curve fitter implementing Douglas and Peucker algorithm.
Definition: qwt_curve_fitter.h:116
QwtSplineCurveFitter::Auto
Definition: qwt_curve_fitter.h:61
QwtSplineCurveFitter::FitMode
FitMode
Definition: qwt_curve_fitter.h:54