scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Filter.h
Go to the documentation of this file.
1 
11 
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, QString name = QString());
47  Filter(ApplicationWindow *parent, Graph *g = 0, QString name = QString());
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(QColor colorId){d_curveColor = 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 
122 
125 
127  unsigned d_n;
128 
130  double *d_x;
131 
133  double *d_y;
134 
136  double d_tolerance;
137 
139  int d_points;
140 
142  QColor d_curveColor;
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
Filter::isDataAcceptable
virtual bool isDataAcceptable()
Definition: Filter.cpp:120
Filter::d_max_iterations
int d_max_iterations
Maximum number of iterations per fit.
Definition: Filter.h:145
Filter::d_points
int d_points
Number of result points to de calculated and displayed in the output curve.
Definition: Filter.h:139
Filter::setColor
void setColor(QColor colorId)
Sets the color of the output fit curve.
Definition: Filter.h:64
Filter::sortedCurveData
int sortedCurveData(QwtPlotCurve *c, double start, double end, double **x, double **y)
Same as curveData, but sorts the points by their x value.
Definition: Filter.cpp:240
Filter::setMaximumIterations
void setMaximumIterations(int iter)
Sets the maximum number of iterations to be performed during an iterative session.
Definition: Filter.h:76
Filter::d_x
double * d_x
x data set to be analysed
Definition: Filter.h:130
Filter::d_sort_data
bool d_sort_data
Specifies if the filter needs sorted data as input.
Definition: Filter.h:160
Filter::d_to
double d_to
Definition: Filter.h:157
Filter::setOutputPoints
void setOutputPoints(int points)
Sets the number of points in the output curve.
Definition: Filter.h:70
Filter::d_prec
int d_prec
Precision (number of significant digits) used for the results output.
Definition: Filter.h:151
Filter::d_curve
QwtPlotCurve * d_curve
The curve to be analysed.
Definition: Filter.h:148
Filter::setOutputPrecision
void setOutputPrecision(int digits)
Sets the precision used for the output.
Definition: Filter.h:73
Filter::~Filter
~Filter()
Definition: Filter.cpp:327
Filter::d_tolerance
double d_tolerance
GSL Tolerance, if ever needed...
Definition: Filter.h:136
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:51
Filter::setInterval
void setInterval(double from, double to)
Changes the data range if the source curve was already assigned. Provided for convenience.
Definition: Filter.cpp:79
Filter::curveIndex
int curveIndex(const QString &curveTitle, Graph *g)
Performs checks and returns the index of the source data curve if OK, -1 otherwise.
Definition: Filter.cpp:129
Filter
Abstract base class for data analysis operations.
Definition: Filter.h:42
Filter::legendInfo
virtual QString legendInfo()
Output string added to the plot as a new legend.
Definition: Filter.h:82
Filter::curveData
int curveData(QwtPlotCurve *c, double start, double end, double **x, double **y)
Sets x and y to the curve points between start and end.
Definition: Filter.cpp:275
Filter::dataSize
int dataSize()
Returns the size of the fitted data set.
Definition: Filter.h:85
ApplicationWindow
SciDAVis's main window.
Definition: ApplicationWindow.h:122
Filter::d_table
Table * d_table
A table source of data.
Definition: Filter.h:124
Filter::d_min_points
int d_min_points
Minimum number of data points necessary to perform the operation.
Definition: Filter.h:163
Filter::output
virtual void output()
Performs the data analysis and takes care of the output.
Definition: Filter.cpp:229
Filter::d_explanation
QString d_explanation
String explaining the operation in the comment of the result table and in the project explorer.
Definition: Filter.h:166
Filter::d_graph
Graph * d_graph
The graph where the result curve should be displayed.
Definition: Filter.h:118
Filter::d_curveColor
QColor d_curveColor
Color index of the result curve.
Definition: Filter.h:142
name
char * name()
Definition: exp_saturation.c:45
Filter::setDataCurve
virtual void setDataCurve(int curve, double start, double end)
Definition: Filter.cpp:90
Filter::d_from
double d_from
Data interval.
Definition: Filter.h:157
Filter::showLegend
virtual void showLegend()
Adds a new legend to the plot. Calls virtual legendInfo()
Definition: Filter.cpp:196
Filter::logInfo
virtual QString logInfo()
Output string added to the log pannel of the application.
Definition: Filter.h:112
Filter::error
bool error()
Definition: Filter.h:87
Filter::d_n
unsigned d_n
Size of the data arrays.
Definition: Filter.h:127
Filter::run
virtual bool run()
Actually does the job. Should be reimplemented in derived classes.
Definition: Filter.cpp:208
Graph
A 2D-plotting widget.
Definition: Graph.h:119
Filter::calculateOutputData
virtual void calculateOutputData(double *X, double *Y)
Calculates the data for the output curve and store it in the X an Y vectors.
Definition: Filter.h:118
Filter::setTolerance
void setTolerance(double eps)
Sets the tolerance used by the GSL routines.
Definition: Filter.h:61
Filter::setDataFromCurve
bool setDataFromCurve(const QString &curveTitle, Graph *g=0)
Definition: Filter.cpp:151
Filter::Filter
Filter(ApplicationWindow *parent, Table *t=0, QString name=QString())
Definition: Filter.cpp:54
Filter::d_init_err
bool d_init_err
Error flag telling if something went wrong during the initialization phase.
Definition: Filter.h:154
ApplicationWindow.h
Filter::addResultCurve
QwtPlotCurve * addResultCurve(double *x, double *y)
Adds the result curve to the target output plot window. Creates a hidden table and frees the input da...
Definition: Filter.cpp:301
Filter::init
void init()
Definition: Filter.cpp:62
Filter::d_y
double * d_y
y data set to be analysed
Definition: Filter.h:133