forked from organicmaps/organicmaps
Merge pull request #1060 from gardster/turnaround_direction_fix
Turnaround direction fix.
This commit is contained in:
commit
fe7c1e6859
2 changed files with 28 additions and 0 deletions
|
@ -8,6 +8,30 @@
|
|||
using namespace routing;
|
||||
using namespace routing::turns;
|
||||
|
||||
UNIT_TEST(RussiaMoscowNagatinoUturnTurnTest)
|
||||
{
|
||||
TRouteResult const routeResult = integration::CalculateRoute(
|
||||
integration::GetOsrmComponents(),
|
||||
MercatorBounds::FromLatLon(55.67251, 37.63604), {-0.004, -0.01},
|
||||
MercatorBounds::FromLatLon(55.67293, 37.63507));
|
||||
|
||||
Route const & route = *routeResult.first;
|
||||
IRouter::ResultCode const result = routeResult.second;
|
||||
TEST_EQUAL(result, IRouter::NoError, ());
|
||||
|
||||
integration::TestTurnCount(route, 3);
|
||||
|
||||
integration::GetNthTurn(route, 0)
|
||||
.TestValid()
|
||||
.TestDirection(TurnDirection::TurnRight);
|
||||
integration::GetNthTurn(route, 1)
|
||||
.TestValid()
|
||||
.TestDirection(TurnDirection::UTurnLeft);
|
||||
integration::GetNthTurn(route, 2).TestValid().TestDirection(TurnDirection::TurnLeft);
|
||||
|
||||
integration::TestRouteLength(route, 561.);
|
||||
}
|
||||
|
||||
UNIT_TEST(RussiaMoscowLenigradskiy39UturnTurnTest)
|
||||
{
|
||||
TRouteResult const routeResult = integration::CalculateRoute(
|
||||
|
|
|
@ -956,6 +956,10 @@ size_t CheckUTurnOnRoute(vector<LoadedPathSegment> const & segments, size_t curr
|
|||
if (checkedSegment.m_name.empty())
|
||||
return 0;
|
||||
|
||||
// Avoid returning to the same edge after uturn somewere else.
|
||||
if (path[path.size() - 2] == checkedSegment.m_path[1])
|
||||
return 0;
|
||||
|
||||
m2::PointD const v1 = path[path.size() - 1] - path[path.size() - 2];
|
||||
m2::PointD const v2 = checkedSegment.m_path[1] - checkedSegment.m_path[0];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue