SchematicViewWidget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _GAZEBO_SCHEMATIC_VIEW_WIDGET_HH_
19 #define _GAZEBO_SCHEMATIC_VIEW_WIDGET_HH_
20 
21 #include <utility>
22 #include <map>
23 #include <string>
24 #include <vector>
25 
27 #include "gazebo/gui/qt.h"
28 
29 namespace gazebo
30 {
31  namespace gui
32  {
33  class GraphView;
34  class GraphScene;
35 
39  {
42  public: SchematicViewWidget(QWidget *_parent = 0);
43 
45  public: ~SchematicViewWidget() = default;
46 
48  public: void Init();
49 
51  public: void Reset();
52 
55  public: void AddNode(const std::string &_node);
56 
59  public: void RemoveNode(const std::string &_node);
60 
64  public: bool HasNode(const std::string &_name) const;
65 
71  public: void AddEdge(const std::string &_id, const std::string &_name,
72  const std::string &_parent, const std::string &_child);
73 
76  public: void RemoveEdge(const std::string &_id);
77 
80  public: unsigned int GetNodeCount() const;
81 
84  public: unsigned int GetEdgeCount() const;
85 
87  public: void FitInView();
88 
92  private: std::string GetLeafName(const std::string &_scopedName);
93 
96  private: void resizeEvent(QResizeEvent *_event);
97 
99  private: GraphScene *scene;
100 
102  private: GraphView *view;
103 
105  private: int minimumWidth;
106 
108  private: int minimumHeight;
109 
111  private: std::map<std::string, std::pair<std::string, std::string>>
112  edges;
113 
115  private: std::vector<event::ConnectionPtr> connections;
116  };
117  }
118 }
119 
120 #endif
A scene of 2D graph nodes and edges.
Definition: GraphScene.hh:32
A view for the graph scene.
Definition: GraphView.hh:29
#define GZ_GUI_MODEL_VISIBLE
Definition: system.hh:418
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
The parent widget of the CML editor.
Definition: SchematicViewWidget.hh:38