diff options
author | vng <viktor.govako@gmail.com> | 2011-09-27 13:05:59 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:24:30 +0300 |
commit | 20faf97e15cda565899cfa6ced0c40e7f8262071 (patch) | |
tree | 07053f325ca2c0489d8b02d1cfc23c5720bbef79 /indexer/index.hpp | |
parent | 5d10c28ea8a69011533a7c6d07e246124bcbdfba (diff) |
Minor changes with rect cover getting in index.
Diffstat (limited to 'indexer/index.hpp')
-rw-r--r-- | indexer/index.hpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/indexer/index.hpp b/indexer/index.hpp index 51793b78b7..51585f5fd1 100644 --- a/indexer/index.hpp +++ b/indexer/index.hpp @@ -89,13 +89,23 @@ private: } }; - /// @param[in] mode\n - /// - 0 - cover viewport with low lovels;\n - /// - 1 - cover append low levels only;\n - /// - 2 - make full cover\n - static void GetCovering(m2::RectD const & rect, - int mode, int cellDepth, - covering::IntervalsT & res); + class CoveringGetter + { + typedef covering::IntervalsT ResT; + ResT m_res[2]; + + m2::RectD const & m_rect; + int m_mode; + + public: + /// @param[in] mode\n + /// - 0 - cover viewport with low lovels;\n + /// - 1 - cover append low levels only;\n + /// - 2 - make full cover\n + CoveringGetter(m2::RectD const & r, int mode) : m_rect(r), m_mode(mode) {} + + ResT const & Get(feature::DataHeader const & header); + }; template <typename F> void ForEachInIntervals(F & f, int mode, m2::RectD const & rect, uint32_t scale) const @@ -103,7 +113,7 @@ private: vector<MwmInfo> mwm; GetMwmInfo(mwm); - covering::IntervalsT intervals[2]; + CoveringGetter cov(rect, mode); for (MwmId id = 0; id < mwm.size(); ++id) { @@ -117,11 +127,7 @@ private: feature::DataHeader const & header = pValue->GetHeader(); // prepare needed covering - int const cellDepth = covering::GetCodingDepth(header.GetScaleRange()); - int const ind = (cellDepth == RectId::DEPTH_LEVELS ? 0 : 1); - - if (intervals[ind].empty()) - GetCovering(rect, mode, cellDepth, intervals[ind]); + covering::IntervalsT const & interval = cov.Get(header); // prepare features reading FeaturesVector fv(pValue->m_cont, header); @@ -131,10 +137,9 @@ private: // iterate through intervals unordered_set<uint32_t> offsets; ReadFeatureFunctor<F> f1(fv, f, offsets); - for (size_t i = 0; i < intervals[ind].size(); ++i) + for (size_t i = 0; i < interval.size(); ++i) { - index.ForEachInIntervalAndScale(f1, intervals[ind][i].first, intervals[ind][i].second, - scale); + index.ForEachInIntervalAndScale(f1, interval[i].first, interval[i].second, scale); } } } |