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 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

Generated on Thu Feb 7 13:59:26 2008 for QtiPlot by  doxygen 1.5.4