Choreonoid  1.8
MarkerDevice.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_MARKER_DEVICE_H
7 #define CNOID_BODY_MARKER_DEVICE_H
8 
9 #include <cnoid/Device>
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class StdBodyLoader;
15 class Mapping;
16 
17 class CNOID_EXPORT MarkerDevice : public Device
18 {
19 public:
20  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
21 
22  MarkerDevice();
23  MarkerDevice(const MarkerDevice& org, bool copyStateOnly = false);
24 
25  virtual const char* typeName() const override;
26  void copyMarkerDeviceStateFrom(const MarkerDevice& other);
27  virtual void copyStateFrom(const DeviceState& other) override;
28  virtual DeviceState* cloneState() const override;
29  virtual void forEachActualType(std::function<bool(const std::type_info& type)> func) override;
30  virtual int stateSize() const override;
31  virtual const double* readState(const double* buf) override;
32  virtual double* writeState(double* out_buf) const override;
33 
34  bool readSpecifications(const Mapping* node);
35  bool writeSpecifications(Mapping* node) const;
36 
37  virtual bool on() const override;
38  virtual void on(bool on) override;
39 
40  enum MarkerType {
44  N_MARKER_TYPES
45  };
46 
47  int markerType() const { return markerType_; }
48  void setMarkerType(int type){ markerType_ = type; }
49 
50  double markerSize() const { return markerSize_; }
51  void setMarkerSize(double size) { markerSize_ = size; }
52 
53  const Vector3f& color() const { return color_; }
54  void setColor(const Vector3f& c) { color_ = c; }
55  float emission() const { return emission_; }
56  void setEmission(float r) { emission_ = r; }
57  float transparency() const { return transparency_; }
58  void setTransparency(float t) { transparency_ = t; }
59 
60  const Isometry3& offsetPosition() const { return offsetPosition_; }
61  void setOffsetPosition(const Isometry3& T) { offsetPosition_ = T; }
62  void setOffsetTranslation(const Vector3& p) { offsetPosition_.translation() = p; }
63 
64 protected:
65  virtual Referenced* doClone(CloneMap* cloneMap) const override;
66 
67 private:
68  bool on_;
69  int markerType_;
70  Isometry3 offsetPosition_;
71  Vector3f color_;
72  float markerSize_;
73  float emission_;
74  float transparency_;
75 };
76 
78 
79 }
80 
81 #endif
cnoid::MarkerDevice::setEmission
void setEmission(float r)
Definition: MarkerDevice.h:56
cnoid::Mapping
Definition: ValueTree.h:253
cnoid::MarkerDevice::transparency
float transparency() const
Definition: MarkerDevice.h:57
cnoid::MarkerDevice::color
const Vector3f & color() const
Definition: MarkerDevice.h:53
cnoid::MarkerDevice::markerType
int markerType() const
Definition: MarkerDevice.h:47
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::MarkerDevice
Definition: MarkerDevice.h:17
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::MarkerDevice::offsetPosition
const Isometry3 & offsetPosition() const
Definition: MarkerDevice.h:60
cnoid::MarkerDevice::markerSize
double markerSize() const
Definition: MarkerDevice.h:50
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::MarkerDevice::setMarkerSize
void setMarkerSize(double size)
Definition: MarkerDevice.h:51
cnoid::MarkerDevice::setColor
void setColor(const Vector3f &c)
Definition: MarkerDevice.h:54
cnoid::MarkerDevice::CROSS_MARKER
@ CROSS_MARKER
Definition: MarkerDevice.h:41
cnoid::MarkerDevice::MarkerType
MarkerType
Definition: MarkerDevice.h:40
cnoid::MarkerDevice::setOffsetTranslation
void setOffsetTranslation(const Vector3 &p)
Definition: MarkerDevice.h:62
cnoid::MarkerDevicePtr
ref_ptr< MarkerDevice > MarkerDevicePtr
Definition: MarkerDevice.h:77
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::CloneMap
Definition: CloneMap.h:13
cnoid::DeviceState
Definition: Device.h:20
cnoid::MarkerDevice::setTransparency
void setTransparency(float t)
Definition: MarkerDevice.h:58
cnoid::MarkerDevice::AXES_MARKER
@ AXES_MARKER
Definition: MarkerDevice.h:43
cnoid::MarkerDevice::emission
float emission() const
Definition: MarkerDevice.h:55
cnoid::Referenced
Definition: Referenced.h:54
cnoid::Device
Definition: Device.h:53
cnoid::MarkerDevice::SPHERE_MARKER
@ SPHERE_MARKER
Definition: MarkerDevice.h:42
cnoid::MarkerDevice::setOffsetPosition
void setOffsetPosition(const Isometry3 &T)
Definition: MarkerDevice.h:61
cnoid::MarkerDevice::setMarkerType
void setMarkerType(int type)
Definition: MarkerDevice.h:48