FunctionCurve.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FUNCTIONCURVE_H
00030 #define FUNCTIONCURVE_H
00031
00032 #include "PlotCurve.h"
00033
00034 class Graph;
00035
00036
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 void 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