Choreonoid  1.8
SceneMarkers.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_UTIL_SCENE_MARKERS_H
7 #define CNOID_UTIL_SCENE_MARKERS_H
8 
9 #include "SceneDrawables.h"
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class CNOID_EXPORT SceneMarker : public SgPosTransform
15 {
16 public:
17  SceneMarker();
18 
19  enum MarkerType {
24  N_MARKER_TYPES
25  };
26 
27  int markerType() const { return markerType_; }
28  void setMarkerType(int type){ markerType_ = type; }
29  double markerSize() const { return markerSize_; }
30  void setMarkerSize(double size){ markerSize_ = size; }
31  void updateMarker(bool doNotify = false);
32 
33  const Vector3f& color() const;
34  void setColor(const Vector3f& c);
35  float emission() const;
36  void setEmission(float r);
37  double transparency() const;
38  void setTransparency(float t);
39 
40 private:
41  int markerType_;
42  float markerSize_;
43  SgMaterialPtr material;
44  float emission_;
45 
46  void setCross();
47  void setSphere();
48  void setAxes();
49 };
50 
52 
53 
54 class CNOID_EXPORT CrossMarker : public SgPosTransform
55 {
56 public:
57  CrossMarker(double size, const Vector3f& color, double lineWidth = 1.0);
58  void setSize(double size);
59 
60 private:
61  SgVertexArrayPtr vertices;
62  double size_;
63 };
64 
66 
67 
68 class CNOID_EXPORT SphereMarker : public SgPosTransform
69 {
70 public:
71  SphereMarker();
72  SphereMarker(double radius, const Vector3f& color, float transparency = 0.0);
73  void setRadius(double r);
74  void setColor(const Vector3f& c);
75 private:
76  void initialize(double radius, const Vector3f& color, float transparency);
77  SgScaleTransformPtr scale;
78  SgMaterialPtr material;
79 };
80 
82 
83 
84 class CNOID_EXPORT BoundingBoxMarker : public SgGroup
85 {
86 public:
87  BoundingBoxMarker(const BoundingBox& bbox, const Vector3f& color, float transparency, double width);
88  BoundingBoxMarker(const BoundingBox& bbox, const Vector3f& color, float transparency);
89 
90 private:
91  void create(const BoundingBox& bbox, const Vector3f& color, float transparency, double width);
92  void addMarker(SgShape* shape, double x, double y, double z);
93 };
94 
96 
97 }
98 
99 #endif
cnoid::SceneMarker::CROSS_MARKER
@ CROSS_MARKER
Definition: SceneMarkers.h:21
cnoid::BoundingBoxMarkerPtr
ref_ptr< BoundingBoxMarker > BoundingBoxMarkerPtr
Definition: SceneMarkers.h:95
cnoid::SgPosTransform
Definition: SceneGraph.h:357
cnoid::BoundingBoxMarker
Definition: SceneMarkers.h:84
SceneDrawables.h
cnoid::SphereMarkerPtr
ref_ptr< SphereMarker > SphereMarkerPtr
Definition: SceneMarkers.h:81
cnoid::SgGroup
Definition: SceneGraph.h:220
cnoid::SceneMarker::SPHERE_MARKER
@ SPHERE_MARKER
Definition: SceneMarkers.h:22
cnoid::SceneMarker
Definition: SceneMarkers.h:14
cnoid::SceneMarker::NO_MARKER
@ NO_MARKER
Definition: SceneMarkers.h:20
cnoid::CrossMarker
Definition: SceneMarkers.h:54
cnoid::ref_ptr< SgMaterial >
cnoid::SceneMarker::markerSize
double markerSize() const
Definition: SceneMarkers.h:29
cnoid::SceneMarker::setMarkerSize
void setMarkerSize(double size)
Definition: SceneMarkers.h:30
cnoid::SceneMarker::setMarkerType
void setMarkerType(int type)
Definition: SceneMarkers.h:28
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::SceneMarkerPtr
ref_ptr< SceneMarker > SceneMarkerPtr
Definition: SceneMarkers.h:51
cnoid::SceneMarker::markerType
int markerType() const
Definition: SceneMarkers.h:27
cnoid::SgShape
Definition: SceneDrawables.h:530
cnoid::SceneMarker::AXES_MARKER
@ AXES_MARKER
Definition: SceneMarkers.h:23
cnoid::CrossMarkerPtr
ref_ptr< CrossMarker > CrossMarkerPtr
Definition: SceneMarkers.h:65
cnoid::BoundingBox
Definition: BoundingBox.h:17
cnoid::SphereMarker
Definition: SceneMarkers.h:68
cnoid::SceneMarker::MarkerType
MarkerType
Definition: SceneMarkers.h:19