access way names through RouteStep in post processing
This commit is contained in:
parent
d5232d5f5c
commit
56459d37d1
@ -36,10 +36,7 @@ bool isStaggeredIntersection(const RouteStepIterator step_prior_to_intersection,
|
|||||||
// a - > x
|
// a - > x
|
||||||
bool isUTurn(const RouteStepIterator step_prior_to_intersection,
|
bool isUTurn(const RouteStepIterator step_prior_to_intersection,
|
||||||
const RouteStepIterator step_entering_intersection,
|
const RouteStepIterator step_entering_intersection,
|
||||||
const RouteStepIterator step_leaving_intersection,
|
const RouteStepIterator step_leaving_intersection);
|
||||||
const std::string &step_prior_name,
|
|
||||||
const std::string &step_entering_name,
|
|
||||||
const std::string &step_leaving_name);
|
|
||||||
|
|
||||||
// detect oscillating names where a name switch A->B->A occurs. This is often the case due to
|
// detect oscillating names where a name switch A->B->A occurs. This is often the case due to
|
||||||
// bridges or tunnels. Any such oszillation is not supposed to show up
|
// bridges or tunnels. Any such oszillation is not supposed to show up
|
||||||
|
@ -43,12 +43,11 @@ bool noIntermediaryIntersections(const RouteStep &step)
|
|||||||
// Link roads, as far as we are concerned, are short unnamed segments between to named segments.
|
// Link roads, as far as we are concerned, are short unnamed segments between to named segments.
|
||||||
bool isLinkRoad(const RouteStep &link_step,
|
bool isLinkRoad(const RouteStep &link_step,
|
||||||
const std::string &pre_link_step_name,
|
const std::string &pre_link_step_name,
|
||||||
const std::string &link_step_name,
|
|
||||||
const std::string &post_link_step_name)
|
const std::string &post_link_step_name)
|
||||||
{
|
{
|
||||||
const constexpr double MAX_LINK_ROAD_LENGTH = 2 * MAX_COLLAPSE_DISTANCE;
|
const constexpr double MAX_LINK_ROAD_LENGTH = 2 * MAX_COLLAPSE_DISTANCE;
|
||||||
const auto is_short = link_step.distance <= MAX_LINK_ROAD_LENGTH;
|
const auto is_short = link_step.distance <= MAX_LINK_ROAD_LENGTH;
|
||||||
const auto unnamed = link_step_name.empty();
|
const auto unnamed = link_step.name.empty();
|
||||||
const auto between_named = !pre_link_step_name.empty() && !post_link_step_name.empty();
|
const auto between_named = !pre_link_step_name.empty() && !post_link_step_name.empty();
|
||||||
|
|
||||||
return is_short && unnamed && between_named && noIntermediaryIntersections(link_step);
|
return is_short && unnamed && between_named && noIntermediaryIntersections(link_step);
|
||||||
@ -163,10 +162,10 @@ bool isStaggeredIntersection(const RouteStepIterator step_prior_to_intersection,
|
|||||||
|
|
||||||
bool isUTurn(const RouteStepIterator step_prior_to_intersection,
|
bool isUTurn(const RouteStepIterator step_prior_to_intersection,
|
||||||
const RouteStepIterator step_entering_intersection,
|
const RouteStepIterator step_entering_intersection,
|
||||||
const RouteStepIterator step_leaving_intersection,
|
const RouteStepIterator step_leaving_intersection)
|
||||||
const std::string &step_prior_name,
|
// const std::string &step_prior_name,
|
||||||
const std::string &step_entering_name,
|
// const std::string &step_entering_name,
|
||||||
const std::string &step_leaving_name)
|
// const std::string &step_leaving_name)
|
||||||
{
|
{
|
||||||
if (!basicCollapsePreconditions(
|
if (!basicCollapsePreconditions(
|
||||||
step_prior_to_intersection, step_entering_intersection, step_leaving_intersection))
|
step_prior_to_intersection, step_entering_intersection, step_leaving_intersection))
|
||||||
@ -200,9 +199,8 @@ bool isUTurn(const RouteStepIterator step_prior_to_intersection,
|
|||||||
noIntermediaryIntersections(*step_entering_intersection);
|
noIntermediaryIntersections(*step_entering_intersection);
|
||||||
|
|
||||||
return collapsable || isLinkRoad(*step_entering_intersection,
|
return collapsable || isLinkRoad(*step_entering_intersection,
|
||||||
step_prior_name,
|
step_prior_to_intersection->name,
|
||||||
step_entering_name,
|
step_leaving_intersection->name) ||
|
||||||
step_leaving_name) ||
|
|
||||||
only_allowed_turn;
|
only_allowed_turn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,9 +371,6 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
const auto previous_step = findPreviousTurn(current_step);
|
const auto previous_step = findPreviousTurn(current_step);
|
||||||
const auto previous_step_name = facade.GetNameForID(previous_step->name_id).to_string();
|
|
||||||
const auto current_step_name = facade.GetNameForID(current_step->name_id).to_string();
|
|
||||||
const auto next_step_name = facade.GetNameForID(next_step->name_id).to_string();
|
|
||||||
|
|
||||||
// don't collapse anything that does change modes
|
// don't collapse anything that does change modes
|
||||||
if (current_step->mode != next_step->mode)
|
if (current_step->mode != next_step->mode)
|
||||||
@ -390,12 +387,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData
|
|||||||
TransferSignageStrategy(),
|
TransferSignageStrategy(),
|
||||||
NoModificationStrategy());
|
NoModificationStrategy());
|
||||||
}
|
}
|
||||||
else if (isUTurn(previous_step,
|
else if (isUTurn(previous_step, current_step, next_step))
|
||||||
current_step,
|
|
||||||
next_step,
|
|
||||||
previous_step_name,
|
|
||||||
current_step_name,
|
|
||||||
next_step_name))
|
|
||||||
{
|
{
|
||||||
combineRouteSteps(
|
combineRouteSteps(
|
||||||
*current_step,
|
*current_step,
|
||||||
@ -475,12 +467,7 @@ RouteSteps collapseTurnInstructions(RouteSteps steps, const datafacade::BaseData
|
|||||||
const auto far_back_step_name = facade.GetNameForID(far_back_step->name_id).to_string();
|
const auto far_back_step_name = facade.GetNameForID(far_back_step->name_id).to_string();
|
||||||
// due to name changes, we can find u-turns a bit late. Thats why we check far back as
|
// due to name changes, we can find u-turns a bit late. Thats why we check far back as
|
||||||
// well
|
// well
|
||||||
if (isUTurn(far_back_step,
|
if (isUTurn(far_back_step, previous_step, current_step))
|
||||||
previous_step,
|
|
||||||
current_step,
|
|
||||||
far_back_step_name,
|
|
||||||
previous_step_name,
|
|
||||||
current_step_name))
|
|
||||||
{
|
{
|
||||||
combineRouteSteps(
|
combineRouteSteps(
|
||||||
*previous_step,
|
*previous_step,
|
||||||
|
Loading…
Reference in New Issue
Block a user