GCC Code Coverage Report


Directory: ./
File: include/gepetto/viewer/leaf-node-ground.h
Date: 2024-08-14 11:04:57
Exec Total Coverage
Lines: 0 3 0.0%
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 private:
20 RangedStoredPropertyTpl<float, float> square_size_x_;
21 RangedStoredPropertyTpl<float, float> square_size_y_;
22 RangedStoredPropertyTpl<int, int> nX_;
23 RangedStoredPropertyTpl<int, int> nY_;
24
25 osgVector4 color1_;
26 osgVector4 color2_;
27
28 /** Associated weak pointer */
29 LeafNodeGroundWeakPtr weak_ptr_;
30
31 /** Array of colors */
32 ::osg::Vec3ArrayRefPtr vertices_array_ptr_;
33 ::osg::Vec4ArrayRefPtr colors_array_ptr_;
34
35 /** Associated Geometry for LeafNodeGround */
36 ::osg::GeometryRefPtr grid_geometry_ptr_;
37 ::osg::ref_ptr< ::osg::DrawArrays> draw_array_ptr_;
38
39 /** Init method */
40 void init();
41
42 void updateVertices();
43
44 /** Constructor
45 \brief Constructor with all useful parameters
46 \param length : length of demi-axis
47 \param width : width of demi-axis
48 \param square_length : length of a basic square
49 \param square_width : width of a basic square
50 */
51 LeafNodeGround(const std::string& name, int nX, int nY, float square_length,
52 float square_width, const osgVector4& color1,
53 const osgVector4& color2);
54
55 /** Initialize weak_ptr */
56 void initWeakPtr(const LeafNodeGroundWeakPtr& other_weak_ptr);
57
58 protected:
59 public:
60 /** Builder
61 \brief Constructor with all useful parameters
62 \param length : length of demi-axis
63 \param width : width of demi-axis
64 \param square_length : length of a basic square
65 \param square_width : width of a basic square
66 \param configuration_ptr : configuration of plane
67 */
68 static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY,
69 float square_length, float square_width);
70
71 static LeafNodeGroundPtr_t create(const std::string& name, int nX, int nY,
72 float square_length, float square_width,
73 const osgVector4& color1,
74 const osgVector4& color2);
75
76 static LeafNodeGroundPtr_t create(const std::string& name);
77
78 /**
79 \brief Returns a shared pointer of the object itself.
80 */
81 LeafNodeGroundPtr_t self(void) const;
82
83 /**
84 * \sa setColor1
85 */
86 void setColor(const osgVector4& color);
87
88 /** inline virtual void setColor1(const ColotSharedPtr &color1_ptr)
89 \brief Allow to define color1
90 \param color1_ptr : color to apply to first color
91 */
92 virtual void setColor1(const osgVector4& color1);
93
94 const osgVector4& getColor1() const { return color1_; }
95
96 /** inline virtual void setColor2(const ColotSharedPtr &color2_ptr)
97 \brief Allow to define color2
98 \param color2_ptr : color to apply to second color
99 */
100 virtual void setColor2(const osgVector4& color2);
101
102 const osgVector4& getColor2() const { return color2_; }
103 /** virtual void setColors(const ColorSharedPtr &color1_ptr , const
104 ColorSharedPtr &color2_ptr); \brief Allow to define both colors \param
105 color1_ptr : color to apply to first color \param color2_ptr : color to apply
106 to second color
107 */
108 virtual void setColors(const osgVector4& color1, const osgVector4& color2);
109
110 /**
111 \brief Virtual method for setting the shadow mode of the object : receive,
112 cast, both or no shadow \param shadow_state state
113 */
114 // virtual void setShadowMode (const ShadowMode& shadow_state) {
115 // Node::setShadowMode ( shadow_state );
116 // }
117
118 SCENE_VIEWER_ACCEPT_VISITOR;
119
120 /** Destructor */
121 virtual ~LeafNodeGround();
122 };
123 } /* namespace viewer */
124 } /* namespace gepetto */
125
126 #endif /* GEPETTO_VIEWER_LEAFNODEGROUND_HH */
127