SciDAVis  1.D4
Filter.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Filter.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Abstract base class for data analysis operations
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef FILTER_H
30 #define FILTER_H
31 
32 #include <QObject>
33 
34 #include "ApplicationWindow.h"
35 
36 class QwtPlotCurve;
37 class Graph;
38 class Table;
39 
41 class Filter : public QObject
42 {
43  Q_OBJECT
44 
45  public:
46  Filter(ApplicationWindow *parent, Table *t = 0, const char * name = 0);
47  Filter(ApplicationWindow *parent, Graph *g = 0, const char * name = 0);
48  ~Filter();
49 
51  virtual bool run();
52 
53  virtual void setDataCurve(int curve, double start, double end);
54  bool setDataFromCurve(const QString& curveTitle, Graph *g = 0);
55  bool setDataFromCurve(const QString& curveTitle, double from, double to, Graph *g = 0);
56 
58  void setInterval(double from, double to);
59 
61  void setTolerance(double eps){d_tolerance = eps;};
62 
64  void setColor(int colorId){d_curveColorIndex = colorId;};
65 
67  void setColor(const QString& colorName);
68 
70  void setOutputPoints(int points){d_points = points;};
71 
73  void setOutputPrecision(int digits){d_prec = digits;};
74 
76  void setMaximumIterations(int iter){d_max_iterations = iter;};
77 
79  virtual void showLegend();
80 
82  virtual QString legendInfo(){return QString();};
83 
85  int dataSize(){return d_n;};
86 
87  bool error(){return d_init_err;};
88 
89  private:
90  void init();
91 
98  int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
100  int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
101 
102  protected:
103  virtual bool isDataAcceptable();
104 
106  QwtPlotCurve* addResultCurve(double *x, double *y);
107 
109  int curveIndex(const QString& curveTitle, Graph *g);
110 
112  virtual QString logInfo(){return QString();};
113 
115  virtual void output();
116 
118  virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
119 
121  Graph *d_graph;
122 
125 
127  int d_n;
128 
130  double *d_x;
131 
133  double *d_y;
134 
136  double d_tolerance;
137 
139  int d_points;
140 
143 
146 
148  QwtPlotCurve *d_curve;
149 
151  int d_prec;
152 
155 
157  double d_from, d_to;
158 
161 
164 
166  QString d_explanation;
167 };
168 
169 #endif