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 FILTER_H
00030 #define FILTER_H
00031
00032 #include <QObject>
00033
00034 #include <ApplicationWindow.h>
00035
00036 class MultiLayer;
00037 class QwtPlotCurve;
00038 class Graph;
00039 class Table;
00040
00042 class Filter : public QObject
00043 {
00044 Q_OBJECT
00045
00046 public:
00047 Filter(ApplicationWindow *parent, Table *t = 0, const QString& name = QString());
00048 Filter(ApplicationWindow *parent, Graph *g = 0, const QString& name = QString());
00049 Filter(ApplicationWindow *parent, QwtPlotCurve *c);
00050 ~Filter();
00051
00053 virtual bool run();
00054
00055 virtual void setDataCurve(QwtPlotCurve *curve, double start, double end);
00056 bool setDataFromCurve(QwtPlotCurve *c);
00057 bool setDataFromCurve(QwtPlotCurve *c, double from, double to);
00058 bool setDataFromCurve(const QString& curveTitle, Graph *g = 0);
00059 bool setDataFromCurve(const QString& curveTitle, double from, double to, Graph *g = 0);
00060
00061 virtual bool setDataFromTable(Table *, const QString&, const QString&, int = 1, int = -1);
00062
00064 void setInterval(double from, double to);
00065
00067 void setTolerance(double eps){d_tolerance = eps;};
00068
00070 void setColor(int colorId);
00072 void setColor(const QColor& color){d_curveColor = color;};
00074 void setColor(const QString& colorName);
00075
00077 void setOutputPoints(int points){d_points = points;};
00078
00080 void setOutputPrecision(int digits){d_prec = digits;};
00081
00083 void setMaximumIterations(int iter){d_max_iterations = iter;};
00084
00086 virtual void showLegend();
00087
00089 virtual QString legendInfo(){return QString();};
00090
00092 int dataSize(){return d_n;};
00094 double* x(){return d_x;};
00096 double* y(){return d_y;};
00098 Table *resultTable(){return d_result_table;};
00100 Graph *outputGraph(){return d_output_graph;};
00101
00102 bool error(){return d_init_err;};
00103
00104 virtual void enableGraphicsDisplay(bool on = true, Graph *g = 0);
00105
00106 protected:
00107 void init();
00108 void memoryErrorMessage();
00110 virtual void freeMemory();
00111
00114 virtual int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00116 virtual int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00117
00118 int curveRange(QwtPlotCurve *c, double start, double end, int *iStart, int *iEnd);
00119
00121 QwtPlotCurve* addResultCurve(double *x, double *y);
00122
00124 int curveIndex(const QString& curveTitle, Graph *g);
00125
00127 virtual QString logInfo(){return QString();};
00128
00130 virtual void output();
00131
00133 virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
00134
00135 MultiLayer* createOutputGraph();
00136
00138 Graph *d_graph;
00139
00141 Graph *d_output_graph;
00142
00144 Table *d_table;
00145
00147 Table *d_result_table;
00148
00150 int d_n;
00151
00153 double *d_x;
00154
00156 double *d_y;
00157
00159 double d_tolerance;
00160
00162 int d_points;
00163
00165 QColor d_curveColor;
00166
00168 int d_max_iterations;
00169
00171 QwtPlotCurve *d_curve;
00172
00174 int d_prec;
00175
00177 bool d_init_err;
00178
00180 double d_from, d_to;
00181
00183 bool d_sort_data;
00184
00186 int d_min_points;
00187
00189 QString d_explanation;
00190
00192 bool d_graphics_display;
00193
00194 QString d_y_col_name;
00195 };
00196
00197 #endif