handle non-through case

This commit is contained in:
Moritz Kobitzsch
2016-08-10 14:35:02 +02:00
parent 46fd17a9ff
commit 9b2f6585fb
7 changed files with 28 additions and 34 deletions
-1
View File
@@ -584,7 +584,6 @@ std::vector<RouteStep> removeNoTurnInstructions(std::vector<RouteStep> steps)
// that we come across.
std::vector<RouteStep> postProcess(std::vector<RouteStep> steps)
{
util::guidance::print(steps);
// the steps should always include the first/last step in form of a location
BOOST_ASSERT(steps.size() >= 2);
if (steps.size() == 2)
@@ -393,7 +393,8 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
const RoadClassification obvious_candidate,
const RoadClassification compare_candidate) {
const bool has_high_priority =
2 * obvious_candidate.GetPriority() < compare_candidate.GetPriority();
PRIORITY_DISTINCTION_FACTOR * obvious_candidate.GetPriority() <
compare_candidate.GetPriority();
const bool continues_on_same_class = in_classification == obvious_candidate;
return (has_high_priority && continues_on_same_class) ||
(!obvious_candidate.IsLowPriorityRoadClass() &&
@@ -445,8 +446,6 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
}
}
std::cout << "Chose Best: " << best << std::endl;
if (best == 0)
return 0;
@@ -504,17 +503,12 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
if (angularDeviation(intersection[right_index].turn.angle, STRAIGHT_ANGLE) <=
FUZZY_ANGLE_DIFFERENCE &&
!obvious_to_right)
{
std::cout << "Index to the right prevents it." << std::endl;
return 0;
}
if (angularDeviation(intersection[left_index].turn.angle, STRAIGHT_ANGLE) <=
FUZZY_ANGLE_DIFFERENCE &&
!obvious_to_left)
{
std::cout << "Index to the left prevents it." << std::endl;
return 0;
}
const bool distinct_to_left =
left_deviation / best_deviation >= DISTINCTION_RATIO ||
@@ -528,9 +522,6 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
// Well distinct turn that is nearly straight
if ((distinct_to_left || obvious_to_left) && (distinct_to_right || obvious_to_right))
return best;
std::cout << "Failed: " << distinct_to_left << " " << distinct_to_right << " "
<< obvious_to_left << " " << obvious_to_right << std::endl;
}
else
{
+2 -7
View File
@@ -121,9 +121,6 @@ bool TurnHandler::isObviousOfTwo(const EdgeID via_edge,
Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection intersection) const
{
const auto &in_data = node_based_graph.GetEdgeData(via_edge);
const auto &first_data = node_based_graph.GetEdgeData(intersection[1].turn.eid);
const auto &second_data = node_based_graph.GetEdgeData(intersection[2].turn.eid);
const auto obvious_index = findObviousTurn(via_edge, intersection);
BOOST_ASSERT(intersection[0].turn.angle < 0.001);
/* Two nearly straight turns -> FORK
@@ -164,8 +161,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
}
else
{
if (obvious_index == 1 &&
(in_data.name_id != second_data.name_id || first_data.name_id == second_data.name_id))
if (obvious_index == 1)
{
intersection[1].turn.instruction = getInstructionForObvious(
3, via_edge, isThroughStreet(1, intersection), intersection[1]);
@@ -176,8 +172,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
getTurnDirection(intersection[1].turn.angle)};
}
if (obvious_index == 2 &&
(in_data.name_id != first_data.name_id || first_data.name_id == second_data.name_id))
if (obvious_index == 2)
{
intersection[2].turn.instruction = getInstructionForObvious(
3, via_edge, isThroughStreet(2, intersection), intersection[2]);