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

Method Update

libs/search/nested_rects_cache.cpp:89–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void NestedRectsCache::Update()
90{
91 for (int scale = 0; scale != RECT_SCALE_COUNT; ++scale)
92 {
93 auto & bucket = m_buckets[scale];
94 bucket.clear();
95
96 m2::RectD const rect =
97 mercator::RectByCenterXYAndSizeInMeters(m_position, GetRadiusMeters(static_cast<RectScale>(scale)));
98
99 MwmSet::MwmId lastId;
100 Features * lastFeatures = nullptr;
101 auto addId = [&lastId, &lastFeatures, &bucket](FeatureID const & id)
102 {
103 if (!id.IsValid())
104 return;
105 if (id.m_mwmId != lastId)
106 {
107 lastId = id.m_mwmId;
108 lastFeatures = &bucket[lastId];
109 }
110 lastFeatures->push_back(id.m_index);
111 };
112 m_dataSource.ForEachFeatureIDInRect(addId, rect, m_scale);
113 for (auto & kv : bucket)
114 std::sort(kv.second.begin(), kv.second.end());
115 }
116
117 m_valid = true;
118}
119} // namespace search

Callers

nothing calls this directly

Calls 7

clearMethod · 0.45
IsValidMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected