Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// leaf-node-cylinder.h |
3 |
|
|
// gepetto-viewer |
4 |
|
|
// |
5 |
|
|
// Created by Justin Carpentier, Mathieu Geisert November 2014. |
6 |
|
|
// Copyright (c) 2014 LAAS-CNRS. All rights reserved. |
7 |
|
|
// |
8 |
|
|
|
9 |
|
|
#ifndef GEPETTO_VIEWER_LEAFNODECYLINDER_HH |
10 |
|
|
#define GEPETTO_VIEWER_LEAFNODECYLINDER_HH |
11 |
|
|
|
12 |
|
|
#include <gepetto/viewer/node-drawable.h> |
13 |
|
|
|
14 |
|
|
namespace gepetto { |
15 |
|
|
namespace viewer { |
16 |
|
|
DEF_CLASS_SMART_PTR(LeafNodeCylinder) |
17 |
|
|
|
18 |
|
|
/** Implementation of the Cylinder GraphicalObject in OSG render */ |
19 |
|
|
class LeafNodeCylinder : public NodeDrawable { |
20 |
|
|
private: |
21 |
|
|
/** Associated weak pointer */ |
22 |
|
|
LeafNodeCylinderWeakPtr weak_ptr_; |
23 |
|
|
|
24 |
|
|
/** Associated Cylinder Shape */ |
25 |
|
|
::osg::CylinderRefPtr cylinder_ptr_; |
26 |
|
|
|
27 |
|
|
void init(); |
28 |
|
|
|
29 |
|
|
/* Default constructor */ |
30 |
|
|
LeafNodeCylinder(const std::string &name, const float &radius, |
31 |
|
|
const float &height); |
32 |
|
|
LeafNodeCylinder(const std::string &name, const float &radius, |
33 |
|
|
const float &height, const osgVector4 &color); |
34 |
|
|
|
35 |
|
|
/* Copy constructor */ |
36 |
|
|
LeafNodeCylinder(const LeafNodeCylinder &other); |
37 |
|
|
|
38 |
|
|
/** Initialize weak_ptr */ |
39 |
|
|
void initWeakPtr(LeafNodeCylinderWeakPtr 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 LeafNodeCylinderPtr_t create(const std::string &name, |
46 |
|
|
const float &radius, const float &height); |
47 |
|
|
static LeafNodeCylinderPtr_t create(const std::string &name, |
48 |
|
|
const float &radius, const float &height, |
49 |
|
|
const osgVector4 &color); |
50 |
|
|
|
51 |
|
|
/** Static method for creating a clone of box other with the copy constructor |
52 |
|
|
*/ |
53 |
|
|
static LeafNodeCylinderPtr_t createCopy(LeafNodeCylinderPtr_t other); |
54 |
|
|
|
55 |
|
|
/** Proceed to a clonage of the current object defined by the copy constructor |
56 |
|
|
*/ |
57 |
|
|
virtual LeafNodeCylinderPtr_t clone(void) const; |
58 |
|
|
|
59 |
|
|
/** Copy |
60 |
|
|
\brief Proceed to a copy of the currend object as clone |
61 |
|
|
*/ |
62 |
|
✗ |
virtual NodePtr_t copy() const { return clone(); } |
63 |
|
|
|
64 |
|
|
/** Return a shared pointer of the current object |
65 |
|
|
*/ |
66 |
|
|
LeafNodeCylinderPtr_t self(void) const; |
67 |
|
|
|
68 |
|
|
/** Fix the new radius of the cylinder |
69 |
|
|
* Note : radius must be positive scalar |
70 |
|
|
*/ |
71 |
|
|
void setRadius(const float &radius); |
72 |
|
|
|
73 |
|
✗ |
float getRadius() const { return cylinder_ptr_->getRadius(); } |
74 |
|
|
|
75 |
|
|
/** Fix the new jeight of the cylinder |
76 |
|
|
* Note : radius must be positive scalar |
77 |
|
|
*/ |
78 |
|
|
void setHeight(const float &height); |
79 |
|
|
|
80 |
|
✗ |
float getHeight() const { return cylinder_ptr_->getHeight(); } |
81 |
|
|
|
82 |
|
✗ |
SCENE_VIEWER_ACCEPT_VISITOR; |
83 |
|
|
|
84 |
|
|
/** Destructor */ |
85 |
|
|
virtual ~LeafNodeCylinder(); |
86 |
|
|
}; |
87 |
|
|
} /* namespace viewer */ |
88 |
|
|
} /* namespace gepetto */ |
89 |
|
|
|
90 |
|
|
#endif /* GEPETTO_VIEWER_LEAFNODECYLINDER_HH */ |
91 |
|
|
|