| 821 | } |
| 822 | |
| 823 | void Geocoder::FillVillageLocalities(BaseContext const & ctx) |
| 824 | { |
| 825 | vector<Locality> preLocalities; |
| 826 | FillLocalityCandidates(ctx, ctx.m_villages, kMaxNumVillages, preLocalities); |
| 827 | |
| 828 | for (auto & l : preLocalities) |
| 829 | { |
| 830 | auto ft = m_context->GetFeature(l.GetFeatureIndex()); |
| 831 | if (!ft) |
| 832 | continue; |
| 833 | |
| 834 | if (m_model.GetType(*ft) != Model::TYPE_VILLAGE) |
| 835 | continue; |
| 836 | |
| 837 | ASSERT_EQUAL(ft->GetGeomType(), feature::GeomType::Point, (ft->GetID())); |
| 838 | |
| 839 | auto const center = ft->GetCenter(); |
| 840 | |
| 841 | // Always grab top kMaxNumVillages, despite of the distance. |
| 842 | /* |
| 843 | vector<m2::PointD> pivotPoints = {m_params.m_pivot.Center()}; |
| 844 | if (m_params.m_position) |
| 845 | pivotPoints.push_back(*m_params.m_position); |
| 846 | if (!m_context->GetType().m_containsMatchedState && |
| 847 | all_of(pivotPoints.begin(), pivotPoints.end(), [&](auto const & p) { |
| 848 | return mercator::DistanceOnEarth(center, p) > m_params.m_filteringParams.m_villageSearchRadiusM; |
| 849 | })) |
| 850 | { |
| 851 | continue; |
| 852 | } |
| 853 | */ |
| 854 | |
| 855 | City village(std::move(l), Model::TYPE_VILLAGE); |
| 856 | |
| 857 | auto const population = ftypes::GetPopulation(*ft); |
| 858 | auto const radius = ftypes::GetRadiusByPopulation(population); |
| 859 | village.m_rect = mercator::RectByCenterXYAndSizeInMeters(center, radius); |
| 860 | |
| 861 | LOG(LDEBUG, ("Village =", ft->GetName(localisation::kDefaultNameIndex), "ll =", mercator::ToLatLon(center), |
| 862 | "radius =", radius)); |
| 863 | |
| 864 | m_cities[village.m_tokenRange].push_back(std::move(village)); |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | bool Geocoder::CityHasPostcode(BaseContext const & ctx) const |
| 869 | { |
nothing calls this directly
no test coverage detected