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/rtabmap_gui_export.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 RTABMAP_GUI_EXPORT 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
rtabmap::EditMapArea::setPenWidth_
QAction * setPenWidth_
Definition: EditMapArea.h:84
rtabmap::EditMapArea::isModified
bool isModified() const
Definition: EditMapArea.h:54
rtabmap::EditMapArea
Definition: EditMapArea.h:45
uCvQtDepthColorMap
uCvQtDepthColorMap
Definition: UCv2Qt.h:30
type
rtabmap::EditMapArea::scribbling_
bool scribbling_
Definition: EditMapArea.h:76
rtabmap::EditMapArea::originalMap_
cv::Mat originalMap_
Definition: EditMapArea.h:79
rtabmap::EditMapArea::penWidth
int penWidth() const
Definition: EditMapArea.h:57
rtabmap::EditMapArea::map_
QImage map_
Definition: EditMapArea.h:78
rtabmap::EditMapArea::modified_
bool modified_
Definition: EditMapArea.h:75
rtabmap::EditMapArea::resetChanges_
QAction * resetChanges_
Definition: EditMapArea.h:83
rtabmap::EditMapArea::myPenWidth_
int myPenWidth_
Definition: EditMapArea.h:77
UCv2Qt.h
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
rtabmap::EditMapArea::addObstacle_
QAction * addObstacle_
Definition: EditMapArea.h:85
rtabmap::EditMapArea::menu_
QMenu * menu_
Definition: EditMapArea.h:82
rtabmap::EditMapArea::setUnknown_
QAction * setUnknown_
Definition: EditMapArea.h:87
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::EditMapArea::clearObstacle_
QAction * clearObstacle_
Definition: EditMapArea.h:86
rtabmap::EditMapArea::lastPoint_
QPoint lastPoint_
Definition: EditMapArea.h:80


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