QGCDataPlot2D.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef QGCDATAPLOT2D_H
#define QGCDATAPLOT2D_H

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

namespace Ui {
    class QGCDataPlot2D;
}

class QGCDataPlot2D : public QWidget {
    Q_OBJECT
public:
    QGCDataPlot2D(QWidget *parent = 0);
    ~QGCDataPlot2D();

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

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

public slots:
26
    /** @brief Load previously selected file */
27
    void loadFile();
28 29
    /** @brief Load file with this name */
    void loadFile(QString file);
30 31 32 33 34 35 36 37
    /** @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();
38 39
    /** @brief Export PDF file */
    void exportPDF(QString fileName);
40 41 42 43
    /** @brief Export SVG file */
    void exportSVG(QString file);
    /** @brief Print or save PDF file (MacOS/Linux) */
    void print();
44 45
    /** @brief Calculate and display regression function*/
    bool calculateRegression();
46 47 48 49 50 51 52

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

private:
    Ui::QGCDataPlot2D *ui;
};

#endif // QGCDATAPLOT2D_H