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
00104 virtual int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00106 virtual int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00107
00108 int curveRange(QwtPlotCurve *c, double start, double end, int *iStart, int *iEnd);
00109
00111 QwtPlotCurve* addResultCurve(double *x, double *y);
00112
00114 int curveIndex(const QString& curveTitle, Graph *g);
00115
00117 virtual QString logInfo(){return QString();};
00118
00120 virtual void output();
00121
00123 virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
00124
00125 MultiLayer* createOutputGraph();
00126
00128 Graph *d_graph;
00129
00131 Graph *d_output_graph;
00132
00134 Table *d_table;
00135
00137 Table *d_result_table;
00138
00140 int d_n;
00141
00143 double *d_x;
00144
00146 double *d_y;
00147
00149 double d_tolerance;
00150
00152 int d_points;
00153
00155 int d_curveColorIndex;
00156
00158 int d_max_iterations;
00159
00161 QwtPlotCurve *d_curve;
00162
00164 int d_prec;
00165
00167 bool d_init_err;
00168
00170 double d_from, d_to;
00171
00173 bool d_sort_data;
00174
00176 int d_min_points;
00177
00179 QString d_explanation;
00180
00182 bool d_graphics_display;
00183
00184 QString d_y_col_name;
00185 };
00186
00187 #endif