QGCDataPlot2D.h 1.6 KB
Newer Older
1
2
3
4
5
6
7
8
#ifndef QGCDATAPLOT2D_H
#define QGCDATAPLOT2D_H

#include <QWidget>
#include <QFile>
#include "IncrementalPlot.h"
#include "LogCompressor.h"

9
10
11
namespace Ui
{
class QGCDataPlot2D;
12
13
}

14
15
class QGCDataPlot2D : public QWidget
{
16
17
18
19
20
    Q_OBJECT
public:
    QGCDataPlot2D(QWidget *parent = 0);
    ~QGCDataPlot2D();

21
22
23
    /** @brief Calculate and display regression function*/
    bool calculateRegression(QString xName, QString yName, QString method="linear");

24
    /** @brief Linear regression over data points */
25
    int linearRegression(double* x,double* y,int n,double* a,double* b,double* r);
26
27

public slots:
28
    /** @brief Load previously selected file */
29
    void loadFile();
30
31
    /** @brief Load file with this name */
    void loadFile(QString file);
32
33
34
35
36
37
38
39
    /** @brief Reload a file, with filtering enabled */
    void reloadFile();
    void selectFile();
    void loadCsvLog(QString file, QString xAxisName="", QString yAxisFilter="");
    void loadRawLog(QString file, QString xAxisName="", QString yAxisFilter="");
    void saveCsvLog();
    /** @brief Save plot to PDF or SVG */
    void savePlot();
40
41
    /** @brief Export PDF file */
    void exportPDF(QString fileName);
42
43
44
45
    /** @brief Export SVG file */
    void exportSVG(QString file);
    /** @brief Print or save PDF file (MacOS/Linux) */
    void print();
46
47
    /** @brief Calculate and display regression function*/
    bool calculateRegression();
48
49
50
51
52
53
54

protected:
    void changeEvent(QEvent *e);
    IncrementalPlot* plot;
    LogCompressor* compressor;
    QFile* logFile;
    QString fileName;
55
    QStringList curveNames;
56
57
58
59
60
61

private:
    Ui::QGCDataPlot2D *ui;
};

#endif // QGCDATAPLOT2D_H