From 9fbb9f2019f383ec1a39eaf2d8c5cd6c1886fb39 Mon Sep 17 00:00:00 2001 From: ExMix Date: Fri, 7 Feb 2014 12:35:48 +0300 Subject: [PATCH] [drape] use upper style zoom for 18 and 19 zoom levels also guard DoNeedReadIndex by mutex. is's need in situations when one tile info was push to back of thread pool, and than push to front and processed on separate threads in one time. --- drape_frontend/tile_info.cpp | 12 +++++++++--- drape_frontend/tile_info.hpp | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp index 1f8c05a4aa..4642428a39 100644 --- a/drape_frontend/tile_info.cpp +++ b/drape_frontend/tile_info.cpp @@ -43,11 +43,11 @@ namespace df void TileInfo::ReadFeatureIndex(model::FeaturesFetcher const & model) { + threads::MutexGuard guard(m_mutex); if (DoNeedReadIndex()) { - threads::MutexGuard guard(m_mutex); CheckCanceled(); - model.ForEachFeatureID(GetGlobalRect(), *this, m_key.m_zoomLevel); + model.ForEachFeatureID(GetGlobalRect(), *this, GetZoomLevel()); sort(m_featureInfo.begin(), m_featureInfo.end()); } } @@ -91,7 +91,7 @@ namespace df void TileInfo::InitStylist(const FeatureType & f, Stylist & s) { CheckCanceled(); - df::InitStylist(f, m_key.m_zoomLevel, s); + df::InitStylist(f, GetZoomLevel(), s); } //====================================================// @@ -112,4 +112,10 @@ namespace df if (m_isCanceled) MYTHROW(ReadCanceledException, ()); } + + int TileInfo::GetZoomLevel() const + { + int upperScale = scales::GetUpperScale(); + return m_key.m_zoomLevel <= upperScale ? m_key.m_zoomLevel : upperScale; + } } diff --git a/drape_frontend/tile_info.hpp b/drape_frontend/tile_info.hpp index eeffd7fcc5..d7139cad30 100644 --- a/drape_frontend/tile_info.hpp +++ b/drape_frontend/tile_info.hpp @@ -46,6 +46,8 @@ namespace df void CheckCanceled() const; bool DoNeedReadIndex() const; + int GetZoomLevel() const; + private: TileKey m_key; vector m_featureInfo;