GraphTool  1.0
Tool for analyzing and graphically visualizing code dependencies for Ericsson.
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
graph_scene.h
1 
6 #ifndef GUI_GRAPH_SCENE_H_
7 #define GUI_GRAPH_SCENE_H_
8 
9 // Qt-imports
10 #include <QGraphicsScene>
11 #include <QDebug>
12 
13 // General imports
14 #include <queue>
15 
16 // Local imports
17 #include "grapher.h"
18 #include "node_widget.h"
19 #include "edge_widget.h"
20 #include "graph_model.h"
21 #include "graph_model_item.h"
22 
23 
24 class GraphScene : public QGraphicsScene {
25  Q_OBJECT
26 
27  public:
33  GraphScene(GraphModel* graph, QObject* parent = 0);
34 
38  virtual ~GraphScene();
39 
44  void set_model(GraphModel* model);
45 
50  GraphModel* model();
51 
56  void set_node_label_column(int column_idx);
57 
63  void set_xy_columns(int x_idx, int y_idx);
64 
69  void set_color_column(int color);
70 
75  void populateScene();
76 
82  NodeWidget* get_node_widget(std::string item_name);
83 
89  NodeWidget* get_node_widget(QString item_name);
90 
96  NodeWidget* get_node_widget(QModelIndex item_index);
97 
103  NodeWidget* add_node_widget(QModelIndex item_index);
104 
109  void del_node_widget(QModelIndex item_index);
110 
111 
116  int nodes();
117 
122  std::vector<std::string> get_names_of_all_nodes();
123 
124 
125  private:
126 
128  GraphModel* graph_;
129 
131  std::map<QString, NodeWidget*> node_widgets_;
132 
134  int num_nodes_;
135 
137  int label_column_;
138 
140  int x_column_;
141 
143  int y_column_;
144 
146  int color_column_;
147 };
148 
149 #endif
Definition: graph_model.h:36
Definition: node_widget.h:29
GraphScene(GraphModel *graph, QObject *parent=0)
Definition: graph_scene.cc:3
void populateScene()
Definition: graph_scene.cc:20
NodeWidget * add_node_widget(QModelIndex item_index)
Definition: graph_scene.cc:162
void set_color_column(int color)
Definition: graph_scene.cc:142
Definition: graph_scene.h:24
GraphModel * model()
Definition: graph_scene.cc:129
void set_node_label_column(int column_idx)
Definition: graph_scene.cc:133
void del_node_widget(QModelIndex item_index)
Definition: graph_scene.cc:201
NodeWidget * get_node_widget(std::string item_name)
Definition: graph_scene.cc:146
void set_xy_columns(int x_idx, int y_idx)
Definition: graph_scene.cc:137
std::vector< std::string > get_names_of_all_nodes()
Definition: graph_scene.cc:217
void set_model(GraphModel *model)
Definition: graph_scene.cc:116
virtual ~GraphScene()
Definition: graph_scene.cc:12
int nodes()
Definition: graph_scene.cc:213