| 255 | } |
| 256 | |
| 257 | void LocalityFinder::LoadVicinity(m2::PointD const & p, bool loadCities, bool loadVillages) |
| 258 | { |
| 259 | UpdateMaps(); |
| 260 | |
| 261 | if (loadCities) |
| 262 | { |
| 263 | m2::RectD const crect = m_cities.GetDRect(p); |
| 264 | auto handle = m_dataSource.GetMwmHandleById(m_worldId); |
| 265 | if (handle.IsAlive()) |
| 266 | { |
| 267 | auto const & value = *handle.GetValue(); |
| 268 | if (!m_ranks) |
| 269 | m_ranks = RankTable::Load(value.m_cont, SEARCH_RANKS_FILE_TAG); |
| 270 | if (!m_ranks) |
| 271 | m_ranks = make_unique<DummyRankTable>(); |
| 272 | |
| 273 | MwmContext ctx(std::move(handle)); |
| 274 | ctx.ForEachIndex(crect, LocalitiesLoader(ctx, m_boundariesTable, CityFilter(*m_ranks), m_cities, m_loadedIds)); |
| 275 | } |
| 276 | |
| 277 | m_cities.SetCovered(p); |
| 278 | } |
| 279 | |
| 280 | if (loadVillages) |
| 281 | { |
| 282 | m2::RectD const vrect = m_villages.GetDRect(p); |
| 283 | m_maps.ForEachInRect(m2::RectD(p, p), [&](MwmSet::MwmId const & id) |
| 284 | { |
| 285 | auto handle = m_dataSource.GetMwmHandleById(id); |
| 286 | if (!handle.IsAlive()) |
| 287 | return; |
| 288 | |
| 289 | static int const scale = GetVillagesScale(); |
| 290 | MwmContext ctx(std::move(handle)); |
| 291 | ctx.ForEachIndex( |
| 292 | vrect, scale, |
| 293 | LocalitiesLoader(ctx, m_boundariesTable, VillageFilter(ctx, m_villagesCache), m_villages, m_loadedIds)); |
| 294 | }); |
| 295 | |
| 296 | m_villages.SetCovered(p); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | void LocalityFinder::UpdateMaps() |
| 301 | { |
nothing calls this directly
no test coverage detected