Changeset 1879:01d41844ef46 in lemon-0.x
- Timestamp:
- 01/05/06 17:54:34 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2454
- Location:
- gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
gui/algobox.cc
r1878 r1879 60 60 } 61 61 62 void AlgoBox::update_maplist( void* ms)62 void AlgoBox::update_maplist(MapStorage * ms) 63 63 { 64 mapstorage= (MapStorage *)ms;64 mapstorage=ms; 65 65 std::vector<std::string> nml; 66 66 std::vector<std::string> eml; … … 70 70 mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed)); 71 71 nml=mapstorage->getNodeMapList(); 72 eml=mapstorage->get NodeMapList();72 eml=mapstorage->getEdgeMapList(); 73 73 } 74 74 for(int i=0;i<(int)nodemapcbts.size();i++) -
gui/algobox.h
r1878 r1879 34 34 35 35 void update_tablist( std::vector< std::string > tl ); 36 void update_maplist( void* );36 void update_maplist( MapStorage * ); 37 37 38 38 void nodemaplist_changed(std::string); -
gui/algowin.cc
r1878 r1879 72 72 } 73 73 74 void AlgoWin::update_maplist( void* mapstorage)74 void AlgoWin::update_maplist(MapStorage * mapstorage) 75 75 { 76 76 ab->update_maplist(mapstorage); -
gui/algowin.h
r1878 r1879 7 7 8 8 #include <all_include.h> 9 //#include <mapstorage.h> 9 10 #include <algobox.h> 10 11 #include <libgnomecanvasmm.h> 11 12 #include <libgnomecanvasmm/polygon.h> 13 14 class MapStorage; 12 15 13 16 enum {GENERAL, KRUSKAL, ALGO_NUM}; // algorithm IDs; … … 35 38 36 39 void update_tablist(std::vector<std::string> tabnames); 37 void update_maplist( void*);40 void update_maplist(MapStorage *); 38 41 39 42 void on_hide(); -
gui/graph_displayer_canvas-event.cc
r1860 r1879 851 851 } 852 852 } 853 854 } 855 856 int GraphDisplayerCanvas::addNewEdgeMap(double default_value, std::string mapname) 857 { 858 //create the new map 859 Graph::EdgeMap<double> * emptr=new Graph::EdgeMap<double> ((mytab.mapstorage).graph, default_value); 860 861 //if addition was not successful addEdgeMap returns one. 862 //cause can be that there is already a map named like the new one 863 if((mytab.mapstorage).addEdgeMap(mapname,emptr, default_value)) 864 { 865 return 1; 866 } 867 868 869 //add it to the list of the displayable maps 870 mytab.registerNewEdgeMap(mapname); 871 872 //display it 873 changeEdgeText(mapname); 874 875 return 0; 876 } 877 878 int GraphDisplayerCanvas::addNewNodeMap(double default_value, std::string mapname) 879 { 880 //create the new map 881 Graph::NodeMap<double> * emptr=new Graph::NodeMap<double> ((mytab.mapstorage).graph,default_value); 882 883 //if addition was not successful addNodeMap returns one. 884 //cause can be that there is already a map named like the new one 885 if((mytab.mapstorage).addNodeMap(mapname,emptr, default_value)) 886 { 887 return 1; 888 } 889 890 //add it to the list of the displayable maps 891 mytab.registerNewNodeMap(mapname); 892 893 //display it 894 changeNodeText(mapname); 895 896 return 0; 897 } 898 853 } -
gui/kruskalbox.cc
r1878 r1879 1 1 #include <kruskalbox.h> 2 3 enum {INPUT, OUTPUT, MAP_NUM}; 2 4 3 5 KruskalBox::KruskalBox(std::vector<std::string> t):AlgoBox() … … 8 10 void KruskalBox::run() 9 11 { 10 11 std::cout << "Kruskal inditasa, de meg nincsen keszen." << std::endl; 12 Graph g=mapstorage->graph; 13 Graph::EdgeMap<double> * inputmap=((mapstorage->edgemap_storage)[(edgemapcbts[INPUT])->get_active_text()]); 14 Graph::EdgeMap<bool> outputmap(g); 15 double res=kruskal(g, *inputmap, outputmap); 16 17 for (EdgeIt i(g); i!=INVALID; ++i) 18 { 19 if(outputmap[i]) 20 { 21 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->get_active_text()]))[i]=1; 22 } 23 else 24 { 25 (*((mapstorage->edgemap_storage)[(edgemapcbts[OUTPUT])->get_active_text()]))[i]=0; 26 } 27 } 28 29 std::ostringstream o; 30 o << "Result: " << res; 31 resultlabel.set_text(o.str()); 32 33 mapstorage->changeActiveMap(true, E_COLOR, (edgemapcbts[OUTPUT])->get_active_text()); 34 mapstorage->changeActiveMap(true, E_TEXT, (edgemapcbts[INPUT])->get_active_text()); 12 35 } 13 36 14 37 void KruskalBox::build_box() 15 38 { 16 edgemapcbts.resize( 1);17 Gtk::HBox * hbox =new Gtk::HBox();39 edgemapcbts.resize(MAP_NUM); 40 Gtk::HBox * hbox; 18 41 19 std::ostringstream o;20 o << "Edgecosts: "; 21 label=new Gtk::Label( o.str());42 hbox=new Gtk::HBox(); 43 44 label=new Gtk::Label("Edgecosts: "); 22 45 23 46 edgemapcbts[0]=new Gtk::ComboBoxText(); 24 47 25 48 hbox->pack_start(*label); 26 hbox->pack_start(*(edgemapcbts[ 0]));49 hbox->pack_start(*(edgemapcbts[INPUT])); 27 50 pack_start(*hbox); 51 52 hbox=new Gtk::HBox(); 53 54 label=new Gtk::Label("Edges of tree here: "); 55 56 edgemapcbts[1]=new Gtk::ComboBoxText(); 57 58 hbox->pack_start(*label); 59 hbox->pack_start(*(edgemapcbts[OUTPUT])); 60 pack_start(*hbox); 61 62 resultlabel.set_text("Result: algorithm is not run yet."); 63 pack_start(resultlabel); 28 64 } -
gui/kruskalbox.h
r1878 r1879 14 14 class KruskalBox : public AlgoBox 15 15 { 16 Gtk::Label resultlabel; 17 16 18 public: 17 19 KruskalBox(std::vector<std::string> t); -
gui/new_map_win.cc
r1878 r1879 121 121 } 122 122 polishstack.push(atof(def_val_ch)); 123 delete def_val_ch; 123 124 } 124 125 operation=false; … … 165 166 //display it 166 167 //gdc.changeEdgeText(mapname); 168 169 //delete emptr; 167 170 } 168 171 else //!edge.get_active() … … 205 208 } 206 209 polishstack.push(atof(def_val_ch)); 210 delete def_val_ch; 207 211 } 208 212 operation=false; … … 249 253 //display it 250 254 //gdc.changeNodeText(mapname); 255 256 //delete emptr; 251 257 } 252 258 if(!abortion)
Note: See TracChangeset
for help on using the changeset viewer.