ViewerGui.cpp
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 #include <iostream>
26 #include <fstream>
27 //#include <octomap/octomap_timing.h>
28 
29 #include <octovis/ViewerGui.h>
31 #include <octomap/MapCollection.h>
32 //Dummy object definition to ensure VS2012 does not drop the StaticMemberInitializer, causing this tree failing to register.
34 
35 
36 #define _MAXRANGE_URG 5.1
37 #define _MAXRANGE_SICK 50.0
38 
39 namespace octomap{
40 
41 ViewerGui::ViewerGui(const std::string& filename, QWidget *parent, unsigned int initDepth)
42 : QMainWindow(parent), m_scanGraph(NULL),
43  m_trajectoryDrawer(NULL), m_pointcloudDrawer(NULL),
44  m_cameraFollowMode(NULL),
45  m_octreeResolution(0.1), m_laserMaxRange(-1.), m_occupancyThresh(0.5),
46  m_max_tree_depth(initDepth > 0 && initDepth <= 16 ? initDepth : 16),
47  m_laserType(LASERTYPE_SICK),
48  m_cameraStored(false),
49  m_filename("")
50 {
51 
52  ui.setupUi(this);
53  m_glwidget = new ViewerWidget(this);
54  this->setCentralWidget(m_glwidget);
55 
56  // Settings panel at the right side
57  ViewerSettingsPanel* settingsPanel = new ViewerSettingsPanel(this);
58  settingsPanel->setTreeDepth(initDepth);
59  QDockWidget* settingsDock = new QDockWidget("Octree / Scan graph settings", this);
60  settingsDock->setWidget(settingsPanel);
61  this->addDockWidget(Qt::RightDockWidgetArea, settingsDock);
62  ui.menuShow->addAction(settingsDock->toggleViewAction());
63 
64  // Camera settings panel at the right side
65  ViewerSettingsPanelCamera* settingsCameraPanel = new ViewerSettingsPanelCamera(this);
66  QDockWidget *settingsCameraDock = new QDockWidget("Camera settings", this);
67  settingsCameraDock->setWidget(settingsCameraPanel);
68  this->addDockWidget(Qt::RightDockWidgetArea, settingsCameraDock);
69  this->tabifyDockWidget(settingsDock, settingsCameraDock);
70  settingsDock->raise();
71  ui.menuShow->addAction(settingsCameraDock->toggleViewAction());
72 
73  // status bar
74  m_mapSizeStatus = new QLabel("Map size", this);
75  m_mapMemoryStatus = new QLabel("Memory consumption", this);
76  m_mapSizeStatus->setFrameStyle(QFrame::Panel | QFrame::Sunken);
77  m_mapMemoryStatus->setFrameStyle(QFrame::Panel | QFrame::Sunken);
78  statusBar()->addPermanentWidget(m_mapSizeStatus);
79  statusBar()->addPermanentWidget(m_mapMemoryStatus);
80 
82 
83  connect(this, SIGNAL(updateStatusBar(QString, int)), statusBar(), SLOT(showMessage(QString, int)));
84 
85  connect(settingsPanel, SIGNAL(treeDepthChanged(int)), this, SLOT(changeTreeDepth(int)));
86  connect(settingsPanel, SIGNAL(addNextScans(unsigned)), this, SLOT(addNextScans(unsigned)));
87  connect(settingsPanel, SIGNAL(gotoFirstScan()), this, SLOT(gotoFirstScan()));
88 
89  connect(settingsCameraPanel, SIGNAL(jumpToFrame(unsigned)), m_cameraFollowMode, SLOT(jumpToFrame(unsigned)));
90  connect(settingsCameraPanel, SIGNAL(play()), m_cameraFollowMode, SLOT(play()));
91  connect(settingsCameraPanel, SIGNAL(pause()), m_cameraFollowMode, SLOT(pause()));
92  connect(settingsCameraPanel, SIGNAL(clearCameraPath()), m_cameraFollowMode, SLOT(clearCameraPath()));
93  connect(settingsCameraPanel, SIGNAL(saveToCameraPath()), m_cameraFollowMode, SLOT(saveToCameraPath()));
94  connect(settingsCameraPanel, SIGNAL(removeFromCameraPath()), m_cameraFollowMode, SLOT(removeFromCameraPath()));
95  connect(settingsCameraPanel, SIGNAL(addToCameraPath()), m_cameraFollowMode, SLOT(addToCameraPath()));
96  connect(settingsCameraPanel, SIGNAL(followCameraPath()), m_cameraFollowMode, SLOT(followCameraPath()));
97  connect(settingsCameraPanel, SIGNAL(followRobotPath()), m_cameraFollowMode, SLOT(followRobotPath()));
98 
99  connect(m_cameraFollowMode, SIGNAL(changeNumberOfFrames(unsigned)), settingsCameraPanel, SLOT(setNumberOfFrames(unsigned)));
100  connect(m_cameraFollowMode, SIGNAL(frameChanged(unsigned)), settingsCameraPanel, SLOT(setCurrentFrame(unsigned)));
101  connect(m_cameraFollowMode, SIGNAL(stopped()), settingsCameraPanel, SLOT(setStopped()));
102  connect(m_cameraFollowMode, SIGNAL(scanGraphAvailable(bool)), settingsCameraPanel, SLOT(setRobotTrajectoryAvailable(bool)));
103 
104  connect(m_cameraFollowMode, SIGNAL(deleteCameraPath(int)), m_glwidget, SLOT(deleteCameraPath(int)));
105  connect(m_cameraFollowMode, SIGNAL(removeFromCameraPath(int,int)), m_glwidget, SLOT(removeFromCameraPath(int,int)));
106  connect(m_cameraFollowMode, SIGNAL(appendToCameraPath(int, const octomath::Pose6D&)), m_glwidget, SLOT(appendToCameraPath(int, const octomath::Pose6D&)));
107  connect(m_cameraFollowMode, SIGNAL(appendCurrentToCameraPath(int)), m_glwidget, SLOT(appendCurrentToCameraPath(int)));
108  connect(m_cameraFollowMode, SIGNAL(addCurrentToCameraPath(int,int)), m_glwidget, SLOT(addCurrentToCameraPath(int,int)));
109  connect(m_cameraFollowMode, SIGNAL(updateCameraPath(int,int)), m_glwidget, SLOT(updateCameraPath(int,int)));
110  connect(m_cameraFollowMode, SIGNAL(playCameraPath(int,int)), m_glwidget, SLOT(playCameraPath(int,int)));
111  connect(m_cameraFollowMode, SIGNAL(stopCameraPath(int)), m_glwidget, SLOT(stopCameraPath(int)));
112  connect(m_cameraFollowMode, SIGNAL(jumpToCamFrame(int, int)), m_glwidget, SLOT(jumpToCamFrame(int, int)));
113  connect(m_glwidget, SIGNAL(cameraPathStopped(int)), m_cameraFollowMode, SLOT(cameraPathStopped(int)));
114  connect(m_glwidget, SIGNAL(cameraPathFrameChanged(int, int)), m_cameraFollowMode, SLOT(cameraPathFrameChanged(int, int)));
115 
116  connect(this, SIGNAL(changeNumberOfScans(unsigned)), settingsPanel, SLOT(setNumberOfScans(unsigned)));
117  connect(this, SIGNAL(changeCurrentScan(unsigned)), settingsPanel, SLOT(setCurrentScan(unsigned)));
118  connect(this, SIGNAL(changeResolution(double)), settingsPanel, SLOT(setResolution(double)));
119 
120  connect(settingsCameraPanel, SIGNAL(changeCamPosition(double, double, double, double, double, double)),
121  m_glwidget, SLOT(setCamPosition(double, double, double, double, double, double)));
122  connect(m_cameraFollowMode, SIGNAL(changeCamPose(const octomath::Pose6D&)),
123  m_glwidget, SLOT(setCamPose(const octomath::Pose6D&)));
124 
125  connect(ui.actionReset_view, SIGNAL(triggered()), m_glwidget, SLOT(resetView()));
126 
127  if (filename != ""){
128  m_filename = filename;
129  openFile();
130  }
131 }
132 
134  if (m_trajectoryDrawer){
136  delete m_trajectoryDrawer;
137  m_trajectoryDrawer = NULL;
138  }
139 
140  if (m_pointcloudDrawer){
142  delete m_pointcloudDrawer;
143  m_pointcloudDrawer = NULL;
144  }
145 
146  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin(); it != m_octrees.end(); ++it) {
147  m_glwidget->removeSceneObject(it->second.octree_drawer);
148  delete (it->second.octree_drawer);
149  delete (it->second.octree);
150  }
151  m_octrees.clear();
152 
153  if(m_cameraFollowMode) {
154  delete m_cameraFollowMode;
155  m_cameraFollowMode = NULL;
156  }
157 }
158 
160  return m_glwidget->isVisible();
161 }
162 
163 void ViewerGui::showInfo(QString string, bool newline) {
164  std::cerr << string.toLocal8Bit().data();
165  if (newline) std::cerr << std::endl;
166  else std::cerr << std::flush;
167  int duration = 0;
168  if (newline)
169  duration = 3000;
170  emit updateStatusBar(string, duration);
171 }
172 
174  std::map<int, OcTreeRecord>::iterator it = m_octrees.find(id);
175  if( it != m_octrees.end() ) {
176  otr = &(it->second);
177  return true;
178  }
179  else {
180  return false;
181  }
182 }
183 
185  // is id in use?
186  OcTreeRecord* r;
187  bool foundRecord = getOctreeRecord(id, r);
188  if (foundRecord && r->octree->getTreeType().compare(tree->getTreeType()) !=0){
189  // delete old drawer, create new
190  delete r->octree_drawer;
191  if (dynamic_cast<OcTree*>(tree)) {
192  r->octree_drawer = new OcTreeDrawer();
193  // fprintf(stderr, "adding new OcTreeDrawer for node %d\n", id);
194  }
195  else if (dynamic_cast<ColorOcTree*>(tree)) {
196  r->octree_drawer = new ColorOcTreeDrawer();
197  } else{
198  OCTOMAP_ERROR("Could not create drawer for tree type %s\n", tree->getTreeType().c_str());
199  }
200 
201  delete r->octree;
202  r->octree = tree;
203  r->origin = origin;
204 
205  } else if (foundRecord && r->octree->getTreeType().compare(tree->getTreeType()) ==0) {
206  // only swap out tree
207 
208  delete r->octree;
209  r->octree = tree;
210  r->origin = origin;
211  } else {
212  // add new record
213  OcTreeRecord otr;
214  otr.id = id;
215  if (dynamic_cast<OcTree*>(tree)) {
216  otr.octree_drawer = new OcTreeDrawer();
217  // fprintf(stderr, "adding new OcTreeDrawer for node %d\n", id);
218  }
219  else if (dynamic_cast<ColorOcTree*>(tree)) {
220  otr.octree_drawer = new ColorOcTreeDrawer();
221  } else{
222  OCTOMAP_ERROR("Could not create drawer for tree type %s\n", tree->getTreeType().c_str());
223  }
224  otr.octree = tree;
225  otr.origin = origin;
226  m_octrees[id] = otr;
228  }
229 }
230 
232  octomap::pose6d o; // initialized to (0,0,0) , (0,0,0,1) by default
233  addOctree(tree, id, o);
234 }
235 
237 
238  // update viewer stat
239  double minX, minY, minZ, maxX, maxY, maxZ;
240  minX = minY = minZ = -10; // min bbx for drawing
241  maxX = maxY = maxZ = 10; // max bbx for drawing
242  double sizeX, sizeY, sizeZ;
243  sizeX = sizeY = sizeZ = 0.;
244  size_t memoryUsage = 0;
245  size_t num_nodes = 0;
246  size_t memorySingleNode = 0;
247 
248 
249  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin(); it != m_octrees.end(); ++it) {
250  // get map bbx
251  double lminX, lminY, lminZ, lmaxX, lmaxY, lmaxZ;
252  it->second.octree->getMetricMin(lminX, lminY, lminZ);
253  it->second.octree->getMetricMax(lmaxX, lmaxY, lmaxZ);
254  // transform to world coords using map origin
255  octomap::point3d pmin(lminX, lminY, lminZ);
256  octomap::point3d pmax(lmaxX, lmaxY, lmaxZ);
257  pmin = it->second.origin.transform(pmin);
258  pmax = it->second.origin.transform(pmax);
259  lminX = pmin.x(); lminY = pmin.y(); lminZ = pmin.z();
260  lmaxX = pmax.x(); lmaxY = pmax.y(); lmaxZ = pmax.z();
261  // update global bbx
262  if (lminX < minX) minX = lminX;
263  if (lminY < minY) minY = lminY;
264  if (lminZ < minZ) minZ = lminZ;
265  if (lmaxX > maxX) maxX = lmaxX;
266  if (lmaxY > maxY) maxY = lmaxY;
267  if (lmaxZ > maxZ) maxZ = lmaxZ;
268  double lsizeX, lsizeY, lsizeZ;
269  // update map stats
270  it->second.octree->getMetricSize(lsizeX, lsizeY, lsizeZ);
271  if (lsizeX > sizeX) sizeX = lsizeX;
272  if (lsizeY > sizeY) sizeY = lsizeY;
273  if (lsizeZ > sizeZ) sizeZ = lsizeZ;
274  memoryUsage += it->second.octree->memoryUsage();
275  num_nodes += it->second.octree->size();
276  memorySingleNode = std::max(memorySingleNode, it->second.octree->memoryUsageNode());
277  }
278 
279  m_glwidget->setSceneBoundingBox(qglviewer::Vec(minX, minY, minZ), qglviewer::Vec(maxX, maxY, maxZ));
280 
281  //if (m_octrees.size()) {
282  QString size = QString("%L1 x %L2 x %L3 m^3; %L4 nodes").arg(sizeX).arg(sizeY).arg(sizeZ).arg(unsigned(num_nodes));
283  QString memory = QString("Single node: %L1 B; ").arg(memorySingleNode)
284  + QString ("Octree: %L1 B (%L2 MB)").arg(memoryUsage).arg((double) memoryUsage/(1024.*1024.), 0, 'f', 3);
285  m_mapMemoryStatus->setText(memory);
286  m_mapSizeStatus->setText(size);
287  //}
288 
289  m_glwidget->updateGL();
290 
291  // generate cubes -> display
292  // timeval start;
293  // timeval stop;
294  // gettimeofday(&start, NULL); // start timer
295  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin(); it != m_octrees.end(); ++it) {
296  it->second.octree_drawer->setMax_tree_depth(m_max_tree_depth);
297  it->second.octree_drawer->setOcTree(*it->second.octree, it->second.origin, it->second.id);
298  }
299  // gettimeofday(&stop, NULL); // stop timer
300  // double time_to_generate = (stop.tv_sec - start.tv_sec) + 1.0e-6 *(stop.tv_usec - start.tv_usec);
301  // fprintf(stderr, "setOcTree took %f sec\n", time_to_generate);
302  m_glwidget->updateGL();
303 }
304 
305 
307 
308  if (m_scanGraph) {
309 
310  QApplication::setOverrideCursor(Qt::WaitCursor);
311 
312  showInfo("Generating OcTree... ");
313  std::cerr << std::endl;
314 
315  //if (m_ocTree) delete m_ocTree;
317 
319  unsigned numScans = m_scanGraph->size();
320  unsigned currentScan = 1;
321  for (it = m_scanGraph->begin(); it != m_nextScanToAdd; it++) {
322  tree->insertPointCloud(**it, m_laserMaxRange);
323  fprintf(stderr, "generateOctree:: inserting scan node with %d points, origin: %.2f ,%.2f , %.2f.\n",
324  (unsigned int) (*it)->scan->size(), (*it)->pose.x(), (*it)->pose.y(), (*it)->pose.z() );
325 
326  std::cout << " S ("<<currentScan<<"/"<<numScans<<") " << std::flush;
327  currentScan++;
328  }
329 
330  this->addOctree(tree, DEFAULT_OCTREE_ID);
331  this->showOcTree();
332 
333  showInfo("Done.", true);
334  QApplication::restoreOverrideCursor();
335  }
336  else {
337  std::cerr << "generateOctree called but no ScanGraph present!\n";
338  }
339 
340 }
341 
342 // == incremental graph generation =======================
343 
345  if (m_scanGraph){
346  showInfo("Inserting first scan node into tree... ", true);
347  QApplication::setOverrideCursor(Qt::WaitCursor);
348 
350 
351  // if (m_ocTree) delete m_ocTree;
352  // m_ocTree = new octomap::OcTree(m_octreeResolution);
354  this->addOctree(tree, DEFAULT_OCTREE_ID);
355 
356  addNextScan();
357 
358  QApplication::restoreOverrideCursor();
359  showOcTree();
360  }
361 }
362 
364 
365  if (m_scanGraph){
366  showInfo("Inserting next scan node into tree... ", true);
367 
368  QApplication::setOverrideCursor(Qt::WaitCursor);
369  if (m_nextScanToAdd != m_scanGraph->end()){
370  OcTreeRecord* r;
372  fprintf(stderr, "ERROR: OctreeRecord for id %d not found!\n", DEFAULT_OCTREE_ID);
373  return;
374  }
375  // not used with ColorOcTrees, omitting casts
376  ((OcTree*) r->octree)->insertPointCloud(**m_nextScanToAdd, m_laserMaxRange);
377  m_nextScanToAdd++;
378  }
379 
380  QApplication::restoreOverrideCursor();
381  showOcTree();
382 
383  }
384 }
385 
386 
387 void ViewerGui::addNextScans(unsigned scans){
388  for (unsigned i = 0; i < scans; ++i){
389  addNextScan();
390  }
391 }
392 
393 
394 // == file I/O ===========================================
395 
397  if (!m_filename.empty()){
398  m_glwidget->clearAll();
399 
400  QString temp = QString(m_filename.c_str());
401  QFileInfo fileinfo(temp);
402  this->setWindowTitle(fileinfo.fileName());
403  if (fileinfo.suffix() == "graph"){
404  openGraph();
405  }else if (fileinfo.suffix() == "bt"){
406  openTree();
407  }
408  else if (fileinfo.suffix() == "ot")
409  {
410  openOcTree();
411  }
412  else if (fileinfo.suffix() == "hot"){
414  }
415  else if (fileinfo.suffix() == "dat"){
416  openPointcloud();
417  }
418  else {
419  QMessageBox::warning(this, "Unknown file", "Cannot open file, unknown extension: "+fileinfo.suffix(), QMessageBox::Ok);
420  }
421  }
422 }
423 
424 
425 void ViewerGui::openGraph(bool completeGraph){
426 
427  QApplication::setOverrideCursor(Qt::WaitCursor);
428  showInfo("Loading scan graph from file " + QString(m_filename.c_str()) );
429 
430  if (m_scanGraph) delete m_scanGraph;
433 
434  loadGraph(completeGraph);
435 }
436 
437 
439 
440  QApplication::setOverrideCursor(Qt::WaitCursor);
441  showInfo("Loading ASCII pointcloud from file "+QString(m_filename.c_str()) + "...");
442 
443  if (m_scanGraph) delete m_scanGraph;
445 
446 
447  // read pointcloud from file
448  std::ifstream s(m_filename.c_str());
449  Pointcloud* pc = new Pointcloud();
450 
451  if (!s) {
452  std::cout <<"ERROR: could not read " << m_filename << std::endl;
453  return;
454  }
455 
456  pc->read(s);
457 
458  pose6d laser_pose(0,0,0,0,0,0);
459  m_scanGraph->addNode(pc, laser_pose);
460 
461  loadGraph(true);
462  showInfo("Done.", true);
463 }
464 
465 
467  ui.actionPointcloud->setChecked(false);
468  ui.actionPointcloud->setEnabled(false);
469  ui.actionOctree_cells->setChecked(true);
470  ui.actionOctree_cells->setEnabled(true);
471  ui.actionFree->setChecked(false);
472  ui.actionFree->setEnabled(true);
473  ui.actionOctree_structure->setEnabled(true);
474  ui.actionOctree_structure->setChecked(false);
475  ui.actionTrajectory->setEnabled(false);
476  ui.actionConvert_ml_tree->setEnabled(true);
477  ui.actionReload_Octree->setEnabled(true);
478  ui.actionSettings->setEnabled(false);
479 }
480 
482  OcTree* tree = new octomap::OcTree(m_filename);
483  this->addOctree(tree, DEFAULT_OCTREE_ID);
484 
487 
489  showOcTree();
491 }
492 
495 
496  if (tree){
497  this->addOctree(tree, DEFAULT_OCTREE_ID);
498 
501 
503  showOcTree();
505 
506  if (tree->getTreeType() == "ColorOcTree"){
507  // map color and height map share the same color array and QAction
508  ui.actionHeight_map->setText ("Map color"); // rename QAction in Menu
509  this->on_actionHeight_map_toggled(true); // enable color view
510  ui.actionHeight_map->setChecked(true);
511  }
512  }
513  else {
514  QMessageBox::warning(this, "File error", "Cannot open OcTree file", QMessageBox::Ok);
515  }
516 }
517 
518 
519 // EXPERIMENTAL
521 
522  OCTOMAP_DEBUG("Opening hierarchy from %s...\n", m_filename.c_str());
523 
524  std::ifstream infile(m_filename.c_str(), std::ios_base::in |std::ios_base::binary);
525  if (!infile.is_open()) {
526  QMessageBox::warning(this, "File error", "Cannot open OcTree file", QMessageBox::Ok);
527  return;
528  }
529  infile.close();
530 
532  int i=0;
533  for (MapCollection<MapNode<OcTree> >::iterator it = collection.begin();
534  it != collection.end(); ++it) {
535  OCTOMAP_DEBUG("Adding hierarchy node %s\n", (*it)->getId().c_str());
536  OcTree* tree = (*it)->getMap();
537  if (!tree)
538  OCTOMAP_ERROR("Error while reading node %s\n", (*it)->getId().c_str());
539  else {
540  OCTOMAP_DEBUG("Read tree with %zu tree nodes\n", tree->size());
541  }
542  pose6d origin = (*it)->getOrigin();
543  this->addOctree(tree, i, origin);
544  ++i;
545  }
547  showOcTree();
549  OCTOMAP_DEBUG("done\n");
550 }
551 
552 void ViewerGui::loadGraph(bool completeGraph) {
553 
554  ui.actionSettings->setEnabled(true);
555  ui.actionPointcloud->setEnabled(true);
556  ui.actionPointcloud->setChecked(false);
557  ui.actionTrajectory->setEnabled(true);
558  ui.actionOctree_cells->setEnabled(true);
559  ui.actionOctree_cells->setChecked(true);
560  ui.actionOctree_structure->setEnabled(true);
561  ui.actionOctree_structure->setChecked(false);
562  ui.actionFree->setChecked(false);
563  ui.actionFree->setEnabled(true);
564  ui.actionReload_Octree->setEnabled(true);
565  ui.actionConvert_ml_tree->setEnabled(true);
566 
567  unsigned graphSize = m_scanGraph->size();
568  unsigned currentScan;
569 
570  if (completeGraph){
571  fprintf(stderr, "loadGraph:: generating octree from complete graph.\n" );
573  generateOctree();
574  currentScan = graphSize;
575  }
576  else{
578 
579  //if (m_ocTree) delete m_ocTree;
580  //m_ocTree = new octomap::OcTree(m_octreeResolution);
582  this->addOctree(tree, DEFAULT_OCTREE_ID);
583 
584  addNextScan();
585 
586  currentScan = 1;
587  }
588 
590  QApplication::restoreOverrideCursor();
591 
592  emit changeNumberOfScans(graphSize);
593  emit changeCurrentScan(currentScan);
594  showInfo("Done (" +QString::number(currentScan)+ " of "+ QString::number(graphSize)+" nodes)", true);
595 
596  if (!m_trajectoryDrawer){
598  }
600 
601  if (!m_pointcloudDrawer){
603  }
605 
607 
608  if (ui.actionTrajectory->isChecked())
610 
611  if (ui.actionPointcloud->isChecked())
613 }
614 
616  // range check:
617  if (depth < 1 || depth > 16)
618  return;
619 
620  m_max_tree_depth = unsigned(depth);
621 
622  if (m_octrees.size() > 0)
623  showOcTree();
624 }
625 
626 
628  this->close();
629 }
630 
632  m_glwidget->help();
633 }
634 
636 
637  ViewerSettings dialog(this);
639  dialog.setLaserType(m_laserType);
641 
642 
643  if (dialog.exec()){
644 
645  double oldResolution = m_octreeResolution;
646  double oldLaserMaxRange = m_laserMaxRange;
647  double oldType = m_laserType;
648 
650  m_laserType = dialog.getLaserType();
651  m_laserMaxRange = dialog.getMaxRange();
652 
653  // apply new settings
654  bool resolutionChanged = (std::abs(oldResolution - m_octreeResolution) > 1e-5);
655  bool maxRangeChanged = (std::abs(oldLaserMaxRange - m_laserMaxRange) > 1e-5);
656 
657  if (resolutionChanged)
659 
660  if (oldType != m_laserType){ // parameters changed, reload file:
661  openFile();
662  } else if (resolutionChanged || maxRangeChanged){
663  generateOctree();
664  }
665 
666  }
667 }
668 
670  QString filename = QFileDialog::getOpenFileName(this,
671  tr("Open data file"), "",
672  "All supported files (*.graph *.bt *.ot *.dat);;OcTree file (*.ot);;Bonsai tree file (*.bt);;Binary scan graph (*.graph);;Pointcloud (*.dat);;All files (*)");
673  if (!filename.isEmpty()){
674 #ifdef _WIN32
675  m_filename = std::string(filename.toLocal8Bit().data());
676 #else
677  m_filename = filename.toStdString();
678 #endif
679  openFile();
680  }
681 }
682 
683 
685  QString filename = QFileDialog::getOpenFileName(this,
686  tr("Open graph file incrementally (at start)"), "",
687  "Binary scan graph (*.graph)");
688  if (!filename.isEmpty()){
689  m_glwidget->clearAll();
690 
691 #ifdef _WIN32
692  m_filename = std::string(filename.toLocal8Bit().data());
693 #else
694  m_filename = filename.toStdString();
695 #endif
696 
697  openGraph(false);
698  }
699 }
700 
702 
703  OcTreeRecord* r;
705  fprintf(stderr, "ERROR: OctreeRecord for id %d not found!\n", DEFAULT_OCTREE_ID);
706  QMessageBox::warning(this, tr("3D Mapping Viewer"),
707  "Error: No OcTree present.",
708  QMessageBox::Ok);
709  return;
710  }
711 
712  QString filename = QFileDialog::getSaveFileName(this, tr("Save octree file"),
713  "", tr("Full OcTree (*.ot);;Bonsai Tree file (*.bt);;"));
714 
715  if (filename != ""){
716  QApplication::setOverrideCursor(Qt::WaitCursor);
717  showInfo("Writing file... ", false);
718 
719  QFileInfo fileinfo(filename);
720  std::string std_filename;
721 #ifdef _WIN32
722  std_filename = filename.toLocal8Bit().data();
723 #else
724  std_filename = filename.toStdString();
725 #endif
726 
727  AbstractOcTree* t = r->octree;
728 
729  if (fileinfo.suffix() == "bt") {
730  AbstractOccupancyOcTree* ot = dynamic_cast<AbstractOccupancyOcTree*> (t);
731  if (ot)
732  ot->writeBinaryConst(std_filename);
733  else{
734  QMessageBox::warning(this, "Unknown tree type",
735  "Could not convert to occupancy tree for writing .bt file",
736  QMessageBox::Ok);
737  }
738  }
739  else if (fileinfo.suffix() == "ot"){
740  r->octree->write(std_filename);
741  }
742  else {
743  QMessageBox::warning(this, "Unknown file",
744  "Cannot write file, unknown extension: "+fileinfo.suffix(),
745  QMessageBox::Ok);
746  }
747 
748  QApplication::restoreOverrideCursor();
749  showInfo("Done.", true);
750  }
751 }
752 
754  point3d min, max;
755  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
756  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
757 
758  updateNodesInBBX(min, max, false);
759 }
760 
762  point3d min, max;
763  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
764  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
765 
766  setNodesInBBX(min, max, false);
767 }
768 
770 {
771  point3d min, max;
772  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
773  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
774 
775  setNonNodesInBBX(min, max, false);
776 }
777 
779 {
780  point3d min, max;
781  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
782  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
783 
784  setNonNodesInBBX(min, max, true);
785 }
786 
788  point3d min, max;
789  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
790  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
791 
792  setNodesInBBX(min, max, true);
793 }
794 
796  point3d min, max;
797  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
798  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
799 
800  updateNodesInBBX(min, max, true);
801 }
802 
804  point3d min, max;
805  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
806  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
807 
808  for (std::map<int, OcTreeRecord>::iterator t_it = m_octrees.begin(); t_it != m_octrees.end(); ++t_it) {
809  OcTree* octree = dynamic_cast<OcTree*>(t_it->second.octree);
810 
811  if (octree){
812  for(OcTree::leaf_bbx_iterator it = octree->begin_leafs_bbx(min,max),
813  end=octree->end_leafs_bbx(); it!= end; ++it){
814  octree->deleteNode(it.getKey(), it.getDepth());
815  }
816  } else{
817  QMessageBox::warning(this, "Not implemented", "Functionality not yet implemented for this octree type",
818  QMessageBox::Ok);
819 
820  }
821  }
822 
823  showOcTree();
824 }
825 
827  point3d min, max;
828  m_glwidget->selectionBox().getBBXMin(min.x(), min.y(), min.z());
829  m_glwidget->selectionBox().getBBXMax(max.x(), max.y(), max.z());
830 
831  for (std::map<int, OcTreeRecord>::iterator t_it = m_octrees.begin(); t_it != m_octrees.end(); ++t_it) {
832  OcTree* octree = dynamic_cast<OcTree*>(t_it->second.octree);
833 
834  if (octree){
835  octomap::OcTreeKey minKey, maxKey;
836 
837  if (!octree->coordToKeyChecked(min, minKey) || !octree->coordToKeyChecked(max, maxKey)){
838  return;
839  }
840 
841  for(OcTree::leaf_iterator it = octree->begin_leafs(),
842  end=octree->end_leafs(); it!= end; ++it){
843  // check if outside of bbx:
844  OcTreeKey k = it.getKey();
845  if (k[0] < minKey[0] || k[1] < minKey[1] || k[2] < minKey[2]
846  || k[0] > maxKey[0] || k[1] > maxKey[1] || k[2] > maxKey[2])
847  {
848  octree->deleteNode(k, it.getDepth());
849  }
850  }
851  } else
852  QMessageBox::warning(this, "Not implemented", "Functionality not yet implemented for this octree type",
853  QMessageBox::Ok);
854  }
855 
856  showOcTree();
857 }
858 
859 void ViewerGui::updateNodesInBBX(const point3d& min, const point3d& max, bool occupied){
860  for (std::map<int, OcTreeRecord>::iterator t_it = m_octrees.begin(); t_it != m_octrees.end(); ++t_it) {
861  OcTree* octree = dynamic_cast<OcTree*>(t_it->second.octree);
862 
863  if (octree){
864  float logodds;
865  if (occupied)
866  logodds = octree->getClampingThresMaxLog();
867  else
868  logodds = octree->getClampingThresMinLog();
869 
870  for(OcTree::leaf_bbx_iterator it = octree->begin_leafs_bbx(min,max),
871  end=octree->end_leafs_bbx(); it!= end; ++it)
872  {
873  // directly set values of leafs:
874  it->setLogOdds(logodds);
875  }
876 
877  // update inner nodes to make tree consistent:
878  octree->updateInnerOccupancy();
879 
880  } else
881  QMessageBox::warning(this, "Not implemented", "Functionality not yet implemented for this octree type",
882  QMessageBox::Ok);
883 
884  }
885 
886  showOcTree();
887 }
888 
889 
890 void ViewerGui::setNodesInBBX(const point3d& min, const point3d& max, bool occupied){
891  for (std::map<int, OcTreeRecord>::iterator t_it = m_octrees.begin(); t_it != m_octrees.end(); ++t_it) {
892  OcTree* octree = dynamic_cast<OcTree*>(t_it->second.octree);
893 
894  if (octree){
895  float logodds = octree->getClampingThresMaxLog() - octree->getClampingThresMinLog();
896  if (!occupied)
897  logodds *= -1;
898 
899  OcTreeKey minKey(0,0,0);
900  OcTreeKey maxKey(0,0,0);
901  octree->coordToKeyChecked(min, minKey);
902  octree->coordToKeyChecked(max, maxKey);
903  OcTreeKey k;
904  for (k[0] = minKey[0]; k[0] < maxKey[0]; ++k[0]){
905  for (k[1] = minKey[1]; k[1] < maxKey[1]; ++k[1]){
906  for (k[2] = minKey[2]; k[2] < maxKey[2]; ++k[2]){
907  octree->updateNode(k, logodds);
908  }
909  }
910  }
911  }
912 
913  }
914 
915  showOcTree();
916 }
917 
918 void ViewerGui::setNonNodesInBBX(const point3d& min, const point3d& max, bool occupied) {
919  for (std::map<int, OcTreeRecord>::iterator t_it = m_octrees.begin(); t_it != m_octrees.end(); ++t_it) {
920  OcTree* octree = dynamic_cast<OcTree*>(t_it->second.octree);
921 
922  if (octree){
923  float logodds = octree->getClampingThresMaxLog() - octree->getClampingThresMinLog();
924  if (!occupied)
925  logodds *= -1;
926 
927  OcTreeKey minKey(0,0,0);
928  OcTreeKey maxKey(0,0,0);
929  octree->coordToKeyChecked(min, minKey);
930  octree->coordToKeyChecked(max, maxKey);
931  OcTreeKey k;
932  for (k[0] = minKey[0]; k[0] < maxKey[0]; ++k[0]){
933  for (k[1] = minKey[1]; k[1] < maxKey[1]; ++k[1]){
934  for (k[2] = minKey[2]; k[2] < maxKey[2]; ++k[2]){
935  OcTreeNode* n = octree->search(k);
936  if(!n)
937  octree->updateNode(k, logodds);
938  }
939  }
940  }
941  }
942 
943  }
944 
945  showOcTree();
946 }
947 
950  m_glwidget->saveSnapshot(false);
951 }
952 
954  if(checked) {
956  m_glwidget->saveSnapshot(false);
958  connect(m_glwidget, SIGNAL(drawFinished(bool)), m_glwidget, SLOT(saveSnapshot(bool)));
959  } else {
960  ui.actionExport_sequence->setChecked(false);
961  }
962  } else {
963  disconnect(m_glwidget, SIGNAL(drawFinished(bool)), m_glwidget, SLOT(saveSnapshot(bool)));
964  }
965 }
966 
968  if (checked) {
969  ui.actionHeight_map->setChecked(false);
970  ui.actionSemanticColoring->setChecked(false);
971  }
972 
973  m_glwidget->enablePrintoutMode(checked);
974 }
975 
977 
978  ui.menuDelete_nodes->setEnabled(checked);
979  ui.menuFill_selection->setEnabled(checked);
980  ui.menuChange_nodes_in_selection->setEnabled(checked);
981 
982 
983  m_glwidget->enableSelectionBox(checked);
984 
985 
986  m_glwidget->updateGL();
987 }
988 
990  if (checked) {
991  ui.actionPrintout_mode->setChecked(false);
992  ui.actionSemanticColoring->setChecked(false);
993  }
995 }
996 
998  if (checked) {
999  ui.actionHeight_map->setChecked(false);
1000  ui.actionPrintout_mode->setChecked(false);
1001  }
1002 
1004 }
1005 
1006 
1008  m_glwidget->camera()->deletePath(0);
1010  m_cameraStored = true;
1011  ui.actionRestore_camera->setEnabled(true);
1012 }
1013 
1015  if (m_cameraStored){
1016  m_glwidget->camera()->playPath(0);
1017  }
1018 }
1019 
1021  if (m_pointcloudDrawer){
1022  if (checked)
1024  else
1026  }
1027 }
1028 
1030  if (m_trajectoryDrawer){
1031  if (checked)
1033  else
1035  }
1036 }
1037 
1039  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1040  it != m_octrees.end(); ++it) {
1041  it->second.octree_drawer->enableAxes(checked);
1042  }
1043  m_glwidget->updateGL();
1044 }
1045 
1047  OcTreeRecord* r;
1049  if (checked) m_glwidget->removeSceneObject(r->octree_drawer);
1051  m_glwidget->updateGL();
1052  }
1053 }
1054 
1056  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin(); it != m_octrees.end(); ++it) {
1057  //std::cout << "Setting Octree " << it->first << " to " << (checked ? "alternate" : "regular") << " rendering.";
1058  it->second.octree_drawer->setAlternativeDrawing(checked);
1059  }
1060 }
1061 
1063  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1064  it != m_octrees.end(); ++it) {
1065  m_glwidget->removeSceneObject(it->second.octree_drawer);
1066  delete (it->second.octree_drawer);
1067  delete (it->second.octree);
1068  }
1069  m_octrees.clear();
1070  showOcTree();
1071 }
1072 
1074 
1075 }
1076 
1078  if (m_scanGraph) {
1079  generateOctree();
1080  } else {
1081  openFile();
1082  }
1083 }
1084 
1086  QApplication::setOverrideCursor(Qt::WaitCursor);
1087  if (m_octrees.size()) {
1088  showInfo("Converting OcTree to maximum Likelihood map... ");
1089  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1090  it != m_octrees.end(); ++it) {
1091  AbstractOcTree* t = it->second.octree;
1092  if (dynamic_cast<OcTree*>(t)) {
1093  ((OcTree*) t)->toMaxLikelihood();
1094  }
1095  else if (dynamic_cast<OcTree*>(t)) {
1096  ((ColorOcTree*) t)->toMaxLikelihood();
1097  }
1098  }
1099  showInfo("Done.", true);
1100  showOcTree();
1101  QApplication::restoreOverrideCursor();
1102  }
1103 }
1104 
1105 
1107  QApplication::setOverrideCursor(Qt::WaitCursor);
1108  if (m_octrees.size()) {
1109  showInfo("Pruning OcTree... ");
1110  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1111  it != m_octrees.end(); ++it) {
1112  it->second.octree->prune();
1113  }
1114  showOcTree();
1115  showInfo("Done.", true);
1116  }
1117  QApplication::restoreOverrideCursor();
1118 }
1119 
1120 
1122 
1123  QApplication::setOverrideCursor(Qt::WaitCursor);
1124 
1125  // if (m_ocTree) {
1126  if (m_octrees.size()) {
1127  showInfo("Expanding OcTree... ");
1128  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1129  it != m_octrees.end(); ++it) {
1130  it->second.octree->expand();
1131  }
1132  showOcTree();
1133 
1134  showInfo("Done.", true);
1135  }
1136  QApplication::restoreOverrideCursor();
1137 }
1138 
1139 
1141  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1142  it != m_octrees.end(); ++it) {
1143  it->second.octree_drawer->enableOcTreeCells(enabled);
1144  }
1145  m_glwidget->updateGL();
1146 }
1147 
1149  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1150  it != m_octrees.end(); ++it) {
1151  it->second.octree_drawer->enableOcTree(enabled);
1152  }
1153  m_glwidget->updateGL();
1154 }
1155 
1157  for (std::map<int, OcTreeRecord>::iterator it = m_octrees.begin();
1158  it != m_octrees.end(); ++it) {
1159  it->second.octree_drawer->enableFreespace(enabled);
1160  }
1161  m_glwidget->updateGL();
1162 
1163 }
1164 
1166  // if(m_octreeDrawer) {
1167  // m_octreeDrawer->enableSelection(enabled);
1168 
1169  // // just for testing, you should set the selection somewhere else and only enable it here:
1170  // if (enabled){
1171  // std::list<OcTreeVolume> selection;
1172  // std::pair<octomath::Vector3, double> volume(octomath::Vector3(0.0, 0.0, 0.0), 0.2);
1173  // selection.push_back(volume);
1174  // m_octreeDrawer->setOcTreeSelection(selection);
1175 
1176  // } else{
1177  // m_octreeDrawer->clearOcTreeSelection();
1178  // }
1179  // m_glwidget->updateGL();
1180  // }
1181 }
1182 
1183 
1185  m_glwidget->setBackgroundColor( QColor(0,0,0) );
1186  m_glwidget->qglClearColor( m_glwidget->backgroundColor() );
1187 }
1188 
1190  m_glwidget->setBackgroundColor( QColor(255,255,255) );
1191  m_glwidget->qglClearColor( m_glwidget->backgroundColor() );
1192 }
1193 
1195  m_glwidget->setBackgroundColor( QColor(117,117,117) );
1196  m_glwidget->qglClearColor( m_glwidget->backgroundColor() );
1197 }
1198 
1200  QString filename = QFileDialog::getSaveFileName(this, "Save Viewer State", "camera.xml", "Camera/State file (*.xml)");
1201  if (!filename.isEmpty()) {
1202 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1203  saveCameraPosition(filename.toLatin1().constData());
1204 #else // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1205  saveCameraPosition(filename.toAscii().constData());
1206 #endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1207  }
1208 }
1209 
1211  QString filename = QFileDialog::getOpenFileName(this, "Load Viewer State", "camera.xml", "Camera/State file (*.xml)");
1212  if (!filename.isEmpty()) {
1213 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1214  loadCameraPosition(filename.toLatin1().constData());
1215 #else // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1216  loadCameraPosition(filename.toAscii().constData());
1217 #endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
1218  }
1219 }
1220 
1221 
1222 
1223 void ViewerGui::saveCameraPosition(const char* filename) const {
1224  // HACK get non-const pointer to myself
1225  ViewerWidget* aux = const_cast<ViewerWidget*>( m_glwidget);
1226  aux->setStateFileName(QString(filename));
1227  aux->saveStateToFile();
1228  aux->setStateFileName(QString::null);
1229 }
1230 
1231 void ViewerGui::loadCameraPosition(const char* filename) {
1232  m_glwidget->setStateFileName(QString(filename));
1234  m_glwidget->setStateFileName(QString::null);
1235 }
1236 
1237 
1238 }
1239 
1240 
ScanNode * addNode(Pointcloud *scan, pose6d pose)
void on_actionRestore_camera_triggered()
Definition: ViewerGui.cpp:1014
QLabel * m_mapMemoryStatus
Definition: ViewerGui.h:217
ViewerWidget * m_glwidget
Definition: ViewerGui.h:206
size_t size() const
QColor backgroundColor() const
Definition: qglviewer.h:168
virtual std::string getTreeType() const=0
ScanGraph::iterator m_nextScanToAdd
Definition: ViewerGui.h:203
const SelectionBox & selectionBox() const
Definition: ViewerWidget.h:75
void on_actionStore_camera_triggered()
Definition: ViewerGui.cpp:1007
void on_actionOctree_cells_toggled(bool enabled)
Definition: ViewerGui.cpp:1140
std::istream & readBinary(std::ifstream &s)
void openOcTree()
open "regular" file containing an octree
Definition: ViewerGui.cpp:493
void on_action_bg_black_triggered()
Definition: ViewerGui.cpp:1184
virtual void setSceneBoundingBox(const qglviewer::Vec &min, const qglviewer::Vec &max)
double m_octreeResolution
Definition: ViewerGui.h:210
void on_actionTest_triggered()
Definition: ViewerGui.cpp:1073
void enablePrintoutMode(bool enabled=true)
void loadGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:552
void openGraph(bool completeGraph=true)
Definition: ViewerGui.cpp:425
void enableSelectionBox(bool enabled=true)
static AbstractOcTree * read(const std::string &filename)
void changeCurrentScan(unsigned scans)
#define OCTOMAP_DEBUG(...)
virtual OcTreeNode * updateNode(const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)
void getBBXMax(float &x, float &y, float &z) const
octomap::ColorOcTree colortreeTmp(0)
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 removeSceneObject(SceneObject *obj)
void on_actionReload_Octree_triggered()
Definition: ViewerGui.cpp:1077
void on_actionSemanticColoring_toggled(bool checked)
Definition: ViewerGui.cpp:997
void changeNumberOfScans(unsigned scans)
virtual void saveStateToFile()
Definition: qglviewer.cpp:3399
void on_actionFill_nodes_in_selection_triggered()
Definition: ViewerGui.cpp:795
void on_actionSave_file_triggered()
Definition: ViewerGui.cpp:701
virtual void setScanGraph(const octomap::ScanGraph &graph)
bool deleteNode(double x, double y, double z, unsigned int depth=0)
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
virtual void deletePath(unsigned int i)
Definition: camera.cpp:1762
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
unsigned int getLaserType()
void on_actionDelete_nodes_outside_of_selection_triggered()
Definition: ViewerGui.cpp:826
TrajectoryDrawer * m_trajectoryDrawer
Definition: ViewerGui.h:207
void setTreeDepth(int depth)
Ui::ViewerGuiClass ui
Definition: ViewerGui.h:205
void enableHeightColorMode(bool enabled=true)
void on_actionAxes_toggled(bool checked)
Definition: ViewerGui.cpp:1038
virtual void insertPointCloud(const Pointcloud &scan, const octomap::point3d &sensor_origin, double maxrange=-1., bool lazy_eval=false, bool discretize=false)
void on_actionAlternateRendering_toggled(bool checked)
Definition: ViewerGui.cpp:1055
void showInfo(QString string, bool newline=false)
Definition: ViewerGui.cpp:163
void enableSemanticColoring(bool enabled=true)
std::vector< ScanNode *>::iterator iterator
leaf_iterator begin_leafs(unsigned char maxDepth=0) const
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
The Vec class represents 3D positions and 3D vectors.
Definition: vec.h:65
OcTreeNode * search(double x, double y, double z, unsigned int depth=0) const
qglviewer::Camera * camera() const
Definition: qglviewer.h:250
void on_actionHeight_map_toggled(bool checked)
Definition: ViewerGui.cpp:989
virtual double getResolution() const=0
void on_action_bg_gray_triggered()
Definition: ViewerGui.cpp:1194
bool openSnapshotFormatDialog()
unsigned int m_laserType
Definition: ViewerGui.h:214
void changeResolution(double resolution)
bool coordToKeyChecked(const point3d &coord, OcTreeKey &key) const
void addSceneObject(SceneObject *obj)
void setLaserType(int type)
void on_savecampose_triggered()
Definition: ViewerGui.cpp:1199
void setScanGraph(octomap::ScanGraph *graph)
void on_actionSelection_box_toggled(bool checked)
Definition: ViewerGui.cpp:976
bool writeBinaryConst(const std::string &filename) const
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
leaf_bbx_iterator begin_leafs_bbx(const OcTreeKey &min, const OcTreeKey &max, unsigned char maxDepth=0) const
ScanGraph * m_scanGraph
Definition: ViewerGui.h:202
void setStateFileName(const QString &name)
Definition: qglviewer.h:1059
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 getBBXMin(float &x, float &y, float &z) const
void setBackgroundColor(const QColor &color)
Definition: qglviewer.h:186
virtual void addKeyFrameToPath(unsigned int i)
Definition: camera.cpp:1710
void updateStatusBar(QString message, int duration)
void setOcTreeUISwitches()
Definition: ViewerGui.cpp:466
void on_loadcampose_triggered()
Definition: ViewerGui.cpp:1210
virtual bool restoreStateFromFile()
Definition: qglviewer.cpp:3460
void setMaxRange(double range)
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 getResolution()
AbstractOcTree * octree
Definition: OcTreeRecord.h:34
OcTreeDrawer * octree_drawer
Definition: OcTreeRecord.h:35
double getMaxRange()
void loadCameraPosition(const char *filename)
Definition: ViewerGui.cpp:1231
std::map< int, OcTreeRecord > m_octrees
Definition: ViewerGui.h:200
void setResolution(double resolution)
float logodds(double probability)
virtual void playPath(unsigned int i)
Definition: camera.cpp:1726
bool write(const std::string &filename) const
virtual void setScanGraph(const ScanGraph &graph)
#define OCTOMAP_ERROR(...)
void on_actionPrintout_mode_toggled(bool checked)
Definition: ViewerGui.cpp:967
void on_actionFill_unknown_in_selection_triggered()
Definition: ViewerGui.cpp:778
virtual void help()
Definition: qglviewer.cpp:1975
void openMapCollection()
Definition: ViewerGui.cpp:520
void saveSnapshot(bool automatic=true, bool overwrite=false)
void on_actionHelp_triggered()
Definition: ViewerGui.cpp:631
void setSnapshotCounter(int counter)
Definition: qglviewer.h:516
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