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_approximation.h" 00011 #include "qwt_spline_parametrization.h" 00012 00013 class QwtSplineApproximation::PrivateData 00014 { 00015 public: 00016 PrivateData(): 00017 boundaryType( QwtSplineApproximation::ConditionalBoundaries ) 00018 { 00019 parametrization = new QwtSplineParametrization( 00020 QwtSplineParametrization::ParameterChordal ); 00021 } 00022 00023 ~PrivateData() 00024 { 00025 delete parametrization; 00026 } 00027 00028 QwtSplineParametrization *parametrization; 00029 QwtSplineApproximation::BoundaryType boundaryType; 00030 }; 00031 00039 QwtSplineApproximation::QwtSplineApproximation() 00040 { 00041 d_data = new PrivateData; 00042 } 00043 00045 QwtSplineApproximation::~QwtSplineApproximation() 00046 { 00047 delete d_data; 00048 } 00049 00063 uint QwtSplineApproximation::locality() const 00064 { 00065 return 0; 00066 } 00067 00068 void QwtSplineApproximation::setParametrization( int type ) 00069 { 00070 if ( d_data->parametrization->type() != type ) 00071 { 00072 delete d_data->parametrization; 00073 d_data->parametrization = new QwtSplineParametrization( type ); 00074 } 00075 } 00076 00077 void QwtSplineApproximation::setParametrization( QwtSplineParametrization *parametrization ) 00078 { 00079 if ( ( parametrization != NULL ) && ( d_data->parametrization != parametrization ) ) 00080 { 00081 delete d_data->parametrization; 00082 d_data->parametrization = parametrization; 00083 } 00084 } 00085 00086 const QwtSplineParametrization *QwtSplineApproximation::parametrization() const 00087 { 00088 return d_data->parametrization; 00089 } 00090 00091 void QwtSplineApproximation::setBoundaryType( BoundaryType boundaryType ) 00092 { 00093 d_data->boundaryType = boundaryType;; 00094 } 00095 00096 QwtSplineApproximation::BoundaryType QwtSplineApproximation::boundaryType() const 00097 { 00098 return d_data->boundaryType; 00099 }