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;