gui/graph_displayer_canvas.h
changeset 1515 dd7616b51333
parent 1505 7121597da9ba
child 1524 587a823bcdd0
equal deleted inserted replaced
12:beafb2a3fd1d 13:f5bfe071007c
     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 <libgnomecanvasmm.h>
    12 #include <libgnomecanvasmm.h>
    12 #include <libgnomecanvasmm/polygon.h>
    13 #include <libgnomecanvasmm/polygon.h>
    13 
    14 
    15 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
    16 class GraphDisplayerCanvas : public Gnome::Canvas::CanvasAA
    16 {
    17 {
    17   typedef Gnome::Canvas::CanvasAA Parent;
    18   typedef Gnome::Canvas::CanvasAA Parent;
    18 
    19 
    19 public:
    20 public:
    20   GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &);
    21   GraphDisplayerCanvas(Graph &, CoordinatesMap &, MapStorage &, MapWin *);
    21   virtual ~GraphDisplayerCanvas();
    22   virtual ~GraphDisplayerCanvas();
    22 
    23 
    23   ///Changes the linewidth attribute according to the given map.
    24   ///Changes the linewidth attribute according to the given map.
    24   ///\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
    25   int changeLineWidth (std::string mapname);
    26   int changeEdgeWidth (std::string mapname, Graph::Edge new_item=INVALID);
    26 
    27 
    27   ///Changes the linecolor attribute according to the given map.
    28   ///Changes the linecolor attribute according to the given map.
    28   ///\param mapname is the name of the map which contains the new values
    29   ///\param mapname is the name of the map which contains the new values
    29   int changeColor (std::string mapname);
    30   int changeEdgeColor (std::string mapname, Graph::Edge new_item=INVALID);
    30 
    31 
    31   ///Changes the text of line attribute according to the given map.
    32   ///Changes the text of line attribute according to the given map.
    32   ///\param mapname is the name of the map which contains the new values
    33   ///\param mapname is the name of the map which contains the new values
    33   int changeText (std::string mapname);
    34   int changeEdgeText (std::string mapname, Graph::Edge new_item=INVALID);
       
    35 
       
    36   ///Changes the linewidth attribute according to the given map.
       
    37   ///\param mapname is the name of the map which contains the new values
       
    38   int changeNodeRadius (std::string mapname, Graph::Node new_item=INVALID);
       
    39 
       
    40   ///Changes the linecolor attribute according to the given map.
       
    41   ///\param mapname is the name of the map which contains the new values
       
    42   int changeNodeColor (std::string mapname, Graph::Node new_item=INVALID);
       
    43 
       
    44   ///Changes the text of line attribute according to the given map.
       
    45   ///\param mapname is the name of the map which contains the new values
       
    46   int changeNodeText (std::string mapname, Graph::Node new_item=INVALID);
    34 
    47 
    35   ///Callback for 'ViewZoomIn' action.
    48   ///Callback for 'ViewZoomIn' action.
    36   virtual void zoomIn();
    49   virtual void zoomIn();
    37   ///Callback for 'ViewZoomOut' action.
    50   ///Callback for 'ViewZoomOut' action.
    38   virtual void zoomOut();
    51   virtual void zoomOut();
   105   Graph::EdgeMap<BrokenEdge *> edgesmap;
   118   Graph::EdgeMap<BrokenEdge *> edgesmap;
   106 
   119 
   107   ///Map of texts to write on edges
   120   ///Map of texts to write on edges
   108   Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
   121   Graph::EdgeMap<Gnome::Canvas::Text *> edgetextmap;
   109 
   122 
       
   123   ///Map of texts to write on nodes
       
   124   Graph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
       
   125 
   110   ///Group of graphical elements of displayed_graph
   126   ///Group of graphical elements of displayed_graph
   111   Gnome::Canvas::Group displayed_graph;
   127   Gnome::Canvas::Group displayed_graph;
   112 
   128 
   113   ///Here we store the maps that can be displayed through properties.
   129   ///Here we store the maps that can be displayed through properties.
   114   MapStorage mapstorage;
   130   MapStorage mapstorage;
   131   Graph::NodeIt active_node;
   147   Graph::NodeIt active_node;
   132   Graph::EdgeIt active_edge;
   148   Graph::EdgeIt active_edge;
   133 
   149 
   134   static const int zoom_step = 5;
   150   static const int zoom_step = 5;
   135 
   151 
       
   152   ///We need to store mapwin, to be able to ask the appropriate values for properties of new items.
       
   153   MapWin * mapwin;
       
   154 
   136 };
   155 };
   137 
   156 
   138 #endif //GRAPH_DISPLAYER_CANVAS_H
   157 #endif //GRAPH_DISPLAYER_CANVAS_H