Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrachytski <siarhei.rachytski@gmail.com>2011-04-27 01:54:11 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:16:31 +0300
commit132f7aa28820bce4465dc0e672ea02970e3ea4df (patch)
tree254f33bb29b6d009b05f9554a58b53a999e897a2 /map/benchmark_provider.cpp
parentf46cfe55705a9962e440e923ce755db4bd1f1c1e (diff)
refactored benchmarks support.
Diffstat (limited to 'map/benchmark_provider.cpp')
-rw-r--r--map/benchmark_provider.cpp33
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;
+}