Choreonoid  1.8
LinkGraphView.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BODY_PLUGIN_LINK_GRAPH_VIEW_H
6 #define CNOID_BODY_PLUGIN_LINK_GRAPH_VIEW_H
7 
8 #include "BodyItem.h"
9 #include <cnoid/Buttons>
10 #include <cnoid/MultiSE3SeqItem>
11 #include <cnoid/View>
12 #include <cnoid/GraphWidget>
13 #include <cnoid/ItemList>
14 #include <cnoid/ConnectionSet>
15 #include <QBoxLayout>
16 #include <set>
17 
18 namespace cnoid {
19 
20 class Archive;
21 
26 class LinkGraphView : public View
27 {
28 public:
29  static void initializeClass(ExtensionManager* ext);
30 
31  LinkGraphView();
33 
34  virtual bool storeState(Archive& archive);
35  virtual bool restoreState(const Archive& archive);
36 
37 protected:
38  virtual QWidget* indicatorOnInfoBar();
39 
40 private:
41  GraphWidget graph;
42  ToggleToolButton xyzToggles[3];
43  ToggleToolButton rpyToggles[3];
44  ConnectionSet toggleConnections;
45  Connection rootItemConnection;
46 
47  struct ItemInfo
48  {
49  ~ItemInfo(){
50  connections.disconnect();
51  }
52  MultiSE3SeqItemPtr item;
53  std::shared_ptr<MultiSE3Seq> seq;
54  BodyItemPtr bodyItem;
55  ConnectionSet connections;
56  std::vector<GraphDataHandlerPtr> handlers;
57  };
58 
59  std::list<ItemInfo> itemInfos;
60 
61  std::set<BodyItemPtr> bodyItems;
62  ConnectionSet bodyItemConnections;
63 
64  void setupElementToggleSet(QBoxLayout* box, ToggleToolButton toggles[], const char* labels[], bool isActive);
65  void onSelectedItemsChanged(ItemList<MultiSE3SeqItem> items);
66  void onDataItemDisconnectedFromRoot(std::list<ItemInfo>::iterator itemInfoIter);
67  void updateBodyItems();
68  void onBodyItemDisconnectedFromRoot(BodyItemPtr bodyItem);
69  void setupGraphWidget();
70  void addPositionTrajectory(std::list<ItemInfo>::iterator itemInfoIter, Link* link, std::shared_ptr<MultiSE3Seq> seq);
71  void onDataItemUpdated(std::list<ItemInfo>::iterator itemInfoIter);
72 
73  void onDataRequest(
74  std::list<ItemInfo>::iterator itemInfoIter,
75  int linkIndex, int type, int axis, int frame, int size, double* out_values);
76  void onDataModified(
77  std::list<ItemInfo>::iterator itemInfoIter,
78  int linkIndex, int type, int axis, int frame, int size, double* values);
79 };
80 
81 }
82 
83 #endif
cnoid::Connection::disconnect
void disconnect()
Definition: Signal.h:221
cnoid::ExtensionManager
Definition: ExtensionManager.h:23
cnoid::View
Definition: View.h:27
cnoid::ConnectionSet
Definition: ConnectionSet.h:84
cnoid::Archive
Definition: Archive.h:22
cnoid::LinkGraphView
Definition: LinkGraphView.h:26
cnoid::GraphWidget
Definition: GraphWidget.h:66
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid::LinkGraphView::initializeClass
static void initializeClass(ExtensionManager *ext)
Definition: LinkGraphView.cpp:18
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::ItemList
Definition: Item.h:20
cnoid::LinkGraphView::indicatorOnInfoBar
virtual QWidget * indicatorOnInfoBar()
Definition: LinkGraphView.cpp:77
cnoid::ToggleToolButton
Definition: Buttons.h:106
cnoid::LinkGraphView::storeState
virtual bool storeState(Archive &archive)
Definition: LinkGraphView.cpp:291
cnoid::LinkGraphView::LinkGraphView
LinkGraphView()
Definition: LinkGraphView.cpp:25
cnoid::View::isActive
bool isActive() const
Definition: View.cpp:194
cnoid::LinkGraphView::~LinkGraphView
~LinkGraphView()
Definition: LinkGraphView.cpp:70
cnoid::LinkGraphView::restoreState
virtual bool restoreState(const Archive &archive)
Definition: LinkGraphView.cpp:311
BodyItem.h
cnoid::Connection
Definition: Signal.h:206