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 SCENEOBJECT_H_ 00026 #define SCENEOBJECT_H_ 00027 00028 // fix Windows includes 00029 #include <qglobal.h> 00030 #ifdef Q_WS_WIN 00031 #include <QtCore/qt_windows.h> 00032 #endif 00033 00034 #ifdef Q_WS_MAC 00035 #include <OpenGL/glu.h> 00036 #else 00037 #include <GL/glu.h> 00038 #endif 00039 00040 #include <qglviewer.h> 00041 #include <octomap/octomap.h> 00042 00043 namespace octomap { 00044 00049 class SceneObject { 00050 public: 00051 enum ColorMode { 00052 CM_FLAT, 00053 CM_PRINTOUT, 00054 CM_COLOR_HEIGHT, 00055 CM_GRAY_HEIGHT, 00056 CM_SEMANTIC 00057 }; 00058 00059 public: 00060 SceneObject(); 00061 virtual ~SceneObject(){}; 00062 00066 virtual void draw() const = 0; 00067 00071 virtual void clear(){}; 00072 00073 public: 00076 inline void setColorMode(ColorMode mode) { m_colorMode = mode; } 00077 inline void enablePrintoutMode(bool enabled = true) { if (enabled) m_colorMode = CM_PRINTOUT; else m_colorMode = CM_FLAT; } 00078 inline void enableHeightColorMode(bool enabled = true) { if (enabled) m_colorMode = CM_COLOR_HEIGHT; else m_colorMode = CM_FLAT; } 00079 inline void enableSemanticColoring(bool enabled = true) { if (enabled) m_colorMode = CM_SEMANTIC; else m_colorMode = CM_FLAT; } 00080 00081 protected: 00084 void heightMapColor(double h, GLfloat* glArrayPos) const; 00085 void heightMapGray(double h, GLfloat* glArrayPos) const; 00086 double m_zMin; 00087 double m_zMax; 00088 ColorMode m_colorMode; 00089 }; 00090 00091 00092 00093 00097 class ScanGraphDrawer : public SceneObject { 00098 public: 00099 ScanGraphDrawer(): SceneObject(){}; 00100 virtual ~ScanGraphDrawer(){}; 00101 00109 virtual void setScanGraph(const octomap::ScanGraph& graph) = 0; 00110 }; 00111 00112 } 00113 00114 #endif /* SCENEOBJECT_H_ */