diff options
author | Maxim Pimenov <m@maps.me> | 2015-06-10 20:39:04 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:52:09 +0300 |
commit | 93dcd65744b6af1e405d77aa50f53fa20a8fb633 (patch) | |
tree | 2b83da2224d6bc888e931554eb63f66e50784f8e /indexer/scale_index_builder.hpp | |
parent | 6523a2ca67ad55781c33dbef9b0a26bd2acc4bcf (diff) |
[omim] [indexer] Skip the buckets that are not allowed by classificator.
Diffstat (limited to 'indexer/scale_index_builder.hpp')
-rw-r--r-- | indexer/scale_index_builder.hpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/indexer/scale_index_builder.hpp b/indexer/scale_index_builder.hpp index 0be10e08aa..3a9090287d 100644 --- a/indexer/scale_index_builder.hpp +++ b/indexer/scale_index_builder.hpp @@ -100,13 +100,17 @@ public: { uint32_t minScale = 0; m_scalesIdx = 0; - for (uint32_t bucket = 0; bucket < m_bucketsCount; ++bucket) + uint32_t minScaleClassif = feature::GetMinDrawableScaleClassifOnly(f); + // The classificator won't allow this feature to be drawable for smaller + // scales so the first buckets can be safely skipped. + for (uint32_t bucket = minScaleClassif; bucket < m_bucketsCount; ++bucket) { // There is a one-to-one correspondence between buckets and scales. // This is not immediately obvious and in fact there was an idea to map // a bucket to a contiguous range of scales. // todo(@pimenov): We probably should remove scale_index.hpp altogether. - if (!FeatureShouldBeIndexed(f, offset, bucket, minScale)) + if (!FeatureShouldBeIndexed(f, offset, bucket, bucket == minScaleClassif /* needReset */, + minScale)) continue; vector<int64_t> const cells = covering::CoverFeature(f, m_codingDepth, 250); @@ -121,14 +125,15 @@ public: } private: - // Every feature should be indexed at most once: for the smallest possible scale where - // its geometry is non-empty, where it is visible and where the classificator allows. + // Every feature should be indexed at most once, namely for the smallest possible scale where + // -- its geometry is non-empty; + // -- it is visible; + // -- the classificator allows. // If the feature is invisible at all scales, do not index it. template <class TFeature> - bool FeatureShouldBeIndexed(TFeature const & f, uint32_t offset, uint32_t scale, + bool FeatureShouldBeIndexed(TFeature const & f, uint32_t offset, uint32_t scale, bool needReset, uint32_t & minScale) const { - bool needReset = (scale == 0); while (m_scalesIdx < m_header.GetScalesCount() && m_header.GetScale(m_scalesIdx) < scale) { ++m_scalesIdx; |