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

Method GetLineCandidatesForPoints

tools/openlr/candidate_paths_getter.cpp:65–96  ·  view source on GitHub ↗

CandidatePathsGetter ----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

63
64// CandidatePathsGetter ----------------------------------------------------------------------------
65bool 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
98void CandidatePathsGetter::GetStartLines(vector<m2::PointD> const & points, bool const isLastPoint,
99 Graph::EdgeVector & edges)

Callers 2

DecodeSegmentMethod · 0.45
DecodeSegmentMethod · 0.45

Calls 6

backMethod · 0.80
FromLatLonFunction · 0.50
sizeMethod · 0.45
emplace_backMethod · 0.45
GetCandidatePointsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected