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_parametrization.h" 00011 00017 QwtSplineParametrization::QwtSplineParametrization( int type ): 00018 d_type( type ) 00019 { 00020 } 00021 00023 QwtSplineParametrization::~QwtSplineParametrization() 00024 { 00025 } 00026 00035 double QwtSplineParametrization::valueIncrement( 00036 const QPointF &point1, const QPointF &point2 ) const 00037 { 00038 switch( d_type ) 00039 { 00040 case QwtSplineParametrization::ParameterX: 00041 { 00042 return valueIncrementX( point1, point2 ); 00043 } 00044 case QwtSplineParametrization::ParameterY: 00045 { 00046 return valueIncrementY( point1, point2 ); 00047 } 00048 case QwtSplineParametrization::ParameterCentripetal: 00049 { 00050 return valueIncrementCentripetal( point1, point2 ); 00051 } 00052 case QwtSplineParametrization::ParameterChordal: 00053 { 00054 return valueIncrementChordal( point1, point2 ); 00055 } 00056 case QwtSplineParametrization::ParameterManhattan: 00057 { 00058 return valueIncrementManhattan( point1, point2 ); 00059 } 00060 case QwtSplineParametrization::ParameterUniform: 00061 { 00062 return valueIncrementUniform( point1, point2 ); 00063 } 00064 default: 00065 { 00066 return 1; 00067 } 00068 } 00069 } 00070 00072 int QwtSplineParametrization::type() const 00073 { 00074 return d_type; 00075 }