Choreonoid  1.8
LocatableItem.h
Go to the documentation of this file.
1 #ifndef CNOID_BASE_LOCATABLE_ITEM_H
2 #define CNOID_BASE_LOCATABLE_ITEM_H
3 
4 #include <cnoid/Referenced>
5 #include <cnoid/Signal>
6 #include <cnoid/EigenTypes>
7 #include "exportdecl.h"
8 
9 namespace cnoid {
10 
11 class Item;
14 
15 class CNOID_EXPORT LocationProxy : public Referenced
16 {
17 public:
18  enum LocationType {
22  // This is basically same as ParentRelativeCoordinate, but
23  // this maeks the global coordinate unavailable in the user interface
24  OffsetLocation
25  };
26 
27  virtual ~LocationProxy();
28 
29  LocationType locationType() const { return locationType_; }
30  void setLocationType(LocationType type) { locationType_ = type; }
31  virtual std::string getName() const;
32  virtual Isometry3 getLocation() const = 0;
33  virtual bool isEditable() const;
34  virtual void setEditable(bool on);
35  virtual bool setLocation(const Isometry3& T);
36  virtual void finishLocationEditing();
37  virtual Item* getCorrespondingItem();
38  virtual LocationProxyPtr getParentLocationProxy() const;
39  virtual void expire();
40  virtual SignalProxy<void()> sigLocationChanged() = 0;
41  virtual SignalProxy<void()> sigAttributeChanged();
42  virtual SignalProxy<void()> sigExpired();
43  Isometry3 getGlobalLocation() const;
44  Isometry3 getGlobalLocationOf(const Isometry3 T) const;
45  bool setGlobalLocation(const Isometry3& T);
46  void notifyAttributeChange();
47  bool requestEdit();
48 
49  static SignalProxy<bool(LocationProxyPtr location), LogicalSum> sigEditRequest();
50 
51 protected:
52  LocationProxy(LocationType type);
53 
54 private:
55  LocationType locationType_;
56  bool isEditable_;
57  Signal<void()> sigAttributeChanged_;
58  Signal<void()> sigExpired_;
59  ScopedConnection itemNameConnection_;
60 };
61 
63 {
64 public:
65  virtual LocationProxyPtr getLocationProxy() = 0;
66 };
67 
68 }
69 
70 #endif
cnoid::LocatableItem::getLocationProxy
virtual LocationProxyPtr getLocationProxy()=0
cnoid::Isometry3
Eigen::Isometry3d Isometry3
Definition: EigenTypes.h:73
cnoid::ScopedConnection
Definition: Signal.h:279
cnoid::LocationProxyPtr
ref_ptr< LocationProxy > LocationProxyPtr
Definition: LocatableItem.h:12
cnoid::ref_ptr< LocationProxy >
cnoid::LocationProxy::InvalidLocation
@ InvalidLocation
Definition: LocatableItem.h:19
cnoid::LocationProxy
Definition: LocatableItem.h:15
cnoid::LocationProxy::LocationType
LocationType
Definition: LocatableItem.h:18
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::Item
Definition: Item.h:29
cnoid::LocationProxy::ParentRelativeLocation
@ ParentRelativeLocation
Definition: LocatableItem.h:21
cnoid::Referenced
Definition: Referenced.h:54
cnoid::LocationProxy::locationType
LocationType locationType() const
Definition: LocatableItem.h:29
cnoid::Signal
Definition: Signal.h:165
cnoid::SignalProxy
Definition: Signal.h:470
cnoid::LogicalSum
Definition: Signal.h:447
cnoid::LocationProxy::GlobalLocation
@ GlobalLocation
Definition: LocatableItem.h:20
cnoid::LocatableItem
Definition: LocatableItem.h:62
cnoid::LocationProxy::setLocationType
void setLocationType(LocationType type)
Definition: LocatableItem.h:30