fix looping in sliproad handler for lanes
This commit is contained in:
parent
e3c1b133bf
commit
b3c5a9c010
@ -235,7 +235,8 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
|
|||||||
route_step.values["distance"] = std::round(step.distance * 10) / 10.;
|
route_step.values["distance"] = std::round(step.distance * 10) / 10.;
|
||||||
route_step.values["duration"] = std::round(step.duration * 10) / 10.;
|
route_step.values["duration"] = std::round(step.duration * 10) / 10.;
|
||||||
route_step.values["name"] = std::move(step.name);
|
route_step.values["name"] = std::move(step.name);
|
||||||
if (!step.ref.empty()) route_step.values["ref"] = std::move(step.ref);
|
if (!step.ref.empty())
|
||||||
|
route_step.values["ref"] = std::move(step.ref);
|
||||||
if (!step.pronunciation.empty())
|
if (!step.pronunciation.empty())
|
||||||
route_step.values["pronunciation"] = std::move(step.pronunciation);
|
route_step.values["pronunciation"] = std::move(step.pronunciation);
|
||||||
if (!step.destinations.empty())
|
if (!step.destinations.empty())
|
||||||
|
@ -37,9 +37,9 @@ SliproadHandler::SliproadHandler(const IntersectionGenerator &intersection_gener
|
|||||||
// included for interface reasons only
|
// included for interface reasons only
|
||||||
bool SliproadHandler::canProcess(const NodeID /*nid*/,
|
bool SliproadHandler::canProcess(const NodeID /*nid*/,
|
||||||
const EdgeID /*via_eid*/,
|
const EdgeID /*via_eid*/,
|
||||||
const Intersection & /*intersection*/) const
|
const Intersection &intersection) const
|
||||||
{
|
{
|
||||||
return true;
|
return intersection.size() > 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intersection SliproadHandler::
|
Intersection SliproadHandler::
|
||||||
@ -59,6 +59,13 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
|||||||
while (intersection.size() == 2)
|
while (intersection.size() == 2)
|
||||||
{
|
{
|
||||||
const auto node = node_based_graph.GetTarget(in_edge);
|
const auto node = node_based_graph.GetTarget(in_edge);
|
||||||
|
if (node == at_node)
|
||||||
|
{
|
||||||
|
// we ended up in a loop without exit
|
||||||
|
output_node = SPECIAL_NODEID;
|
||||||
|
intersection.clear();
|
||||||
|
return intersection;
|
||||||
|
}
|
||||||
in_edge = intersection[1].turn.eid;
|
in_edge = intersection[1].turn.eid;
|
||||||
output_node = node_based_graph.GetTarget(in_edge);
|
output_node = node_based_graph.GetTarget(in_edge);
|
||||||
intersection = intersection_generator(node, in_edge);
|
intersection = intersection_generator(node, in_edge);
|
||||||
@ -82,6 +89,10 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
|||||||
intersection_node_id, intersection[1], intersection_node_one);
|
intersection_node_id, intersection[1], intersection_node_one);
|
||||||
const auto intersection_following_index_two = findNextIntersectionForRoad(
|
const auto intersection_following_index_two = findNextIntersectionForRoad(
|
||||||
intersection_node_id, intersection[2], intersection_node_two);
|
intersection_node_id, intersection[2], intersection_node_two);
|
||||||
|
// in case of broken roads, we return
|
||||||
|
if (intersection_following_index_one.empty() ||
|
||||||
|
intersection_following_index_two.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
// In case of loops at the end of the road, we will arrive back at the intersection
|
// In case of loops at the end of the road, we will arrive back at the intersection
|
||||||
// itself. If that is the case, the road is obviously not a sliproad.
|
// itself. If that is the case, the road is obviously not a sliproad.
|
||||||
|
@ -94,6 +94,7 @@ Intersection TurnAnalysis::assignTurnTypes(const NodeID from_nid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle sliproads
|
// Handle sliproads
|
||||||
|
if (sliproad_handler.canProcess(from_nid, via_eid, intersection))
|
||||||
intersection = sliproad_handler(from_nid, via_eid, std::move(intersection));
|
intersection = sliproad_handler(from_nid, via_eid, std::move(intersection));
|
||||||
|
|
||||||
// Turn On Ramps Into Off Ramps, if we come from a motorway-like road
|
// Turn On Ramps Into Off Ramps, if we come from a motorway-like road
|
||||||
|
Loading…
Reference in New Issue
Block a user