Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_spline_curve_fitter.cpp
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#include "qwt_spline_curve_fitter.h"
11#include "qwt_spline_local.h"
12#include "qwt_spline_parametrization.h"
13
14#include <qpolygon.h>
15#include <qpainterpath.h>
16
24
27{
28 delete m_spline;
29}
30
41{
42 if ( m_spline == spline )
43 return;
44
45 delete m_spline;
46 m_spline = spline;
47}
48
54{
55 return m_spline;
56}
57
63{
64 return m_spline;
65}
66
75QPolygonF QwtSplineCurveFitter::fitCurve( const QPolygonF& points ) const
76{
77 const QPainterPath path = fitCurvePath( points );
78
79 const QList< QPolygonF > subPaths = path.toSubpathPolygons();
80 if ( subPaths.size() == 1 )
81 return subPaths.first();
82
83 return QPolygonF();
84}
85
94QPainterPath QwtSplineCurveFitter::fitCurvePath( const QPolygonF& points ) const
95{
96 QPainterPath path;
97
98 if ( m_spline )
99 path = m_spline->painterPath( points );
100
101 return path;
102}
Abstract base class for a curve fitter.
virtual QPainterPath fitCurvePath(const QPolygonF &) const override
virtual ~QwtSplineCurveFitter()
Destructor.
const QwtSpline * spline() const
virtual QPolygonF fitCurve(const QPolygonF &) const override
Base class for all splines.
Definition qwt_spline.h:58
virtual QPainterPath painterPath(const QPolygonF &) const =0
void setParametrization(int type)
A spline with C1 continuity.