| 171 | } |
| 172 | |
| 173 | std::optional<std::pair<m2::PointD, double>> GetPointInMwm(NodePoints const & points, size_t index, bool forward) |
| 174 | { |
| 175 | auto const & pointOnBorder = points[index]; |
| 176 | |
| 177 | m2::PointD newPoint = pointOnBorder.m_point; |
| 178 | double dist = 0.0; |
| 179 | |
| 180 | while ((!forward && index > 0) || (forward && index < points.size() - 1)) |
| 181 | { |
| 182 | if (forward) |
| 183 | ++index; |
| 184 | else |
| 185 | --index; |
| 186 | |
| 187 | auto const & point = points[index]; |
| 188 | |
| 189 | if (point.m_mwm != pointOnBorder.m_mwm) |
| 190 | break; |
| 191 | |
| 192 | double const curDist = mercator::DistanceOnEarth(pointOnBorder.m_point, point.m_point); |
| 193 | |
| 194 | if (curDist >= kHalfSegmentLengthM) |
| 195 | return std::make_pair(point.m_point, curDist); |
| 196 | |
| 197 | newPoint = point.m_point; |
| 198 | dist = curDist; |
| 199 | } |
| 200 | |
| 201 | return std::make_pair(newPoint, dist); |
| 202 | } |
| 203 | |
| 204 | bool FillCrossBorderGraph(CrossBorderGraph & graph, RegionSegmentId & curSegmentId, |
| 205 | std::vector<uint64_t> const & nodeIds, |
no test coverage detected