From 815412aca8439fafb0c7c0ca439708cf06c5a247 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Wed, 28 Feb 2018 11:17:27 +0300 Subject: Review fixes. --- routing/routing_integration_tests/turn_test.cpp | 2 +- routing/turns_generator.cpp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'routing') diff --git a/routing/routing_integration_tests/turn_test.cpp b/routing/routing_integration_tests/turn_test.cpp index 6220a189ec..6084d1a8cd 100644 --- a/routing/routing_integration_tests/turn_test.cpp +++ b/routing/routing_integration_tests/turn_test.cpp @@ -813,7 +813,7 @@ UNIT_TEST(EnglandLondonExitToLeftTest) integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::ExitHighwayToLeft); } -// Test on the route from Leninsky prospect to its understudy and turns generated on the route. +// Test on the route from Leninsky prospect to its frontage road and turns generated on the route. UNIT_TEST(RussiaMoscowLeninskyProspTest) { TRouteResult const routeResult = diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp index c5e4b2dded..9aaebc0ac9 100644 --- a/routing/turns_generator.cpp +++ b/routing/turns_generator.cpp @@ -41,6 +41,12 @@ bool IsLinkOrSmallRoad(ftypes::HighwayClass hwClass, bool isLink) hwClass == ftypes::HighwayClass::Pedestrian; } +bool IsSmallRoad(ftypes::HighwayClass hwClass) +{ + return hwClass == ftypes::HighwayClass::LivingStreet || + hwClass == ftypes::HighwayClass::Service || hwClass == ftypes::HighwayClass::Pedestrian; +} + /// \brief Fills |turn| with |CarDirection::ExitHighwayToRight| or |CarDirection::ExitHighwayToLeft| /// and returns true. Or does not change |turn| and returns false. /// \note The function makes a decision about |turn| based on geometry of the route and turn @@ -52,16 +58,13 @@ bool IsExit(TurnCandidates const & possibleTurns, TurnInfo const & turnInfo, return false; if (!IsHighway(turnInfo.m_ingoing.m_highwayClass, turnInfo.m_ingoing.m_isLink) || - !IsLinkOrSmallRoad(turnInfo.m_outgoing.m_highwayClass, turnInfo.m_outgoing.m_isLink)) - { - return false; - } - - if (turnInfo.m_ingoing.m_highwayClass == ftypes::HighwayClass::Primary && - !turnInfo.m_outgoing.m_isLink && !IsGoStraightOrSlightTurn(intermediateDirection)) + !(turnInfo.m_outgoing.m_isLink || IsSmallRoad(turnInfo.m_outgoing.m_highwayClass) && + IsGoStraightOrSlightTurn(intermediateDirection))) { return false; } + // At this point it is known that the route goes form a highway to a link road or to a small road + // which has a slight angle with the highway. // Considering cases when the route goes from a highway to a link or a small road. // Checking all turn candidates (sorted by their angles) and looking for the road which is a -- cgit v1.2.3