852 } |
852 } |
853 } |
853 } |
854 |
854 |
855 } |
855 } |
856 |
856 |
857 void GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname) |
857 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname) |
858 { |
858 { |
859 //create the new map |
859 //create the new map |
860 Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> (g,default_value); |
860 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 |
862 |
869 |
863 //add it to the list of the displayable maps |
870 //add it to the list of the displayable maps |
864 mapwin->registerNewEdgeMap(mapname); |
871 mapwin->registerNewEdgeMap(mapname); |
865 |
872 |
866 //display it |
873 //display it |
867 changeEdgeText(mapname); |
874 changeEdgeText(mapname); |
868 } |
875 |
869 |
876 return 0; |
870 void GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname) |
877 } |
|
878 |
|
879 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname) |
871 { |
880 { |
872 //create the new map |
881 //create the new map |
873 Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> (g,default_value); |
882 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 } |
875 |
890 |
876 //add it to the list of the displayable maps |
891 //add it to the list of the displayable maps |
877 mapwin->registerNewNodeMap(mapname); |
892 mapwin->registerNewNodeMap(mapname); |
878 |
893 |
879 //display it |
894 //display it |
880 changeNodeText(mapname); |
895 changeNodeText(mapname); |
881 } |
896 |
882 |
897 return 0; |
|
898 } |
|
899 |