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 #ifndef GAZEBO_GUI_MODEL_GRAPHSCENE_HH_
18 #define GAZEBO_GUI_MODEL_GRAPHSCENE_HH_
19 
20 #include <string>
21 
22 #include "gazebo/common/Color.hh"
23 
24 #include "gazebo/gui/qt.h"
25 #include "gazebo/gui/qgv/QGVScene.h"
26 
27 namespace gazebo
28 {
29  namespace gui
30  {
33  class GZ_GUI_VISIBLE GraphScene : public QGVScene
34  {
35  Q_OBJECT
36 
39  public: GraphScene(QWidget *_parent = 0);
40 
42  public: virtual ~GraphScene() = default;
43 
47  public: QGVNode *AddNode(const std::string &_name);
48 
51  public: void RemoveNode(const std::string &_name);
52 
56  public: bool HasNode(const std::string &_name);
57 
61  public: QGVNode *GetNode(const std::string &_name);
62 
68  public: QGVEdge *AddEdge(const std::string &_id,
69  const std::string &_node1, const std::string &_node2);
70 
73  public: void RemoveEdge(const std::string &_id);
74 
78  public: void SetEdgeColor(const std::string &_id,
79  const common::Color &_color);
80 
84  private: void drawBackground(QPainter *_painter, const QRectF &_rect);
85  };
86  }
87 }
88 
89 #endif
A scene of 2D graph nodes and edges.
Definition: GraphScene.hh:33
Defines a color.
Definition: Color.hh:36