| 19 | namespace openlr |
| 20 | { |
| 21 | void 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 | |
| 53 | void CandidatePointsGetter::EnrichWithProjectionPoints(m2::PointD const & p, std::vector<m2::PointD> & candidates) |
| 54 | { |
nothing calls this directly
no test coverage detected