-
Notifications
You must be signed in to change notification settings - Fork 2
/
plotter.h
101 lines (85 loc) · 3.52 KB
/
plotter.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/***************************************************************************
* Copyright 2015 Michael Eischer, Philipp Nordhus *
* Robotics Erlangen e.V. *
* http://www.robotics-erlangen.de/ *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef PLOTTER_H
#define PLOTTER_H
#include "proto/cpp/messages_parsian_simurosot_data_wrapper.pb.h"
#include <QDialog>
#include <QSet>
#include <QStandardItemModel>
#define MSG WorldModel
class LeafFilterProxyModel;
class Plot;
class GuiTimer;
class QMenu;
namespace Ui {
class Plotter;
}
class Plotter : public QWidget
{
Q_OBJECT
public:
explicit Plotter();
~Plotter() override;
public slots:
void setScaling(float min, float max, float timespan);
void handleStatus(WorldModel *status);
void clearData();
signals:
void addPlot(const Plot *plot);
void removePlot(const Plot *plot);
protected:
void closeEvent(QCloseEvent *event) override;
private slots:
void updateScrollBar();
void updateOffset(int pos);
void setFreeze(bool freeze);
void plotContextMenu(const QPoint &pos);
void clearSelection();
void itemChanged(QStandardItem *item);
void invalidatePlots();
private:
bool eventFilter(QObject *obj, QEvent *event) override;
void loadSelection();
QStandardItem* getItem(const QString &name);
void addRootItem(const QString &name, const QString &displayName);
void parseMessage(const google::protobuf::Message &message, const QString &parent, float time);
void addPoint(const std::string &name, const QString &parent, float time, float value, QVector<QStandardItem *> &childLookup, int descriptorIndex);
void tryAddLength(const std::string &name, const QString &parent, float time, float value1, float value2, QVector<QStandardItem *> &childLookup, int descriptorIndex);
private:
enum ItemRole {
FullNameRole = Qt::UserRole + 2
};
Ui::Plotter *ui;
qint64 m_startTime;
qint64 m_time;
double m_timeLimit;
bool m_freeze;
GuiTimer *m_guiTimer;
QHash<QString, QStandardItem*> m_items;
QHash<QString, QVector<QStandardItem *>> m_itemLookup;
QHash<QStandardItem*, Plot*> m_plots;
QHash<QStandardItem*, Plot*> m_frozenPlots;
QSet<QString> m_selection;
QStandardItemModel m_model;
LeafFilterProxyModel *m_proxy;
QMenu *m_plotMenu;
int cnt;
};
#endif // PLOTTER_H