GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-ground.h Lines: 0 6 0.0 %
Date: 2020-05-14 11:23:33 Branches: 0 2 0.0 %

Line Branch Exec Source
1
//
2
//  leaf-node-ground.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_LEAFNODEGROUND_HH
10
#define GEPETTO_VIEWER_LEAFNODEGROUND_HH
11
12
#include <gepetto/viewer/node.h>
13
14
namespace gepetto {
15
namespace viewer {
16
    DEF_CLASS_SMART_PTR(LeafNodeGround)
17
18
    class LeafNodeGround : public Node
19
    {
20
    private:
21
22
        float length_;
23
        float width_;
24
        float square_length_;
25
        float square_width_;
26
27
        osgVector4 color1_;
28
        osgVector4 color2_;
29
30
        /** Associated weak pointer */
31
        LeafNodeGroundWeakPtr weak_ptr_;
32
33
        /** Array of colors */
34
        ::osg::Vec4ArrayRefPtr colors_array_ptr_;
35
36
        /** Associated Geometry for LeafNodeGround */
37
        ::osg::GeometryRefPtr grid_geometry_ptr_;
38
39
        /** Init method */
40
        void init();
41
42
        /** Constructor
43
         \brief Constructor with all useful parameters
44
         \param length : length of demi-axis
45
         \param width : width of demi-axis
46
         \param square_length : length of a basic square
47
         \param square_width : width of a basic square
48
         */
49
        LeafNodeGround(const std::string& name, const float& length, const float& width,
50
                  const float& square_length, const float& square_width, const osgVector4& color1, const osgVector4& color2);
51
52
        /** Copy constructor */
53
        LeafNodeGround(const LeafNodeGround& other);
54
55
        /** Initialize weak_ptr */
56
        void initWeakPtr( const LeafNodeGroundWeakPtr& other_weak_ptr );
57
58
    protected:
59
    public:
60
61
        /** Builder
62
         \param length : length of plane
63
         \param width : width of plane
64
         */
65
        static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width);
66
67
        /** Builder
68
         \brief Constructor with all useful parameters
69
         \param length : length of demi-axis
70
         \param width : width of demi-axis
71
         \param square_length : length of a basic square
72
         \param square_width : width of a basic square
73
         \param configuration_ptr : configuration of plane
74
         */
75
        static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width,
76
                                         const float &square_length, const float &square_width);
77
78
        static LeafNodeGroundPtr_t create(const std::string& name, const float &length, const float &width, const float &square_length, const float &square_width, const osgVector4& color1, const osgVector4& color2);
79
80
        static LeafNodeGroundPtr_t create(const std::string& name);
81
82
        /** Create copy */
83
        static LeafNodeGroundPtr_t createCopy( const LeafNodeGroundPtr_t &other );
84
85
        /** Clone
86
         \brief Returns a shared pointer to a newly allocated copy of the object.
87
         */
88
        virtual LeafNodeGroundPtr_t clone(void) const;
89
90
91
        /** Copy
92
         \brief Proceed to a copy of the currend object as clone
93
         */
94
        virtual LeafNodeGroundPtr_t copy() const { return clone(); }
95
96
        /**
97
         \brief Returns a shared pointer of the object itself.
98
         */
99
        LeafNodeGroundPtr_t self(void) const;
100
101
        /**
102
         * \sa setColor1
103
         */
104
        void setColor (const osgVector4 &color);
105
106
        /** inline virtual void setColor1(const ColotSharedPtr &color1_ptr)
107
         \brief Allow to define color1
108
         \param color1_ptr : color to apply to first color
109
         */
110
        virtual void setColor1(const osgVector4 &color1);
111
112
        const osgVector4& getColor1() const
113
        {
114
            return color1_;
115
        }
116
117
        /** inline virtual void setColor2(const ColotSharedPtr &color2_ptr)
118
         \brief Allow to define color2
119
         \param color2_ptr : color to apply to second color
120
         */
121
        virtual void setColor2(const osgVector4 &color2);
122
123
        const osgVector4& getColor2() const
124
        {
125
            return color2_;
126
        }
127
        /** virtual void setColors(const ColorSharedPtr &color1_ptr , const ColorSharedPtr &color2_ptr);
128
         \brief Allow to define both colors
129
         \param color1_ptr : color to apply to first color
130
         \param color2_ptr : color to apply to second color
131
         */
132
        virtual void setColors(const osgVector4 &color1 , const osgVector4 &color2);
133
134
        /**
135
         \brief Virtual method for setting the shadow mode of the object : receive, cast, both or no shadow
136
         \param shadow_state state
137
         */
138
        //virtual void setShadowMode (const ShadowMode& shadow_state) {
139
        //    Node::setShadowMode ( shadow_state );
140
        //}
141
142
        SCENE_VIEWER_ACCEPT_VISITOR;
143
144
        /** Destructor */
145
        virtual ~LeafNodeGround();
146
    };
147
} /* namespace viewer */
148
} /* namespace gepetto */
149
150
#endif /* GEPETTO_VIEWER_LEAFNODEGROUND_HH */