prefer obvious turn assignment over forks

This commit is contained in:
Moritz Kobitzsch 2016-06-13 14:33:36 +02:00
parent 2b5355edca
commit 47b19f209b
3 changed files with 33 additions and 12 deletions

View File

@ -609,6 +609,8 @@ Feature: Collapse
| waypoints | route | turns |
| a,g | road,cross,cross | depart,turn left,arrive |
| a,e | road,road,road | depart,continue slight right,arrive |
# We should discuss whether the next item should be collapsed to depart,turn right,arrive.
| a,f | road,road,cross,cross | depart,continue slight right,turn right,arrive |
Scenario: On-Off on Highway
Given the node map

View File

@ -281,3 +281,18 @@ Feature: Fork Instructions
| a,c | abd,bc,bc | depart,turn slight left,arrive |
| a,d | abd,abd | depart,arrive |
| a,e | abd,be,be | depart,turn slight right,arrive |
Scenario: Don't Fork when leaving Road
Given the node map
| a | | b | | c |
| | | | | d |
And the ways
| nodes | highway |
| abc | secondary |
| bd | secondary |
When I route I should get
| waypoints | route | turns |
| a,c | abc,abc | depart,arrive |
| a,d | abc,bd,bd | depart,turn slight right,arrive |

View File

@ -110,7 +110,11 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
const bool is_much_narrower_than_other =
angularDeviation(other.turn.angle, STRAIGHT_ANGLE) /
angularDeviation(road.turn.angle, STRAIGHT_ANGLE) >
INCREASES_BY_FOURTY_PERCENT;
INCREASES_BY_FOURTY_PERCENT &&
angularDeviation(angularDeviation(other.turn.angle, STRAIGHT_ANGLE),
angularDeviation(road.turn.angle, STRAIGHT_ANGLE)) >
FUZZY_ANGLE_DIFFERENCE;
return is_much_narrower_than_other;
};
@ -129,11 +133,7 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
.road_classification.road_class;
const auto right_class = node_based_graph.GetEdgeData(intersection[1].turn.eid)
.road_classification.road_class;
if (canBeSeenAsFork(left_class, right_class))
{
assignFork(via_edge, intersection[2], intersection[1]);
}
else if (isObviousOfTwo(intersection[1], intersection[2]) &&
if (isObviousOfTwo(intersection[1], intersection[2]) &&
(second_data.name_id != in_data.name_id ||
first_data.name_id == second_data.name_id))
{
@ -151,6 +151,10 @@ Intersection TurnHandler::handleThreeWayTurn(const EdgeID via_edge, Intersection
intersection[1].turn.instruction = {findBasicTurnType(via_edge, intersection[1]),
DirectionModifier::SlightRight};
}
else if (canBeSeenAsFork(left_class, right_class))
{
assignFork(via_edge, intersection[2], intersection[1]);
}
else
{
intersection[1].turn.instruction = {findBasicTurnType(via_edge, intersection[1]),