Revert "remove remnants of hinting mechanism"

This reverts commit 7de428233e.
This commit is contained in:
Dennis Luxen 2015-01-05 12:57:34 +01:00
parent 061f46306f
commit b384340cbb
4 changed files with 24 additions and 8 deletions

View File

@ -78,11 +78,13 @@ struct RouteParameters
bool compression; bool compression;
bool deprecatedAPI; bool deprecatedAPI;
bool uturn_default; bool uturn_default;
unsigned check_sum;
short num_results; short num_results;
std::string service; std::string service;
std::string output_format; std::string output_format;
std::string jsonp_parameter; std::string jsonp_parameter;
std::string language; std::string language;
std::vector<std::string> hints;
std::vector<bool> uturns; std::vector<bool> uturns;
std::vector<FixedPointCoordinate> coordinates; std::vector<FixedPointCoordinate> coordinates;
}; };

View File

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
RouteParameters::RouteParameters() RouteParameters::RouteParameters()
: zoom_level(18), print_instructions(false), alternate_route(true), geometry(true), : zoom_level(18), print_instructions(false), alternate_route(true), geometry(true),
compression(true), deprecatedAPI(false), uturn_default(false), num_results(1) compression(true), deprecatedAPI(false), uturn_default(false), check_sum(-1), num_results(1)
{ {
} }
@ -77,7 +77,7 @@ void RouteParameters::setAllUTurns(const bool flag)
void RouteParameters::setDeprecatedAPIFlag(const std::string &) { deprecatedAPI = true; } void RouteParameters::setDeprecatedAPIFlag(const std::string &) { deprecatedAPI = true; }
void RouteParameters::setChecksum(const unsigned sum) { } void RouteParameters::setChecksum(const unsigned sum) { check_sum = sum; }
void RouteParameters::setInstructionFlag(const bool flag) { print_instructions = flag; } void RouteParameters::setInstructionFlag(const bool flag) { print_instructions = flag; }
@ -92,11 +92,11 @@ void RouteParameters::setJSONpParameter(const std::string &parameter)
void RouteParameters::addHint(const std::string &hint) void RouteParameters::addHint(const std::string &hint)
{ {
// hints.resize(coordinates.size()); hints.resize(coordinates.size());
// if (!hints.empty()) if (!hints.empty())
// { {
// hints.back() = hint; hints.back() = hint;
// } }
} }
void RouteParameters::setLanguage(const std::string &language_string) void RouteParameters::setLanguage(const std::string &language_string)

View File

@ -57,6 +57,8 @@ class HelloWorldPlugin final : public BasePlugin
temp_string = cast::integral_to_string(routeParameters.zoom_level); temp_string = cast::integral_to_string(routeParameters.zoom_level);
json_result.values["zoom_level"] = temp_string; json_result.values["zoom_level"] = temp_string;
temp_string = cast::integral_to_string(routeParameters.check_sum);
json_result.values["check_sum"] = temp_string;
json_result.values["instructions"] = (routeParameters.print_instructions ? "yes" : "no"); json_result.values["instructions"] = (routeParameters.print_instructions ? "yes" : "no");
json_result.values["geometry"] = (routeParameters.geometry ? "yes" : "no"); json_result.values["geometry"] = (routeParameters.geometry ? "yes" : "no");
json_result.values["compression"] = (routeParameters.compression ? "yes" : "no"); json_result.values["compression"] = (routeParameters.compression ? "yes" : "no");
@ -84,6 +86,16 @@ class HelloWorldPlugin final : public BasePlugin
++counter; ++counter;
} }
json_result.values["locations"] = json_locations; json_result.values["locations"] = json_locations;
json_result.values["hint_count"] = routeParameters.hints.size();
JSON::Array json_hints;
counter = 0;
for (const std::string &current_hint : routeParameters.hints)
{
json_hints.values.push_back(current_hint);
++counter;
}
json_result.values["hints"] = json_hints;
JSON::render(reply.content, json_result); JSON::render(reply.content, json_result);
} }

View File

@ -90,10 +90,12 @@ int main(int argc, const char *argv[])
route_parameters.alternate_route = true; // get an alternate route, too route_parameters.alternate_route = true; // get an alternate route, too
route_parameters.geometry = true; // retrieve geometry of route route_parameters.geometry = true; // retrieve geometry of route
route_parameters.compression = true; // polyline encoding route_parameters.compression = true; // polyline encoding
route_parameters.check_sum = UINT_MAX; // see wiki
route_parameters.service = "viaroute"; // that's routing route_parameters.service = "viaroute"; // that's routing
route_parameters.output_format = "json"; route_parameters.output_format = "json";
route_parameters.jsonp_parameter = ""; // set for jsonp wrapping route_parameters.jsonp_parameter = ""; // set for jsonp wrapping
route_parameters.language = ""; // unused atm route_parameters.language = ""; // unused atm
// route_parameters.hints.push_back(); // see wiki, saves I/O if done properly
// start_coordinate // start_coordinate
route_parameters.coordinates.emplace_back(52.519930 * COORDINATE_PRECISION, route_parameters.coordinates.emplace_back(52.519930 * COORDINATE_PRECISION,