00001 /* 00002 * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees 00003 * http://octomap.github.com/ 00004 * 00005 * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg 00006 * All rights reserved. 00007 * License (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 along 00022 * with this program; if not, write to the Free Software Foundation, Inc., 00023 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 */ 00025 00026 #ifndef SCENEOBJECT_H_ 00027 #define SCENEOBJECT_H_ 00028 00029 // fix Windows includes 00030 #include <qglobal.h> 00031 #ifdef Q_WS_WIN 00032 #include <QtCore/qt_windows.h> 00033 #endif 00034 00035 #ifdef Q_WS_MAC 00036 #include <OpenGL/glu.h> 00037 #else 00038 #include <GL/glu.h> 00039 #endif 00040 00041 #include <qglviewer.h> 00042 #include <octomap/octomap.h> 00043 00044 namespace octomap { 00045 00050 class SceneObject { 00051 public: 00052 enum ColorMode { 00053 CM_FLAT, 00054 CM_PRINTOUT, 00055 CM_COLOR_HEIGHT, 00056 CM_GRAY_HEIGHT, 00057 CM_SEMANTIC 00058 }; 00059 00060 public: 00061 SceneObject(); 00062 virtual ~SceneObject(){}; 00063 00067 virtual void draw() const = 0; 00068 00072 virtual void clear(){}; 00073 00074 public: 00077 inline void setColorMode(ColorMode mode) { m_colorMode = mode; } 00078 inline void enablePrintoutMode(bool enabled = true) { if (enabled) m_colorMode = CM_PRINTOUT; else m_colorMode = CM_FLAT; } 00079 inline void enableHeightColorMode(bool enabled = true) { if (enabled) m_colorMode = CM_COLOR_HEIGHT; else m_colorMode = CM_FLAT; } 00080 inline void enableSemanticColoring(bool enabled = true) { if (enabled) m_colorMode = CM_SEMANTIC; else m_colorMode = CM_FLAT; } 00081 00082 protected: 00085 void heightMapColor(double h, GLfloat* glArrayPos) const; 00086 void heightMapGray(double h, GLfloat* glArrayPos) const; 00087 double m_zMin; 00088 double m_zMax; 00089 ColorMode m_colorMode; 00090 }; 00091 00092 00093 00094 00098 class ScanGraphDrawer : public SceneObject { 00099 public: 00100 ScanGraphDrawer(): SceneObject(){}; 00101 virtual ~ScanGraphDrawer(){}; 00102 00110 virtual void setScanGraph(const octomap::ScanGraph& graph) = 0; 00111 }; 00112 00113 } 00114 00115 #endif /* SCENEOBJECT_H_ */