MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / resyncGeometry

Function resyncGeometry

src/engine/guidance/post_processing.cpp:495–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495LegGeometry resyncGeometry(LegGeometry leg_geometry, const std::vector<RouteStep> &steps)
496{
497 // The geometry uses an adjacency array-like structure for representation.
498 // To sync it back up with the steps, we cann add a segment for every step.
499 leg_geometry.segment_offsets.clear();
500 leg_geometry.segment_distances.clear();
501 leg_geometry.segment_offsets.push_back(0);
502
503 for (const auto &step : steps)
504 {
505 leg_geometry.segment_distances.push_back(step.distance);
506 // the leg geometry does not follow the begin/end-convetion. So we have to subtract one
507 // to get the back-index.
508 leg_geometry.segment_offsets.push_back(step.geometry_end - 1);
509 }
510
511 // remove the data from the reached-target step again
512 leg_geometry.segment_offsets.pop_back();
513 leg_geometry.segment_distances.pop_back();
514
515 return leg_geometry;
516}
517
518std::vector<RouteStep> buildIntersections(std::vector<RouteStep> steps)
519{

Callers 1

MakeLegsMethod · 0.85

Calls 2

clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected