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

Method FillJunctionPointCandidates

tools/openlr/candidate_points_getter.cpp:21–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace openlr
20{
21void CandidatePointsGetter::FillJunctionPointCandidates(m2::PointD const & p, std::vector<m2::PointD> & candidates)
22{
23 // TODO(mgsergio): Get optimal value using experiments on a sample.
24 // Or start with small radius and scale it up when there are too few points.
25 size_t const kRectSideMeters = 110;
26
27 auto const rect = mercator::RectByCenterXYAndSizeInMeters(p, kRectSideMeters);
28 auto const selectCandidates = [&rect, &candidates](FeatureType & ft)
29 {
30 ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
31 ft.ForEachPoint([&rect, &candidates](m2::PointD const & candidate)
32 {
33 if (rect.IsPointInside(candidate))
34 candidates.emplace_back(candidate);
35 }, scales::GetUpperScale());
36 };
37
38 m_dataSource.ForEachInRect(selectCandidates, rect, scales::GetUpperScale());
39
40 // TODO: Move this to a separate stage.
41 // 1030292476 Does not match. Some problem occur with points.
42 // Either points duplicate or something alike. Check this
43 // later. The idea to fix this was to move SortUnique to the stage
44 // after enriching with projections.
45
46 base::SortUnique(candidates, [&p](m2::PointD const & a, m2::PointD const & b)
47 { return mercator::DistanceOnEarth(a, p) < mercator::DistanceOnEarth(b, p); },
48 [](m2::PointD const & a, m2::PointD const & b) { return a == b; });
49
50 candidates.resize(std::min(m_maxJunctionCandidates, candidates.size()));
51}
52
53void CandidatePointsGetter::EnrichWithProjectionPoints(m2::PointD const & p, std::vector<m2::PointD> & candidates)
54{

Callers

nothing calls this directly

Calls 11

GetUpperScaleFunction · 0.85
SortUniqueFunction · 0.85
ParseGeometryMethod · 0.80
DistanceOnEarthFunction · 0.50
ForEachPointMethod · 0.45
IsPointInsideMethod · 0.45
emplace_backMethod · 0.45
ForEachInRectMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected