QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : FunctionCurve.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 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 class Graph; 00035 00036 // Function curve class 00037 class FunctionCurve: public PlotCurve 00038 { 00039 public: 00040 enum FunctionType{Normal = 0, Parametric = 1, Polar = 2}; 00041 00042 FunctionCurve(const FunctionType& t, const QString& name = QString()); 00043 FunctionCurve(const QString& name = QString()); 00044 00045 double startRange(){return d_from;}; 00046 double endRange(){return d_to;}; 00047 void setRange(double from, double to); 00048 00049 QStringList formulas(){return d_formulas;}; 00050 void setFormulas(const QStringList& lst){d_formulas = lst;}; 00051 00053 void setFormula(const QString& s){d_formulas = QStringList() << s;}; 00054 00055 QString variable(){return d_variable;}; 00056 void setVariable(const QString& s){d_variable = s;}; 00057 00058 FunctionType functionType(){return d_function_type;}; 00059 void setFunctionType(const FunctionType& t){d_function_type = t;}; 00060 00061 void copy(FunctionCurve *f); 00062 00064 QString saveToString(); 00066 static void restore(Graph *g, const QStringList& lst); 00067 00069 QString legend(); 00070 00071 bool loadData(int points = 0, bool xLog10Scale = false); 00072 00073 QMap<QString, double> constants(){return d_constants;}; 00074 void setConstants(const QMap<QString, double>& map){d_constants = map;}; 00075 void setConstant(const QString& parName, double val){d_constants.insert(parName, val);}; 00076 void removeConstant(const QString& parName){d_constants.remove(parName);}; 00077 void removeConstants(){d_constants.clear();}; 00078 00079 private: 00080 FunctionType d_function_type; 00081 QString d_variable; 00082 QStringList d_formulas; 00083 double d_from, d_to; 00084 QMap<QString, double> d_constants; 00085 }; 00086 00087 #endif