Choreonoid  1.8
CoordinateFrameListItem.h
Go to the documentation of this file.
1 #ifndef CNOID_BASE_COORDINATE_FRAME_LIST_ITEM_H
2 #define CNOID_BASE_COORDINATE_FRAME_LIST_ITEM_H
3 
4 #include "Item.h"
5 #include "RenderableItem.h"
6 #include "LocatableItem.h"
7 #include <cnoid/GeneralId>
8 #include <cnoid/Signal>
9 #include <cnoid/EigenTypes>
10 #include "exportdecl.h"
11 
12 namespace cnoid {
13 
14 class CoordinateFrameList;
15 class CoordinateFrameItem;
16 class CoordinateFrame;
17 class LocatableItem;
18 
19 class CNOID_EXPORT CoordinateFrameListItem : public Item, public RenderableItem
20 {
21 public:
22  static void initializeClass(ExtensionManager* ext);
23 
24  static SignalProxy<void(CoordinateFrameListItem* frameListItem, bool on)> sigListAssociationWith(Item* item);
25 
29  virtual ~CoordinateFrameListItem();
30 
52  IndependentItemization
53  };
54 
55  int itemizationMode() const;
56  bool isNoItemizationMode() const;
57  void setItemizationMode(int mode);
58  void customizeFrameItemDisplayName(std::function<std::string(const CoordinateFrameItem* item)> func);
59  std::string getFrameItemDisplayName(const CoordinateFrameItem* item) const;
60  void updateFrameItems();
61  CoordinateFrameItem* findFrameItemAt(int index);
62  CoordinateFrameItem* findFrameItem(const GeneralId& id);
63 
64  CoordinateFrameList* frameList();
65  const CoordinateFrameList* frameList() const;
66 
67  void useAsBaseFrames();
68  void useAsOffsetFrames();
69  bool isForBaseFrames() const;
70  bool isForOffsetFrames() const;
71 
72  virtual LocationProxyPtr getFrameParentLocationProxy();
73  bool getRelativeFramePosition(const CoordinateFrame* frame, Isometry3& out_T) const;
74  bool getGlobalFramePosition(const CoordinateFrame* frame, Isometry3& out_T) const;
75  bool switchFrameMode(CoordinateFrame* frame, int mode);
76 
77  // RenderableItem function
78  virtual SgNode* getScene() override;
79 
80  void setFrameMarkerVisible(const CoordinateFrame* frame, bool on);
81  ReferencedPtr transientFrameMarkerHolder(const CoordinateFrame* frame);
82  bool isFrameMarkerVisible(const CoordinateFrame* frame) const;
83  SignalProxy<void(int index, bool on)> sigFrameMarkerVisibilityChanged();
84 
85  virtual bool store(Archive& archive) override;
86  virtual bool restore(const Archive& archive) override;
87 
88  class Impl;
89 
90 protected:
91  virtual Item* doDuplicate() const override;
92  virtual void onTreePositionChanged() override;
93  virtual void onDisconnectedFromRoot() override;
94  virtual bool onChildItemAboutToBeAdded(Item* childItem, bool isManualOperation) override;
95  virtual void doPutProperties(PutPropertyFunction& putProperty) override;
96 
97 private:
98  friend class CoordinateFrameItem;
99  // Called from CoordinateFrameItem::onPositionChanged
100  bool onFrameItemAdded(CoordinateFrameItem* frameItem);
101  void onFrameItemRemoved(CoordinateFrameItem* frameItem);
102 
103 private:
104  Impl* impl;
105 };
106 
108 
109 }
110 
111 #endif
cnoid::GeneralId
Definition: GeneralId.h:11
Item.h
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::PutPropertyFunction
Definition: PutPropertyFunction.h:51
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::Archive
Definition: Archive.h:22
cnoid::CoordinateFrameItem
Definition: CoordinateFrameItem.h:18
cnoid::CoordinateFrameListItem::NoItemization
@ NoItemization
Definition: CoordinateFrameListItem.h:42
LocatableItem.h
cnoid::ref_ptr< LocationProxy >
cnoid::CoordinateFrame
Definition: CoordinateFrame.h:16
RenderableItem.h
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Item
Definition: Item.h:29
cnoid::RenderableItem
Definition: RenderableItem.h:11
cnoid::CoordinateFrameList
Definition: CoordinateFrameList.h:12
cnoid::CoordinateFrameListItem::ItemizationMode
ItemizationMode
Definition: CoordinateFrameListItem.h:37
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::CoordinateFrameListItemPtr
ref_ptr< CoordinateFrameListItem > CoordinateFrameListItemPtr
Definition: CoordinateFrameListItem.h:107
cnoid::CoordinateFrameListItem
Definition: CoordinateFrameListItem.h:19
cnoid::CoordinateFrameListItem::SubItemization
@ SubItemization
Definition: CoordinateFrameListItem.h:47
cnoid::SgNode
Definition: SceneGraph.h:157