diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2011-04-27 01:54:11 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:16:31 +0300 |
commit | 132f7aa28820bce4465dc0e672ea02970e3ea4df (patch) | |
tree | 254f33bb29b6d009b05f9554a58b53a999e897a2 /map/benchmark_provider.cpp | |
parent | f46cfe55705a9962e440e923ce755db4bd1f1c1e (diff) |
refactored benchmarks support.
Diffstat (limited to 'map/benchmark_provider.cpp')
-rw-r--r-- | map/benchmark_provider.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/map/benchmark_provider.cpp b/map/benchmark_provider.cpp new file mode 100644 index 0000000000..0791c34dc2 --- /dev/null +++ b/map/benchmark_provider.cpp @@ -0,0 +1,33 @@ +#include "../base/SRC_FIRST.hpp" +#include "benchmark_provider.hpp" +#include "../indexer/mercator.hpp" + +BenchmarkRectProvider::BenchmarkRectProvider(int startLevel, m2::RectD const & startRect, int endLevel) + : m_endLevel(endLevel) +{ + m_rects.push_back(make_pair(startRect, startLevel)); +} + +bool BenchmarkRectProvider::hasRect() const +{ + return !m_rects.empty(); +} + +m2::RectD const BenchmarkRectProvider::nextRect() +{ + pair<m2::RectD, int> const & f = m_rects.front(); + m2::RectD r = f.first; + + if (f.second < m_endLevel) + { + int nextLevel = f.second + 1; + + m_rects.push_back(make_pair(m2::RectD(r.minX(), r.minY(), r.minX() + r.SizeX() / 2, r.minY() + r.SizeY() / 2), nextLevel)); + m_rects.push_back(make_pair(m2::RectD(r.minX() + r.SizeX() / 2, r.minY(), r.maxX(), r.minY() + r.SizeY() / 2), nextLevel)); + m_rects.push_back(make_pair(m2::RectD(r.minX(), r.minY() + r.SizeY() / 2, r.minX() + r.SizeX() / 2, r.maxY()), nextLevel)); + m_rects.push_back(make_pair(m2::RectD(r.minX() + r.SizeX() / 2, r.minY() + r.SizeY() / 2, r.maxX(), r.maxY()), nextLevel)); + } + + m_rects.pop_front(); + return r; +} |