Choreonoid  1.8
WorldItem.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODY_PLUGIN_WORLD_ITEM_H
7 #define CNOID_BODY_PLUGIN_WORLD_ITEM_H
8 
9 #include "BodyItem.h"
10 #include <cnoid/Item>
11 #include <cnoid/ItemList>
12 #include <cnoid/RenderableItem>
13 #include "exportdecl.h"
14 
15 namespace cnoid {
16 
17 class CollisionDetector;
18 class MaterialTable;
19 class MaterialTableItem;
20 
21 class CNOID_EXPORT WorldItem : public Item, public RenderableItem
22 {
23 public:
24  static void initializeClass(ExtensionManager* ext);
25 
26  WorldItem();
27  WorldItem(const WorldItem& org);
28  virtual ~WorldItem();
29 
30  void storeCurrentBodyPositionsAsInitialPositions();
31  void restoreInitialBodyPositions(bool doNotify = true);
32 
33  ItemList<BodyItem> coldetBodyItems() const;
34 
35  bool selectCollisionDetector(const std::string& name);
36  CollisionDetector* collisionDetector();
37  void setCollisionDetectionEnabled(bool on);
38  [[deprecated("Use setCollisionDetectionEnabled()")]]
39  void enableCollisionDetection(bool on){ setCollisionDetectionEnabled(on); }
40  bool isCollisionDetectionEnabled();
41  void updateCollisionDetectorLater();
42  void updateCollisionDetector();
43  void updateCollisions();
44  std::vector<CollisionLinkPairPtr>& collisions() const;
45  SignalProxy<void()> sigCollisionsUpdated();
46 
47  void setDefaultMaterialTableFile(const std::string& filename);
48  MaterialTable* defaultMaterialTable(bool checkFileUpdate = true);
49  MaterialTable* materialTable();
50 
51  // RenderableItem
52  virtual SgNode* getScene() override;
53 
55  ItemList<BodyItem> collisionBodyItems() const { return coldetBodyItems(); }
56 
57 protected:
58  virtual Item* doDuplicate() const override;
59  virtual void doPutProperties(PutPropertyFunction& putProperty) override;
60  virtual bool store(Archive& archive) override;
61  virtual bool restore(const Archive& archive) override;
62 
63 private:
64  class Impl;
65  Impl* impl;
66 };
67 
69 
70 }
71 
72 #endif
cnoid::WorldItemPtr
ref_ptr< WorldItem > WorldItemPtr
Definition: WorldItem.h:68
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::PutPropertyFunction
Definition: PutPropertyFunction.h:51
cnoid::Archive
Definition: Archive.h:22
cnoid::ref_ptr< WorldItem >
cnoid::WorldItem::enableCollisionDetection
void enableCollisionDetection(bool on)
Definition: WorldItem.h:39
cnoid::WorldItem
Definition: WorldItem.h:21
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Item
Definition: Item.h:29
cnoid::RenderableItem
Definition: RenderableItem.h:11
cnoid::ItemList
Definition: Item.h:20
cnoid::CollisionDetector
Definition: CollisionDetector.h:20
cnoid::WorldItem::collisionBodyItems
ItemList< BodyItem > collisionBodyItems() const
Definition: WorldItem.h:55
cnoid::SignalProxy
Definition: Signal.h:470
BodyItem.h
cnoid::SgNode
Definition: SceneGraph.h:157
cnoid::MaterialTable
Definition: MaterialTable.h:18