ViewerGui.h
Go to the documentation of this file.
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 VIEWERGUI_H
26 #define VIEWERGUI_H
27 
28 #include <qglobal.h>
29 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
30 #include <QtWidgets/QMainWindow>
31 #else // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
32 #include <QtGui/QMainWindow>
33 #endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
34 #include <QFileDialog>
35 #include <QMessageBox>
36 #include <QDockWidget>
37 #include <string>
38 #include <cmath>
39 #include "TrajectoryDrawer.h"
40 #include "PointcloudDrawer.h"
41 #include "OcTreeDrawer.h"
42 #include "CameraFollowMode.h"
43 #include "ViewerWidget.h"
44 #include "ViewerSettings.h"
45 #include "ViewerSettingsPanel.h"
47 #include "ui_ViewerGui.h"
48 
49 #include <octomap/AbstractOcTree.h>
50 #include <octomap/OcTreeBase.h>
51 #include <octovis/OcTreeRecord.h>
52 
53 namespace octomap {
54 
55  class ViewerGui : public QMainWindow {
56  Q_OBJECT
57 
58  public:
59  ViewerGui(const std::string& filename="", QWidget *parent = 0, unsigned int initTreeDepth = 16);
60  ~ViewerGui();
61 
62  static const unsigned int LASERTYPE_URG = 0;
63  static const unsigned int LASERTYPE_SICK = 1;
64 
65  // use this drawer id if loading files or none is specified in msg
66  static const unsigned int DEFAULT_OCTREE_ID = 0;
67 
68  public slots:
69 
70  void changeTreeDepth(int depth);
71  void addNextScans(unsigned scans);
72  void gotoFirstScan();
73 
74  bool isShown();
75 
76  private slots:
77 
78  // auto-connected Slots (by name))
79 
85  void on_actionExport_sequence_triggered(bool checked);
100  void on_actionPrintout_mode_toggled(bool checked);
101  void on_actionSelection_box_toggled(bool checked);
102  void on_actionHeight_map_toggled(bool checked);
103  void on_actionSemanticColoring_toggled(bool checked);
106  void on_actionPointcloud_toggled(bool checked);
107  void on_actionTrajectory_toggled(bool checked);
108  void on_actionOctree_cells_toggled(bool enabled);
109  void on_actionOctree_structure_toggled(bool enabled);
110  void on_actionFree_toggled(bool enabled);
111  void on_actionSelected_toggled(bool enabled);
112  void on_actionAxes_toggled(bool checked);
113  void on_actionHideBackground_toggled(bool checked);
114  void on_actionAlternateRendering_toggled(bool checked);
116 
120 
123 
124  // use it for testcases etc.
126 
127  signals:
128  void updateStatusBar(QString message, int duration);
129  void changeNumberOfScans(unsigned scans);
130  void changeCurrentScan(unsigned scans);
131  void changeResolution(double resolution);
132  void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ);
133 
134  private:
139  void openFile();
140 
145  void openPointcloud();
146 
151  void openGraph(bool completeGraph = true);
152 
156  void loadGraph(bool completeGraph = true);
157 
161  void addNextScan();
162 
166  void openPC();
167 
169  void openOcTree();
170 
172  void openTree();
173 
174  // EXPERIMENTAL
175  // open a map collection (.hot-file)
176  void openMapCollection();
177 
178 
179  void setOcTreeUISwitches();
180 
184  void generateOctree();
185  void showOcTree();
186 
187  void showInfo(QString string, bool newline=false);
188 
189  void addOctree(AbstractOcTree* tree, int id, pose6d origin);
190  void addOctree(AbstractOcTree* tree, int id);
191  bool getOctreeRecord(int id, OcTreeRecord*& otr);
192 
193  void saveCameraPosition(const char* filename) const;
194  void loadCameraPosition(const char* filename);
195 
196  void updateNodesInBBX(const point3d& min, const point3d& max, bool occupied);
197  void setNodesInBBX(const point3d& min, const point3d& max, bool occupied);
198  void setNonNodesInBBX(const point3d& min, const point3d& max, bool occupied);
199 
200  std::map<int, OcTreeRecord> m_octrees;
201 
204 
205  Ui::ViewerGuiClass ui;
212  double m_occupancyThresh; // FIXME: This is not really used at the moment...
213  unsigned int m_max_tree_depth;
214  unsigned int m_laserType; // SICK or Hokuyo /URG
218 
220  std::string m_filename;
221  };
222 
223 } // namespace
224 
225 
226 #endif // VIEWERGUI_H
void on_actionRestore_camera_triggered()
Definition: ViewerGui.cpp:1014
QLabel * m_mapMemoryStatus
Definition: ViewerGui.h:217
ViewerWidget * m_glwidget
Definition: ViewerGui.h:206
ScanGraph::iterator m_nextScanToAdd
Definition: ViewerGui.h:203
static const unsigned int LASERTYPE_URG
Definition: ViewerGui.h:62
void on_actionStore_camera_triggered()
Definition: ViewerGui.cpp:1007
void on_actionOctree_cells_toggled(bool enabled)
Definition: ViewerGui.cpp:1140
void openOcTree()
open "regular" file containing an octree
Definition: ViewerGui.cpp:493
void on_action_bg_black_triggered()
Definition: ViewerGui.cpp:1184
double m_octreeResolution
Definition: ViewerGui.h:210
void on_actionTest_triggered()
Definition: ViewerGui.cpp:1073
void loadGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:552
void openGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:425
void changeCurrentScan(unsigned scans)
void on_actionClear_selection_triggered()
Definition: ViewerGui.cpp:761
void addNextScans(unsigned scans)
Definition: ViewerGui.cpp:387
void on_actionClear_unknown_in_selection_triggered()
Definition: ViewerGui.cpp:769
void on_action_bg_white_triggered()
Definition: ViewerGui.cpp:1189
void on_actionReload_Octree_triggered()
Definition: ViewerGui.cpp:1077
void on_actionSemanticColoring_toggled(bool checked)
Definition: ViewerGui.cpp:997
void changeNumberOfScans(unsigned scans)
void on_actionFill_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:795
void on_actionSave_file_triggered()
Definition: ViewerGui.cpp:701
void on_actionFree_toggled(bool enabled)
Definition: ViewerGui.cpp:1156
std::string m_filename
Filename of last loaded file, in case it is necessary to reload it.
Definition: ViewerGui.h:220
void on_actionHideBackground_toggled(bool checked)
Definition: ViewerGui.cpp:1046
void on_actionClear_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:753
void updateNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:859
void on_actionDelete_nodes_outside_of_selection_triggered()
Definition: ViewerGui.cpp:826
TrajectoryDrawer * m_trajectoryDrawer
Definition: ViewerGui.h:207
Ui::ViewerGuiClass ui
Definition: ViewerGui.h:205
void on_actionAxes_toggled(bool checked)
Definition: ViewerGui.cpp:1038
static const unsigned int LASERTYPE_SICK
Definition: ViewerGui.h:63
void on_actionAlternateRendering_toggled(bool checked)
Definition: ViewerGui.cpp:1055
void showInfo(QString string, bool newline=false)
Definition: ViewerGui.cpp:163
std::vector< ScanNode *>::iterator iterator
void on_actionClear_triggered()
Definition: ViewerGui.cpp:1062
void on_actionFill_selection_triggered()
Definition: ViewerGui.cpp:787
void addOctree(AbstractOcTree *tree, int id, pose6d origin)
Definition: ViewerGui.cpp:184
void on_actionExport_view_triggered()
Definition: ViewerGui.cpp:948
double m_laserMaxRange
Definition: ViewerGui.h:211
void on_actionHeight_map_toggled(bool checked)
Definition: ViewerGui.cpp:989
void on_action_bg_gray_triggered()
Definition: ViewerGui.cpp:1194
unsigned int m_laserType
Definition: ViewerGui.h:214
void changeResolution(double resolution)
void on_savecampose_triggered()
Definition: ViewerGui.cpp:1199
void on_actionSelection_box_toggled(bool checked)
Definition: ViewerGui.cpp:976
void setNonNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:918
unsigned int m_max_tree_depth
Definition: ViewerGui.h:213
void on_actionPrune_tree_triggered()
Definition: ViewerGui.cpp:1106
void on_actionExport_sequence_triggered(bool checked)
Definition: ViewerGui.cpp:953
void on_actionDelete_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:803
void on_actionTrajectory_toggled(bool checked)
Definition: ViewerGui.cpp:1029
QLabel * m_mapSizeStatus
Definition: ViewerGui.h:216
ViewerGui(const std::string &filename="", QWidget *parent=0, unsigned int initTreeDepth=16)
Definition: ViewerGui.cpp:41
void on_actionOpen_graph_incremental_triggered()
Definition: ViewerGui.cpp:684
ScanGraph * m_scanGraph
Definition: ViewerGui.h:202
void on_actionSettings_triggered()
Definition: ViewerGui.cpp:635
void saveCameraPosition(const char *filename) const
Definition: ViewerGui.cpp:1223
void on_actionExit_triggered()
Definition: ViewerGui.cpp:627
CameraFollowMode * m_cameraFollowMode
Definition: ViewerGui.h:209
void updateStatusBar(QString message, int duration)
void setOcTreeUISwitches()
Definition: ViewerGui.cpp:466
void on_loadcampose_triggered()
Definition: ViewerGui.cpp:1210
PointcloudDrawer * m_pointcloudDrawer
Definition: ViewerGui.h:208
void on_actionOpen_file_triggered()
Definition: ViewerGui.cpp:669
void on_actionSelected_toggled(bool enabled)
Definition: ViewerGui.cpp:1165
void on_actionOctree_structure_toggled(bool enabled)
Definition: ViewerGui.cpp:1148
static const unsigned int DEFAULT_OCTREE_ID
Definition: ViewerGui.h:66
void setNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:890
double m_occupancyThresh
Definition: ViewerGui.h:212
void loadCameraPosition(const char *filename)
Definition: ViewerGui.cpp:1231
std::map< int, OcTreeRecord > m_octrees
Definition: ViewerGui.h:200
void on_actionPrintout_mode_toggled(bool checked)
Definition: ViewerGui.cpp:967
void on_actionFill_unknown_in_selection_triggered()
Definition: ViewerGui.cpp:778
void openMapCollection()
Definition: ViewerGui.cpp:520
void on_actionHelp_triggered()
Definition: ViewerGui.cpp:631
void changeTreeDepth(int depth)
Definition: ViewerGui.cpp:615
bool getOctreeRecord(int id, OcTreeRecord *&otr)
Definition: ViewerGui.cpp:173
void on_actionConvert_ml_tree_triggered()
Definition: ViewerGui.cpp:1085
void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ)
void on_actionPointcloud_toggled(bool checked)
Definition: ViewerGui.cpp:1020
void on_actionExpand_tree_triggered()
Definition: ViewerGui.cpp:1121
void openTree()
open binary format OcTree
Definition: ViewerGui.cpp:481


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Feb 28 2022 22:58:17