void reach_client::on_mouse_down(int x, int y, int button) { boost::optional<my_graph::vertex_id> hover = get_vertex(*pgraph_, coord<int>(x, y)); if (button == 0) selected_ = hover; /*if (button == 1 && hover.is_initialized()) { if (marked_.count(*hover) == 0) marked_.insert(*hover); else marked_.erase(*hover); }*/ if (button == 1 && selected_.is_initialized()&& hover.is_initialized()) { run_astar(*selected_, *hover); } base_visualizer_client::on_mouse_down(x, y, button); }
int main(int argc, char** argv) { // parse arguments warthog::util::param valid_args[] = { {"scen", required_argument, 0, 0}, {"alg", required_argument, 0, 1}, {"gen", required_argument, 0, 3}, {"help", no_argument, &print_help, 1}, {"checkopt", no_argument, &checkopt, 1}, {"verbose", no_argument, &verbose, 1}, {"wgm", no_argument, &wgm, 1} }; warthog::util::cfg cfg; cfg.parse_args(argc, argv, valid_args); if(print_help) { help(); exit(0); } std::string sfile = cfg.get_param_value("scen"); std::string alg = cfg.get_param_value("alg"); std::string gen = cfg.get_param_value("gen"); // generate scenarios if(gen != "") { warthog::scenario_manager sm; warthog::gridmap gm(gen.c_str()); sm.generate_experiments(&gm, 1000) ; sm.write_scenario(std::cout); exit(0); } // run experiments if(alg == "" || sfile == "") { std::cerr << "Err. Must specify a scenario file and search algorithm. Try --help for options.\n"; exit(0); } warthog::scenario_manager scenmgr; scenmgr.load_scenario(sfile.c_str()); if(alg == "jps+") { run_jpsplus(scenmgr); } if(alg == "jps2") { run_jps2(scenmgr); } if(alg == "jps2+") { run_jps2plus(scenmgr); } if(alg == "jps") { if(wgm) { run_jps_wgm(scenmgr); } else { run_jps(scenmgr); } } if(alg == "astar") { if(wgm) { run_wgm_astar(scenmgr); } else { run_astar(scenmgr); } } if(alg == "sssp") { if(wgm) { run_wgm_sssp(scenmgr); } else { //run_astar(scenmgr); } } }