Communication with algorithm window is developed.
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, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
8 init(tabnames, nodemapnames, edgemapnames);
11 void AlgoBox::init(std::vector<std::string> tabnames, std::vector<std::string> nodemapnames, std::vector<std::string> edgemapnames)
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));
24 update_maplist(nodemapnames, edgemapnames);
29 void AlgoBox::update_cbt(std::vector< std::string > stringlist, Gtk::ComboBoxText & cbt)
31 std::string actname=cbt.get_active_text();
37 std::vector< std::string >::iterator emsi=stringlist.begin();
38 for(;emsi!=stringlist.end();emsi++)
45 cbt.append_text(*emsi);
51 cbt.set_active(prev_act);
53 else if(actptr>0) //so there is item in the list
59 void AlgoBox::update_tablist( std::vector< std::string > tl )
61 update_cbt(tl, tabcbt);
65 void AlgoBox::update_maplist( std::vector< std::string > nml, std::vector< std::string > eml )
67 for(int i=0;i<(int)nodemapcbts.size();i++)
69 update_cbt(nml, *(nodemapcbts[i]));
71 for(int i=0;i<(int)edgemapcbts.size();i++)
73 update_cbt(eml, *(edgemapcbts[i]));
79 std::cout << "Start algorithm." << std::endl;
82 void AlgoBox::build_box()
84 pack_start(*(new Gtk::HSeparator()));
86 label=new Gtk::Label("Specific part for each algorithm.");
89 pack_start(*(new Gtk::HSeparator()));
91 label=new Gtk::Label("Maps in chosen tab:");
95 nodemapcbts.resize(NODE_INPUT_NUM);
96 for(int i=0;i<(int)nodemapcbts.size();i++)
98 Gtk::HBox * hbox=new Gtk::HBox();
100 std::ostringstream o;
101 o << "NodeInput " << i+1 << ":";
102 label=new Gtk::Label(o.str());
104 nodemapcbts[i]=new Gtk::ComboBoxText();
106 hbox->pack_start(*label);
107 hbox->pack_start(*(nodemapcbts[i]));
111 pack_start(*(new Gtk::HSeparator()));
113 edgemapcbts.resize(EDGE_INPUT_NUM);
114 for(int i=0;i<(int)edgemapcbts.size();i++)
116 Gtk::HBox * hbox=new Gtk::HBox();
118 std::ostringstream o;
119 o << "EdgeInput " << i+1 << ":";
120 label=new Gtk::Label(o.str());
122 edgemapcbts[i]=new Gtk::ComboBoxText();
124 hbox->pack_start(*label);
125 hbox->pack_start(*(edgemapcbts[i]));
129 pack_start(*(new Gtk::HSeparator()));
132 sigc::signal<void, std::string> AlgoBox::signal_maplist_needed()
134 return signal_maplist_need;
137 void AlgoBox::emit_tab_change()
139 signal_maplist_need.emit(tabcbt.get_active_text());