Choreonoid  1.8
SceneItem.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_SCENE_ITEM_H
6 #define CNOID_BASE_SCENE_ITEM_H
7 
8 #include "Item.h"
9 #include "RenderableItem.h"
10 #include <cnoid/SceneGraph>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 class ItemManager;
16 class ItemFileIO;
17 
18 class CNOID_EXPORT SceneItem : public Item, public RenderableItem
19 {
20 public:
21  static void initializeClass(ExtensionManager* ext);
22 
23  // The following functions are implemented in SceneItemFileIO.cpp
24  static void registerSceneItemFileIoSet(ItemManager* im);
25  static ItemFileIO* stdSceneFileExporter();
26 
27  SceneItem();
28  SceneItem(const SceneItem& org);
29  virtual ~SceneItem();
30 
31  virtual bool setName(const std::string& name) override;
32 
33  // RenderableItem
34  virtual SgNode* getScene() override;
35 
36  SgPosTransform* topNode() { return topNode_; }
37  const SgPosTransform* topNode() const { return topNode_; }
38 
39  void setTranslation(const Vector3& translation);
40  void setRotation(const AngleAxis& rotation);
41 
42  [[deprecated("Use setTranslation(const Vector3& translation)")]]
43  void setTranslation(const Vector3f& translation);
44  [[deprecated("Use void setRotation(const AngleAxis& rotation)")]]
45  void setRotation(const AngleAxisf& rotation);
46 
47  void setLightweightRenderingEnabled(bool on);
48  bool isLightweightRenderingEnabled() const { return isLightweightRenderingEnabled_; }
49 
50 protected:
51  virtual Item* doDuplicate() const override;
52  virtual bool store(Archive& archive) override;
53  virtual bool restore(const Archive& archive) override;
54  virtual void doPutProperties(PutPropertyFunction& putProperty) override;
55 
56 private:
57  SgPosTransformPtr topNode_;
58  bool isLightweightRenderingEnabled_;
59 
60  bool onTranslationChanged(const std::string& value);
61  bool onRotationChanged(const std::string& value);
62 };
63 
65 
66 }
67 
68 #endif
cnoid::ItemFileIO
Definition: ItemFileIO.h:19
cnoid::SceneItem::topNode
const SgPosTransform * topNode() const
Definition: SceneItem.h:37
cnoid::SgPosTransform
Definition: SceneGraph.h:357
Item.h
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::PutPropertyFunction
Definition: PutPropertyFunction.h:51
cnoid::SceneItemPtr
ref_ptr< SceneItem > SceneItemPtr
Definition: SceneItem.h:64
cnoid::Archive
Definition: Archive.h:22
cnoid::AngleAxis
Eigen::AngleAxisd AngleAxis
Definition: EigenTypes.h:64
cnoid::ref_ptr< SgPosTransform >
cnoid::SceneItem::topNode
SgPosTransform * topNode()
Definition: SceneItem.h:36
RenderableItem.h
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Item
Definition: Item.h:29
cnoid::RenderableItem
Definition: RenderableItem.h:11
cnoid::SceneItem::isLightweightRenderingEnabled
bool isLightweightRenderingEnabled() const
Definition: SceneItem.h:48
cnoid::ItemManager
Definition: ItemManager.h:59
cnoid::SgNode
Definition: SceneGraph.h:157
cnoid::SceneItem
Definition: SceneItem.h:18