COIN-OR::LEMON - Graph Library

Changeset 46:121452cc4096 in glemon-0.x for graph_displayer_canvas-event.cc


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

No maps with the same name can be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • graph_displayer_canvas-event.cc

    r45 r46  
    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.