Rename alternative -> alternatives
This commit is contained in:
parent
6c00ccca9a
commit
5f457bff12
@ -30,18 +30,18 @@ struct RouteParameters : public BaseParameters
|
||||
|
||||
template <typename... Args>
|
||||
RouteParameters(const bool steps_,
|
||||
const bool alternative_,
|
||||
const bool alternatives_,
|
||||
const GeometriesType geometries_,
|
||||
const OverviewType overview_,
|
||||
std::vector<boost::optional<bool>> uturns_,
|
||||
Args... args_)
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternative{alternative_},
|
||||
: BaseParameters{std::forward<Args>(args_)...}, steps{steps_}, alternatives{alternatives_},
|
||||
geometries{geometries_}, overview{overview_}, uturns{std::move(uturns_)}
|
||||
{
|
||||
}
|
||||
|
||||
bool steps = true;
|
||||
bool alternative = true;
|
||||
bool alternatives = true;
|
||||
GeometriesType geometries = GeometriesType::Polyline;
|
||||
OverviewType overview = OverviewType::Simplified;
|
||||
std::vector<boost::optional<bool>> uturns;
|
||||
|
@ -56,16 +56,16 @@ struct RouteParametersGrammar : public BaseParametersGrammar
|
||||
{
|
||||
parameters.steps = steps;
|
||||
};
|
||||
const auto set_alternative = [this](const AlternativeT alternative)
|
||||
const auto set_alternatives = [this](const AlternativeT alternatives)
|
||||
{
|
||||
parameters.alternative = alternative;
|
||||
parameters.alternatives = alternatives;
|
||||
};
|
||||
const auto set_uturns = [this](UturnsT &uturns)
|
||||
{
|
||||
parameters.uturns = std::move(uturns);
|
||||
};
|
||||
|
||||
alternative_rule = qi::lit("alternative=") >> qi::bool_;
|
||||
alternatives_rule = qi::lit("alternatives=") >> qi::bool_;
|
||||
steps_rule = qi::lit("steps=") >> qi::bool_;
|
||||
geometries_rule = qi::lit("geometries=geojson")[set_geojson_type] |
|
||||
qi::lit("geometries=polyline")[set_polyline_type];
|
||||
@ -73,7 +73,7 @@ struct RouteParametersGrammar : public BaseParametersGrammar
|
||||
qi::lit("overview=full")[set_full_type] |
|
||||
qi::lit("overview=false")[set_false_type];
|
||||
uturns_rule = qi::lit("uturns=") >> -qi::bool_ % ";";
|
||||
route_rule = steps_rule[set_steps] | alternative_rule[set_alternative] | geometries_rule |
|
||||
route_rule = steps_rule[set_steps] | alternatives_rule[set_alternatives] | geometries_rule |
|
||||
overview_rule | uturns_rule[set_uturns];
|
||||
|
||||
root_rule =
|
||||
@ -87,7 +87,7 @@ struct RouteParametersGrammar : public BaseParametersGrammar
|
||||
qi::rule<Iterator> route_rule, geometries_rule, overview_rule;
|
||||
qi::rule<Iterator, UturnsT()> uturns_rule;
|
||||
qi::rule<Iterator, StepsT()> steps_rule;
|
||||
qi::rule<Iterator, AlternativeT()> alternative_rule;
|
||||
qi::rule<Iterator, AlternativeT()> alternatives_rule;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter
|
||||
|
||||
if (1 == raw_route.segment_end_coordinates.size())
|
||||
{
|
||||
if (route_parameters.alternative && facade.GetCoreSize() == 0)
|
||||
if (route_parameters.alternatives && facade.GetCoreSize() == 0)
|
||||
{
|
||||
alternative_path(raw_route.segment_end_coordinates.front(), raw_route);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(invalid_route_urls)
|
||||
testInvalidOptions<engine::api::RouteParameters>("1,2;3,4?overview=false&overview=foo"),
|
||||
22L);
|
||||
BOOST_CHECK_EQUAL(
|
||||
testInvalidOptions<engine::api::RouteParameters>("1,2;3,4?overview=false&alternative=foo"),
|
||||
testInvalidOptions<engine::api::RouteParameters>("1,2;3,4?overview=false&alternatives=foo"),
|
||||
22UL);
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
auto result_1 = api::parseParameters<engine::api::RouteParameters>("1,2;3,4");
|
||||
BOOST_CHECK(result_1);
|
||||
BOOST_CHECK_EQUAL(reference_1.steps, result_1->steps);
|
||||
BOOST_CHECK_EQUAL(reference_1.alternative, result_1->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_1.alternatives, result_1->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_1.geometries, result_1->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_1.overview, result_1->overview);
|
||||
CHECK_EQUAL_RANGE(reference_1.uturns, result_1->uturns);
|
||||
@ -140,10 +140,10 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
engine::api::RouteParameters reference_2{};
|
||||
reference_2.coordinates = coords_1;
|
||||
auto result_2 = api::parseParameters<engine::api::RouteParameters>(
|
||||
"1,2;3,4?steps=true&alternative=true&geometries=polyline&overview=simplified");
|
||||
"1,2;3,4?steps=true&alternatives=true&geometries=polyline&overview=simplified");
|
||||
BOOST_CHECK(result_2);
|
||||
BOOST_CHECK_EQUAL(reference_2.steps, result_2->steps);
|
||||
BOOST_CHECK_EQUAL(reference_2.alternative, result_2->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_2.alternatives, result_2->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_2.geometries, result_2->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_2.overview, result_2->overview);
|
||||
CHECK_EQUAL_RANGE(reference_2.uturns, result_2->uturns);
|
||||
@ -157,11 +157,11 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
engine::api::RouteParameters::OverviewType::False, uturns_3};
|
||||
reference_3.coordinates = coords_1;
|
||||
auto result_3 = api::parseParameters<engine::api::RouteParameters>(
|
||||
"1,2;3,4?steps=false&alternative=false&geometries=geojson&overview=false&uturns=true;"
|
||||
"1,2;3,4?steps=false&alternatives=false&geometries=geojson&overview=false&uturns=true;"
|
||||
"false;");
|
||||
BOOST_CHECK(result_3);
|
||||
BOOST_CHECK_EQUAL(reference_3.steps, result_3->steps);
|
||||
BOOST_CHECK_EQUAL(reference_3.alternative, result_3->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_3.alternatives, result_3->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_3.geometries, result_3->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_3.overview, result_3->overview);
|
||||
CHECK_EQUAL_RANGE(reference_3.uturns, result_3->uturns);
|
||||
@ -193,7 +193,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
"3wEAAAYAAAAQAAAAB4AAABAAAAAoUYBAJ4AAADlcCEDSefMAAMAAQGLSzmR");
|
||||
BOOST_CHECK(result_4);
|
||||
BOOST_CHECK_EQUAL(reference_4.steps, result_4->steps);
|
||||
BOOST_CHECK_EQUAL(reference_4.alternative, result_4->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_4.alternatives, result_4->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_4.geometries, result_4->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_4.overview, result_4->overview);
|
||||
CHECK_EQUAL_RANGE(reference_4.uturns, result_4->uturns);
|
||||
@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
"1,2;3,4?steps=false&bearings=;200,10;100,5");
|
||||
BOOST_CHECK(result_5);
|
||||
BOOST_CHECK_EQUAL(reference_5.steps, result_5->steps);
|
||||
BOOST_CHECK_EQUAL(reference_5.alternative, result_5->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_5.alternatives, result_5->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_5.geometries, result_5->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_5.overview, result_5->overview);
|
||||
CHECK_EQUAL_RANGE(reference_5.uturns, result_5->uturns);
|
||||
@ -235,7 +235,7 @@ BOOST_AUTO_TEST_CASE(valid_route_urls)
|
||||
api::parseParameters<engine::api::RouteParameters>("polyline(_ibE?_seK_seK_seK_seK)");
|
||||
BOOST_CHECK(result_6);
|
||||
BOOST_CHECK_EQUAL(reference_6.steps, result_6->steps);
|
||||
BOOST_CHECK_EQUAL(reference_6.alternative, result_6->alternative);
|
||||
BOOST_CHECK_EQUAL(reference_6.alternatives, result_6->alternatives);
|
||||
BOOST_CHECK_EQUAL(reference_6.geometries, result_6->geometries);
|
||||
BOOST_CHECK_EQUAL(reference_6.overview, result_6->overview);
|
||||
CHECK_EQUAL_RANGE(reference_6.uturns, result_6->uturns);
|
||||
|
Loading…
Reference in New Issue
Block a user