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
00035 class FunctionCurve: public PlotCurve
00036 {
00037 public:
00038 enum FunctionType{Normal = 0, Parametric = 1, Polar = 2};
00039
00040 FunctionCurve(const FunctionType& t, const QString& name = QString());
00041 FunctionCurve(const QString& name = QString());
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();
00064 static void restore(Graph *g, const QStringList& lst);
00065
00067 QString legend();
00068
00069 void loadData(int points = 0);
00070
00071 QMap<QString, double> constants(){return d_constants;};
00072 void setConstants(const QMap<QString, double>& map){d_constants = map;};
00073 void setConstant(const QString& parName, double val){d_constants.insert(parName, val);};
00074 void removeConstant(const QString& parName){d_constants.remove(parName);};
00075 void removeConstants(){d_constants.clear();};
00076
00077 private:
00078 FunctionType d_function_type;
00079 QString d_variable;
00080 QStringList d_formulas;
00081 double d_from, d_to;
00082 QMap<QString, double> d_constants;
00083 };
00084
00085 #endif