Routing short road crash fix.

This commit is contained in:
Lev Dragunov 2016-01-15 16:49:34 +03:00
parent d613bb21d8
commit 44a8350ed4
2 changed files with 17 additions and 1 deletions

View file

@ -316,7 +316,11 @@ OsrmRouter::ResultCode OsrmRouter::CalculateRoute(m2::PointD const & startPoint,
Route::TTimes times;
vector<m2::PointD> points;
MakeTurnAnnotation(routingResult, startMapping, delegate, points, turnsDir, times);
if (MakeTurnAnnotation(routingResult, startMapping, delegate, points, turnsDir, times) != NoError)
{
LOG(LWARNING, ("Can't load road path data from disk!"));
return RouteNotFound;
}
route.SetGeometry(points.begin(), points.end());
route.SetTurnInstructions(turnsDir);
@ -468,6 +472,10 @@ OsrmRouter::ResultCode OsrmRouter::MakeTurnAnnotation(
}
}
// Path found. Points will be replaced by start and end edges points.
if (points.size() == 1)
points.push_back(points.front());
if (points.size() < 2)
return RouteNotFound;

View file

@ -15,6 +15,14 @@ namespace
MercatorBounds::FromLatLon(19.172889999999998878, 30.473150000000000404), 7250.);
}
UNIT_TEST(MoscowShortRoadUnpacking)
{
integration::CalculateRouteAndTestRouteLength(
integration::GetOsrmComponents(),
MercatorBounds::FromLatLon(55.66218, 37.63253), {0., 0.},
MercatorBounds::FromLatLon(55.66237, 37.63560), 101.);
}
// Node filtering test. SVO has many restricted service roads that absent in a OSRM index.
UNIT_TEST(MoscowToSVOAirport)
{