roadmap-viewer.h
Go to the documentation of this file.
1 //
2 // roadmap-viewer.h
3 // gepetto-viewer
4 //
5 // Created by Pierre Fernbach in april 2015.
6 // Copyright (c) 2015 LAAS-CNRS. All rights reserved.
7 //
8 
9 #ifndef GEPETTO_VIEWER_ROADMAPVIEWER_HH
10 #define GEPETTO_VIEWER_ROADMAPVIEWER_HH
11 
12 #include <OpenThreads/Mutex>
13 
14 #include <gepetto/viewer/node.h>
18 
19 namespace gepetto {
20 namespace viewer {
21 
22  DEF_CLASS_SMART_PTR(RoadmapViewer)
23 
24  class RoadmapViewer : public Node
25  {
26  private:
30  std::list<LeafNodeXYZAxisPtr_t> list_nodes_;
31  std::list<LeafNodeLinePtr_t> list_edges_;
32 
34  RoadmapViewerWeakPtr weak_ptr_;
35  // ---
36  float radiusSphere_;
37  float sizeAxis_;
38  osgVector4 colorNode_;
39  osgVector4 colorEdge_;
41  void initWeakPtr(RoadmapViewerWeakPtr other_weak_ptr);
42 
43  protected:
47  RoadmapViewer (const std::string& name,const osgVector4& colorNode,float radiusSphere,float sizeAxis,const osgVector4& colorEdge);
48 
50  RoadmapViewer (const RoadmapViewer& other);
51 
52  public:
55  static RoadmapViewerPtr_t create(const std::string& name,const osgVector4& colorNode,float radiusSphere,float sizeAxis,const osgVector4& colorEdge);
56 
59  static RoadmapViewerPtr_t createCopy(RoadmapViewerPtr_t other);
60 
63  virtual RoadmapViewerPtr_t clone(void) const;
64 
67  RoadmapViewerPtr_t self(void) const;
68 
69  bool addNode(osgVector3 position, osgQuat quat, ::OpenThreads::Mutex& mtx);
70 
71  bool addEdge(osgVector3 from, osgVector3 to, ::OpenThreads::Mutex& mtx);
72 
73  virtual void removeAllChildren();
74 
79  virtual void setVisibilityMode (const VisibilityMode& visibility_state);
80 
85  virtual void setLightingMode (const LightingMode& lighting_state);
86 
91  virtual void setWireFrameMode (const WireFrameMode& wireframe_state);
92 
93  virtual size_t getNumOfNodes() const
94  {
95  return list_nodes_.size();
96  }
97 
98  virtual size_t getNumOfEdges() const
99  {
100  return list_edges_.size();
101  }
102 
103  virtual LeafNodeXYZAxisPtr_t getNode(size_t i) const
104  {
105  std::list<LeafNodeXYZAxisPtr_t>::const_iterator it = list_nodes_.begin();
106  if (list_nodes_.size() > i)
107  {
108  std::advance(it, (long)i);
109  }
110  return *it;
111  }
112 
113  virtual LeafNodeLinePtr_t getEdge(size_t i) const
114  {
115  std::list<LeafNodeLinePtr_t>::const_iterator it = list_edges_.begin();
116  if (list_edges_.size() > i)
117  {
118  std::advance(it, (long)i);
119  }
120  return *it;
121  }
122 
123  virtual float getRadiusSphere() const {
124  return radiusSphere_;
125  }
126 
127  virtual float getSizeAxis() const {
128  return sizeAxis_;
129  }
130 
131  virtual osgVector4 getColorNode() const{
132  return colorNode_;
133  }
134 
135  virtual osgVector4 getColorEdge() const{
136  return colorEdge_;
137  }
138 
139  void setColorNode(const osgVector4& color);
140 
141  void setColorEdge(const osgVector4& color);
142 
143  void setColor (const osgVector4& color) {
144  setColorEdge (color);
145  }
146 
147  }; //class
148 
149 } /* namespace viewer */
150 } /* namespace gepetto */
151 
152 #endif
virtual LeafNodeXYZAxisPtr_t getNode(size_t i) const
Definition: roadmap-viewer.h:103
::osg::Vec3f osgVector3
Definition: config-osg.h:109
::osg::Quat osgQuat
Definition: config-osg.h:112
virtual float getSizeAxis() const
Definition: roadmap-viewer.h:127
::osg::Vec4f osgVector4
Definition: config-osg.h:110
VisibilityMode
Definition: config-osg.h:117
virtual LeafNodeLinePtr_t getEdge(size_t i) const
Definition: roadmap-viewer.h:113
virtual float getRadiusSphere() const
Definition: roadmap-viewer.h:123
Definition: action-search-bar.hh:27
virtual osgVector4 getColorNode() const
Definition: roadmap-viewer.h:131
LightingMode
Definition: config-osg.h:124
virtual size_t getNumOfEdges() const
Definition: roadmap-viewer.h:98
OpenThreads::Mutex Mutex
Definition: windows-manager.h:30
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
void setColor(const osgVector4 &color)
Definition: roadmap-viewer.h:143
WireFrameMode
Definition: config-osg.h:130
Definition: roadmap-viewer.h:24
virtual osgVector4 getColorEdge() const
Definition: roadmap-viewer.h:135
virtual size_t getNumOfNodes() const
Definition: roadmap-viewer.h:93
Abstract base class of 3D objects in a scene.
Definition: node.h:27