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-02-28 11:17:27 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-02-28 14:09:16 +0300
commit815412aca8439fafb0c7c0ca439708cf06c5a247 (patch)
tree6598bcfcd6b4964ada110816f1c13672f722bd79 /routing
parentd92efa0a8a09150b96834dad58b764d81691ec4b (diff)
Review fixes.
Diffstat (limited to 'routing')
-rw-r--r--routing/routing_integration_tests/turn_test.cpp2
-rw-r--r--routing/turns_generator.cpp17
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 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