Result of KruskalGUIAlgo is refreshed if displayed, but no more setin a forced way.
3 enum {N_DEMO1, N_DEMO2, NODE_INPUT_NUM}; // input IDs for nodes;
4 enum {E_DEMO1, EDGE_INPUT_NUM}; // input IDs for edges;
6 AlgoBox::AlgoBox(std::vector<std::string> tabnames)
11 void AlgoBox::init(std::vector<std::string> tabnames)
15 update_tablist(tabnames);
17 //if active tab is changed, the map names in cbt/s have to be updated
18 tabcbt.signal_changed().connect(sigc::mem_fun(*this, &AlgoBox::emit_tab_change));
26 void AlgoBox::update_cbt(std::vector< std::string > stringlist, Gtk::ComboBoxText & cbt)
28 std::string actname=cbt.get_active_text();
34 std::vector< std::string >::iterator emsi=stringlist.begin();
35 for(;emsi!=stringlist.end();emsi++)
42 cbt.append_text(*emsi);
48 cbt.set_active(prev_act);
50 else if(actptr>0) //so there is item in the list
56 void AlgoBox::update_tablist( std::vector< std::string > tl )
58 update_cbt(tl, tabcbt);
62 void AlgoBox::update_maplist(MapStorage * ms)
65 std::vector<std::string> nml;
66 std::vector<std::string> eml;
69 mapstorage->signal_node_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::nodemaplist_changed));
70 mapstorage->signal_edge_map_ch().connect(sigc::mem_fun(*this, &AlgoBox::edgemaplist_changed));
71 nml=mapstorage->getNodeMapList();
72 eml=mapstorage->getEdgeMapList();
74 for(int i=0;i<(int)nodemapcbts.size();i++)
76 update_cbt(nml, *(nodemapcbts[i]));
78 for(int i=0;i<(int)edgemapcbts.size();i++)
80 update_cbt(eml, *(edgemapcbts[i]));
84 void AlgoBox::nodemaplist_changed(std::string newmap)
86 for(int i=0;i<(int)nodemapcbts.size();i++)
88 (nodemapcbts[i])->append_text(newmap);
92 void AlgoBox::edgemaplist_changed(std::string newmap)
94 for(int i=0;i<(int)edgemapcbts.size();i++)
96 (edgemapcbts[i])->append_text(newmap);
102 std::cout << "Start algorithm." << std::endl;
105 void AlgoBox::build_box()
107 pack_start(*(new Gtk::HSeparator()));
109 label=new Gtk::Label("Specific part for each algorithm.");
112 pack_start(*(new Gtk::HSeparator()));
114 label=new Gtk::Label("Maps in chosen tab:");
118 nodemapcbts.resize(NODE_INPUT_NUM);
119 for(int i=0;i<(int)nodemapcbts.size();i++)
121 Gtk::HBox * hbox=new Gtk::HBox();
123 std::ostringstream o;
124 o << "NodeInput " << i+1 << ":";
125 label=new Gtk::Label(o.str());
127 nodemapcbts[i]=new Gtk::ComboBoxText();
129 hbox->pack_start(*label);
130 hbox->pack_start(*(nodemapcbts[i]));
134 pack_start(*(new Gtk::HSeparator()));
136 edgemapcbts.resize(EDGE_INPUT_NUM);
137 for(int i=0;i<(int)edgemapcbts.size();i++)
139 Gtk::HBox * hbox=new Gtk::HBox();
141 std::ostringstream o;
142 o << "EdgeInput " << i+1 << ":";
143 label=new Gtk::Label(o.str());
145 edgemapcbts[i]=new Gtk::ComboBoxText();
147 hbox->pack_start(*label);
148 hbox->pack_start(*(edgemapcbts[i]));
152 pack_start(*(new Gtk::HSeparator()));
155 sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
157 return signal_maplist_need;
160 void AlgoBox::emit_tab_change()
162 std::string active_tab=tabcbt.get_active_text();
165 signal_maplist_need.emit(active_tab);
169 std::vector<std::string> empty_vector;
170 update_maplist(NULL);