| 87 | } |
| 88 | |
| 89 | void 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 |
nothing calls this directly
no test coverage detected