EditMapArea.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_EDITMAPAREA_H
29 #define RTABMAP_EDITMAPAREA_H
30 
31 #include "rtabmap/gui/RtabmapGuiExp.h" // DLL export/import defines
32 
33 #include <QColor>
34 #include <QImage>
35 #include <QPoint>
36 #include <QWidget>
37 #include <opencv2/opencv.hpp>
38 #include "rtabmap/utilite/UCv2Qt.h"
39 
40 class QMenu;
41 class QAction;
42 
43 namespace rtabmap {
44 
45 class RTABMAPGUI_EXP EditMapArea : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50  EditMapArea(QWidget *parent = 0);
51 
52  void setMap(const cv::Mat & map);
53  cv::Mat getModifiedMap() const;
54  bool isModified() const {return modified_;}
55 
56  void setPenWidth(int newWidth);
57  int penWidth() const { return myPenWidth_; }
58  void setColorMap(uCvQtDepthColorMap type);
59 
60 public Q_SLOTS:
61  void resetChanges();
62 
63 protected:
64  virtual void mousePressEvent(QMouseEvent *event);
65  virtual void mouseMoveEvent(QMouseEvent *event);
66  virtual void mouseReleaseEvent(QMouseEvent *event);
67  virtual void paintEvent(QPaintEvent *event);
68  virtual void resizeEvent(QResizeEvent *event);
69  virtual void contextMenuEvent(QContextMenuEvent * e);
70 
71 private:
72  void drawLineTo(const QPoint &endPoint);
73  void computeScaleOffsets(const QRect & targetRect, float & scale, float & offsetX, float & offsetY) const;
74 
75  bool modified_;
78  QImage map_;
79  cv::Mat originalMap_;
80  QPoint lastPoint_;
81 
82  QMenu * menu_;
83  QAction * resetChanges_;
84  QAction * setPenWidth_;
85  QAction * addObstacle_;
86  QAction * clearObstacle_;
87  QAction * setUnknown_;
88 };
89 
90 }
91 
92 #endif
#define RTABMAPGUI_EXP
Definition: RtabmapGuiExp.h:38
QAction * addObstacle_
Definition: EditMapArea.h:85
QAction * clearObstacle_
Definition: EditMapArea.h:86
GLM_FUNC_DECL genType e()
QAction * setUnknown_
Definition: EditMapArea.h:87
GLM_FUNC_DECL detail::tmat4x4< T, P > scale(detail::tmat4x4< T, P > const &m, detail::tvec3< T, P > const &v)
bool isModified() const
Definition: EditMapArea.h:54
QAction * setPenWidth_
Definition: EditMapArea.h:84
int penWidth() const
Definition: EditMapArea.h:57
QAction * resetChanges_
Definition: EditMapArea.h:83
uCvQtDepthColorMap
Definition: UCv2Qt.h:30


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Jan 23 2023 03:37:28