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 |
|
|
private: |
23 |
|
|
/** Associated weak pointer */ |
24 |
|
|
LeafNodeCapsuleWeakPtr weak_ptr_; |
25 |
|
|
/** Associated Capsule Shape */ |
26 |
|
|
::osg::CapsuleRefPtr capsule_ptr_; |
27 |
|
|
|
28 |
|
|
void init(); |
29 |
|
|
|
30 |
|
|
/* Default constructor */ |
31 |
|
|
LeafNodeCapsule(const std::string& name, const float& radius, |
32 |
|
|
const float& height); |
33 |
|
|
LeafNodeCapsule(const std::string& name, const float& radius, |
34 |
|
|
const float& height, const osgVector4& color); |
35 |
|
|
|
36 |
|
|
/* Copy constructor */ |
37 |
|
|
LeafNodeCapsule(const LeafNodeCapsule& other); |
38 |
|
|
|
39 |
|
|
/** Initialize weak_ptr */ |
40 |
|
|
void initWeakPtr(LeafNodeCapsuleWeakPtr other_weak_ptr); |
41 |
|
|
|
42 |
|
|
protected: |
43 |
|
|
public: |
44 |
|
|
/** Static method which create a new box defined by the half_axis vector |
45 |
|
|
*/ |
46 |
|
|
static LeafNodeCapsulePtr_t create(const std::string& name, |
47 |
|
|
const float& radius, const float& height); |
48 |
|
|
static LeafNodeCapsulePtr_t create(const std::string& name, |
49 |
|
|
const float& radius, const float& height, |
50 |
|
|
const osgVector4& color); |
51 |
|
|
|
52 |
|
|
/** Static method for creating a clone of box other with the copy constructor |
53 |
|
|
*/ |
54 |
|
|
static LeafNodeCapsulePtr_t createCopy(const LeafNodeCapsulePtr_t& other); |
55 |
|
|
|
56 |
|
|
/** Proceed to a clonage of the current object defined by the copy constructor |
57 |
|
|
*/ |
58 |
|
|
virtual LeafNodeCapsulePtr_t clone(void) const; |
59 |
|
|
|
60 |
|
|
/** Copy |
61 |
|
|
\brief Proceed to a copy of the currend object as clone |
62 |
|
|
*/ |
63 |
|
✗ |
virtual LeafNodeCapsulePtr_t copy() const { return clone(); } |
64 |
|
|
|
65 |
|
|
/** Return a shared pointer of the current object |
66 |
|
|
*/ |
67 |
|
|
LeafNodeCapsulePtr_t self(void) const; |
68 |
|
|
|
69 |
|
|
/** Fix the new radius of the capsule |
70 |
|
|
* \note radius must be positive scalar |
71 |
|
|
*/ |
72 |
|
|
virtual void setRadius(const float& radius); |
73 |
|
|
|
74 |
|
✗ |
float getRadius() const { return capsule_ptr_->getRadius(); } |
75 |
|
|
|
76 |
|
|
/** Fix the new height of the capsule |
77 |
|
|
* \note height must be positive scalar |
78 |
|
|
*/ |
79 |
|
|
virtual void setHeight(const float& height); |
80 |
|
✗ |
float getHeight() const { return capsule_ptr_->getHeight(); } |
81 |
|
|
|
82 |
|
✗ |
SCENE_VIEWER_ACCEPT_VISITOR; |
83 |
|
|
|
84 |
|
|
/** Destructor */ |
85 |
|
|
virtual ~LeafNodeCapsule(); |
86 |
|
|
}; |
87 |
|
|
} /* namespace viewer */ |
88 |
|
|
} /* namespace gepetto */ |
89 |
|
|
|
90 |
|
|
#endif /* GEPETTO_VIEWER_LEAFNODECAPSULE_HH */ |
91 |
|
|
|