COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
07/27/05 13:35:13 (19 years ago)
Author:
Hegyi Péter
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2101
Message:

No maps with the same name can be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gui/graph_displayer_canvas-event.cc

    r1596 r1597  
    855855}
    856856
    857 void GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
     857int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
    858858{
    859859  //create the new map
    860860  Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (g,default_value);
    861   mapstorage.addEdgeMap(mapname,emptr);
     861
     862  //if addition was not successful addEdgeMap returns one.
     863  //cause can be that there is already a map named like the new one
     864  if(mapstorage.addEdgeMap(mapname,emptr))
     865    {
     866      return 1;
     867    }
     868
    862869
    863870  //add it to the list of the displayable maps
     
    866873  //display it
    867874  changeEdgeText(mapname);
    868 }
    869 
    870 void GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
     875
     876  return 0;
     877}
     878
     879int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
    871880{
    872881  //create the new map
    873882  Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (g,default_value);
    874   mapstorage.addNodeMap(mapname,emptr);
     883
     884  //if addition was not successful addNodeMap returns one.
     885  //cause can be that there is already a map named like the new one
     886  if(mapstorage.addNodeMap(mapname,emptr))
     887    {
     888      return 1;
     889    }
    875890
    876891  //add it to the list of the displayable maps
     
    879894  //display it
    880895  changeNodeText(mapname);
    881 }
    882 
     896
     897  return 0;
     898}
     899
Note: See TracChangeset for help on using the changeset viewer.