Skip to content

Commit 6763d4c

Browse files
committed
Handle motorway forks with links as a normal motorway ...
passing some ramps or mering onto another motorway
1 parent 6d2860e commit 6763d4c

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- CHANGED #4835: MAXIMAL_ALLOWED_SEPARATION_WIDTH increased to 12 meters
77
- CHANGED #4842: Lower priority links from a motorway now are used as motorway links [#4842](https://github.com/Project-OSRM/osrm-backend/pull/4842)
88
- CHANGED #4895: Use ramp bifurcations as fork intersections [#4895](https://github.com/Project-OSRM/osrm-backend/issues/4895)
9+
- CHANGED #4893: Handle motorway forks with links as normal motorway intersections[#4893](https://github.com/Project-OSRM/osrm-backend/issues/4893)
910
- Profile:
1011
- FIXED: `highway=service` will now be used for restricted access, `access=private` is still disabled for snapping.
1112
- ADDED #4775: Exposes more information to the turn function, now being able to set turn weights with highway and access information of the turn as well as other roads at the intersection [#4775](https://github.com/Project-OSRM/osrm-backend/issues/4775)

features/guidance/motorway.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Feature: Motorway Guidance
341341
| cd | motorway_link |
342342

343343
When I route I should get
344-
| waypoints | route | turns |
345-
| a,d | abce,cd,cd | depart,turn straight,arrive |
346-
| a,e | abce,abce,abce | depart,fork slight left,arrive |
347-
| a,f | abce,cf,cf | depart,fork slight right,arrive |
344+
| waypoints | route | turns |
345+
| a,d | abce,cd,cd | depart,off ramp slight left,arrive |
346+
| a,e | abce,abce | depart,arrive |
347+
| a,f | abce,cf,cf | depart,turn slight right,arrive |

src/guidance/motorway_handler.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,6 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
118118
node_data_container.GetAnnotation(node_based_graph.GetEdgeData(via_eid).annotation_data);
119119
BOOST_ASSERT(isMotorwayClass(via_eid, node_based_graph));
120120

121-
const auto countExitingMotorways = [this](const Intersection &intersection) {
122-
unsigned count = 0;
123-
for (const auto &road : intersection)
124-
{
125-
if (road.entry_allowed && isMotorwayClass(road.eid, node_based_graph))
126-
++count;
127-
}
128-
return count;
129-
};
130-
131121
// find the angle that continues on our current highway
132122
const auto getContinueAngle = [this, in_data](const Intersection &intersection) {
133123
for (const auto &road : intersection)
@@ -219,7 +209,13 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
219209
}
220210
else
221211
{
222-
const unsigned exiting_motorways = countExitingMotorways(intersection);
212+
const auto valid_exits = std::count_if(intersection.begin(),
213+
intersection.end(),
214+
[](const auto &road) { return road.entry_allowed; });
215+
const auto exiting_motorways =
216+
std::count_if(intersection.begin(), intersection.end(), [this](const auto &road) {
217+
return road.entry_allowed && isMotorwayClass(road.eid, node_based_graph);
218+
});
223219

224220
if (exiting_motorways == 0)
225221
{
@@ -233,7 +229,7 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
233229
}
234230
}
235231
}
236-
else if (exiting_motorways == 1)
232+
else if (exiting_motorways == 1 || exiting_motorways != valid_exits)
237233
{
238234
// normal motorway passing some ramps or mering onto another motorway
239235
if (intersection.size() == 2)

0 commit comments

Comments
 (0)