3 #ifndef GRAPH_DISPLAYER_CANVAS_H
4 #define GRAPH_DISPLAYER_CANVAS_H
6 #include <all_include.h>
7 #include <mapstorage.h>
8 #include <libgnomecanvasmm.h>
9 #include <libgnomecanvasmm/polygon.h>
11 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
13 typedef Gnome::Canvas::CanvasAA Parent;
16 GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
17 virtual ~GraphDisplayerCanvas();
19 int changeLineWidth (std::string mapname);
20 int changeColor (std::string mapname);
21 int changeText (std::string mapname);
26 virtual bool on_expose_event(GdkEventExpose *);
30 ///Event handler function that handles dragging nodes of displayed_graph
31 bool event_handler(GdkEvent* e, Node n);
33 ///The graph, on which we work
35 ///Map of nodes of planefigure
36 Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
37 ///Map of edges of planefigure
38 Graph::EdgeMap<Gnome::Canvas::Line *> edgesmap;
40 ///Map of texts to write on edges
41 Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
43 ///Group of graphical elements of displayed_graph
44 Gnome::Canvas::Group displayed_graph;
46 ///Here we store the maps that can be displayed through properties.
47 MapStorage mapstorage;
49 ///Indicates whether the button of mouse is pressed or not
52 ///At this location was the mousebutton pressed.
53 ///It helps to calculate the distance of dragging.
54 double clicked_x, clicked_y;
56 ///Remembers which Gnome::Canvas::Item was pressed.
57 ///this variable is needed, because
58 ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
59 ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
60 Gnome::Canvas::Item * active_item;
65 #endif //GRAPH_DISPLAYER_CANVAS_H