GCC Code Coverage Report


Directory: ./
File: include/gepetto/viewer/group-node.h
Date: 2024-08-14 11:04:57
Exec Total Coverage
Lines: 0 7 0.0%
Branches: 0 6 0.0%

Line Branch Exec Source
1 //
2 // group-node.h
3 // gepetto-viewer
4 //
5 // Created by Justin Carpentier, Mathieu Geisert in November 2014.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7 //
8
9 #ifndef GEPETTO_VIEWER_GROUPNODE_HH
10 #define GEPETTO_VIEWER_GROUPNODE_HH
11
12 #include <gepetto/viewer/node.h>
13
14 namespace gepetto {
15 namespace viewer {
16
17 DEF_CLASS_SMART_PTR(GroupNode)
18
19 class GroupNode : public Node {
20 private:
21 /**
22 \brief List of all child graphical object
23 */
24 typedef std::vector<NodePtr_t> Nodes_t;
25 Nodes_t list_of_objects_;
26
27 /** Associated weak pointer */
28 GroupNodeWeakPtr weak_ptr_;
29
30 protected:
31 /**
32 \brief Default constructor
33 */
34 GroupNode(const std::string& name);
35
36 /** Copy constructor */
37 GroupNode(const GroupNode& other);
38
39 /** Initialize weak_ptr */
40 void initWeakPtr(GroupNodeWeakPtr other_weak_ptr);
41
42 public:
43 /** Static method which create a new box defined by the half_axis vector
44 */
45 static GroupNodePtr_t create(const std::string& name);
46
47 /** Static method for creating a clone of box other with the copy constructor
48 */
49 static GroupNodePtr_t createCopy(GroupNodePtr_t other);
50
51 /** Proceed to a clonage of the current object defined by the copy constructor
52 */
53 GroupNodePtr_t clone(void) const;
54
55 /** Return a shared pointer of the current object
56 */
57 GroupNodePtr_t self(void) const;
58
59 /** Add a GraphicalObject to the list
60 */
61 virtual bool addChild(NodePtr_t child_ptr);
62
63 /** Remove a GraphicalObject from the list
64 */
65 virtual bool removeChild(NodePtr_t child_ptr);
66
67 /** Return true if this group contains this child
68 */
69 virtual bool hasChild(NodePtr_t child_ptr) const;
70
71 /** Remove all children
72 */
73 virtual void removeAllChildren();
74
75 virtual size_t getNumOfChildren() const { return list_of_objects_.size(); }
76
77 virtual NodePtr_t getChild(size_t i) const {
78 Nodes_t::const_iterator it = list_of_objects_.begin();
79 if (list_of_objects_.size() > i) {
80 std::advance(it, (long)i);
81 }
82 return *it;
83 }
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 /** Replace the old transparency value with alpha
98 * Note : alpha must be in [0,1]
99 */
100 virtual void setAlpha(const float& alpha);
101
102 /** Set the color of the object */
103 void setColor(const osgVector4& color);
104
105 void traverse(NodeVisitor& visitor);
106
107 virtual osg::ref_ptr<osg::Node> getOsgNode() const;
108
109 SCENE_VIEWER_ACCEPT_VISITOR;
110
111 /* Destructor */
112 virtual ~GroupNode();
113
114 }; /* class GraphicalGroupOSG */
115
116 } /* namespace viewer */
117 } /* namespace gepetto */
118
119 #endif /* GEPETTO_VIEWER_GROUPNODE_HH */
120