rebasing branch on develop and adding new API features
This commit is contained in:
parent
954710d6cc
commit
aeff6c8caa
@ -29,11 +29,13 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
#include "../DataStructures/Coordinate.h"
|
#include "../DataStructures/Coordinate.h"
|
||||||
|
|
||||||
struct RouteParameters {
|
struct RouteParameters {
|
||||||
RouteParameters() : zoomLevel(18), printInstructions(false), geometry(true), compression(true), checkSum(-1) {}
|
RouteParameters() : zoomLevel(18), printInstructions(false), alternateRoute(true), geometry(true), compression(true), deprecatedAPI(false), checkSum(-1) {}
|
||||||
short zoomLevel;
|
short zoomLevel;
|
||||||
bool printInstructions;
|
bool printInstructions;
|
||||||
|
bool alternateRoute;
|
||||||
bool geometry;
|
bool geometry;
|
||||||
bool compression;
|
bool compression;
|
||||||
|
bool deprecatedAPI;
|
||||||
int checkSum;
|
int checkSum;
|
||||||
std::string service;
|
std::string service;
|
||||||
std::string outputFormat;
|
std::string outputFormat;
|
||||||
@ -48,6 +50,14 @@ struct RouteParameters {
|
|||||||
zoomLevel = i;
|
zoomLevel = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAlternateRouteFlag(const bool b) {
|
||||||
|
alternateRoute = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDeprecatedAPIFlag(const std::string &) {
|
||||||
|
deprecatedAPI = true;
|
||||||
|
}
|
||||||
|
|
||||||
void setChecksum(const int c) {
|
void setChecksum(const int c) {
|
||||||
checkSum = c;
|
checkSum = c;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public:
|
|||||||
segmentPhantomNodes.targetPhantom = phantomNodeVector[i+1];
|
segmentPhantomNodes.targetPhantom = phantomNodeVector[i+1];
|
||||||
rawRoute.segmentEndCoordinates.push_back(segmentPhantomNodes);
|
rawRoute.segmentEndCoordinates.push_back(segmentPhantomNodes);
|
||||||
}
|
}
|
||||||
if(( "false" != routeParameters.options.Find("alt") ) && (1 == rawRoute.segmentEndCoordinates.size())) {
|
if( ( routeParameters.alternateRoute ) && (1 == rawRoute.segmentEndCoordinates.size()) ) {
|
||||||
// INFO("Checking for alternative paths");
|
// INFO("Checking for alternative paths");
|
||||||
searchEngine->alternativePaths(rawRoute.segmentEndCoordinates[0], rawRoute);
|
searchEngine->alternativePaths(rawRoute.segmentEndCoordinates[0], rawRoute);
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ template <typename Iterator, class HandlerT>
|
|||||||
struct APIGrammar : qi::grammar<Iterator> {
|
struct APIGrammar : qi::grammar<Iterator> {
|
||||||
APIGrammar(HandlerT * h) : APIGrammar::base_type(api_call), handler(h) {
|
APIGrammar(HandlerT * h) : APIGrammar::base_type(api_call), handler(h) {
|
||||||
api_call = qi::lit('/') >> string[boost::bind(&HandlerT::setService, handler, ::_1)] >> ('?') >> query;
|
api_call = qi::lit('/') >> string[boost::bind(&HandlerT::setService, handler, ::_1)] >> ('?') >> query;
|
||||||
query = (*(zoom | output | jsonp | checksum | location | hint | compressed_geometry | language | instruction) ) ;
|
query = (*(zoom | output | jsonp | checksum | location | hint | compressed_geometry | language | instruction | alt_route | old_API) ) ;
|
||||||
|
|
||||||
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >> qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
|
zoom = (-qi::lit('&')) >> qi::lit('z') >> '=' >> qi::short_[boost::bind(&HandlerT::setZoomLevel, handler, ::_1)];
|
||||||
output = (-qi::lit('&')) >> qi::lit("output") >> '=' >> string[boost::bind(&HandlerT::setOutputFormat, handler, ::_1)];
|
output = (-qi::lit('&')) >> qi::lit("output") >> '=' >> string[boost::bind(&HandlerT::setOutputFormat, handler, ::_1)];
|
||||||
@ -45,12 +45,16 @@ struct APIGrammar : qi::grammar<Iterator> {
|
|||||||
location = (-qi::lit('&')) >> qi::lit("loc") >> '=' >> (qi::double_ >> qi::lit(',') >> qi::double_)[boost::bind(&HandlerT::addCoordinate, handler, ::_1)];
|
location = (-qi::lit('&')) >> qi::lit("loc") >> '=' >> (qi::double_ >> qi::lit(',') >> qi::double_)[boost::bind(&HandlerT::addCoordinate, handler, ::_1)];
|
||||||
hint = (-qi::lit('&')) >> qi::lit("hint") >> '=' >> stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)];
|
hint = (-qi::lit('&')) >> qi::lit("hint") >> '=' >> stringwithDot[boost::bind(&HandlerT::addHint, handler, ::_1)];
|
||||||
language = (-qi::lit('&')) >> qi::lit("hl") >> '=' >> string[boost::bind(&HandlerT::setLanguage, handler, ::_1)];
|
language = (-qi::lit('&')) >> qi::lit("hl") >> '=' >> string[boost::bind(&HandlerT::setLanguage, handler, ::_1)];
|
||||||
|
alt_route = (-qi::lit('&')) >> qi::lit("alt") >> '=' >> qi::bool_[boost::bind(&HandlerT::setAlternateRouteFlag, handler, ::_1)];
|
||||||
|
old_API = (-qi::lit('&')) >> qi::lit("geomformat") >> '=' >> string[boost::bind(&HandlerT::setDeprecatedAPIFlag, handler, ::_1)];
|
||||||
|
|
||||||
string = +(qi::char_("a-zA-Z"));
|
string = +(qi::char_("a-zA-Z"));
|
||||||
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
|
stringwithDot = +(qi::char_("a-zA-Z0-9_.-"));
|
||||||
}
|
}
|
||||||
qi::rule<Iterator> api_call, query;
|
qi::rule<Iterator> api_call, query;
|
||||||
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location, hint, compressed_geometry, stringwithDot, language, instruction, geometry, cmp;
|
qi::rule<Iterator, std::string()> service, zoom, output, string, jsonp, checksum, location, hint,
|
||||||
|
compressed_geometry, stringwithDot, language, instruction, geometry,
|
||||||
|
cmp, alt_route, old_API;
|
||||||
|
|
||||||
HandlerT * handler;
|
HandlerT * handler;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user