| 32 | using namespace traffic; |
| 33 | |
| 34 | void FillSegmentInfo(vector<double> const & times, vector<RouteSegment> & routeSegments) |
| 35 | { |
| 36 | CHECK_EQUAL(times.size(), routeSegments.size(), ()); |
| 37 | ASSERT(is_sorted(times.cbegin(), times.cend()), ()); |
| 38 | |
| 39 | if (routeSegments.empty()) |
| 40 | return; |
| 41 | |
| 42 | double routeLengthMeters = 0.0; |
| 43 | double routeLengthMerc = 0.0; |
| 44 | for (size_t i = 0; i < routeSegments.size(); ++i) |
| 45 | { |
| 46 | if (i > 0) |
| 47 | { |
| 48 | auto const & junction = routeSegments[i].GetJunction(); |
| 49 | auto const & prevJunction = routeSegments[i - 1].GetJunction(); |
| 50 | routeLengthMeters += mercator::DistanceOnEarth(junction.GetPoint(), prevJunction.GetPoint()); |
| 51 | routeLengthMerc += junction.GetPoint().Length(prevJunction.GetPoint()); |
| 52 | } |
| 53 | |
| 54 | routeSegments[i].SetDistancesAndTime(routeLengthMeters, routeLengthMerc, times[i]); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | void ReconstructRoute(DirectionsEngine & engine, IndexRoadGraph const & graph, base::Cancellable const & cancellable, |
| 59 | vector<geometry::PointWithAltitude> const & path, vector<double> const & times, Route & route) |