Skip to content

Commit

Permalink
Revert "remove remnants of hinting mechanism"
Browse files Browse the repository at this point in the history
This reverts commit 7de4282.
  • Loading branch information
DennisOSRM committed Jan 5, 2015
1 parent 061f463 commit b384340
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Include/osrm/RouteParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct RouteParameters
RouteParameters();

void setZoomLevel(const short level);

void setNumberOfResults(const short number);

void setAlternateRouteFlag(const bool flag);
Expand Down Expand Up @@ -78,11 +78,13 @@ struct RouteParameters
bool compression;
bool deprecatedAPI;
bool uturn_default;
unsigned check_sum;
short num_results;
std::string service;
std::string output_format;
std::string jsonp_parameter;
std::string language;
std::vector<std::string> hints;
std::vector<bool> uturns;
std::vector<FixedPointCoordinate> coordinates;
};
Expand Down
14 changes: 7 additions & 7 deletions data_structures/route_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

RouteParameters::RouteParameters()
: 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)
{
}

Expand Down Expand Up @@ -77,7 +77,7 @@ void RouteParameters::setAllUTurns(const bool flag)

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; }

Expand All @@ -92,11 +92,11 @@ void RouteParameters::setJSONpParameter(const std::string &parameter)

void RouteParameters::addHint(const std::string &hint)
{
// hints.resize(coordinates.size());
// if (!hints.empty())
// {
// hints.back() = hint;
// }
hints.resize(coordinates.size());
if (!hints.empty())
{
hints.back() = hint;
}
}

void RouteParameters::setLanguage(const std::string &language_string)
Expand Down
12 changes: 12 additions & 0 deletions plugins/hello_world.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class HelloWorldPlugin final : public BasePlugin
temp_string = cast::integral_to_string(routeParameters.zoom_level);
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["geometry"] = (routeParameters.geometry ? "yes" : "no");
json_result.values["compression"] = (routeParameters.compression ? "yes" : "no");
Expand Down Expand Up @@ -84,6 +86,16 @@ class HelloWorldPlugin final : public BasePlugin
++counter;
}
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);
}
Expand Down
2 changes: 2 additions & 0 deletions tools/simpleclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ int main(int argc, const char *argv[])
route_parameters.alternate_route = true; // get an alternate route, too
route_parameters.geometry = true; // retrieve geometry of route
route_parameters.compression = true; // polyline encoding
route_parameters.check_sum = UINT_MAX; // see wiki
route_parameters.service = "viaroute"; // that's routing
route_parameters.output_format = "json";
route_parameters.jsonp_parameter = ""; // set for jsonp wrapping
route_parameters.language = ""; // unused atm
// route_parameters.hints.push_back(); // see wiki, saves I/O if done properly

// start_coordinate
route_parameters.coordinates.emplace_back(52.519930 * COORDINATE_PRECISION,
Expand Down

0 comments on commit b384340

Please sign in to comment.