00001 // HOG-Man - Hierarchical Optimization for Pose Graphs on Manifolds 00002 // Copyright (C) 2010 G. Grisetti, R. Kümmerle, C. Stachniss 00003 // 00004 // This file is part of HOG-Man. 00005 // 00006 // HOG-Man is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // HOG-Man is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with HOG-Man. If not, see <http://www.gnu.org/licenses/>. 00018 00019 #ifndef VIS_POSE_GRAPH_SHARED_H 00020 #define VIS_POSE_GRAPH_SHARED_H 00021 00022 #include <vector> 00023 #include <iostream> 00024 #include <qgl.h> 00025 00026 namespace AISNavigation { 00027 00028 // forward declarartion 00029 class PoseGraph3D; 00030 00034 class PoseGraph3DVis 00035 { 00036 public: 00037 struct HEdge 00038 { 00039 int id1, id2; 00040 }; 00041 typedef std::vector<HEdge> HEdgeVector; 00042 00043 struct Color 00044 { 00045 float r,g,b; 00046 Color(float r_, float g_, float b_) : r(r_), g(g_), b(b_) {} 00047 }; 00048 00049 public: 00050 PoseGraph3DVis(); 00051 ~PoseGraph3DVis(); 00052 00053 virtual void draw() const; 00054 00055 void writeVrml(std::ostream& os) const; 00056 00058 const PoseGraph3D* getGraph() const {return _graph;} 00059 PoseGraph3D* getGraph() {return _graph;} 00061 void setGraph(PoseGraph3D* graph); 00062 00063 void setHirarchy(std::vector<PoseGraph3DVis::HEdgeVector>* hirarchy); 00064 00066 bool getUseDrawList() const { return _useDrawList; } 00067 void setUseDrawList(bool useDrawList) { _useDrawList = useDrawList; if (useDrawList) _updateDrawList = true;} 00068 00070 bool getUpdateDrawList() const { return _updateDrawList; } 00071 void setUpdateDrawList(bool update) { _updateDrawList = update; } 00072 00073 bool getDrawGraph() const { return _drawOptions[0];} 00074 void setDrawGraph(bool draw); 00075 bool getDrawHirarchy() const { return _drawOptions[1];} 00076 void setDrawHirarchy(bool draw); 00077 00078 protected: 00079 // draw routines 00080 void drawGraph() const; 00081 void drawHirarchy() const; 00082 00083 // routines to output to vrml file 00084 void writeGraph(std::ostream& os) const; 00085 void writeHirarchy(std::ostream& os) const; 00086 00087 PoseGraph3D* _graph; 00088 std::vector<HEdgeVector>* _hirarchy; 00089 std::vector<Color> _colors; 00090 00091 mutable bool _updateDrawList; 00092 mutable bool _useDrawList; 00093 mutable GLuint _drawList; 00094 mutable bool _listAllocated; 00095 std::vector<bool> _drawOptions; 00096 }; 00097 00098 } // end namespace 00099 00100 #endif