graph_displayer_canvas.h
branchgui
changeset 94 adfdc2f70548
parent 89 4042761b21e3
child 96 e664d8aa3f72
equal deleted inserted replaced
28:ce84f94d14bc 29:9ac30f1cd0fb
     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 "mapstorage.h"
     9 #include "main_win.h"
    10 #include "map_win.h"
       
    11 #include <libgnomecanvasmm.h>
    10 #include <libgnomecanvasmm.h>
    12 #include <libgnomecanvasmm/polygon.h>
    11 #include <libgnomecanvasmm/polygon.h>
    13 #include <lemon/xy.h>
    12 #include <lemon/xy.h>
    14 
    13 
    15 ///This class is the canvas, on which the graph can be drawn.
    14 ///This class is the canvas, on which the graph can be drawn.
    38     xy<double> getArrowPos();
    37     xy<double> getArrowPos();
    39   };
    38   };
    40   typedef Gnome::Canvas::CanvasAA Parent;
    39   typedef Gnome::Canvas::CanvasAA Parent;
    41 
    40 
    42 public:
    41 public:
    43   GraphDisplayerCanvas(MapStorage &, MapWin &, Gtk::Window *);
    42   GraphDisplayerCanvas(MainWin &);
    44   virtual ~GraphDisplayerCanvas();
    43   virtual ~GraphDisplayerCanvas();
    45 
    44 
    46   ///Changes the linewidth attribute according to the given map.
    45   ///Changes the linewidth attribute according to the given map.
    47   ///\param mapname is the name of the map which contains the new values
    46   ///\param mapname is the name of the map which contains the new values
    48   int changeEdgeWidth (std::string mapname, Edge new_item=INVALID);
    47   int changeEdgeWidth (std::string mapname, Edge new_item=INVALID);
    70 
    69 
    71   ///Changes the text of line attribute according to the given map.
    70   ///Changes the text of line attribute according to the given map.
    72   ///\param mapname is the name of the map which contains the new values
    71   ///\param mapname is the name of the map which contains the new values
    73   int changeNodeText (std::string mapname, Node new_item=INVALID);
    72   int changeNodeText (std::string mapname, Node new_item=INVALID);
    74   int resetNodeText (Node new_item=INVALID);
    73   int resetNodeText (Node new_item=INVALID);
       
    74 
       
    75   void propertyChange(bool, int);
       
    76   void propertyUpdate(Edge, int, int dummy=0);
       
    77   void propertyUpdate(Node, int, int dummy=0);
       
    78 
       
    79   void propertyUpdate(Edge);
       
    80   void propertyUpdate(Node);
    75 
    81 
    76   ///Callback for 'ViewZoomIn' action.
    82   ///Callback for 'ViewZoomIn' action.
    77   virtual void zoomIn();
    83   virtual void zoomIn();
    78   ///Callback for 'ViewZoomOut' action.
    84   ///Callback for 'ViewZoomOut' action.
    79   virtual void zoomOut();
    85   virtual void zoomOut();
   163   Graph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
   169   Graph::NodeMap<Gnome::Canvas::Text *> nodetextmap;
   164 
   170 
   165   ///Group of graphical elements of displayed_graph
   171   ///Group of graphical elements of displayed_graph
   166   Gnome::Canvas::Group displayed_graph;
   172   Gnome::Canvas::Group displayed_graph;
   167 
   173 
   168 public:
       
   169   ///Here we store the maps that can be displayed through properties.
       
   170   MapStorage & mapstorage;
       
   171 
       
   172 private:
   174 private:
   173   ///Indicates whether the button of mouse is pressed or not
   175   ///Indicates whether the button of mouse is pressed or not
   174   int isbutton;
   176   int isbutton;
   175 
   177 
   176   ///Stores the actual tool in hand
   178   ///Stores the actual tool in hand
   191 
   193 
   192   std::string nodemap_to_edit, edgemap_to_edit;
   194   std::string nodemap_to_edit, edgemap_to_edit;
   193 
   195 
   194   static const int zoom_step = 5;
   196   static const int zoom_step = 5;
   195 
   197 
   196 public:
   198 private:
   197   ///We need to store mapwin, to be able to ask the appropriate values for properties of new items.
   199 
   198   MapWin & mapwin;
   200   ///reference to the parent window
   199 
   201   MainWin & mainwin;
   200 private:
       
   201 
       
   202   ///pointer to the parent window
       
   203   Gtk::Window * parentwin;
       
   204 
   202 
   205 };
   203 };
   206 
   204 
   207 #endif //GRAPH_DISPLAYER_CANVAS_H
   205 #endif //GRAPH_DISPLAYER_CANVAS_H