diff options
author | vng <viktor.govako@gmail.com> | 2011-09-24 16:05:07 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:24:20 +0300 |
commit | 6368e0e6dcaf3fc636b6a8b629c213199c82f8cf (patch) | |
tree | 32d3e537710b3752bed7e4fc63ab7db7e904b2f6 /indexer | |
parent | 6a5c67addcdeece9051748b55acfd7a5fe7b7cad (diff) |
Add 'maxDepth' parameter to 'CoverRect'. Use different depth for different mwm's.
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/cell_coverer.hpp | 6 | ||||
-rw-r--r-- | indexer/feature_covering.cpp | 2 | ||||
-rw-r--r-- | 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 <typename BoundsT, typename CellIdT> inline void CoverRect(CoordT minX, CoordT minY, CoordT maxX, CoordT maxY, - size_t cells_count, + size_t cells_count, int maxDepth, vector<CellIdT> & 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<CellIdT> children; SplitRectCell<BoundsT>(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<RectId> ids; - CoverRect<MercatorBounds, RectId>(r.minX(), r.minY(), r.maxX(), r.maxY(), 8, ids); + CoverRect<MercatorBounds, RectId>(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<CellIdT> cells; - CoverRect<OrthoBounds>(27.43, 53.83, 27.70, 53.96, 4, cells); + CoverRect<OrthoBounds>(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<CellIdT> cells; - CoverRect<TestBounds>(5, 5, 11, 11, 4, cells); + CoverRect<TestBounds>(5, 5, 11, 11, 4, RectId::DEPTH_LEVELS, cells); TEST_EQUAL(cells.size(), 4, ()); |