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
#ifndef QGCXYPLOT_H
#define QGCXYPLOT_H

#include "QGCToolWidgetItem.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();
30
    void styleChanged(bool styleIsDark);
John Tapsell's avatar
John Tapsell committed
31 32
    void updateMinMaxSettings();

33

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

John Tapsell's avatar
John Tapsell committed
40 41 42 43 44
private:
    Ui::QGCXYPlot *ui;
    QwtPlot *plot;
    XYPlotCurve* xycurve;

45
    bool autoScaleTime;
John Tapsell's avatar
John Tapsell committed
46 47 48 49 50 51
    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
52
    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
53 54 55
};

#endif // QGCXYPLOT_H