Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2018-03-15 18:13:37 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-03-16 15:48:29 +0300
commita6064c7e4858eeb770ea38f3049e5bb0e69c2538 (patch)
tree4290ae77b52dba865402c176121e4be59c0f84b2 /routing
parent37e80ee4108212ba78770a944e66f812b6bcc52a (diff)
Removing more slight turns in case if other roads has less highway class.
Diffstat (limited to 'routing')
-rw-r--r--routing/routing_integration_tests/turn_test.cpp8
-rw-r--r--routing/turns_generator.cpp11
2 files changed, 11 insertions, 8 deletions
diff --git a/routing/routing_integration_tests/turn_test.cpp b/routing/routing_integration_tests/turn_test.cpp
index dd0b92a41e..daa6ff8d97 100644
--- a/routing/routing_integration_tests/turn_test.cpp
+++ b/routing/routing_integration_tests/turn_test.cpp
@@ -232,11 +232,10 @@ UNIT_TEST(RussiaMoscowParallelResidentalUTurnAvoiding)
IRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, IRouter::NoError, ());
- integration::TestTurnCount(route, 3 /* expectedTurnCount */);
+ integration::TestTurnCount(route, 2 /* expectedTurnCount */);
// Checking a turn in case going from a not-link to a link
integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::TurnLeft);
- integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::GoStraight);
- integration::GetNthTurn(route, 2).TestValid().TestDirection(CarDirection::TurnLeft);
+ integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::TurnLeft);
}
UNIT_TEST(RussiaMoscowPankratevskiPerBolshaySuharedskazPloschadTurnTest)
@@ -892,9 +891,8 @@ UNIT_TEST(RussiaMoscowTTKToNMaslovkaTest)
IRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, IRouter::NoError, ());
- integration::TestTurnCount(route, 2 /* expectedTurnCount */);
+ integration::TestTurnCount(route, 1 /* expectedTurnCount */);
integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::ExitHighwayToRight);
- integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::GoStraight);
}
UNIT_TEST(RussiaMoscowComplicatedTurnTest)
diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp
index d6af46f465..d10d8036f7 100644
--- a/routing/turns_generator.cpp
+++ b/routing/turns_generator.cpp
@@ -150,9 +150,14 @@ bool KeepTurnByHighwayClass(CarDirection turn, TurnCandidates const & possibleTu
if (minClassForTheRoute == ftypes::HighwayClass::Undefined)
return false; // Fake edges have HighwayClass::Undefined.
- int const kMaxHighwayClassDiffToKeepTheTurn = 2;
- if (static_cast<int>(maxClassForPossibleTurns) - static_cast<int>(minClassForTheRoute) >=
- kMaxHighwayClassDiffToKeepTheTurn)
+ // Maximum difference between HighwayClasses of route segments and possible way segments
+ // to keep the bifurcation point as a turn.
+ int constexpr kMaxHighwayClassDiff = 2;
+ int constexpr kMaxHighwayClassDiffForService = 1;
+ int const diff =
+ static_cast<int>(maxClassForPossibleTurns) - static_cast<int>(minClassForTheRoute);
+ if (diff >= kMaxHighwayClassDiff ||
+ (maxClassForPossibleTurns == ftypes::HighwayClass::Service && diff >= kMaxHighwayClassDiffForService))
{
// The turn shall be removed if the route goes near small roads without changing the direction.
return false;