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 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){d_curveColorIndex = colorId;};
00071 
00073         void setColor(const QString& colorName);
00074 
00076         void setOutputPoints(int points){d_points = points;};
00077 
00079         void setOutputPrecision(int digits){d_prec = digits;};
00080 
00082         void setMaximumIterations(int iter){d_max_iterations = iter;};
00083 
00085         virtual void showLegend();
00086 
00088         virtual QString legendInfo(){return QString();};
00089 
00091         int dataSize(){return d_n;};
00093         double* x(){return d_x;};
00095         double* y(){return d_y;};
00097         Table *resultTable(){return d_result_table;};
00099         Graph *outputGraph(){return d_output_graph;};
00100 
00101         bool error(){return d_init_err;};
00102 
00103         virtual void enableGraphicsDisplay(bool on = true, Graph *g = 0);
00104 
00105     protected:
00106         void init();
00107         void memoryErrorMessage();
00109         virtual void freeMemory();
00110 
00113         virtual int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00115         virtual int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y);
00116 
00117         int curveRange(QwtPlotCurve *c, double start, double end, int *iStart, int *iEnd);
00118 
00120         QwtPlotCurve* addResultCurve(double *x, double *y);
00121 
00123         int curveIndex(const QString& curveTitle, Graph *g);
00124 
00126         virtual QString logInfo(){return QString();};
00127 
00129         virtual void output();
00130 
00132         virtual void calculateOutputData(double *X, double *Y) { Q_UNUSED(X) Q_UNUSED(Y) };
00133 
00134         MultiLayer* createOutputGraph();
00135 
00137         Graph *d_graph;
00138 
00140         Graph *d_output_graph;
00141 
00143         Table *d_table;
00144 
00146         Table *d_result_table;
00147 
00149         int d_n;
00150 
00152         double *d_x;
00153 
00155         double *d_y;
00156 
00158         double d_tolerance;
00159 
00161         int d_points;
00162 
00164         int d_curveColorIndex;
00165 
00167         int d_max_iterations;
00168 
00170         QwtPlotCurve *d_curve;
00171 
00173         int d_prec;
00174 
00176         bool d_init_err;
00177 
00179         double d_from, d_to;
00180 
00182         bool d_sort_data;
00183 
00185         int d_min_points;
00186 
00188         QString d_explanation;
00189 
00191         bool d_graphics_display;
00192 
00193         QString d_y_col_name;
00194 };
00195 
00196 #endif

Generated by  doxygen 1.6.2