gui/graph_displayer_canvas.h
changeset 1644 62548b317e65
parent 1614 350c1d8bb7cc
child 1648 dd8672338691
equal deleted inserted replaced
23:4d0f36faf8a9 24:b5744fa2cf74
    21   GraphDisplayerCanvas(MapStorage &, MapWin &, Gtk::Window *);
    21   GraphDisplayerCanvas(MapStorage &, MapWin &, Gtk::Window *);
    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, Edge new_item=INVALID);
    27 
    27 
    28   ///Changes the linecolor attribute according to the given map.
    28   ///Changes the linecolor attribute according to the given map.
    29   ///\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
    30   int changeEdgeColor (std::string mapname, Graph::Edge new_item=INVALID);
    30   int changeEdgeColor (std::string mapname, Edge new_item=INVALID);
    31 
    31 
    32   ///Changes the text of line attribute according to the given map.
    32   ///Changes the text of line attribute according to the given map.
    33   ///\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
    34   int changeEdgeText (std::string mapname, Graph::Edge new_item=INVALID);
    34   int changeEdgeText (std::string mapname, Edge new_item=INVALID);
    35 
    35 
    36   ///Changes the linewidth attribute according to the given map.
    36   ///Changes the linewidth attribute according to the given map.
    37   ///\param mapname is the name of the map which contains the new values
    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);
    38   int changeNodeRadius (std::string mapname, Node new_item=INVALID);
    39 
    39 
    40   ///Changes the linecolor attribute according to the given map.
    40   ///Changes the linecolor attribute according to the given map.
    41   ///\param mapname is the name of the map which contains the new values
    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);
    42   int changeNodeColor (std::string mapname, Node new_item=INVALID);
    43 
    43 
    44   ///Changes the text of line attribute according to the given map.
    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
    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);
    46   int changeNodeText (std::string mapname, Node new_item=INVALID);
    47 
    47 
    48   ///Callback for 'ViewZoomIn' action.
    48   ///Callback for 'ViewZoomIn' action.
    49   virtual void zoomIn();
    49   virtual void zoomIn();
    50   ///Callback for 'ViewZoomOut' action.
    50   ///Callback for 'ViewZoomOut' action.
    51   virtual void zoomOut();
    51   virtual void zoomOut();
   117   ///creates a new Edgemap
   117   ///creates a new Edgemap
   118   int addNewEdgeMap(double,std::string);
   118   int addNewEdgeMap(double,std::string);
   119 
   119 
   120 private:
   120 private:
   121   ///Deletes the given element.
   121   ///Deletes the given element.
   122   void deleteItem(NodeIt);
   122   void deleteItem(Node);
   123   ///Deletes the given element.
   123   ///Deletes the given element.
   124   void deleteItem(EdgeIt);
   124   void deleteItem(Edge);
   125   ///Deletes the given element.
       
   126   void deleteItem(Graph::Edge);
       
   127 
   125 
   128 private:
   126 private:
   129 
   127 
   130   ///Map of nodes of graph
   128   ///Map of nodes of graph
   131   Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
   129   Graph::NodeMap<Gnome::Canvas::Ellipse *> nodesmap;
   164   ///Remembers which Gnome::Canvas::Item was pressed.
   162   ///Remembers which Gnome::Canvas::Item was pressed.
   165   ///this variable is needed, because
   163   ///this variable is needed, because
   166   ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
   164   ///1. we cannot query the item at he cursor as fast as it could not cause a Segmentation Fault
   167   ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
   165   ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
   168   Gnome::Canvas::Item * active_item, * target_item;
   166   Gnome::Canvas::Item * active_item, * target_item;
   169   Graph::NodeIt active_node;
   167   Node active_node;
   170   Graph::EdgeIt active_edge;
   168   Edge active_edge;
   171   Graph::EdgeIt forming_edge;
   169   Edge forming_edge;
   172 
   170 
   173   std::string nodemap_to_edit, edgemap_to_edit;
   171   std::string nodemap_to_edit, edgemap_to_edit;
   174 
   172 
   175   static const int zoom_step = 5;
   173   static const int zoom_step = 5;
   176 
   174