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

Function ForEachOfTypesInRect

libs/search/utils.cpp:40–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40void ForEachOfTypesInRect(DataSource const & dataSource, std::vector<uint32_t> const & types, m2::RectD const & pivot,
41 FeatureIndexCallback const & fn)
42{
43 std::vector<std::shared_ptr<MwmInfo>> infos;
44 dataSource.GetMwmsInfo(infos);
45
46 base::Cancellable const cancellable;
47 CategoriesCache cache(types, cancellable);
48 auto pivotRectsCache =
49 PivotRectsCache(1 /* maxNumEntries */, cancellable, std::max(pivot.SizeX(), pivot.SizeY()) /* maxRadiusMeters */);
50
51 for (auto const & info : infos)
52 {
53 if (!pivot.IsIntersect(info->m_bordersRect))
54 continue;
55
56 auto handle = dataSource.GetMwmHandleById(MwmSet::MwmId(info));
57 auto & value = *handle.GetValue();
58 if (!value.HasSearchIndex())
59 continue;
60
61 MwmContext const mwmContext(std::move(handle));
62 auto features = cache.Get(mwmContext);
63
64 auto const pivotFeatures = pivotRectsCache.Get(mwmContext, pivot, scales::GetUpperScale());
65 ViewportFilter const filter(pivotFeatures, 0 /* threshold */);
66 features = filter.Filter(features);
67 MwmSet::MwmId mwmId(info);
68 features.ForEach([&fn, &mwmId](uint64_t bit) { fn(FeatureID(mwmId, base::asserted_cast<uint32_t>(bit))); });
69 }
70}
71
72bool IsCategorialRequestFuzzy(std::string const & query, std::string const & categoryName)
73{

Callers 1

UNIT_CLASS_TESTFunction · 0.85

Calls 14

PivotRectsCacheClass · 0.85
MwmIdClass · 0.85
GetUpperScaleFunction · 0.85
GetMwmsInfoMethod · 0.80
SizeXMethod · 0.80
SizeYMethod · 0.80
HasSearchIndexMethod · 0.80
FeatureIDClass · 0.70
IsIntersectMethod · 0.45
GetMwmHandleByIdMethod · 0.45
GetValueMethod · 0.45
GetMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.68