Choreonoid  1.8
JointGraphView.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BODY_PLUGIN_JOINT_GRAPH_VIEW_H
6 #define CNOID_BODY_PLUGIN_JOINT_GRAPH_VIEW_H
7 
8 #include "BodyItem.h"
9 #include <cnoid/MultiValueSeqItem>
10 #include <cnoid/View>
11 #include <cnoid/GraphWidget>
12 #include <cnoid/ItemList>
13 #include <cnoid/ConnectionSet>
14 #include <set>
15 
16 namespace cnoid {
17 
18 class Archive;
19 
20 class JointGraphView : public View
21 {
22 public:
23  static void initializeClass(ExtensionManager* ext);
24 
27 
28  virtual bool storeState(Archive& archive);
29  virtual bool restoreState(const Archive& archive);
30 
31 protected:
32  virtual QWidget* indicatorOnInfoBar();
33 
34 private:
35  GraphWidget graph;
36 
37  struct ItemInfo
38  {
39  ~ItemInfo(){
40  connections.disconnect();
41  }
43  std::shared_ptr<MultiValueSeq> seq;
44  BodyItemPtr bodyItem;
45  ConnectionSet connections;
46  std::vector<GraphDataHandlerPtr> handlers;
47  };
48 
49  std::list<ItemInfo> itemInfos;
50 
51  std::set<BodyItemPtr> bodyItems;
52  ConnectionSet bodyItemConnections;
53  Connection rootItemConnection;
54 
55  void onSelectedItemsChanged(ItemList<MultiValueSeqItem> items);
56  void onDataItemDisconnectedFromRoot(std::list<ItemInfo>::iterator itemInfoIter);
57  void updateBodyItems();
58  void onBodyItemDisconnectedFromRoot(BodyItemPtr bodyItem);
59  void setupGraphWidget();
60  void addJointTrajectory(std::list<ItemInfo>::iterator itemInfoIter, Link* joint, std::shared_ptr<MultiValueSeq> seq);
61  void onDataItemUpdated(std::list<ItemInfo>::iterator itemInfoIter);
62  void onDataRequest(std::list<ItemInfo>::iterator itemInfoIter, int jointId, int frame, int size, double* out_values);
63  void onDataModified(std::list<ItemInfo>::iterator itemInfoIter, int jointId, int frame, int size, double* values);
64 };
65 
66 }
67 
68 #endif
cnoid::JointGraphView::storeState
virtual bool storeState(Archive &archive)
Definition: JointGraphView.cpp:239
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::JointGraphView::JointGraphView
JointGraphView()
Definition: JointGraphView.cpp:25
cnoid::JointGraphView::initializeClass
static void initializeClass(ExtensionManager *ext)
Definition: JointGraphView.cpp:18
cnoid::GraphWidget
Definition: GraphWidget.h:66
cnoid::ref_ptr
Definition: Referenced.h:103
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::JointGraphView::indicatorOnInfoBar
virtual QWidget * indicatorOnInfoBar()
Definition: JointGraphView.cpp:48
cnoid::ItemList
Definition: Item.h:20
cnoid::JointGraphView::~JointGraphView
~JointGraphView()
Definition: JointGraphView.cpp:41
cnoid::JointGraphView
Definition: JointGraphView.h:20
BodyItem.h
cnoid::Connection
Definition: Signal.h:206
cnoid::JointGraphView::restoreState
virtual bool restoreState(const Archive &archive)
Definition: JointGraphView.cpp:245