Skip to content

Commit bfbdd18

Browse files
Moritz Kobitzschdaniel-j-h
authored andcommitted
fix emitting invalid turn types, now surfacing due to changes in obvious detection
Conflicts: features/guidance/dedicated-turn-roads.feature include/extractor/guidance/intersection.hpp
1 parent 5159d57 commit bfbdd18

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

features/guidance/dedicated-turn-roads.feature

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,3 +782,40 @@ Feature: Slipways and Dedicated Turn Lanes
782782
When I route I should get
783783
| waypoints | route | turns |
784784
| s,g | main,sliproad,another,another | depart,turn right,turn left,arrive |
785+
786+
Scenario: Sliproad before a roundabout
787+
Given the node map
788+
"""
789+
e
790+
a - b - - c - d
791+
'f|l'
792+
m
793+
g
794+
|
795+
.h-_
796+
k - i |
797+
'.j.'
798+
799+
"""
800+
801+
And the ways
802+
| nodes | junction | oneway | highway | name |
803+
| ab | | yes | primary | road |
804+
| bc | | yes | primary | road |
805+
| cd | | yes | primary | road |
806+
| ec | | yes | secondary | |
807+
| cm | | yes | secondary | |
808+
| mg | | yes | primary | |
809+
| gh | | no | primary | |
810+
| hijh | roundabout | yes | primary | |
811+
| ik | | yes | primary | |
812+
| bfm | | yes | primary | |
813+
| gld | | yes | primary | |
814+
815+
And the relations
816+
| type | way:from | way:to | node:via | restriction |
817+
| restriction | bc | cd | c | only_straight |
818+
819+
When I route I should get
820+
| waypoints | route | turns | locations |
821+
| a,k | road,,, | depart,continue right,roundabout turn right exit-1,arrive | a,b,h,k |

include/extractor/guidance/intersection.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ struct IntersectionShapeData
3434
};
3535

3636
inline auto makeCompareShapeDataByBearing(const double base_bearing)
37+
{
38+
return [base_bearing](const auto &lhs, const auto &rhs) {
39+
return util::angularDeviation(base_bearing, lhs.bearing) <
40+
util::angularDeviation(base_bearing, rhs.bearing);
41+
};
42+
}
43+
44+
inline auto makeCompareShapeDataAngleToBearing(const double base_bearing)
3745
{
3846
return [base_bearing](const auto &lhs, const auto &rhs) {
3947
return util::angleBetweenBearings(base_bearing, lhs.bearing) <

src/engine/guidance/post_processing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,8 @@ std::vector<RouteStep> collapseTurns(std::vector<RouteStep> steps)
10731073
if (one_back_step.maneuver.instruction.type == TurnType::Sliproad)
10741074
{
10751075
if (current_step.maneuver.instruction.type == TurnType::Suppressed &&
1076-
compatible(one_back_step, current_step))
1076+
compatible(one_back_step, current_step) && current_step.intersections.size() == 1 &&
1077+
current_step.intersections.front().entry.size() == 2)
10771078
{
10781079
// Traffic light on the sliproad, the road itself will be handled in the next
10791080
// iteration, when one-back-index again points to the sliproad.

src/extractor/guidance/intersection_generator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ IntersectionGenerator::ComputeIntersectionShape(const NodeID node_at_center_of_i
135135
}
136136
return util::reverseBearing(intersection.begin()->bearing);
137137
}();
138-
std::sort(
139-
intersection.begin(), intersection.end(), makeCompareShapeDataByBearing(base_bearing));
138+
std::sort(intersection.begin(),
139+
intersection.end(),
140+
makeCompareShapeDataAngleToBearing(base_bearing));
140141
}
141142
return intersection;
142143
}

0 commit comments

Comments
 (0)