Drake Designer
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
vtkOctomap.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 
5 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6 All rights reserved.
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkOctomap - An orthonormal frame representation
15 // .SECTION Description
16 // An orthonormal frame representation for use with the vtkFrameWidget
17 
18 // .SECTION See Also
19 // vtkFrameWidget vtkFrameWidget
20 
21 
22 #ifndef __vtkOctomap_h
23 #define __vtkOctomap_h
24 
25 #include "vtkProp.h"
26 
27 #include <vtkOpenGL.h>
28 
29 #include <vtkDRCFiltersModule.h>
30 
31 #include <octomap/AbstractOcTree.h>
32 #include <octomap/OcTreeBase.h>
33 #include <octomap/octomap_types.h>
34 #include <octomap/ColorOcTree.h>
35 #include <octovis/ColorOcTreeDrawer.h>
36 #include <octovis/OcTreeRecord.h>
37 #include <iostream>
38 #include <sstream>
39 
40 
41 class VTKDRCFILTERS_EXPORT vtkOctomap : public vtkProp
42 {
43 public:
44  // Description:
45  // Instantiate the class.
46  static vtkOctomap *New();
47 
48  // Description:
49  // Standard methods for the class.
50  vtkTypeMacro(vtkOctomap,vtkProp);
51  void PrintSelf(ostream& os, vtkIndent indent);
52 
53  void UpdateOctomapData(const char* data);
54 
55  void setAlphaOccupied(double alphaOccupied);
56  void changeTreeDepth(int depth);
57  void setColorMode (int colorMode);
58  void enableOctreeStructure (bool enabled);
59  void enableOcTreeCells (bool enabled);
60  void enableFreespace (bool enabled);
61 
62  // Description:
63  // Methods supporting, and required by, the rendering process.
64  virtual void ReleaseGraphicsResources(vtkWindow*);
65  virtual int RenderOpaqueGeometry(vtkViewport*);
66  virtual int RenderOverlay(vtkViewport*);
67  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*);
68  virtual int HasTranslucentPolygonalGeometry();
69 
70 
71  // use this drawer id if loading files or none is specified in msg
72  static const unsigned int DEFAULT_OCTREE_ID = 0;
73 
74 
75  void addOctree(octomap::AbstractOcTree* tree, int id, octomap::pose6d origin);
76  void addOctree(octomap::AbstractOcTree* tree, int id);
77  bool getOctreeRecord(int id, octomap::OcTreeRecord*& otr);
78 
79 protected:
80  vtkOctomap();
81  ~vtkOctomap();
82 
83 private:
84 
86  void openOcTree(std::string filename);
87 
89  void openTree(std::string filename);
90 
91  void parseTree(std::string datastream_string);
92  void parseOcTree(std::string datastream_string);
93 
94  void showOcTree();
95 
96  class vtkInternal;
97  vtkInternal* Internal;
98 
99  vtkOctomap(const vtkOctomap&); //Not implemented
100  void operator=(const vtkOctomap&); //Not implemented
101 };
102 
103 #endif
#define VTKDRCFILTERS_EXPORT