GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/gepetto/viewer/leaf-node-capsule.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-capsule.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_LEAFNODECAPSULE_HH
10
#define GEPETTO_VIEWER_LEAFNODECAPSULE_HH
11
12
#include <gepetto/viewer/node-drawable.h>
13
14
namespace gepetto {
15
namespace viewer {
16
    DEF_CLASS_SMART_PTR(LeafNodeCapsule)
17
18
    /** Implementation of the Capsule GraphicalObject in OSG render
19
     * The capsule height is along Z.
20
     * */
21
    class LeafNodeCapsule : public NodeDrawable
22
    {
23
    private:
24
        /** Associated weak pointer */
25
        LeafNodeCapsuleWeakPtr weak_ptr_;
26
        /** Associated Capsule Shape */
27
        ::osg::CapsuleRefPtr capsule_ptr_;
28
29
        void init();
30
31
        /* Default constructor */
32
        LeafNodeCapsule(const std::string& name, const float& radius, const float& height);
33
        LeafNodeCapsule(const std::string& name, const float& radius, const float& height, const osgVector4& color);
34
35
        /* Copy constructor */
36
        LeafNodeCapsule(const LeafNodeCapsule& other);
37
38
        /** Initialize weak_ptr */
39
        void initWeakPtr (LeafNodeCapsuleWeakPtr other_weak_ptr);
40
41
    protected:
42
    public:
43
        /** Static method which create a new box defined by the half_axis vector
44
         */
45
        static LeafNodeCapsulePtr_t create(const std::string& name, const float &radius, const float& height);
46
        static LeafNodeCapsulePtr_t create(const std::string& name, const float &radius, const float& height, const osgVector4& color);
47
48
        /** Static method for creating a clone of box other with the copy constructor
49
         */
50
        static LeafNodeCapsulePtr_t createCopy(const LeafNodeCapsulePtr_t& other);
51
52
        /** Proceed to a clonage of the current object defined by the copy constructor
53
         */
54
        virtual LeafNodeCapsulePtr_t clone(void) const;
55
56
        /** Copy
57
         \brief Proceed to a copy of the currend object as clone
58
         */
59
        virtual LeafNodeCapsulePtr_t copy() const { return clone(); }
60
61
        /** Return a shared pointer of the current object
62
         */
63
        LeafNodeCapsulePtr_t self(void) const;
64
65
66
        /** Fix the new radius of the capsule
67
         *  \note radius must be positive scalar
68
         */
69
        virtual void setRadius (const float& radius);
70
71
        float getRadius() const
72
        {
73
            return capsule_ptr_->getRadius();
74
        }
75
76
77
78
        /** Fix the new height of the capsule
79
         *  \note height must be positive scalar
80
         */
81
        virtual void setHeight (const float& height);
82
        float getHeight() const
83
        {
84
            return capsule_ptr_->getHeight();
85
        }
86
87
        SCENE_VIEWER_ACCEPT_VISITOR;
88
89
        /** Destructor */
90
        virtual ~LeafNodeCapsule();
91
    };
92
} /* namespace viewer */
93
} /* namespace gepetto */
94
95
#endif /* GEPETTO_VIEWER_LEAFNODECAPSULE_HH */