| 81 | } |
| 82 | |
| 83 | openlr::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 | |
| 117 | template <typename Func> |
| 118 | void WithRoad(vector<m2::PointD> const & points, Func && fn) |
no test coverage detected