OpenCurves  0.9
plotgenerator.h
1 //
2 // author Kazys Stepanas
3 //
4 // Copyright (c) CSIRO 2015
5 //
6 #ifndef PLOTGENERATOR_H_
7 #define PLOTGENERATOR_H_
8 
9 #include "ocurvesconfig.h"
10 
11 #include <QThread>
12 
13 #include <QDir>
14 #include <QList>
15 #include <QRgb>
16 #include <QString>
17 #include <QStringList>
18 #include <QVector>
19 #include <QPointF>
20 
21 class QMutex;
22 class QwtPlotCurve;
23 class QwtPointSeriesData;
24 class PlotExpression;
25 
26 class Curves;
27 class FileHandle;
28 class PlotFile;
29 class PlotExpression;
30 class PlotInstance;
31 
84 class PlotGenerator : public QThread
85 {
86  Q_OBJECT
87 public:
90  {
91  None = 0,
94  RelativeTime = (1 << 0)
95  };
96 
100 
102  virtual ~PlotGenerator();
103 
105  inline const Curves *curves() const { return _curves; }
106 
112  void setTimeColumn(uint number);
113 
116  uint timeColumn() const;
117 
123  void setTimeScale(double scale);
124 
127  double timeScale() const;
128 
131  void setControlFlags(uint flags);
132 
137  void setControlFlags(uint flags, bool on);
138 
140  uint controlFlags() const;
141 
143  void quit() { _abortFlag = true; }
144 
148  virtual inline bool isFileLoad() const { return false; }
149 
150 public slots:
152  void abortLoad();
153 
154 signals:
157  void itemName(const QString &name);
158 
161  void itemProgress(int current);
162 
174  void overallProgress(int current, int total);
175 
179  void beginNewCurves();
180 
183  void endNewCurves();
184 
187  void loadComplete(int curveCount);
188 
189 protected:
191  QMutex *_dataMutex;
193  uint _timeColumn;
194  double _timeScale;
195  bool _abortFlag;
196 };
197 
198 #endif // PLOTGENERATOR_H_
double timeScale() const
Access the time scale used by this generator.
ControlFlag
Plot generation control flags. Must be set before execution.
Definition: plotgenerator.h:89
const Curves * curves() const
Access the curves model to load data into.
Definition: plotgenerator.h:105
void setTimeColumn(uint number)
Set the expected time column for all curves created by this generator.
virtual ~PlotGenerator()
Destructor. The thread should generally be stopped before destructing.
void itemProgress(int current)
Update progress through the current item.
void endNewCurves()
End notification of new curves via Curves::newCurve().
void loadComplete(int curveCount)
Notify completion of curve generation.
uint controlFlags() const
Access the current ControlFlag values.
Holds data for a single curve.
Definition: plotinstance.h:43
The data model for loaded plots and curves.
Definition: curves.h:36
Use relative time based on the first sample.
Definition: plotgenerator.h:94
Curves * _curves
Curves data model.
Definition: plotgenerator.h:190
uint _timeColumn
Index of the time column, zero for none.
Definition: plotgenerator.h:193
uint _controlFlags
ControlFlag values affecting generation.
Definition: plotgenerator.h:192
void setTimeScale(double scale)
Set the scale factor applied to all curves created by this generator.
QMutex * _dataMutex
Data mutex.
Definition: plotgenerator.h:191
void quit()
Call to request the generator terminate operation.
Definition: plotgenerator.h:143
PlotGenerator(Curves *curves)
Instantiate the generator thread to load data into curves.
void itemName(const QString &name)
Signal the current item name.
void overallProgress(int current, int total)
This signal reports overall progress.
A curve generation thread.
Definition: plotgenerator.h:84
bool _abortFlag
Abort requested?
Definition: plotgenerator.h:195
The PlotFile supports loading of data series from a CSV style text file.
Definition: plotfile.h:51
void beginNewCurves()
Begin the addition of new curves via Curves::newCurve() Block notification occurs at a per PlotSource...
void abortLoad()
Request loading abort.
uint timeColumn() const
The time column value in used.
A PlotExpression represents an operation in a plot equation.
Definition: plotexpression.h:91
virtual bool isFileLoad() const
True if this is a file loader.
Definition: plotgenerator.h:148
double _timeScale
Time scaling factor.
Definition: plotgenerator.h:194
void setControlFlags(uint flags)
Sets ControlFlag values for this generator.