MCPcopy Create free account
hub / github.com/comaps/comaps / FillSegmentInfo

Function FillSegmentInfo

libs/routing/routing_helpers.cpp:34–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32using namespace traffic;
33
34void 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
58void ReconstructRoute(DirectionsEngine & engine, IndexRoadGraph const & graph, base::Cancellable const & cancellable,
59 vector<geometry::PointWithAltitude> const & path, vector<double> const & times, Route & route)

Callers 6

ReconstructRouteFunction · 0.85
CalculateRouteMethod · 0.85
GetTestRouteSegmentsFunction · 0.85
UNIT_TESTFunction · 0.85
UNIT_TESTFunction · 0.85
FillSubroutesInfoFunction · 0.85

Calls 9

ASSERTFunction · 0.85
SetDistancesAndTimeMethod · 0.80
DistanceOnEarthFunction · 0.50
sizeMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45
emptyMethod · 0.45
GetPointMethod · 0.45
LengthMethod · 0.45

Tested by 4

GetTestRouteSegmentsFunction · 0.68
UNIT_TESTFunction · 0.68
UNIT_TESTFunction · 0.68
FillSubroutesInfoFunction · 0.68