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

Function MakePath

tools/openlr/openlr_tests/decoded_path_test.cpp:83–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83openlr::Path MakePath(FeatureType const & road, bool const forward)
84{
85 CHECK_EQUAL(road.GetGeomType(), feature::GeomType::Line, ());
86 CHECK_GREATER(road.GetPointsCount(), 0, ());
87 openlr::Path path;
88
89 size_t const maxPointIndex = road.GetPointsCount() - 1;
90 for (size_t i = 0; i < maxPointIndex; ++i)
91 {
92 size_t current{};
93 size_t next{};
94 if (forward)
95 {
96 current = i;
97 next = i + 1;
98 }
99 else
100 {
101 current = maxPointIndex - i;
102 next = current - 1;
103 }
104
105 auto const from = road.GetPoint(current);
106 auto const to = road.GetPoint(next);
107 path.push_back(routing::Edge::MakeReal(
108 road.GetID(), forward, base::checked_cast<uint32_t>(current - static_cast<size_t>(!forward)) /* segId */,
109 geometry::PointWithAltitude(from, 0 /* altitude */), geometry::PointWithAltitude(to, 0 /* altitude */)));
110 }
111
112 RoughJunctionsInPath(path);
113
114 return path;
115}
116
117template <typename Func>
118void WithRoad(vector<m2::PointD> const & points, Func && fn)

Callers 2

UNIT_TESTFunction · 0.85
UNIT_CLASS_TESTFunction · 0.85

Calls 7

RoughJunctionsInPathFunction · 0.85
PointWithAltitudeClass · 0.50
GetGeomTypeMethod · 0.45
GetPointsCountMethod · 0.45
GetPointMethod · 0.45
push_backMethod · 0.45
GetIDMethod · 0.45

Tested by

no test coverage detected