GCC Code Coverage Report


Directory: ./
File: include/gepetto/viewer/roadmap-viewer.h
Date: 2024-12-20 15:53:58
Exec Total Coverage
Lines: 0 17 0.0%
Branches: 0 8 0.0%

Line Branch Exec Source
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 <gepetto/viewer/group-node.h>
13 #include <gepetto/viewer/leaf-node-line.h>
14 #include <gepetto/viewer/leaf-node-xyzaxis.h>
15 #include <gepetto/viewer/node.h>
16
17 #include <OpenThreads/Mutex>
18
19 namespace gepetto {
20 namespace viewer {
21
22 DEF_CLASS_SMART_PTR(RoadmapViewer)
23
24 class RoadmapViewer : public Node {
25 private:
26 /**
27 \brief List of all child graphical object
28 */
29 std::list<LeafNodeXYZAxisPtr_t> list_nodes_;
30 std::list<LeafNodeLinePtr_t> list_edges_;
31
32 /** Associated weak pointer */
33 RoadmapViewerWeakPtr weak_ptr_;
34 // ---
35 float radiusSphere_;
36 float sizeAxis_;
37 osgVector4 colorNode_;
38 osgVector4 colorEdge_;
39 /** Initialize weak_ptr */
40 void initWeakPtr(RoadmapViewerWeakPtr other_weak_ptr);
41
42 protected:
43 /**
44 \brief Default constructor
45 */
46 RoadmapViewer(const std::string& name, const osgVector4& colorNode,
47 float radiusSphere, float sizeAxis,
48 const osgVector4& colorEdge);
49
50 /** Copy constructor */
51 RoadmapViewer(const RoadmapViewer& other);
52
53 public:
54 /** Static method which create a new box defined by the half_axis vector
55 */
56 static RoadmapViewerPtr_t create(const std::string& name,
57 const osgVector4& colorNode,
58 float radiusSphere, float sizeAxis,
59 const osgVector4& colorEdge);
60
61 /** Static method for creating a clone of box other with the copy constructor
62 */
63 static RoadmapViewerPtr_t createCopy(RoadmapViewerPtr_t other);
64
65 /** Proceed to a clonage of the current object defined by the copy constructor
66 */
67 virtual RoadmapViewerPtr_t clone(void) const;
68
69 /** Return a shared pointer of the current object
70 */
71 RoadmapViewerPtr_t self(void) const;
72
73 bool addNode(osgVector3 position, osgQuat quat, ::OpenThreads::Mutex& mtx);
74
75 bool addEdge(osgVector3 from, osgVector3 to, ::OpenThreads::Mutex& mtx);
76
77 virtual void removeAllChildren();
78
79 /**
80 \brief Virtual method for setting the visibility mode of the object : visible
81 or not visible \param visibilitymode state
82 */
83 virtual void setVisibilityMode(const VisibilityMode& visibility_state);
84
85 /**
86 \brief Virtual method for setting the lighting mode of the object : influence
87 by light or not \param lightingmode state
88 */
89 virtual void setLightingMode(const LightingMode& lighting_state);
90
91 /**
92 \brief Virtual method for setting the wireframe mode of the object : visible
93 or not \param wireframemode state
94 */
95 virtual void setWireFrameMode(const WireFrameMode& wireframe_state);
96
97 virtual size_t getNumOfNodes() const { return list_nodes_.size(); }
98
99 virtual size_t getNumOfEdges() const { return list_edges_.size(); }
100
101 virtual LeafNodeXYZAxisPtr_t getNode(size_t i) const {
102 std::list<LeafNodeXYZAxisPtr_t>::const_iterator it = list_nodes_.begin();
103 if (list_nodes_.size() > i) {
104 std::advance(it, (long)i);
105 }
106 return *it;
107 }
108
109 virtual LeafNodeLinePtr_t getEdge(size_t i) const {
110 std::list<LeafNodeLinePtr_t>::const_iterator it = list_edges_.begin();
111 if (list_edges_.size() > i) {
112 std::advance(it, (long)i);
113 }
114 return *it;
115 }
116
117 virtual float getRadiusSphere() const { return radiusSphere_; }
118
119 virtual float getSizeAxis() const { return sizeAxis_; }
120
121 virtual osgVector4 getColorNode() const { return colorNode_; }
122
123 virtual osgVector4 getColorEdge() const { return colorEdge_; }
124
125 void setColorNode(const osgVector4& color);
126
127 void setColorEdge(const osgVector4& color);
128
129 void setColor(const osgVector4& color) { setColorEdge(color); }
130
131 }; // class
132
133 } /* namespace viewer */
134 } /* namespace gepetto */
135
136 #endif
137