qwt_spline_curve_fitter.cpp
Go to the documentation of this file.
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 #include "qwt_spline_curve_fitter.h"
00011 #include "qwt_spline_local.h"
00012 #include "qwt_spline_parametrization.h"
00013 
00015 QwtSplineCurveFitter::QwtSplineCurveFitter():
00016     QwtCurveFitter( QwtCurveFitter::Path )
00017 {
00018     d_spline = new QwtSplineLocal( QwtSplineLocal::Cardinal );
00019     d_spline->setParametrization( QwtSplineParametrization::ParameterUniform );
00020 }
00021 
00023 QwtSplineCurveFitter::~QwtSplineCurveFitter()
00024 {
00025     delete d_spline;
00026 }
00027 
00037 void QwtSplineCurveFitter::setSpline( QwtSpline *spline )
00038 {
00039     if ( d_spline == spline )
00040         return;
00041 
00042     delete d_spline;
00043     d_spline = spline;
00044 }
00045 
00050 const QwtSpline *QwtSplineCurveFitter::spline() const
00051 {
00052     return d_spline;
00053 }
00054 
00059 QwtSpline *QwtSplineCurveFitter::spline() 
00060 {
00061     return d_spline;
00062 }
00063 
00072 QPolygonF QwtSplineCurveFitter::fitCurve( const QPolygonF &points ) const
00073 {
00074     const QPainterPath path = fitCurvePath( points );
00075 
00076     const QList<QPolygonF> subPaths = path.toSubpathPolygons();
00077     if ( subPaths.size() == 1 )
00078         subPaths.first();
00079 
00080     return QPolygonF();
00081 }
00082 
00091 QPainterPath QwtSplineCurveFitter::fitCurvePath( const QPolygonF &points ) const
00092 {
00093     QPainterPath path;
00094 
00095     if ( d_spline )
00096         path = d_spline->painterPath( points );
00097 
00098     return path;
00099 }


plotjuggler
Author(s): Davide Faconti
autogenerated on Wed Jul 3 2019 19:28:05