MIRA
CurveTemplatesVisualization2D.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * All rights reserved.
5  *
6  * Redistribution and modification of this code is strictly prohibited.
7  *
8  * IN NO EVENT SHALL "MLAB" BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
9  * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
10  * OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLABS" HS BEEN
11  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12  *
13  * "MLAB" SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
14  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15  * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
16  * "AS IS" BASIS, AND "MLAB" HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
17  * SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
18  */
19 
28 #ifndef _MIRA_GUI_CURVETEMPLATESVISUALIZATION_2D_H_
29 #define _MIRA_GUI_CURVETEMPLATESVISUALIZATION_2D_H_
30 
32 
35 #include <serialization/adapters/Qt/QColor>
36 
37 #include <QGraphicsScene>
38 
39 namespace mira { namespace gui {
40 
42 
43 class CurveTemplatesVisualization2D : public Visualization2DBasic<localization::CurveTemplates>
44 {
46  ("Name", "CurveTemplates")
47  ("Description", "Visualization of recorded laser templates")
48  ("Category", "Maps"))
49 
50 public:
52  virtual ~CurveTemplatesVisualization2D() {}
53 
54  template <typename Reflector>
55  void reflect(Reflector& r)
56  {
58 
59  r.property("CurveIndex", mCurveIndex, setter<int>(&CurveTemplatesVisualization2D::setCurveIndex, this),
60  "Set index of the individual curve to display", 0);
61  r.property("PointSize", getter<qreal>(&CurveTemplatesVisualization2D::pointSize, this),
62  setter<qreal>(&CurveTemplatesVisualization2D::setPointSize, this), "The width of a path point [m]", 0.01f);
63  r.property("Color", getter<QColor>(&CurveTemplatesVisualization2D::color, this),
64  setter<QColor>(&CurveTemplatesVisualization2D::setColor, this), "The color to use for painting the path", QColor(0, 0, 0, 180));
65  }
66 
67  virtual QGraphicsItem* setupScene(QGraphicsScene* mgr);
68  virtual void setEnabled(bool enabled);
69 
70 public:
71  void setPointSize(qreal size);
72  qreal pointSize() const;
73 
74  void setColor(QColor color);
75  QColor color() const;
76 
77 protected:
79  void setCurveIndex(int value);
80 
81 protected:
82  void redrawCurrent();
83  void validateCurveIndex();
84 
86  int mCurveIndex; // std::size_t has a bug and cannot be edited in the PropertyEditor
87 
89 };
90 
92 
93 }}
94 
95 #endif
PointVectorObject< Point2f > * mPointVector
Definition: CurveTemplatesVisualization2D.h:88
#define MIRA_REFLECT_BASE(reflector, BaseClass)
std::vector< CurveTemplate > CurveTemplates
Definition: LaserTemplate.h:62
int mCurveIndex
Definition: CurveTemplatesVisualization2D.h:86
#define MIRA_META_OBJECT(classIdentifier, MetaInfo)
virtual void dataChanged(ChannelRead< localization::CurveTemplates > data)
localization::CurveTemplates mTemplate
Definition: CurveTemplatesVisualization2D.h:85
Definition: CurveTemplatesVisualization2D.h:43