From 6368e0e6dcaf3fc636b6a8b629c213199c82f8cf Mon Sep 17 00:00:00 2001 From: vng Date: Sat, 24 Sep 2011 15:05:07 +0300 Subject: [PATCH] Add 'maxDepth' parameter to 'CoverRect'. Use different depth for different mwm's. --- indexer/cell_coverer.hpp | 6 +++--- indexer/feature_covering.cpp | 2 +- indexer/indexer_tests/cell_coverer_test.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/indexer/cell_coverer.hpp b/indexer/cell_coverer.hpp index 0bd59b5821..bd643da8b7 100644 --- a/indexer/cell_coverer.hpp +++ b/indexer/cell_coverer.hpp @@ -26,7 +26,7 @@ inline void SplitRectCell(CellIdT id, template inline void CoverRect(CoordT minX, CoordT minY, CoordT maxX, CoordT maxY, - size_t cells_count, + size_t cells_count, int maxDepth, vector & cells) { ASSERT_LESS(minX, maxX, ()); @@ -53,7 +53,7 @@ inline void CoverRect(CoordT minX, CoordT minY, CellIdT id = cellQueue.front(); cellQueue.pop(); - if (id.Level() == CellIdT::DEPTH_LEVELS - 1) + if (id.Level() == maxDepth - 1) { result.push_back(id); break; @@ -85,7 +85,7 @@ inline void CoverRect(CoordT minX, CoordT minY, for (size_t i = 0; i < result.size(); ++i) { CellIdT id = result[i]; - while (id.Level() < CellIdT::DEPTH_LEVELS - 1) + while (id.Level() < maxDepth - 1) { vector children; SplitRectCell(id, minX, minY, maxX, maxY, children); diff --git a/indexer/feature_covering.cpp b/indexer/feature_covering.cpp index 01b8436791..40d98593b9 100644 --- a/indexer/feature_covering.cpp +++ b/indexer/feature_covering.cpp @@ -165,7 +165,7 @@ void AppendLowerLevels(RectId id, int cellDepth, IntervalsT & intervals) void CoverViewportAndAppendLowerLevels(m2::RectD const & r, int cellDepth, IntervalsT & res) { vector ids; - CoverRect(r.minX(), r.minY(), r.maxX(), r.maxY(), 8, ids); + CoverRect(r.minX(), r.minY(), r.maxX(), r.maxY(), 8, cellDepth, ids); IntervalsT intervals; intervals.reserve(ids.size() * 4); diff --git a/indexer/indexer_tests/cell_coverer_test.cpp b/indexer/indexer_tests/cell_coverer_test.cpp index b47acc61ae..fb9370220a 100644 --- a/indexer/indexer_tests/cell_coverer_test.cpp +++ b/indexer/indexer_tests/cell_coverer_test.cpp @@ -18,7 +18,7 @@ UNIT_TEST(CellIdToStringRecode) UNIT_TEST(GoldenCoverRect) { vector cells; - CoverRect(27.43, 53.83, 27.70, 53.96, 4, cells); + CoverRect(27.43, 53.83, 27.70, 53.96, 4, RectId::DEPTH_LEVELS, cells); TEST_EQUAL(cells.size(), 4, ()); @@ -33,7 +33,7 @@ UNIT_TEST(ArtificialCoverRect) typedef Bounds<0, 0, 16, 16> TestBounds; vector cells; - CoverRect(5, 5, 11, 11, 4, cells); + CoverRect(5, 5, 11, 11, 4, RectId::DEPTH_LEVELS, cells); TEST_EQUAL(cells.size(), 4, ());