QGCXYPlot.h 1.64 KB
Newer Older
John Tapsell's avatar
John Tapsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#ifndef QGCXYPLOT_H
#define QGCXYPLOT_H

#include "QGCToolWidgetItem.h"
#include "MainWindow.h"

namespace Ui
{
class QGCXYPlot;
}

class UASInterface;
class QwtPlot;
class XYPlotCurve;

class QGCXYPlot : public QGCToolWidgetItem
{
    Q_OBJECT

public:
    explicit QGCXYPlot(QWidget *parent = 0);
    ~QGCXYPlot();
    virtual void setEditMode(bool editMode);

public slots:
    void writeSettings(QSettings& settings);
    void readSettings(const QSettings& settings);
    void readSettings(const QString& pre,const QVariantMap& settings);
    void appendData(int uasId, const QString& curve, const QString& unit, const QVariant& variant, quint64 usec);
    void clearPlot();
    void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style);
    void updateMinMaxSettings();

34 35
private slots:
    void on_maxDataShowSpinBox_valueChanged(int value);
36 37 38
    void on_stopStartButton_toggled(bool checked);

    void on_timeScrollBar_valueChanged(int value);
39

John Tapsell's avatar
John Tapsell committed
40 41 42 43 44 45 46 47 48 49 50
private:
    Ui::QGCXYPlot *ui;
    QwtPlot *plot;
    XYPlotCurve* xycurve;

    double x; /**< Last unused value for the x-coordinate */
    quint64 x_timestamp_us; /**< Timestamp that we last recieved a value for x */
    bool x_valid; /**< Whether we have recieved an x value but so far no corresponding y value */
    double y; /**< Last unused value for the x-coordinate */
    quint64 y_timestamp_us; /**< Timestamp that we last recieved a value for x */
    bool y_valid; /**< Whether we have recieved an x value but so far no corresponding y value */
Don Gagne's avatar
Don Gagne committed
51
    quint64 max_timestamp_diff_us; /**< Only combine x and y to a data point if the timestamp for both doesn't differ by more than this */
John Tapsell's avatar
John Tapsell committed
52 53 54
};

#endif // QGCXYPLOT_H