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 QString& name = QString());
00047 Filter(ApplicationWindow *parent, Graph *g = 0, const QString& name = QString());
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
00057 virtual bool setDataFromTable(Table *, const QString&, const QString&, int = 1, int = -1);
00058
00060 void setInterval(double from, double to);
00061
00063 void setTolerance(double eps){d_tolerance = eps;};
00064
00066 void setColor(int colorId){d_curveColorIndex = colorId;};
00067
00069 void setColor(const QString& colorName);
00070
00072 void setOutputPoints(int points){d_points = points;};
00073
00075 void setOutputPrecision(int digits){d_prec = digits;};
00076
00078 void setMaximumIterations(int iter){d_max_iterations = iter;};
00079
00081 virtual void showLegend();
00082
00084 virtual QString legendInfo(){return QString();};
00085
00087 int dataSize(){return d_n;};
00089 double* x(){return d_x;};
00091 double* y(){return d_y;};
00093 Table *resultTable(){return d_result_table;};
00094
00095 bool error(){return d_init_err;};
00096
00097 virtual void enableGraphicsDisplay(bool on = true, Graph *g = 0);
00098
00099 protected:
00100 void init();
00101 void memoryErrorMessage();
00102
00105 virtual int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00107 virtual int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00108
00109 int curveRange(QwtPlotCurve *c, double start, double end, int *iStart, int *iEnd);
00110
00112 QwtPlotCurve* addResultCurve(double *x, double *y);
00113
00115 int curveIndex(const QString& curveTitle, Graph *g);
00116
00118 virtual QString logInfo(){return QString();};
00119
00121 virtual void output();
00122
00124 virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
00125
00126 MultiLayer* createOutputGraph();
00127
00129 Graph *d_graph;
00130
00132 Graph *d_output_graph;
00133
00135 Table *d_table;
00136
00138 Table *d_result_table;
00139
00141 int d_n;
00142
00144 double *d_x;
00145
00147 double *d_y;
00148
00150 double d_tolerance;
00151
00153 int d_points;
00154
00156 int d_curveColorIndex;
00157
00159 int d_max_iterations;
00160
00162 QwtPlotCurve *d_curve;
00163
00165 int d_prec;
00166
00168 bool d_init_err;
00169
00171 double d_from, d_to;
00172
00174 bool d_sort_data;
00175
00177 int d_min_points;
00178
00180 QString d_explanation;
00181
00183 bool d_graphics_display;
00184
00185 QString d_y_col_name;
00186 };
00187
00188 #endif