| 33 | namespace openlr |
| 34 | { |
| 35 | void 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 | |
| 73 | void ScoreCandidatePointsGetter::EnrichWithProjectionPoints(m2::PointD const & p, ScoreEdgeVec & edgeCandidates) |
| 74 | { |
nothing calls this directly
no test coverage detected