uturns -> continue_straight
This commit is contained in:
@@ -135,7 +135,7 @@ InternalRouteResult TripPlugin::ComputeRoute(const std::vector<PhantomNode> &sna
|
||||
}
|
||||
BOOST_ASSERT(min_route.segment_end_coordinates.size() == trip.size());
|
||||
|
||||
shortest_path(min_route.segment_end_coordinates, parameters.uturns, min_route);
|
||||
shortest_path(min_route.segment_end_coordinates, parameters.continue_straight, min_route);
|
||||
|
||||
BOOST_ASSERT_MSG(min_route.shortest_path_length < INVALID_EDGE_WEIGHT, "unroutable route");
|
||||
return min_route;
|
||||
|
||||
@@ -58,24 +58,26 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter
|
||||
|
||||
auto snapped_phantoms = SnapPhantomNodes(phantom_node_pairs);
|
||||
|
||||
const bool allow_u_turn_at_via =
|
||||
route_parameters.uturns ? *route_parameters.uturns : facade.GetUTurnsDefault();
|
||||
const bool continue_straight_at_waypoint = route_parameters.continue_straight
|
||||
? *route_parameters.continue_straight
|
||||
: facade.GetContinueStraightDefault();
|
||||
|
||||
InternalRouteResult raw_route;
|
||||
auto build_phantom_pairs = [&raw_route, allow_u_turn_at_via](const PhantomNode &first_node,
|
||||
const PhantomNode &second_node)
|
||||
auto build_phantom_pairs = [&raw_route, continue_straight_at_waypoint](
|
||||
const PhantomNode &first_node, const PhantomNode &second_node)
|
||||
{
|
||||
raw_route.segment_end_coordinates.push_back(PhantomNodes{first_node, second_node});
|
||||
auto &last_inserted = raw_route.segment_end_coordinates.back();
|
||||
// enable forward direction if possible
|
||||
if (last_inserted.source_phantom.forward_segment_id.id != SPECIAL_SEGMENTID)
|
||||
{
|
||||
last_inserted.source_phantom.forward_segment_id.enabled |= allow_u_turn_at_via;
|
||||
last_inserted.source_phantom.forward_segment_id.enabled |=
|
||||
!continue_straight_at_waypoint;
|
||||
}
|
||||
// enable reverse direction if possible
|
||||
if (last_inserted.source_phantom.reverse_segment_id.id != SPECIAL_SEGMENTID)
|
||||
{
|
||||
last_inserted.source_phantom.reverse_segment_id.enabled |= allow_u_turn_at_via;
|
||||
last_inserted.source_phantom.reverse_segment_id.enabled |= !continue_straight_at_waypoint;
|
||||
}
|
||||
};
|
||||
util::for_each_pair(snapped_phantoms, build_phantom_pairs);
|
||||
@@ -93,7 +95,7 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter
|
||||
}
|
||||
else
|
||||
{
|
||||
shortest_path(raw_route.segment_end_coordinates, route_parameters.uturns, raw_route);
|
||||
shortest_path(raw_route.segment_end_coordinates, route_parameters.continue_straight, raw_route);
|
||||
}
|
||||
|
||||
// we can only know this after the fact, different SCC ids still
|
||||
|
||||
@@ -101,7 +101,7 @@ void ScriptingEnvironment::InitContext(ScriptingEnvironment::Context &context)
|
||||
.property("u_turn_penalty", &ProfileProperties::GetUturnPenalty,
|
||||
&ProfileProperties::SetUturnPenalty)
|
||||
.def_readwrite("use_turn_restrictions", &ProfileProperties::use_turn_restrictions)
|
||||
.def_readwrite("allow_u_turn_at_via", &ProfileProperties::allow_u_turn_at_via),
|
||||
.def_readwrite("continue_straight_at_waypoint", &ProfileProperties::continue_straight_at_waypoint),
|
||||
|
||||
luabind::class_<std::vector<std::string>>("vector")
|
||||
.def("Add", static_cast<void (std::vector<std::string>::*)(const std::string &)>(
|
||||
|
||||
Reference in New Issue
Block a user