COIN-OR::LEMON - Graph Library

Changeset 1643:9285f3777553 in lemon-0.x


Ignore:
Timestamp:
08/18/05 15:33:49 (14 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2156
Message:
  • The number of gcc-4.0 warnings has significantly decreases.
  • Some code clean-up in gui
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • gui/all_include.h

    r1599 r1643  
    4141typedef Graph::NodeMap<Coordinates> CoordinatesMap;
    4242typedef Graph::Node Node;
     43typedef Graph::Edge Edge;
    4344typedef Graph::EdgeIt EdgeIt;
    4445typedef Graph::NodeIt NodeIt;
  • gui/graph_displayer_canvas-edge.cc

    r1632 r1643  
    44
    55
    6 int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Graph::Edge edge)
     6int GraphDisplayerCanvas::changeEdgeWidth (std::string mapname, Edge edge)
    77{
    88  Graph::EdgeMap<double> * actual_map;
     
    5050};
    5151
    52 int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Graph::Edge edge)
     52int GraphDisplayerCanvas::changeEdgeColor (std::string mapname, Edge edge)
    5353
    5454
     
    117117};
    118118
    119 int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Graph::Edge edge)
     119int GraphDisplayerCanvas::changeEdgeText (std::string mapname, Edge edge)
    120120{
    121121  //the number in the map will be written on the edge
  • gui/graph_displayer_canvas-event.cc

    r1632 r1643  
    226226      isbutton=1;
    227227
    228       active_node=NodeIt(mapstorage.graph,mapstorage.graph.addNode());
     228      active_node=mapstorage.graph.addNode();
    229229
    230230      //initiating values corresponding to new node in maps
     
    340340              window_to_world (e->button.x, e->button.y, clicked_x, clicked_y);
    341341              target_item=(get_item_at(clicked_x, clicked_y));
    342               Graph::NodeIt target_node=INVALID;
     342              Node target_node=INVALID;
    343343              for (NodeIt i(mapstorage.graph); i!=INVALID; ++i)
    344344                {
     
    355355          mapstorage.modified = true;
    356356
    357                       *(nodesmap[target_node]) << Gnome::Canvas::Properties::fill_color("red");
     357                      *(nodesmap[target_node]) <<
     358                        Gnome::Canvas::Properties::fill_color("red");
    358359
    359360                      //creating new edge
    360                       active_edge=EdgeIt(mapstorage.graph,mapstorage.graph.addEdge(active_node, target_node));
     361                      active_edge=mapstorage.graph.addEdge(active_node,
     362                                                           target_node);
    361363
    362364                      //initiating values corresponding to new edge in maps
    363365                      mapstorage.initMapsForEdge(active_edge);
    364                       (*mapstorage.edgemap_storage["id"])[active_edge] = mapstorage.graph.id(active_edge);
     366                      (*mapstorage.edgemap_storage["id"])[active_edge] =
     367                        mapstorage.graph.id(active_edge);
    365368         
    366369                      //calculating coordinates of new edge
     
    556559          {
    557560            //for determine, whether it was an edge
    558             Graph::EdgeIt clicked_edge=INVALID;
     561            Edge clicked_edge=INVALID;
    559562
    560563            //find the activated item between texts
     
    678681          {
    679682            //for determine, whether it was a node
    680             Graph::NodeIt clicked_node=INVALID;
     683            Node clicked_node=INVALID;
    681684
    682685            //find the activated item between texts
     
    850853}
    851854
    852 void GraphDisplayerCanvas::deleteItem(NodeIt node_to_delete)
     855void GraphDisplayerCanvas::deleteItem(Node node_to_delete)
    853856{
    854857  delete(nodetextmap[node_to_delete]);
     
    857860}
    858861
    859 void GraphDisplayerCanvas::deleteItem(EdgeIt edge_to_delete)
     862void GraphDisplayerCanvas::deleteItem(Edge edge_to_delete)
    860863{
    861864  delete(edgetextmap[edge_to_delete]);
     
    864867}
    865868
    866 void GraphDisplayerCanvas::deleteItem(Graph::Edge edge_to_delete)
    867 {
    868   delete(edgetextmap[edge_to_delete]);
    869   delete(edgesmap[edge_to_delete]);
    870   mapstorage.graph.erase(edge_to_delete);
    871 }
    872 
    873869void GraphDisplayerCanvas::textReposition(xy<double> new_place)
    874870{
  • gui/graph_displayer_canvas-node.cc

    r1632 r1643  
    44
    55
    6 int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Graph::Node node)
     6int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node)
    77{
    88  Graph::NodeMap<double> * actual_map;
     
    7070};
    7171
    72 int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Graph::Node node)
     72int GraphDisplayerCanvas::changeNodeColor (std::string mapname, Node node)
    7373
    7474
     
    142142};
    143143
    144 int GraphDisplayerCanvas::changeNodeText (std::string mapname, Graph::Node node)
     144int GraphDisplayerCanvas::changeNodeText (std::string mapname, Node node)
    145145{
    146146
  • gui/graph_displayer_canvas.h

    r1614 r1643  
    2424  ///Changes the linewidth attribute according to the given map.
    2525  ///\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);
    2727
    2828  ///Changes the linecolor attribute according to the given map.
    2929  ///\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);
    3131
    3232  ///Changes the text of line attribute according to the given map.
    3333  ///\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);
    3535
    3636  ///Changes the linewidth attribute according to the given map.
    3737  ///\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);
    3939
    4040  ///Changes the linecolor attribute according to the given map.
    4141  ///\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);
    4343
    4444  ///Changes the text of line attribute according to the given map.
    4545  ///\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);
    4747
    4848  ///Callback for 'ViewZoomIn' action.
     
    120120private:
    121121  ///Deletes the given element.
    122   void deleteItem(NodeIt);
     122  void deleteItem(Node);
    123123  ///Deletes the given element.
    124   void deleteItem(EdgeIt);
    125   ///Deletes the given element.
    126   void deleteItem(Graph::Edge);
     124  void deleteItem(Edge);
    127125
    128126private:
     
    167165  ///2. we would like to handle only ony item per movement, therefore quering it is not a working solution
    168166  Gnome::Canvas::Item * active_item, * target_item;
    169   Graph::NodeIt active_node;
    170   Graph::EdgeIt active_edge;
    171   Graph::EdgeIt forming_edge;
     167  Node active_node;
     168  Edge active_edge;
     169  Edge forming_edge;
    172170
    173171  std::string nodemap_to_edit, edgemap_to_edit;
  • gui/map_win.cc

    r1606 r1643  
    218218};
    219219
    220 void MapWin::updateNode(Graph::Node node)
     220void MapWin::updateNode(Node node)
    221221{
    222222  for(int i=0;i<NODE_PROPERTY_NUM;i++)
     
    251251}
    252252
    253 void MapWin::updateEdge(Graph::Edge edge)
     253void MapWin::updateEdge(Edge edge)
    254254{
    255255  for(int i=0;i<EDGE_PROPERTY_NUM;i++)
  • gui/mapstorage.cc

    r1634 r1643  
    117117}
    118118
    119 void MapStorage::initMapsForEdge(Graph::Edge e)
     119void MapStorage::initMapsForEdge(Edge e)
    120120{
    121121  std::map< std::string,Graph::EdgeMap<double> * >::iterator ems_it;
  • lemon/concept/graph.h

    r1631 r1643  
    405405        /// This constructor sets the iterator to the first edge of \c g.
    406406        ///@param g the graph
    407         EdgeIt(const StaticGraph& g) { }
     407        EdgeIt(const StaticGraph& g) { ignore_unused_variable_warning(g); }
    408408        /// Edge -> EdgeIt conversion
    409409
  • lemon/concept/path.h

    r1624 r1643  
    2525
    2626#include <lemon/invalid.h>
     27#include <lemon/concept_check.h>
    2728
    2829namespace lemon {
     
    5556      /// \param _g The graph in which the path is.
    5657      ///
    57       Path(const Graph &_g) {}
     58      Path(const Graph &_g) {
     59        ignore_unused_variable_warning(_g);
     60      }
    5861
    5962      /// Length of the path.
  • lemon/concept/undir_graph.h

    r1631 r1643  
    558558        /// This constructor sets the iterator to the first edge of \c g.
    559559        ///@param g the graph
    560         EdgeIt(const UndirGraph &g) { }
     560        EdgeIt(const UndirGraph &g) { ignore_unused_variable_warning(g); }
    561561        /// Edge -> EdgeIt conversion
    562562
     
    606606        ///@param n the node
    607607        ///@param g the graph
    608         OutEdgeIt(const UndirGraph& n, const Node& g) { }
     608        OutEdgeIt(const UndirGraph& n, const Node& g) {
     609          ignore_unused_variable_warning(n);
     610          ignore_unused_variable_warning(g);
     611        }
    609612        /// Edge -> OutEdgeIt conversion
    610613
     
    655658        ///@param n the node
    656659        ///@param g the graph
    657         InEdgeIt(const UndirGraph& g, const Node& n) { }
     660        InEdgeIt(const UndirGraph& g, const Node& n) {
     661          ignore_unused_variable_warning(n);
     662          ignore_unused_variable_warning(g);
     663        }
    658664        /// Edge -> InEdgeIt conversion
    659665
  • lemon/full_graph.h

    r1566 r1643  
    126126    protected:
    127127      int id;
    128       Node(int _id) { id = _id;}
     128      Node(int _id) : id(_id) {}
    129129    public:
    130130      Node() {}
    131       Node (Invalid) { id = -1; }
     131      Node (Invalid) : id(-1) {}
    132132      bool operator==(const Node node) const {return id == node.id;}
    133133      bool operator!=(const Node node) const {return id != node.id;}
     
    261261    Node source(Edge e) const {
    262262      /// \todo we may do it faster
    263       return ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;
     263      return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2);
    264264    }
    265265
    266266    Node target(Edge e) const {
    267267      int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;;
    268       return e.id - (source) * (source - 1) / 2;
     268      return Node(e.id - (source) * (source - 1) / 2);
    269269    }
    270270
Note: See TracChangeset for help on using the changeset viewer.