GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/group-node.h Lines: 0 8 0.0 %
Date: 2020-05-14 11:23:33 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
    {
21
    private:
22
        /**
23
         \brief List of all child graphical object
24
         */
25
        typedef std::vector<NodePtr_t> Nodes_t;
26
        Nodes_t list_of_objects_;
27
28
        /** Associated weak pointer */
29
        GroupNodeWeakPtr weak_ptr_;
30
31
    protected:
32
        /**
33
         \brief Default constructor
34
         */
35
        GroupNode (const std::string& name);
36
37
        /** Copy constructor */
38
        GroupNode (const GroupNode& other);
39
40
        /** Initialize weak_ptr */
41
        void initWeakPtr(GroupNodeWeakPtr other_weak_ptr);
42
43
    public:
44
        /** Static method which create a new box defined by the half_axis vector
45
         */
46
       static GroupNodePtr_t create(const std::string& name);
47
48
        /** Static method for creating a clone of box other with the copy constructor
49
         */
50
        static GroupNodePtr_t createCopy(GroupNodePtr_t other);
51
52
        /** Proceed to a clonage of the current object defined by the copy constructor
53
         */
54
        GroupNodePtr_t clone(void) const;
55
56
        /** Return a shared pointer of the current object
57
         */
58
        GroupNodePtr_t self(void) const;
59
60
61
        /** Add a GraphicalObject to the list
62
         */
63
        virtual bool addChild (NodePtr_t child_ptr);
64
65
        /** Remove a GraphicalObject from the list
66
         */
67
        virtual bool removeChild (NodePtr_t child_ptr);
68
69
        /** Return true if this group contains this child
70
         */
71
        virtual bool hasChild (NodePtr_t child_ptr) const;
72
73
        /** Remove all children
74
         */
75
        virtual void removeAllChildren();
76
77
        virtual size_t getNumOfChildren() const
78
        {
79
          return list_of_objects_.size();
80
        }
81
82
        virtual NodePtr_t getChild(size_t i) const
83
        {
84
           Nodes_t::const_iterator it = list_of_objects_.begin();
85
           if (list_of_objects_.size() > i)
86
           {
87
               std::advance(it, (long)i);
88
           }
89
           return *it;
90
        }
91
92
        /**
93
         \brief Virtual method for setting the lighting mode of the object : influence by light or not
94
         \param lightingmode state
95
         */
96
        virtual void setLightingMode (const LightingMode& lighting_state);
97
98
        /**
99
         \brief Virtual method for setting the wireframe mode of the object : visible or not
100
         \param wireframemode state
101
         */
102
        virtual void setWireFrameMode (const WireFrameMode& wireframe_state);
103
104
        /** Replace the old transparency value with alpha
105
         *  Note : alpha must be in [0,1]
106
         */
107
        virtual void setAlpha (const float& alpha);
108
109
        /** Set the color of the object */
110
        void setColor (const osgVector4& color);
111
112
        void traverse (NodeVisitor& visitor);
113
114
	virtual osg::ref_ptr<osg::Node> getOsgNode() const;
115
116
        SCENE_VIEWER_ACCEPT_VISITOR;
117
118
        /* Destructor */
119
        virtual ~GroupNode();
120
121
    }; /* class GraphicalGroupOSG */
122
123
} /* namespace viewer */
124
} /* namespace gepetto */
125
126
#endif /* GEPETTO_VIEWER_GROUPNODE_HH */