Filter.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : Filter.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2007 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Abstract base class for data analysis operations
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
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

Generated on Mon Oct 15 06:11:41 2007 for QtiPlot by  doxygen 1.5.3