3 #ifndef GRAPH_DISPLAYER_CANVAS_H |
3 #ifndef GRAPH_DISPLAYER_CANVAS_H |
4 #define GRAPH_DISPLAYER_CANVAS_H |
4 #define GRAPH_DISPLAYER_CANVAS_H |
5 |
5 |
6 class GraphDisplayerCanvas; |
6 class GraphDisplayerCanvas; |
7 |
7 |
8 #include <all_include.h> |
8 #include "all_include.h" |
9 #include <map_win.h> |
9 #include "mapstorage.h" |
10 #include <mapstorage.h> |
10 #include "broken_edge.h" |
11 #include <broken_edge.h> |
11 #include "map_win.h" |
12 #include <libgnomecanvasmm.h> |
12 #include <libgnomecanvasmm.h> |
13 #include <libgnomecanvasmm/polygon.h> |
13 #include <libgnomecanvasmm/polygon.h> |
14 |
14 |
15 ///This class is the canvas, on which the graph can be drawn. |
15 ///This class is the canvas, on which the graph can be drawn. |
16 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA |
16 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA |
17 { |
17 { |
18 typedef Gnome::Canvas::CanvasAA Parent; |
18 typedef Gnome::Canvas::CanvasAA Parent; |
19 |
19 |
20 public: |
20 public: |
21 GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &, MapWin *); |
21 GraphDisplayerCanvas(MapStorage &, MapWin &); |
22 virtual ~GraphDisplayerCanvas(); |
22 virtual ~GraphDisplayerCanvas(); |
23 |
23 |
24 ///Changes the linewidth attribute according to the given map. |
24 ///Changes the linewidth attribute according to the given map. |
25 ///\param mapname is the name of the map which contains the new values |
25 ///\param mapname is the name of the map which contains the new values |
26 int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID); |
26 int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID); |
107 |
107 |
108 public: |
108 public: |
109 ///\return the actual tool in hand |
109 ///\return the actual tool in hand |
110 int getActualTool(); |
110 int getActualTool(); |
111 |
111 |
|
112 void drawGraph(); |
|
113 void clear(); |
|
114 |
112 ///creates a new Nodemap |
115 ///creates a new Nodemap |
113 int addNewNodeMap(double,std::string); |
116 int addNewNodeMap(double,std::string); |
114 ///creates a new Edgemap |
117 ///creates a new Edgemap |
115 int addNewEdgeMap(double,std::string); |
118 int addNewEdgeMap(double,std::string); |
116 |
119 |
121 void deleteItem(EdgeIt); |
124 void deleteItem(EdgeIt); |
122 ///Deletes the given element. |
125 ///Deletes the given element. |
123 void deleteItem(Graph::Edge); |
126 void deleteItem(Graph::Edge); |
124 |
127 |
125 private: |
128 private: |
126 |
|
127 ///The graph, on which we work |
|
128 Graph & g; |
|
129 |
129 |
130 ///Map of nodes of graph |
130 ///Map of nodes of graph |
131 Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap; |
131 Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap; |
132 |
132 |
133 ///Map of edges of graph |
133 ///Map of edges of graph |
173 std::string nodemap_to_edit, edgemap_to_edit; |
173 std::string nodemap_to_edit, edgemap_to_edit; |
174 |
174 |
175 static const int zoom_step = 5; |
175 static const int zoom_step = 5; |
176 |
176 |
177 ///We need to store mapwin, to be able to ask the appropriate values for properties of new items. |
177 ///We need to store mapwin, to be able to ask the appropriate values for properties of new items. |
178 MapWin * mapwin; |
178 MapWin & mapwin; |
179 |
179 |
180 }; |
180 }; |
181 |
181 |
182 #endif //GRAPH_DISPLAYER_CANVAS_H |
182 #endif //GRAPH_DISPLAYER_CANVAS_H |