Changeset 46:121452cc4096 in glemon-0.x
- Timestamp:
- 07/27/05 13:35:13 (19 years ago)
- Branch:
- gui
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk/gui@2101
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-event.cc
r45 r46 855 855 } 856 856 857 voidGraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname)857 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname) 858 858 { 859 859 //create the new map 860 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 870 //add it to the list of the displayable maps … … 866 873 //display it 867 874 changeEdgeText(mapname); 868 } 869 870 void GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname) 875 876 return 0; 877 } 878 879 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname) 871 880 { 872 881 //create the new map 873 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 891 //add it to the list of the displayable maps … … 879 894 //display it 880 895 changeNodeText(mapname); 881 } 882 896 897 return 0; 898 } 899 -
graph_displayer_canvas.h
r41 r46 111 111 112 112 ///creates a new Nodemap 113 voidaddNewNodeMap(double,std::string);113 int addNewNodeMap(double,std::string); 114 114 ///creates a new Edgemap 115 voidaddNewEdgeMap(double,std::string);115 int addNewEdgeMap(double,std::string); 116 116 117 117 private: -
mapstorage.cc
r31 r46 7 7 int MapStorage::addNodeMap(const std::string & name, Graph::NodeMap<double> *nodemap) 8 8 { 9 nodemap_storage[name]=nodemap; 10 return 0; 9 if( nodemap_storage.find(name) == nodemap_storage.end() ) 10 { 11 nodemap_storage[name]=nodemap; 12 return 0; 13 } 14 return 1; 11 15 } 12 16 13 17 int MapStorage::addEdgeMap(const std::string & name, Graph::EdgeMap<double> *edgemap) 14 18 { 15 edgemap_storage[name]=edgemap; 16 return 0; 19 if( edgemap_storage.find(name) == edgemap_storage.end() ) 20 { 21 edgemap_storage[name]=edgemap; 22 return 0; 23 } 24 return 1; 17 25 } 18 26 -
new_map_win.cc
r42 r46 90 90 if((point_num<=1)&&(valid_double)&&(!mapname.empty())) 91 91 { 92 int abortion=0; 92 93 if(edge.get_active()) 93 94 { 94 gdc.addNewEdgeMap(def_val,mapname);95 abortion=gdc.addNewEdgeMap(def_val,mapname); 95 96 } 96 97 else 97 98 { 98 gdc.addNewNodeMap(def_val,mapname);99 abortion=gdc.addNewNodeMap(def_val,mapname); 99 100 } 100 name.set_text(""); 101 default_value.set_text("0"); 102 hide(); 101 if(!abortion) 102 { 103 name.set_text(""); 104 default_value.set_text("0"); 105 hide(); 106 } 103 107 } 104 108 }
Note: See TracChangeset
for help on using the changeset viewer.