diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-04-14 17:25:28 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:14:52 +0300 |
commit | a0a3b4c077f587839cdd95046c380340551a58fd (patch) | |
tree | dec7a811858020f00259bebd886f73aa8a6f20e4 /drape_frontend/read_manager.cpp | |
parent | cfa3f32c2c16c2ccfd7f7acf6b2613d9909d1070 (diff) |
[drape] move "tile coverage calculation" into frontend renderer
read manager operate by ready set of tilekeys
Diffstat (limited to 'drape_frontend/read_manager.cpp')
-rw-r--r-- | drape_frontend/read_manager.cpp | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/drape_frontend/read_manager.cpp b/drape_frontend/read_manager.cpp index 8a1927fe8c..1a6fa525b2 100644 --- a/drape_frontend/read_manager.cpp +++ b/drape_frontend/read_manager.cpp @@ -45,14 +45,11 @@ namespace df delete task; } - void ReadManager::UpdateCoverage(const ScreenBase & screen) + void ReadManager::UpdateCoverage(ScreenBase const & screen, set<TileKey> const & tiles) { if (screen == m_currentViewport) return; - set<TileKey> tiles; - GetTileKeys(tiles, screen); - if (MustDropAllTiles(screen)) { for_each(m_tileInfos.begin(), m_tileInfos.end(), bind(&ReadManager::CancelTileInfo, this, _1)); @@ -100,37 +97,6 @@ namespace df return max(GetPlatform().CpuCores() - 2, 1); } - void ReadManager::GetTileKeys(set<TileKey> & out, ScreenBase const & screen) const - { - out.clear(); - - int const tileScale = df::GetTileScaleBase(screen); - // equal for x and y - double const range = MercatorBounds::maxX - MercatorBounds::minX; - double const rectSize = range / (1 << tileScale); - - m2::AnyRectD const & globalRect = screen.GlobalRect(); - m2::RectD const & clipRect = screen.ClipRect(); - - int const minTileX = static_cast<int>(floor(clipRect.minX() / rectSize)); - int const maxTileX = static_cast<int>(ceil(clipRect.maxX() / rectSize)); - int const minTileY = static_cast<int>(floor(clipRect.minY() / rectSize)); - int const maxTileY = static_cast<int>(ceil(clipRect.maxY() / rectSize)); - - for (int tileY = minTileY; tileY < maxTileY; ++tileY) - for (int tileX = minTileX; tileX < maxTileX; ++tileX) - { - double const left = tileX * rectSize; - double const top = tileY * rectSize; - - m2::RectD currentTileRect(left, top, - left + rectSize, top + rectSize); - - if (globalRect.IsIntersect(m2::AnyRectD(currentTileRect))) - out.insert(TileKey(tileX, tileY, tileScale)); - } - } - bool ReadManager::MustDropAllTiles(ScreenBase const & screen) const { const int oldScale = df::GetTileScaleBase(m_currentViewport); |