fix coordinate assertion for walking profile with steps
This commit is contained in:
parent
9fa7e6c74f
commit
06ef3053de
@ -1340,3 +1340,34 @@ Feature: Simple Turns
|
|||||||
When I route I should get
|
When I route I should get
|
||||||
| waypoints | route |
|
| waypoints | route |
|
||||||
| a,d | ab,ab |
|
| a,d | ab,ab |
|
||||||
|
|
||||||
|
Scenario: Sharp Turn Onto A Bridge
|
||||||
|
Given the node map
|
||||||
|
"""
|
||||||
|
e
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
g a - - -b
|
||||||
|
f /
|
||||||
|
d -c
|
||||||
|
"""
|
||||||
|
|
||||||
|
And the ways
|
||||||
|
| nodes | oneway | lanes |
|
||||||
|
| gaf | yes | 1 |
|
||||||
|
| abcde | yes | 1 |
|
||||||
|
|
||||||
|
When I route I should get
|
||||||
|
| waypoints | route |
|
||||||
|
| g,e | abcde,abcde |
|
||||||
|
@ -422,12 +422,24 @@ util::Coordinate CoordinateExtractor::ExtractRepresentativeCoordinate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We use the locations on the regression line to offset the regression line onto the
|
|
||||||
// intersection.
|
|
||||||
const auto result =
|
const auto result =
|
||||||
ExtractCoordinateAtLength(LOOKAHEAD_DISTANCE_WITHOUT_LANES, coordinates, segment_distances);
|
ExtractCoordinateAtLength(LOOKAHEAD_DISTANCE_WITHOUT_LANES, coordinates, segment_distances);
|
||||||
BOOST_ASSERT(not_same_as_start(result));
|
// there are cases that loop back to the original node (e.g. a tiny circle travelling on steps).
|
||||||
return result;
|
// To compensate for these, we check if we got back to the start and, if so, return the first
|
||||||
|
// valid result
|
||||||
|
if (not_same_as_start(result))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto result_itr =
|
||||||
|
std::find_if(coordinates.begin(), coordinates.end(), not_same_as_start);
|
||||||
|
if (result_itr != coordinates.end())
|
||||||
|
return *result_itr;
|
||||||
|
else
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
util::Coordinate
|
util::Coordinate
|
||||||
|
Loading…
Reference in New Issue
Block a user