00001 /*************************************************************************** 00002 File : FunctionCurve.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen 00006 Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net 00007 Description : Function curve class 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef FUNCTIONCURVE_H 00030 #define FUNCTIONCURVE_H 00031 00032 #include "PlotCurve.h" 00033 00034 // Function curve class 00035 class FunctionCurve: public PlotCurve 00036 { 00037 public: 00038 enum FunctionType{Normal = 0, Parametric = 1, Polar = 2}; 00039 00040 FunctionCurve(const FunctionType& t, const char *name=0); 00041 FunctionCurve(const char *name=0); 00042 00043 double startRange(){return d_from;}; 00044 double endRange(){return d_to;}; 00045 void setRange(double from, double to); 00046 00047 QStringList formulas(){return d_formulas;}; 00048 void setFormulas(const QStringList& lst){d_formulas = lst;}; 00049 00051 void setFormula(const QString& s){d_formulas = QStringList() << s;}; 00052 00053 QString variable(){return d_variable;}; 00054 void setVariable(const QString& s){d_variable = s;}; 00055 00056 FunctionType functionType(){return d_function_type;}; 00057 void setFunctionType(const FunctionType& t){d_function_type = t;}; 00058 00059 void copy(FunctionCurve *f); 00060 00062 QString saveToString(); 00063 00065 QString legend(); 00066 00067 void loadData(int points = 0); 00068 00069 private: 00070 FunctionType d_function_type; 00071 QString d_variable; 00072 QStringList d_formulas; 00073 double d_from, d_to; 00074 }; 00075 00076 #endif 00077