CandidatePathsGetter ----------------------------------------------------------------------------
| 63 | |
| 64 | // CandidatePathsGetter ---------------------------------------------------------------------------- |
| 65 | bool CandidatePathsGetter::GetLineCandidatesForPoints(vector<LocationReferencePoint> const & points, |
| 66 | vector<vector<Graph::EdgeVector>> & lineCandidates) |
| 67 | { |
| 68 | for (size_t i = 0; i < points.size(); ++i) |
| 69 | { |
| 70 | if (i != points.size() - 1 && points[i].m_distanceToNextPoint == 0) |
| 71 | { |
| 72 | LOG(LINFO, ("Distance to next point is zero. Skipping the whole segment")); |
| 73 | ++m_stats.m_zeroDistToNextPointCount; |
| 74 | return false; |
| 75 | } |
| 76 | |
| 77 | lineCandidates.emplace_back(); |
| 78 | auto const isLastPoint = i == points.size() - 1; |
| 79 | double const distanceToNextPointM = (isLastPoint ? points[i - 1] : points[i]).m_distanceToNextPoint; |
| 80 | |
| 81 | vector<m2::PointD> pointCandidates; |
| 82 | m_pointsGetter.GetCandidatePoints(mercator::FromLatLon(points[i].m_latLon), pointCandidates); |
| 83 | GetLineCandidates(points[i], isLastPoint, distanceToNextPointM, pointCandidates, lineCandidates.back()); |
| 84 | |
| 85 | if (lineCandidates.back().empty()) |
| 86 | { |
| 87 | LOG(LINFO, ("No candidate lines found for point", points[i].m_latLon, "Giving up")); |
| 88 | ++m_stats.m_noCandidateFound; |
| 89 | return false; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | ASSERT_EQUAL(lineCandidates.size(), points.size(), ()); |
| 94 | |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | void CandidatePathsGetter::GetStartLines(vector<m2::PointD> const & points, bool const isLastPoint, |
| 99 | Graph::EdgeVector & edges) |
no test coverage detected