Debian Codegraph @

octovis/include/octovis/ViewerWidget.h

raw symbols SCIP
1 /*
2 * This file is part of OctoMap - An Efficient Probabilistic 3D Mapping
3 * Framework Based on Octrees
4 * http://octomap.github.io
5 *
6 * Copyright (c) 2009-2014, K.M. Wurm and A. Hornung, University of Freiburg
7 * All rights reserved. License for the viewer octovis: GNU GPL v2
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9 *
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
23 */
24
25 #ifndef VIEWERWIDGET_H_
26 #define VIEWERWIDGET_H_
27
28 #include "SceneObject.h"
29 #include "SelectionBox.h"
30 #include <octomap/octomap.h>
31 #include <qglviewer.h>
32
33 namespace octomap{
34
35 class ViewerWidget : public QGLViewer {
36 Q_OBJECT
37
38 public:
39
40 ViewerWidget(QWidget* parent = NULL);
41 void clearAll();
42
43 /**
44 * Adds an object to the scene that can be drawn
45 *
46 * @param obj SceneObject to be added
47 */
48 void addSceneObject(SceneObject* obj);
49
50 /**
51 * Removes a SceneObject from the list of drawable objects if
52 * it has been added previously. Does nothing otherwise.
53 *
54 * @param obj SceneObject to be removed
55 */
56 void removeSceneObject(SceneObject* obj);
57
58 public slots:
59 void enablePrintoutMode (bool enabled = true);
60 void enableHeightColorMode (bool enabled = true);
61 void enableSemanticColoring (bool enabled = true);
62 void enableSelectionBox (bool enabled = true);
63 void setCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ);
64 void setCamPose(const octomath::Pose6D& pose);
65 virtual void setSceneBoundingBox(const qglviewer::Vec& min, const qglviewer::Vec& max);
66 void deleteCameraPath(int id);
67 void appendToCameraPath(int id, const octomath::Pose6D& pose);
68 void appendCurrentToCameraPath(int id);
69 void addCurrentToCameraPath(int id, int frame);
70 void removeFromCameraPath(int id, int frame);
71 void updateCameraPath(int id, int frame);
72 void jumpToCamFrame(int id, int frame);
73 void playCameraPath(int id, int start_frame);
74 void stopCameraPath(int id);
75 const SelectionBox& selectionBox() const { return m_selectionBox;}
76
77 /**
78 * Resets the 3D viewpoint to the initial value
79 */
80 void resetView();
81
82 private slots:
83 void cameraPathFinished();
84 void cameraPathInterpolated();
85
86 signals:
87 void cameraPathStopped(int id);
88 void cameraPathFrameChanged(int id, int current_camera_frame);
89 void select(const QMouseEvent* e);
90
91 protected:
92
93 virtual void draw();
94 virtual void drawWithNames();
95 virtual void init();
96 /**
97 * Overloaded from QGLViewer. Draws own axis and grid in scale, then calls QGLViewer::postDraw().
98 */
99 virtual void postDraw();
100 virtual void postSelection(const QPoint&);
101 virtual QString helpString() const;
102
103 qglviewer::Quaternion poseToQGLQuaternion(const octomath::Pose6D& pose);
104
105 std::vector<SceneObject*> m_sceneObjects;
106 SelectionBox m_selectionBox;
107
108 bool m_printoutMode;
109 bool m_heightColorMode;
110 bool m_semantic_coloring;
111
112 bool m_drawAxis; // actual state of axis (original overwritten)
113 bool m_drawGrid; // actual state of grid (original overwritten)
114 bool m_drawSelectionBox;
115
116 double m_zMin;
117 double m_zMax;
118
119 int m_current_camera_path;
120 int m_current_camera_frame;
121 };
122
123 }
124
125 #endif /* VIEWERWIDGET_H_ */