GraphScene.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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/common/Color.hh"
24 
25 #include "gazebo/gui/qt.h"
26 #include "gazebo/gui/qgv/QGVScene.h"
27 
28 namespace gazebo
29 {
30  namespace gui
31  {
34  class GZ_GUI_VISIBLE GraphScene : public QGVScene
35  {
36  Q_OBJECT
37 
40  public: GraphScene(QWidget *_parent = 0);
41 
43  public: virtual ~GraphScene() = default;
44 
48  public: QGVNode *AddNode(const std::string &_name);
49 
52  public: void RemoveNode(const std::string &_name);
53 
57  public: bool HasNode(const std::string &_name);
58 
62  public: QGVNode *GetNode(const std::string &_name);
63 
69  public: QGVEdge *AddEdge(const std::string &_id,
70  const std::string &_node1, const std::string &_node2);
71 
74  public: void RemoveEdge(const std::string &_id);
75 
79  public: void SetEdgeColor(const std::string &_id,
80  const common::Color &_color);
81 
85  private: void drawBackground(QPainter *_painter, const QRectF &_rect);
86  };
87  }
88 }
89 
90 #endif
A scene of 2D graph nodes and edges.
Definition: GraphScene.hh:34
Defines a color.
Definition: Color.hh:36