graph_displayer_canvas-event.cc
branchgui
changeset 46 121452cc4096
parent 45 199f433eb7cd
child 47 9a0e6e92d06c
     1.1 --- a/graph_displayer_canvas-event.cc	Wed Jul 27 11:19:35 2005 +0000
     1.2 +++ b/graph_displayer_canvas-event.cc	Wed Jul 27 11:35:13 2005 +0000
     1.3 @@ -854,29 +854,46 @@
     1.4  
     1.5  }
     1.6  
     1.7 -void GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
     1.8 +int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)
     1.9  {
    1.10    //create the new map
    1.11    Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (g,default_value);
    1.12 -  mapstorage.addEdgeMap(mapname,emptr);
    1.13 +
    1.14 +  //if addition was not successful addEdgeMap returns one.
    1.15 +  //cause can be that there is already a map named like the new one
    1.16 +  if(mapstorage.addEdgeMap(mapname,emptr))
    1.17 +    {
    1.18 +      return 1;
    1.19 +    }
    1.20 +
    1.21  
    1.22    //add it to the list of the displayable maps
    1.23    mapwin->registerNewEdgeMap(mapname);
    1.24  
    1.25    //display it
    1.26    changeEdgeText(mapname);
    1.27 +
    1.28 +  return 0;
    1.29  }
    1.30  
    1.31 -void GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
    1.32 +int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname)
    1.33  {
    1.34    //create the new map
    1.35    Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (g,default_value);
    1.36 -  mapstorage.addNodeMap(mapname,emptr);
    1.37 +
    1.38 +  //if addition was not successful addNodeMap returns one.
    1.39 +  //cause can be that there is already a map named like the new one
    1.40 +  if(mapstorage.addNodeMap(mapname,emptr))
    1.41 +    {
    1.42 +      return 1;
    1.43 +    }
    1.44  
    1.45    //add it to the list of the displayable maps
    1.46    mapwin->registerNewNodeMap(mapname);
    1.47  
    1.48    //display it
    1.49    changeNodeText(mapname);
    1.50 +
    1.51 +  return 0;
    1.52  }
    1.53