Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// leaf-node-xyzaxis.h |
3 |
|
|
// gepetto-viewer |
4 |
|
|
// |
5 |
|
|
// Created by Justin Carpentier, Mathieu Geisert, Pierre Fernbach in avril |
6 |
|
|
// 2015. Copyright (c) 2014 LAAS-CNRS. All rights reserved |
7 |
|
|
// |
8 |
|
|
|
9 |
|
|
#ifndef GEPETTO_VIEWER_LEAFNODEXYZ_HH |
10 |
|
|
#define GEPETTO_VIEWER_LEAFNODEXYZ_HH |
11 |
|
|
|
12 |
|
|
#include <gepetto/viewer/node-drawable.h> |
13 |
|
|
|
14 |
|
|
#include <osgDB/ReadFile> |
15 |
|
|
|
16 |
|
|
namespace gepetto { |
17 |
|
|
namespace viewer { |
18 |
|
|
|
19 |
|
|
DEF_CLASS_SMART_PTR(LeafNodeXYZAxis) |
20 |
|
|
|
21 |
|
|
/** Implementation of the XYZAxis GraphicalObject in OSG render */ |
22 |
|
|
class LeafNodeXYZAxis : public NodeDrawable { |
23 |
|
|
private: |
24 |
|
|
/** Associated weak pointer */ |
25 |
|
|
LeafNodeXYZAxisWeakPtr weak_ptr_; |
26 |
|
|
|
27 |
|
|
/** Sphere component */ |
28 |
|
|
float radius_; |
29 |
|
|
::osg::SphereRefPtr sphere_ptr_; |
30 |
|
|
|
31 |
|
|
/** axis components : */ |
32 |
|
|
float sizeAxis_; |
33 |
|
|
/** Associated Geometry (drawable objects)*/ |
34 |
|
|
::osg::Vec4ArrayRefPtr color_ptr_; |
35 |
|
|
|
36 |
|
|
void init(); |
37 |
|
|
|
38 |
|
|
/* Default constructor */ |
39 |
|
|
LeafNodeXYZAxis(const std::string& name, const osgVector4& color, |
40 |
|
|
float radiusCenter, float sizeAxis); |
41 |
|
|
|
42 |
|
|
/* Copy constructor */ |
43 |
|
|
LeafNodeXYZAxis(const LeafNodeXYZAxis& other); |
44 |
|
|
|
45 |
|
|
/** Initialize weak_ptr */ |
46 |
|
|
void initWeakPtr(LeafNodeXYZAxisWeakPtr other_weak_ptr); |
47 |
|
|
|
48 |
|
|
protected: |
49 |
|
|
public: |
50 |
|
|
void addVertex(const osgVector3& vertex); |
51 |
|
|
/** Static method which create a new XYZ axis defined by the radius of the |
52 |
|
|
* sphere (center) and size of the axis (0 by default) |
53 |
|
|
*/ |
54 |
|
|
static LeafNodeXYZAxisPtr_t create(const std::string& name, |
55 |
|
|
const osgVector4& color, |
56 |
|
|
float radiusCenter, float sizeAxis); |
57 |
|
|
static LeafNodeXYZAxisPtr_t create(const std::string& name, |
58 |
|
|
const osgVector4& color, |
59 |
|
|
float radiusCenter); |
60 |
|
|
|
61 |
|
|
/** Static method for creating a clone of box other with the copy constructor |
62 |
|
|
*/ |
63 |
|
|
static LeafNodeXYZAxisPtr_t createCopy(LeafNodeXYZAxisPtr_t other); |
64 |
|
|
|
65 |
|
|
/** Proceed to a clonage of the current object defined by the copy constructor |
66 |
|
|
*/ |
67 |
|
|
virtual LeafNodeXYZAxisPtr_t clone(void) const; |
68 |
|
|
|
69 |
|
|
/** Copy |
70 |
|
|
\brief Proceed to a copy of the currend object as clone |
71 |
|
|
*/ |
72 |
|
✗ |
virtual NodePtr_t copy() const { return clone(); } |
73 |
|
|
|
74 |
|
|
/** Return a shared pointer of the current object |
75 |
|
|
*/ |
76 |
|
|
LeafNodeXYZAxisPtr_t self(void) const; |
77 |
|
|
|
78 |
|
|
// set color |
79 |
|
|
float getRadius() const; |
80 |
|
|
void setRadius(const float& radius); |
81 |
|
|
void setSizeAxis(const float& sizeAxis); |
82 |
|
|
float getSizeAxis() const; |
83 |
|
|
|
84 |
|
✗ |
SCENE_VIEWER_ACCEPT_VISITOR; |
85 |
|
|
|
86 |
|
|
/** Destructor */ |
87 |
|
|
virtual ~LeafNodeXYZAxis(); |
88 |
|
|
}; |
89 |
|
|
} /* namespace viewer */ |
90 |
|
|
} /* namespace gepetto */ |
91 |
|
|
|
92 |
|
|
#endif /* GEPETTO_VIEWER_LEAFNODEXYZAXIS_HH */ |
93 |
|
|
|