ViewerGui.h
Go to the documentation of this file.
00001 /*
00002  * This file is part of OctoMap - An Efficient Probabilistic 3D Mapping
00003  * Framework Based on Octrees
00004  * http://octomap.github.io
00005  *
00006  * Copyright (c) 2009-2014, K.M. Wurm and A. Hornung, University of Freiburg
00007  * All rights reserved. License for the viewer octovis: GNU GPL v2
00008  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
00009  *
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful, but
00017  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00018  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
00019  * for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program. If not, see http://www.gnu.org/licenses/.
00023  */
00024 
00025 #ifndef VIEWERGUI_H
00026 #define VIEWERGUI_H
00027 
00028 #include <QtGui/QMainWindow>
00029 #include <QFileDialog>
00030 #include <QMessageBox>
00031 #include <QDockWidget>
00032 #include <string>
00033 #include <cmath>
00034 #include "TrajectoryDrawer.h"
00035 #include "PointcloudDrawer.h"
00036 #include "OcTreeDrawer.h"
00037 #include "CameraFollowMode.h"
00038 #include "ViewerWidget.h"
00039 #include "ViewerSettings.h"
00040 #include "ViewerSettingsPanel.h"
00041 #include "ViewerSettingsPanelCamera.h"
00042 #include "ui_ViewerGui.h"
00043 
00044 #include <octomap/AbstractOcTree.h>
00045 #include <octomap/OcTreeBase.h>
00046 #include <octovis/OcTreeRecord.h>
00047 
00048 namespace octomap {
00049 
00050   class ViewerGui : public QMainWindow {
00051     Q_OBJECT
00052    
00053   public:
00054     ViewerGui(const std::string& filename="", QWidget *parent = 0);
00055     ~ViewerGui();
00056 
00057     static const unsigned int LASERTYPE_URG  = 0;
00058     static const unsigned int LASERTYPE_SICK = 1;
00059 
00060     // use this drawer id if loading files or none is specified in msg
00061     static const unsigned int DEFAULT_OCTREE_ID  = 0; 
00062 
00063     public slots:
00064 
00065     void changeTreeDepth(int depth);
00066     void addNextScans(unsigned scans);
00067     void gotoFirstScan();
00068 
00069     bool isShown();
00070 
00071     private slots:
00072 
00073     // auto-connected Slots (by name))
00074 
00075     void on_actionExit_triggered();
00076     void on_actionOpen_file_triggered();
00077     void on_actionOpen_graph_incremental_triggered();
00078     void on_actionSave_file_triggered();
00079     void on_actionExport_view_triggered();
00080     void on_actionExport_sequence_triggered(bool checked);
00081     void on_actionClear_selection_triggered();
00082     void on_actionFill_selection_triggered();
00083     void on_actionClear_unknown_in_selection_triggered();
00084     void on_actionFill_unknown_in_selection_triggered();
00085     void on_actionClear_nodes_in_selection_triggered();
00086     void on_actionFill_nodes_in_selection_triggered();
00087     void on_actionDelete_nodes_in_selection_triggered();
00088     void on_actionDelete_nodes_outside_of_selection_triggered();
00089     void on_actionHelp_triggered();
00090     void on_actionSettings_triggered();
00091     void on_actionPrune_tree_triggered();
00092     void on_actionExpand_tree_triggered();
00093     void on_actionConvert_ml_tree_triggered();
00094     void on_actionReload_Octree_triggered();
00095     void on_actionPrintout_mode_toggled(bool checked);
00096     void on_actionSelection_box_toggled(bool checked);
00097     void on_actionHeight_map_toggled(bool checked);
00098     void on_actionSemanticColoring_toggled(bool checked);
00099     void on_actionStore_camera_triggered();
00100     void on_actionRestore_camera_triggered();
00101     void on_actionPointcloud_toggled(bool checked);
00102     void on_actionTrajectory_toggled(bool checked);
00103     void on_actionOctree_cells_toggled(bool enabled);
00104     void on_actionOctree_structure_toggled(bool enabled);
00105     void on_actionFree_toggled(bool enabled);
00106     void on_actionSelected_toggled(bool enabled);
00107     void on_actionAxes_toggled(bool checked);
00108     void on_actionHideBackground_toggled(bool checked);
00109     void on_actionClear_triggered();
00110 
00111     void on_action_bg_black_triggered();
00112     void on_action_bg_white_triggered();
00113     void on_action_bg_gray_triggered();
00114 
00115     void on_savecampose_triggered();
00116     void on_loadcampose_triggered();
00117 
00118     // use it for testcases etc.
00119     void on_actionTest_triggered();
00120 
00121   signals:
00122     void updateStatusBar(QString message, int duration);
00123     void changeNumberOfScans(unsigned scans);
00124     void changeCurrentScan(unsigned scans);
00125     void changeResolution(double resolution);
00126     void changeCamPosition(double x, double y, double z, double lookX, double lookY, double lookZ);
00127 
00128   private:
00133     void openFile();
00134 
00139     void openPointcloud();
00140 
00145     void openGraph(bool completeGraph = true);
00146 
00150     void loadGraph(bool completeGraph = true);
00151 
00155     void addNextScan();
00156 
00160     void openPC();
00161 
00163     void openOcTree();
00164 
00166     void openTree();
00167 
00168     // EXPERIMENTAL
00169     // open a map collection (.hot-file)
00170     void openMapCollection();
00171 
00172 
00173     void setOcTreeUISwitches();
00174 
00178     void generateOctree();
00179     void showOcTree();
00180 
00181     void showInfo(QString string, bool newline=false);
00182 
00183     void addOctree(AbstractOcTree* tree, int id, pose6d origin);
00184     void addOctree(AbstractOcTree* tree, int id);
00185     bool getOctreeRecord(int id, OcTreeRecord*& otr);
00186 
00187     void saveCameraPosition(const char* filename) const;
00188     void loadCameraPosition(const char* filename);
00189 
00190     void updateNodesInBBX(const point3d& min, const point3d& max, bool occupied);
00191     void setNodesInBBX(const point3d& min, const point3d& max, bool occupied);
00192     void setNonNodesInBBX(const point3d& min, const point3d& max, bool occupied);
00193 
00194     std::map<int, OcTreeRecord> m_octrees;
00195  
00196     ScanGraph* m_scanGraph;
00197     ScanGraph::iterator m_nextScanToAdd;
00198 
00199     Ui::ViewerGuiClass ui;
00200     ViewerWidget* m_glwidget;
00201     TrajectoryDrawer* m_trajectoryDrawer;
00202     PointcloudDrawer* m_pointcloudDrawer;
00203     CameraFollowMode* m_cameraFollowMode;
00204     double m_octreeResolution;
00205     double m_laserMaxRange;
00206     double m_occupancyThresh; // FIXME: This is not really used at the moment...
00207     unsigned int m_max_tree_depth;
00208     unsigned int m_laserType; // SICK or Hokuyo /URG
00209     bool m_cameraStored;
00210     QLabel* m_mapSizeStatus;
00211     QLabel* m_mapMemoryStatus;
00212 
00214     std::string m_filename;
00215   };
00216 
00217 } // namespace
00218 
00219 
00220 #endif // VIEWERGUI_H


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Feb 11 2016 23:51:20