GraphScene.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_GRAPH_SCENE_HH_
19 #define _GAZEBO_GRAPH_SCENE_HH_
20 
21 #include <string>
22 
23 #include "gazebo/gui/qt.h"
25 
26 namespace gazebo
27 {
28  namespace gui
29  {
32  class GraphScene : public QGVScene
33  {
34  Q_OBJECT
35 
38  public: GraphScene(QWidget *_parent = 0);
39 
41  public: virtual ~GraphScene() = default;
42 
46  public: QGVNode *AddNode(const std::string &_name);
47 
50  public: void RemoveNode(const std::string &_name);
51 
55  public: bool HasNode(const std::string &_name);
56 
60  public: QGVNode *GetNode(const std::string &_name);
61 
67  public: QGVEdge *AddEdge(const std::string &_id,
68  const std::string &_node1, const std::string &_node2);
69 
72  public: void RemoveEdge(const std::string &_id);
73 
77  private: void drawBackground(QPainter *_painter, const QRectF &_rect);
78  };
79  }
80 }
81 
82 #endif
GraphScene(QWidget *_parent=0)
Constructor.
Node item.
Definition: QGVNode.h:33
Edge item.
Definition: QGVEdge.h:34
bool HasNode(const std::string &_name)
Check if a node exists in the scene.
A scene of 2D graph nodes and edges.
Definition: GraphScene.hh:32
QGVEdge * AddEdge(const std::string &_id, const std::string &_node1, const std::string &_node2)
Add an edge to connect two nodes.
GraphViz interactive scene.
Definition: QGVScene.h:40
void RemoveNode(const std::string &_name)
Remove a node from the scene.
virtual ~GraphScene()=default
Destructor.
QGVNode * GetNode(const std::string &_name)
Get a node from the scene.
QGVNode * AddNode(const std::string &_name)
Add a node to the scene.
void RemoveEdge(const std::string &_id)
Remove an edge between two nodes.