add parameter to choose algorithm for tsp calculation and remove redundant code

This commit is contained in:
Chau Nguyen
2015-07-10 12:25:35 -04:00
committed by Huyen Chau Nguyen
parent b15f8f68e4
commit 6191b6bee2
9 changed files with 39 additions and 655 deletions
+5 -2
View File
@@ -42,7 +42,7 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
*(query) >> -(uturns);
query = ('?') >> (+(zoom | output | jsonp | checksum | location | hint | timestamp | u | cmp |
language | instruction | geometry | alt_route | old_API | num_results |
matching_beta | gps_precision | classify | locs));
matching_beta | gps_precision | classify | tsp_algo | locs));
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >>
qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
@@ -85,6 +85,8 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
qi::bool_[boost::bind(&HandlerT::setClassify, handler, ::_1)];
locs = (-qi::lit('&')) >> qi::lit("locs") >> '=' >>
stringforPolyline[boost::bind(&HandlerT::getCoordinatesFromGeometry, handler, ::_1)];
tsp_algo = (-qi::lit('&')) >> qi::lit("tsp_algo") >> '=' >>
string[boost::bind(&HandlerT::setTSPAlgo, handler, ::_1)];
string = +(qi::char_("a-zA-Z"));
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
@@ -96,7 +98,8 @@ template <typename Iterator, class HandlerT> struct APIGrammar : qi::grammar<Ite
qi::rule<Iterator> api_call, query;
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location,
hint, timestamp, stringwithDot, stringwithPercent, language, instruction, geometry, cmp, alt_route, u,
uturns, old_API, num_results, matching_beta, gps_precision, classify, locs, stringforPolyline;
uturns, old_API, num_results, matching_beta, gps_precision, classify, locs, stringforPolyline, tsp_algo;
uturns, old_API, num_results, matching_beta, gps_precision, classify, tsp_algo;
HandlerT *handler;
};