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

Method GetJunctionPointCandidates

tools/openlr/score_candidate_points_getter.cpp:35–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33namespace openlr
34{
35void ScoreCandidatePointsGetter::GetJunctionPointCandidates(m2::PointD const & p, bool isLastPoint,
36 ScoreEdgeVec & edgeCandidates)
37{
38 ScorePointVec pointCandidates;
39 auto const selectCandidates = [&p, &pointCandidates, this](FeatureType & ft)
40 {
41 ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
42 if (ft.GetGeomType() != feature::GeomType::Line || !routing::IsRoad(feature::TypesHolder(ft)))
43 return;
44
45 ft.ForEachPoint([&p, &pointCandidates, this](m2::PointD const & candidate)
46 {
47 if (mercator::DistanceOnEarth(p, candidate) < kRadius)
48 pointCandidates.emplace_back(GetScoreByDistance(p, candidate), candidate);
49 }, scales::GetUpperScale());
50 };
51
52 m_dataSource.ForEachInRect(selectCandidates, mercator::RectByCenterXYAndSizeInMeters(p, kRadius),
53 scales::GetUpperScale());
54
55 base::SortUnique(pointCandidates);
56 std::reverse(pointCandidates.begin(), pointCandidates.end());
57
58 pointCandidates.resize(std::min(m_maxJunctionCandidates, pointCandidates.size()));
59
60 for (auto const & pc : pointCandidates)
61 {
62 Graph::EdgeListT edges;
63 if (!isLastPoint)
64 m_graph.GetOutgoingEdges(geometry::PointWithAltitude(pc.m_point, 0 /* altitude */), edges);
65 else
66 m_graph.GetIngoingEdges(geometry::PointWithAltitude(pc.m_point, 0 /* altitude */), edges);
67
68 for (auto const & e : edges)
69 edgeCandidates.emplace_back(pc.m_score, e);
70 }
71}
72
73void ScoreCandidatePointsGetter::EnrichWithProjectionPoints(m2::PointD const & p, ScoreEdgeVec & edgeCandidates)
74{

Callers

nothing calls this directly

Calls 15

IsRoadFunction · 0.85
GetUpperScaleFunction · 0.85
SortUniqueFunction · 0.85
ParseGeometryMethod · 0.80
TypesHolderClass · 0.70
DistanceOnEarthFunction · 0.50
PointWithAltitudeClass · 0.50
GetGeomTypeMethod · 0.45
ForEachPointMethod · 0.45
emplace_backMethod · 0.45
ForEachInRectMethod · 0.45

Tested by

no test coverage detected