GCC Code Coverage Report


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

Line Branch Exec Source
1 //
2 // leaf-node-sphere.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_LEAFNODESPHERE_HH
10 #define GEPETTO_VIEWER_LEAFNODESPHERE_HH
11
12 #include <gepetto/viewer/node-drawable.h>
13
14 namespace gepetto {
15 namespace viewer {
16 DEF_CLASS_SMART_PTR(LeafNodeSphere)
17
18 /** Implementation of the Sphere GraphicalObject in OSG render */
19 class LeafNodeSphere : public NodeDrawable {
20 private:
21 /** Associated weak pointer */
22 LeafNodeSphereWeakPtr weak_ptr_;
23
24 /** Associated Sphere Shape */
25 ::osg::SphereRefPtr sphere_ptr_;
26
27 void init();
28
29 protected:
30 /* Default constructor */
31 LeafNodeSphere(const std::string& name, const float& radius);
32 LeafNodeSphere(const std::string& name, const float& radius,
33 const osgVector4& color);
34
35 /* Copy constructor */
36 LeafNodeSphere(const std::string& name, const LeafNodeSphere& other);
37
38 /** Initialize weak_ptr */
39 void initWeakPtr(LeafNodeSphereWeakPtr other_weak_ptr);
40
41 public:
42 /** Static method which create a new box defined by the half_axis vector
43 */
44 static LeafNodeSpherePtr_t create(const std::string& name,
45 const float& radius);
46 static LeafNodeSpherePtr_t create(const std::string& name,
47 const float& radius,
48 const osgVector4& color);
49
50 /** Static method for creating a clone of sphere other with the copy
51 * constructor
52 */
53 static LeafNodeSpherePtr_t createCopy(LeafNodeSpherePtr_t other);
54
55 /** Proceed to a clonage of the current object defined by the copy constructor
56 */
57 LeafNodeSpherePtr_t clone(void) const;
58
59 /** Copy
60 \brief Proceed to a copy of the currend object as clone
61 */
62 LeafNodeSpherePtr_t copy() const { return clone(); }
63
64 /** Return a shared pointer of the current object
65 */
66 LeafNodeSpherePtr_t self(void) const;
67
68 /** Fix the new radius of the sphere
69 * Note : radius must be positive vector
70 */
71 void setRadius(const float& radius);
72 float getRadius() const { return sphere_ptr_->getRadius(); }
73
74 SCENE_VIEWER_ACCEPT_VISITOR;
75
76 /** Destructor */
77 virtual ~LeafNodeSphere();
78 };
79 } /* namespace viewer */
80 } /* namespace gepetto */
81
82 #endif /* GEPETTO_VIEWER_LEAFNODESPHERE_HH */
83