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>
31 #else // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
32 #include <QtGui>
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  void voxelSelected(const QMouseEvent* e);
117 
121 
124 
125  // use it for testcases etc.
127 
128  signals:
129  void updateStatusBar(QString message, int duration);
130  void changeNumberOfScans(unsigned scans);
131  void changeCurrentScan(unsigned scans);
132  void changeResolution(double resolution);
133  void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ);
134 
135  private:
140  void openFile();
141 
146  void openPointcloud();
147 
152  void openGraph(bool completeGraph = true);
153 
157  void loadGraph(bool completeGraph = true);
158 
162  void addNextScan();
163 
167  void openPC();
168 
170  void openOcTree();
171 
173  void openTree();
174 
175  // EXPERIMENTAL
176  // open a map collection (.hot-file)
177  void openMapCollection();
178 
179 
180  void setOcTreeUISwitches();
181 
185  void generateOctree();
186  void showOcTree();
187 
188  void showInfo(QString string, bool newline=false);
189 
190  void addOctree(AbstractOcTree* tree, int id, pose6d origin);
191  void addOctree(AbstractOcTree* tree, int id);
192  bool getOctreeRecord(int id, OcTreeRecord*& otr);
193 
194  void saveCameraPosition(const char* filename) const;
195  void loadCameraPosition(const char* filename);
196 
197  void updateNodesInBBX(const point3d& min, const point3d& max, bool occupied);
198  void setNodesInBBX(const point3d& min, const point3d& max, bool occupied);
199  void setNonNodesInBBX(const point3d& min, const point3d& max, bool occupied);
200 
201  std::map<int, OcTreeRecord> m_octrees;
202 
205 
206  Ui::ViewerGuiClass ui;
213  double m_occupancyThresh; // FIXME: This is not really used at the moment...
214  unsigned int m_max_tree_depth;
215  unsigned int m_laserType; // SICK or Hokuyo /URG
217  QLabel* m_nodeSelected;
220 
222  std::string m_filename;
223  };
224 
225 } // namespace
226 
227 
228 #endif // VIEWERGUI_H
octomap::ViewerGui::showInfo
void showInfo(QString string, bool newline=false)
Definition: ViewerGui.cpp:167
octomap::ViewerGui::on_actionOpen_graph_incremental_triggered
void on_actionOpen_graph_incremental_triggered()
Definition: ViewerGui.cpp:690
octomap::ViewerGui::addNextScans
void addNextScans(unsigned scans)
Definition: ViewerGui.cpp:391
octomap::ViewerGui::m_laserType
unsigned int m_laserType
Definition: ViewerGui.h:215
octomap::ViewerGui::ViewerGui
ViewerGui(const std::string &filename="", QWidget *parent=0, unsigned int initTreeDepth=16)
Definition: ViewerGui.cpp:41
octomap::ViewerGui::on_actionOctree_cells_toggled
void on_actionOctree_cells_toggled(bool enabled)
Definition: ViewerGui.cpp:1187
octomap::TrajectoryDrawer
Definition: TrajectoryDrawer.h:33
octomap::ViewerGui::on_actionPointcloud_toggled
void on_actionPointcloud_toggled(bool checked)
Definition: ViewerGui.cpp:1026
octomap::ViewerGui::~ViewerGui
~ViewerGui()
Definition: ViewerGui.cpp:137
octomap::ViewerGui::on_actionExit_triggered
void on_actionExit_triggered()
Definition: ViewerGui.cpp:633
octomap::OcTreeRecord
Definition: OcTreeRecord.h:32
octomap::ViewerGui::m_mapSizeStatus
QLabel * m_mapSizeStatus
Definition: ViewerGui.h:218
CameraFollowMode
Definition: CameraFollowMode.h:31
octomap::ViewerGui::on_actionOctree_structure_toggled
void on_actionOctree_structure_toggled(bool enabled)
Definition: ViewerGui.cpp:1195
octomap::ViewerGui::setOcTreeUISwitches
void setOcTreeUISwitches()
Definition: ViewerGui.cpp:470
octomap::ViewerGui::m_nodeSelected
QLabel * m_nodeSelected
Definition: ViewerGui.h:217
PointcloudDrawer.h
octomap::ViewerGui::setNonNodesInBBX
void setNonNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:924
ViewerSettings.h
octomap::ViewerGui::saveCameraPosition
void saveCameraPosition(const char *filename) const
Definition: ViewerGui.cpp:1257
octomap::ViewerGui::on_actionFill_selection_triggered
void on_actionFill_selection_triggered()
Definition: ViewerGui.cpp:793
octomap::ViewerGui::m_cameraStored
bool m_cameraStored
Definition: ViewerGui.h:216
octomap::ViewerGui::on_actionExport_view_triggered
void on_actionExport_view_triggered()
Definition: ViewerGui.cpp:954
octomap::ViewerWidget
Definition: ViewerWidget.h:35
octomap::ViewerGui::ui
Ui::ViewerGuiClass ui
Definition: ViewerGui.h:206
octomap::ViewerGui::m_laserMaxRange
double m_laserMaxRange
Definition: ViewerGui.h:212
octomap::ViewerGui::loadGraph
void loadGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:558
octomap::ViewerGui::on_actionFill_unknown_in_selection_triggered
void on_actionFill_unknown_in_selection_triggered()
Definition: ViewerGui.cpp:784
AbstractOcTree.h
octomap::ViewerGui::on_actionClear_unknown_in_selection_triggered
void on_actionClear_unknown_in_selection_triggered()
Definition: ViewerGui.cpp:775
OcTreeDrawer.h
octomap::ViewerGui::on_actionSave_file_triggered
void on_actionSave_file_triggered()
Definition: ViewerGui.cpp:707
octomap::ViewerGui::getOctreeRecord
bool getOctreeRecord(int id, OcTreeRecord *&otr)
Definition: ViewerGui.cpp:177
octomap::ViewerGui::on_actionFree_toggled
void on_actionFree_toggled(bool enabled)
Definition: ViewerGui.cpp:1203
octomap::ViewerGui::m_max_tree_depth
unsigned int m_max_tree_depth
Definition: ViewerGui.h:214
octomap::ViewerGui::on_actionDelete_nodes_in_selection_triggered
void on_actionDelete_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:809
octomap::ViewerGui::openFile
void openFile()
Definition: ViewerGui.cpp:400
octomap::ViewerGui::m_trajectoryDrawer
TrajectoryDrawer * m_trajectoryDrawer
Definition: ViewerGui.h:208
ViewerSettingsPanel.h
octomap::ViewerGui::on_actionRestore_camera_triggered
void on_actionRestore_camera_triggered()
Definition: ViewerGui.cpp:1020
octomap::ViewerGui::on_actionSelection_box_toggled
void on_actionSelection_box_toggled(bool checked)
Definition: ViewerGui.cpp:982
octomap::ViewerGui::on_actionHeight_map_toggled
void on_actionHeight_map_toggled(bool checked)
Definition: ViewerGui.cpp:995
octomap::ViewerGui::on_actionSelected_toggled
void on_actionSelected_toggled(bool enabled)
Definition: ViewerGui.cpp:1212
octomap::ViewerGui::LASERTYPE_SICK
static const unsigned int LASERTYPE_SICK
Definition: ViewerGui.h:63
octomap::ViewerGui::updateNodesInBBX
void updateNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:865
octomap::ViewerGui::on_actionClear_nodes_in_selection_triggered
void on_actionClear_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:759
octomath::Vector3
octomap::ViewerGui::generateOctree
void generateOctree()
Definition: ViewerGui.cpp:310
OcTreeRecord.h
octomap::ViewerGui::on_actionSemanticColoring_toggled
void on_actionSemanticColoring_toggled(bool checked)
Definition: ViewerGui.cpp:1003
octomap::ViewerGui::m_octreeResolution
double m_octreeResolution
Definition: ViewerGui.h:211
octomap::ViewerGui::m_glwidget
ViewerWidget * m_glwidget
Definition: ViewerGui.h:207
CameraFollowMode.h
octomap::ScanGraph
octomap::ViewerGui::m_octrees
std::map< int, OcTreeRecord > m_octrees
Definition: ViewerGui.h:201
octomap::ViewerGui::gotoFirstScan
void gotoFirstScan()
Definition: ViewerGui.cpp:348
octomap::ViewerGui::updateStatusBar
void updateStatusBar(QString message, int duration)
octomap::ViewerGui::LASERTYPE_URG
static const unsigned int LASERTYPE_URG
Definition: ViewerGui.h:62
octomap::ViewerGui::on_savecampose_triggered
void on_savecampose_triggered()
Definition: ViewerGui.cpp:1233
octomap::AbstractOcTree
octomap::ViewerGui::on_actionExpand_tree_triggered
void on_actionExpand_tree_triggered()
Definition: ViewerGui.cpp:1168
octomap::ViewerGui::on_actionHideBackground_toggled
void on_actionHideBackground_toggled(bool checked)
Definition: ViewerGui.cpp:1052
octomap::ViewerGui::on_actionTrajectory_toggled
void on_actionTrajectory_toggled(bool checked)
Definition: ViewerGui.cpp:1035
octomap::ViewerGui::on_loadcampose_triggered
void on_loadcampose_triggered()
Definition: ViewerGui.cpp:1244
octomap::ViewerGui::on_actionClear_selection_triggered
void on_actionClear_selection_triggered()
Definition: ViewerGui.cpp:767
octomap::ViewerGui::voxelSelected
void voxelSelected(const QMouseEvent *e)
Definition: ViewerGui.cpp:1079
octomap::ViewerGui::m_mapMemoryStatus
QLabel * m_mapMemoryStatus
Definition: ViewerGui.h:219
octomap::ViewerGui::changeNumberOfScans
void changeNumberOfScans(unsigned scans)
octomap::ViewerGui::addNextScan
void addNextScan()
Definition: ViewerGui.cpp:367
octomap::ViewerGui::openPC
void openPC()
octomap::ViewerGui::on_actionTest_triggered
void on_actionTest_triggered()
Definition: ViewerGui.cpp:1120
octomap::ViewerGui::openMapCollection
void openMapCollection()
Definition: ViewerGui.cpp:526
octomap::ViewerGui::on_actionHelp_triggered
void on_actionHelp_triggered()
Definition: ViewerGui.cpp:637
octomap::ViewerGui::m_cameraFollowMode
CameraFollowMode * m_cameraFollowMode
Definition: ViewerGui.h:210
octomap::ViewerGui::m_scanGraph
ScanGraph * m_scanGraph
Definition: ViewerGui.h:203
octomap::ViewerGui::on_actionAlternateRendering_toggled
void on_actionAlternateRendering_toggled(bool checked)
Definition: ViewerGui.cpp:1061
ViewerWidget.h
octomap::ViewerGui::DEFAULT_OCTREE_ID
static const unsigned int DEFAULT_OCTREE_ID
Definition: ViewerGui.h:66
octomap::ViewerGui::on_actionPrintout_mode_toggled
void on_actionPrintout_mode_toggled(bool checked)
Definition: ViewerGui.cpp:973
octomap::ViewerGui::on_actionPrune_tree_triggered
void on_actionPrune_tree_triggered()
Definition: ViewerGui.cpp:1153
octomap::ViewerGui::on_actionFill_nodes_in_selection_triggered
void on_actionFill_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:801
octomap::ViewerGui::on_action_bg_gray_triggered
void on_action_bg_gray_triggered()
Definition: ViewerGui.cpp:1229
octomap::ViewerGui::on_actionDelete_nodes_outside_of_selection_triggered
void on_actionDelete_nodes_outside_of_selection_triggered()
Definition: ViewerGui.cpp:832
octomap::ViewerGui::m_filename
std::string m_filename
Filename of last loaded file, in case it is necessary to reload it.
Definition: ViewerGui.h:222
octomap::ViewerGui::loadCameraPosition
void loadCameraPosition(const char *filename)
Definition: ViewerGui.cpp:1265
octomap::ViewerGui::m_pointcloudDrawer
PointcloudDrawer * m_pointcloudDrawer
Definition: ViewerGui.h:209
octomap::ViewerGui::isShown
bool isShown()
Definition: ViewerGui.cpp:163
octomap::ViewerGui::addOctree
void addOctree(AbstractOcTree *tree, int id, pose6d origin)
Definition: ViewerGui.cpp:188
octomap::ViewerGui::on_actionSettings_triggered
void on_actionSettings_triggered()
Definition: ViewerGui.cpp:641
OcTreeBase.h
octomap::ViewerGui
Definition: ViewerGui.h:55
octomap::ViewerGui::on_actionClear_triggered
void on_actionClear_triggered()
Definition: ViewerGui.cpp:1068
octomap::ViewerGui::setNodesInBBX
void setNodesInBBX(const point3d &min, const point3d &max, bool occupied)
Definition: ViewerGui.cpp:896
octomap::ViewerGui::changeCamPosition
void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ)
octomap::ViewerGui::changeCurrentScan
void changeCurrentScan(unsigned scans)
octomap::ViewerGui::changeTreeDepth
void changeTreeDepth(int depth)
Definition: ViewerGui.cpp:621
octomap::ViewerGui::on_actionConvert_ml_tree_triggered
void on_actionConvert_ml_tree_triggered()
Definition: ViewerGui.cpp:1132
octomap
octomap::ViewerGui::on_action_bg_black_triggered
void on_action_bg_black_triggered()
Definition: ViewerGui.cpp:1221
octomap::ViewerGui::showOcTree
void showOcTree()
Definition: ViewerGui.cpp:240
octomap::ViewerGui::on_actionAxes_toggled
void on_actionAxes_toggled(bool checked)
Definition: ViewerGui.cpp:1044
octomath::Pose6D
octomap::ViewerGui::on_action_bg_white_triggered
void on_action_bg_white_triggered()
Definition: ViewerGui.cpp:1225
octomap::ViewerGui::on_actionReload_Octree_triggered
void on_actionReload_Octree_triggered()
Definition: ViewerGui.cpp:1124
octomap::ViewerGui::changeResolution
void changeResolution(double resolution)
octomap::ScanGraph::iterator
std::vector< ScanNode * >::iterator iterator
octomap::ViewerGui::on_actionExport_sequence_triggered
void on_actionExport_sequence_triggered(bool checked)
Definition: ViewerGui.cpp:959
ViewerSettingsPanelCamera.h
TrajectoryDrawer.h
octomap::ViewerGui::on_actionStore_camera_triggered
void on_actionStore_camera_triggered()
Definition: ViewerGui.cpp:1013
octomap::ViewerGui::openOcTree
void openOcTree()
open "regular" file containing an octree
Definition: ViewerGui.cpp:499
octomap::ViewerGui::openPointcloud
void openPointcloud()
Definition: ViewerGui.cpp:442
octomap::ViewerGui::on_actionOpen_file_triggered
void on_actionOpen_file_triggered()
Definition: ViewerGui.cpp:675
octomap::ViewerGui::m_nextScanToAdd
ScanGraph::iterator m_nextScanToAdd
Definition: ViewerGui.h:204
octomap::PointcloudDrawer
Definition: PointcloudDrawer.h:35
octomap::ViewerGui::openGraph
void openGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:429
octomap::ViewerGui::m_occupancyThresh
double m_occupancyThresh
Definition: ViewerGui.h:213
octomap::ViewerGui::openTree
void openTree()
open binary format OcTree
Definition: ViewerGui.cpp:487


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Apr 3 2025 02:40:44