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

Method LoadVicinity

libs/search/locality_finder.cpp:257–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257void 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
300void LocalityFinder::UpdateMaps()
301{

Callers

nothing calls this directly

Calls 12

LocalitiesLoaderClass · 0.85
CityFilterClass · 0.85
GetVillagesScaleFunction · 0.85
VillageFilterClass · 0.85
GetDRectMethod · 0.80
ForEachIndexMethod · 0.80
SetCoveredMethod · 0.80
LoadFunction · 0.50
GetMwmHandleByIdMethod · 0.45
IsAliveMethod · 0.45
GetValueMethod · 0.45
ForEachInRectMethod · 0.45

Tested by

no test coverage detected