GCC Code Coverage Report


Directory: ./
File: include/gepetto/viewer/leaf-node-arrow.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-arrow.h
3 // gepetto-viewer
4 //
5 // Created by Pierre Fernbach in june 2015.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved
7 //
8
9 #ifndef GEPETTO_VIEWER_LEAFNODEARROW_HH
10 #define GEPETTO_VIEWER_LEAFNODEARROW_HH
11
12 #include <gepetto/viewer/node-drawable.h>
13
14 namespace gepetto {
15 namespace viewer {
16
17 DEF_CLASS_SMART_PTR(LeafNodeArrow)
18
19 /** Implementation of the XYZAxis GraphicalObject in OSG render */
20 class LeafNodeArrow : public NodeDrawable {
21 private:
22 /** Associated weak pointer */
23 LeafNodeArrowWeakPtr weak_ptr_;
24
25 /** Sphere component */
26 float radius_;
27 /** axis components : */
28 float size_;
29 ::osg::ShapeDrawableRefPtr cylinder_drawable_;
30 ::osg::ShapeDrawableRefPtr cone_drawable_;
31
32 osgVector4 color_;
33
34 void init();
35
36 void resetGeodeContent();
37
38 /* Default constructor */
39 LeafNodeArrow(const std::string& name, const osgVector4& color,
40 float radiusCenter, float sizeAxis);
41
42 /* Copy constructor */
43 LeafNodeArrow(const LeafNodeArrow& other);
44
45 /** Initialize weak_ptr */
46 void initWeakPtr(LeafNodeArrowWeakPtr other_weak_ptr);
47
48 protected:
49 public:
50 void addVertex(const osgVector3& vertex);
51 /** Static method which create a new arrow defined by the radius and length of
52 * the arrow. See \ref getSize and \ref getRadius
53 */
54 static LeafNodeArrowPtr_t create(const std::string& name,
55 const osgVector4& color, float radiusCenter,
56 float sizeAxis);
57 /** Static method which create a new arrow without cylindrical base.
58 */
59 static LeafNodeArrowPtr_t create(const std::string& name,
60 const osgVector4& color, float radiusCenter);
61
62 /** Static method for creating a clone of box other with the copy constructor
63 */
64 static LeafNodeArrowPtr_t createCopy(LeafNodeArrowPtr_t other);
65
66 /** Proceed to a clonage of the current object defined by the copy constructor
67 */
68 virtual LeafNodeArrowPtr_t clone(void) const;
69
70 /** Copy
71 \brief Proceed to a copy of the currend object as clone
72 */
73 virtual NodePtr_t copy() const { return clone(); }
74
75 /** Return a shared pointer of the current object
76 */
77 LeafNodeArrowPtr_t self(void) const;
78
79 // set color
80 void setColor(const osgVector4& color);
81 osgVector4 getColor() const { return color_; }
82 /// Get the radius of the arrow.
83 /// It is the cylinder radius. The cone base radius is twice larger.
84 float getRadius() const;
85 void setRadius(const float& radius);
86 void setSize(const float& size);
87 /// Get the length of the arrow.
88 /// It is the sum of the cylinder and cone length.
89 float getSize() const;
90 void resize(float radius, float length);
91
92 SCENE_VIEWER_ACCEPT_VISITOR;
93
94 /** Destructor */
95 virtual ~LeafNodeArrow();
96 };
97 } /* namespace viewer */
98 } /* namespace gepetto */
99
100 #endif /* GEPETTO_VIEWER_LeafNodeArrow_HH */
101