OpenCurves  0.9
plotfileloader.h
1 //
2 // author Kazys Stepanas
3 //
4 // Copyright (c) CSIRO 2015
5 //
6 #ifndef PLOTFILELOADER_H_
7 #define PLOTFILELOADER_H_
8 
9 #include "ocurvesconfig.h"
10 
11 #include "plotgenerator.h"
12 
13 #include "timesampling.h"
14 
15 #include <QStringList>
16 
39 {
40  Q_OBJECT
41 public:
49  PlotFileLoader(Curves *curves, const QStringList &plotFiles, QVector<TimeSampling> *timing = nullptr);
50 
61  bool append(const QStringList &plotFiles, QVector<TimeSampling> *timing = nullptr);
62 
66  inline void setTargetSampleCount(uint target) { _targetSampleCount = target; }
67 
70  inline uint targetSampleCount() const { return _targetSampleCount; }
71 
74  virtual inline bool isFileLoad() const override { return true; }
75 
76 protected:
78  void run() override;
79 
80 private:
89  size_t loadFile(const QString &filePath, const QString &fileName, int fileNumber, int totalFileCount, const TimeSampling &timing);
90 
99  double calculateSampleRate(PlotFile &file);
100 
101  QStringList _plotFiles;
102  QVector<TimeSampling> _plotTiming;
105  uint _targetSampleCount;
106  bool _loadComplete;
107 };
108 
109 #endif // PLOTFILELOADER_H_
const Curves * curves() const
Access the curves model to load data into.
Definition: plotgenerator.h:105
virtual bool isFileLoad() const override
True.
Definition: plotfileloader.h:74
bool append(const QStringList &plotFiles, QVector< TimeSampling > *timing=nullptr)
Append a list of files to the currently loading list of files.
A plot generator which loads data from CSV style text files.
Definition: plotfileloader.h:38
void setTargetSampleCount(uint target)
Set the target maximum number of sample points in a curve.
Definition: plotfileloader.h:66
Defines how to sample a plot file.
Definition: timesampling.h:11
void run() override
File loading implementation.
The data model for loaded plots and curves.
Definition: curves.h:36
PlotFileLoader(Curves *curves, const QStringList &plotFiles, QVector< TimeSampling > *timing=nullptr)
Creates a loader for the given file set.
A curve generation thread.
Definition: plotgenerator.h:84
The PlotFile supports loading of data series from a CSV style text file.
Definition: plotfile.h:51
uint targetSampleCount() const
Access the target sample count.
Definition: plotfileloader.h:70