StatsToolBox.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef RTABMAP_STATSTOOLBOX_H_
29 #define RTABMAP_STATSTOOLBOX_H_
30 
31 #include "rtabmap/gui/rtabmap_gui_export.h" // DLL export/import defines
32 
33 #include <QWidget>
34 #include <QtCore/QMap>
35 
36 class QToolButton;
37 class QLabel;
38 class QMenu;
39 class QGridLayout;
40 class QToolBox;
41 
42 namespace rtabmap {
43 
44 class RTABMAP_GUI_EXPORT StatItem : public QWidget
45 {
46  Q_OBJECT;
47 
48 public:
49  StatItem(const QString & name, bool cacheOn, const std::vector<qreal> & x, const std::vector<qreal> & y, const QString & unit = QString(), const QMenu * menu = 0, QGridLayout * grid = 0, QWidget * parent = 0);
50  virtual ~StatItem();
51  void addValue(qreal y);
52  void addValue(qreal x, qreal y);
53  void setValues(const std::vector<qreal> & x, const std::vector<qreal> & y);
54  QString value() const;
55  std::vector<qreal> xValues() const {return _x;}
56  std::vector<qreal> yValues() const {return _y;}
57  void setCacheOn(bool on);
58  void clearCache();
59 
60 public Q_SLOTS:
61  void updateMenu(const QMenu * menu);
62 
63 Q_SIGNALS:
64  void valueAdded(qreal);
65  void valueAdded(qreal, qreal);
66  void valuesChanged(const std::vector<qreal> &, const std::vector<qreal> &);
67  void plotRequested(const StatItem *, const QString &);
68 
69 private Q_SLOTS:
70  void preparePlotRequest();
71 
72 private:
73  void setupUi(QGridLayout * grid);
74 
75 private:
76  QToolButton * _button;
77  QLabel * _name;
78  QLabel * _value;
79  QLabel * _unit;
80  QMenu * _menu;
81 
82  bool _cacheOn;
83  std::vector<qreal> _x;
84  std::vector<qreal> _y;
85 };
86 
87 
88 
89 
90 class RTABMAP_GUI_EXPORT StatsToolBox : public QWidget
91 {
92  Q_OBJECT;
93 
94 public:
95  StatsToolBox(QWidget * parent);
96  virtual ~StatsToolBox();
97 
98  void getFiguresSetup(QList<int> & curvesPerFigure, QStringList & curveNames, QStringList & curveThresholds);
99  void addCurve(const QString & name, bool newFigure = true, bool cacheOn = false);
100  void addThreshold(const QString & name, qreal value); // Add to latest figure
101  void setWorkingDirectory(const QString & workingDirectory);
102  void setNewFigureMaxItems(int value) {_newFigureMaxItems = value;}
103  void closeFigures();
104  void setCacheOn(bool on);
105 
106 public Q_SLOTS:
107  void updateStat(const QString & statFullName, bool cacheOn);
108  void updateStat(const QString & statFullName, qreal y, bool cacheOn);
109  void updateStat(const QString & statFullName, qreal x, qreal y, bool cacheOn);
110  void updateStat(const QString & statFullName, const std::vector<qreal> & x, const std::vector<qreal> & y, bool cacheOn);
111  void clear();
112 
113 Q_SIGNALS:
114  void menuChanged(const QMenu *);
115  void figuresSetupChanged();
116 
117 private Q_SLOTS:
118  void plot(const StatItem * stat, const QString & plotName = QString());
119  void figureDeleted(QObject * obj);
120 
121 protected:
122  virtual void contextMenuEvent(QContextMenuEvent * event);
123 
124 private:
125  QMenu * _plotMenu;
126  QToolBox * _statBox;
129  QMap<QString, QWidget*> _figures;
130 };
131 
132 }
133 
134 #endif /* STATSTOOLBOX_H_ */
rtabmap::StatsToolBox
Definition: StatsToolBox.h:90
rtabmap::StatsToolBox::setNewFigureMaxItems
void setNewFigureMaxItems(int value)
Definition: StatsToolBox.h:102
name
rtabmap::StatItem::_x
std::vector< qreal > _x
Definition: StatsToolBox.h:83
rtabmap::StatsToolBox::_plotMenu
QMenu * _plotMenu
Definition: StatsToolBox.h:125
rtabmap::StatItem::xValues
std::vector< qreal > xValues() const
Definition: StatsToolBox.h:55
rtabmap::StatsToolBox::_newFigureMaxItems
int _newFigureMaxItems
Definition: StatsToolBox.h:128
rtabmap::StatsToolBox::_figures
QMap< QString, QWidget * > _figures
Definition: StatsToolBox.h:129
y
Matrix3f y
rtflann::addValue
void addValue(int pos, float val, float *vals, T *point, T *points, int n)
Definition: simplex_downhill.h:69
rtabmap::StatItem
Definition: StatsToolBox.h:44
rtabmap::StatsToolBox::_statBox
QToolBox * _statBox
Definition: StatsToolBox.h:126
x
x
rtabmap::StatItem::_y
std::vector< qreal > _y
Definition: StatsToolBox.h:84
rtabmap::StatItem::_unit
QLabel * _unit
Definition: StatsToolBox.h:79
rtabmap::StatItem::_cacheOn
bool _cacheOn
Definition: StatsToolBox.h:82
rtabmap::StatItem::_menu
QMenu * _menu
Definition: StatsToolBox.h:80
rtabmap::StatsToolBox::_workingDirectory
QString _workingDirectory
Definition: StatsToolBox.h:127
rtabmap::StatItem::_name
QLabel * _name
Definition: StatsToolBox.h:77
rtabmap::StatItem::yValues
std::vector< qreal > yValues() const
Definition: StatsToolBox.h:56
rtabmap::StatItem::_value
QLabel * _value
Definition: StatsToolBox.h:78
rtabmap::StatItem::_button
QToolButton * _button
Definition: StatsToolBox.h:76
rtabmap
Definition: CameraARCore.cpp:35
value
value


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:22