gui/graph_displayer_canvas.h
changeset 1440 3d2e3cfb2a6c
parent 1435 8e85e6bbefdf
child 1441 fd4b6f6d592a
equal deleted inserted replaced
0:8d077010c8e5 1:0af8fddbdfe0
     6 #include <all_include.h>
     6 #include <all_include.h>
     7 #include <mapstorage.h>
     7 #include <mapstorage.h>
     8 #include <libgnomecanvasmm.h>
     8 #include <libgnomecanvasmm.h>
     9 #include <libgnomecanvasmm/polygon.h>
     9 #include <libgnomecanvasmm/polygon.h>
    10 
    10 
       
    11 ///This class is the canvas, on which the graph can be drawn.
    11 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
    12 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
    12 {
    13 {
    13   typedef Gnome::Canvas::CanvasAA Parent;
    14   typedef Gnome::Canvas::CanvasAA Parent;
    14 
    15 
    15 public:
    16 public:
    16   GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
    17   GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
    17   virtual ~GraphDisplayerCanvas();
    18   virtual ~GraphDisplayerCanvas();
    18 
    19 
       
    20   ///Changes the linewidth attribute according to the given map.
       
    21   ///\param mapname is the name of the map which contains the new values
    19   int changeLineWidth (std::string mapname);
    22   int changeLineWidth (std::string mapname);
       
    23 
       
    24   ///Changes the linecolor attribute according to the given map.
       
    25   ///\param mapname is the name of the map which contains the new values
    20   int changeColor (std::string mapname);
    26   int changeColor (std::string mapname);
       
    27 
       
    28   ///Changes the text of line attribute according to the given map.
       
    29   ///\param mapname is the name of the map which contains the new values
    21   int changeText (std::string mapname);
    30   int changeText (std::string mapname);
       
    31 
       
    32   ///Changes the dot-pro-pixel to be able to show the whole graph.
    22   int rezoom();
    33   int rezoom();
    23 
    34 
    24 protected:
    35 protected:
    25 
    36 
       
    37   //maximizing, minimizing, restoring window, etc. 
    26   virtual bool on_expose_event(GdkEventExpose *);
    38   virtual bool on_expose_event(GdkEventExpose *);
    27 
    39 
    28 private:
    40 private:
    29 
    41 
    30   ///Event handler function that handles dragging nodes of displayed_graph
    42   ///This function is responsible for the correct
       
    43   ///reaction of any action happened in the territory
       
    44   ///of the canvas
    31   bool event_handler(GdkEvent* e, Node n);
    45   bool event_handler(GdkEvent* e, Node n);
    32 
    46 
    33   ///The graph, on which we work
    47   ///The graph, on which we work
    34   Graph g;
    48   Graph g;
    35   ///Map of nodes of planefigure
    49 
       
    50   ///Map of nodes of graph
    36   Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
    51   Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
    37   ///Map of edges of planefigure
    52 
       
    53   ///Map of edges of graph
    38   Graph::EdgeMap<Gnome::Canvas::Line *> edgesmap;
    54   Graph::EdgeMap<Gnome::Canvas::Line *> edgesmap;
    39 
    55 
    40   ///Map of texts to write on edges
    56   ///Map of texts to write on edges
    41   Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
    57   Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
    42 
    58