Review fixes.

This commit is contained in:
Vladimir Byko-Ianko 2016-12-13 18:24:19 +03:00
parent c98bde1268
commit fbcc2cfe68
2 changed files with 4 additions and 0 deletions

View file

@ -190,6 +190,7 @@ void BicycleDirectionsEngine::Generate(IRoadGraph const & graph, vector<Junction
MakeTurnAnnotation(resultGraph, delegate, routeGeometry, turns, turnAnnotationTimes,
streetNames, trafficSegs);
// @TODO(bykoianko) The invariant below it's an issue but now it's so and it should be checked.
// The problem is every edge is added as a pair of points to route geometry.
// So all the points except for beginning and ending are duplicated. It should

View file

@ -382,6 +382,9 @@ void Route::AppendTraffic(Route const & route)
if (route.GetTraffic().empty())
{
CHECK_GREATER_OR_EQUAL(route.m_poly.GetPolyline().GetSize(), 1, ());
// Note. It's necessary to deduct 1 because size of |route.m_poly|
// is one less then number of segments of |route.m_poly|. And if |route.m_traffic|
// were not empty it would had had route.m_poly.GetPolyline().GetSize() - 1 items.
m_traffic.insert(m_traffic.end(),
route.m_poly.GetPolyline().GetSize() - 1 /* number of segments is less by one */,
SpeedGroup::Unknown);