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 FILTER_H
00030 #define FILTER_H
00031
00032 #include <QObject>
00033
00034 #include "ApplicationWindow.h"
00035
00036 class QwtPlotCurve;
00037 class Graph;
00038 class Table;
00039
00041 class Filter : public QObject
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 Filter(ApplicationWindow *parent, Table *t = 0, const char * name = 0);
00047 Filter(ApplicationWindow *parent, Graph *g = 0, const char * name = 0);
00048 ~Filter();
00049
00051 virtual bool run();
00052
00053 virtual void setDataCurve(int curve, double start, double end);
00054 bool setDataFromCurve(const QString& curveTitle, Graph *g = 0);
00055 bool setDataFromCurve(const QString& curveTitle, double from, double to, Graph *g = 0);
00056
00058 void setInterval(double from, double to);
00059
00061 void setTolerance(double eps){d_tolerance = eps;};
00062
00064 void setColor(int colorId){d_curveColorIndex = colorId;};
00065
00067 void setColor(const QString& colorName);
00068
00070 void setOutputPoints(int points){d_points = points;};
00071
00073 void setOutputPrecision(int digits){d_prec = digits;};
00074
00076 void setMaximumIterations(int iter){d_max_iterations = iter;};
00077
00079 virtual void showLegend();
00080
00082 virtual QString legendInfo(){return QString();};
00083
00085 int dataSize(){return d_n;};
00086
00087 bool error(){return d_init_err;};
00088
00089 protected:
00090 void init();
00091
00094 virtual int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00096 virtual int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00097
00099 QwtPlotCurve* addResultCurve(double *x, double *y);
00100
00102 int curveIndex(const QString& curveTitle, Graph *g);
00103
00105 virtual QString logInfo(){return QString();};
00106
00108 virtual void output();
00109
00111 virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
00112
00114 Graph *d_graph;
00115
00117 Table *d_table;
00118
00120 int d_n;
00121
00123 double *d_x;
00124
00126 double *d_y;
00127
00129 double d_tolerance;
00130
00132 int d_points;
00133
00135 int d_curveColorIndex;
00136
00138 int d_max_iterations;
00139
00141 QwtPlotCurve *d_curve;
00142
00144 int d_prec;
00145
00147 bool d_init_err;
00148
00150 double d_from, d_to;
00151
00153 bool d_sort_data;
00154
00156 int d_min_points;
00157
00159 QString d_explanation;
00160 };
00161
00162 #endif