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>2016-09-20 16:00:02 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-09-26 15:05:11 +0300
commit5e806179dccc652c37cdc8ac23999a26a6fac12f (patch)
tree367c4d67b0bbcb512ad943fcfaa3c49b1988baa2 /routing
parent9aba9e8fd99ff5f120981e2e9f8668e31ee3ed02 (diff)
Review fixes.
Diffstat (limited to 'routing')
-rw-r--r--routing/routing_integration_tests/osrm_route_test.cpp18
-rw-r--r--routing/turns_generator.cpp6
-rw-r--r--routing/turns_generator.hpp7
3 files changed, 26 insertions, 5 deletions
diff --git a/routing/routing_integration_tests/osrm_route_test.cpp b/routing/routing_integration_tests/osrm_route_test.cpp
index c13c2d9e65..53923e3eec 100644
--- a/routing/routing_integration_tests/osrm_route_test.cpp
+++ b/routing/routing_integration_tests/osrm_route_test.cpp
@@ -281,4 +281,22 @@ namespace
TEST_EQUAL(result, IRouter::NoError, ());
TEST_LESS(route.GetTotalTimeSec(), numeric_limits<uint32_t>::max() / 2, ());
}
+
+// There are road ids in osrm which don't have appropriate features ids in mwm.
+// When the route goes through such osrm id a code line with LOG(LERROR, ... is executed:
+// on route reconstruction stage. As a result some item of |segments| vector could have an empty |m_path|.
+// This test shows such case. It's commented because if to uncomment it debug version of
+// routing_integration_tests would crash.
+// UNIT_TEST(RussiaSpbPloschadBekhterevaToKomendantskiyProspekt)
+// {
+// TRouteResult const routeResult = integration::CalculateRoute(
+// integration::GetOsrmComponents(), MercatorBounds::FromLatLon(59.90126, 30.39970), {0., 0.},
+// MercatorBounds::FromLatLon(60.02499, 30.23889));
+
+// Route const & route = *routeResult.first;
+// IRouter::ResultCode const result = routeResult.second;
+// TEST_EQUAL(result, IRouter::NoError, ());
+
+// integration::TestRouteTime(route, 1364.0);
+// }
} // namespace
diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp
index 6830960367..3f4693677e 100644
--- a/routing/turns_generator.cpp
+++ b/routing/turns_generator.cpp
@@ -668,14 +668,16 @@ size_t CheckUTurnOnRoute(TUnpackedPathSegments const & segments,
auto const & masterSegment = segments[currentSegment - 1];
if (masterSegment.m_path.size() < 2)
return 0;
- if (segments[currentSegment].m_path.empty())
- return 0;
+
// Roundabout is not the UTurn.
if (masterSegment.m_onRoundabout)
return 0;
for (size_t i = 0; i < kUTurnLookAhead && i + currentSegment < segments.size(); ++i)
{
auto const & checkedSegment = segments[currentSegment + i];
+ if (checkedSegment.m_path.size() < 2)
+ return 0;
+
if (checkedSegment.m_name == masterSegment.m_name &&
checkedSegment.m_highwayClass == masterSegment.m_highwayClass &&
checkedSegment.m_isLink == masterSegment.m_isLink && !checkedSegment.m_onRoundabout)
diff --git a/routing/turns_generator.hpp b/routing/turns_generator.hpp
index 4ea146039a..c2b1c7226e 100644
--- a/routing/turns_generator.hpp
+++ b/routing/turns_generator.hpp
@@ -130,9 +130,10 @@ TurnDirection GetRoundaboutDirection(bool isIngoingEdgeRoundabout, bool isOutgoi
void GetTurnDirection(IRoutingResult const & result, turns::TurnInfo & turnInfo, TurnItem & turn);
/*!
- * \brief Finds an UTurn that starts from current segment and returns how many segments it lasts.
- * Returns 0 if there is no UTurn.
- * Warning! currentSegment must be greater than 0.
+ * \brief Finds an U-turn that starts from master segment and returns how many segments it lasts.
+ * \returns an index in |segments| that has the opposite direction with master segment
+ * (|segments[currentSegment - 1]|) and 0 if there is no UTurn.
+ * \warning |currentSegment| must be greater than 0.
*/
size_t CheckUTurnOnRoute(TUnpackedPathSegments const & segments,
size_t currentSegment, TurnItem & turn);