diff --git a/drape_frontend/rule_drawer.cpp b/drape_frontend/rule_drawer.cpp index c6812ac1c7..668ceaaec8 100644 --- a/drape_frontend/rule_drawer.cpp +++ b/drape_frontend/rule_drawer.cpp @@ -499,9 +499,9 @@ void RuleDrawer::operator()(FeatureType & f) } #endif - /// @todo Remove passing of minVisibleScale arg everywhere. - int minVisibleScale = 0; - auto insertShape = [this, &minVisibleScale](drape_ptr && shape) + //int const minVisibleScale = feature::GetMinDrawableScale(f); // original version + int const minVisibleScale = s.m_minOverlaysZoom; // lighter weight version + auto insertShape = [this, minVisibleScale](drape_ptr && shape) { size_t const index = shape->GetType(); ASSERT_LESS(index, m_mapShapes.size(), ()); diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp index f0a3f2afdd..f91ec3d8b2 100644 --- a/drape_frontend/stylist.cpp +++ b/drape_frontend/stylist.cpp @@ -403,6 +403,9 @@ bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool b } } + if (mainOverlayType != 0) + s.m_minOverlaysZoom = cl.GetObject(mainOverlayType)->GetMinOverlaysZoom(); + feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys); if (keys.empty()) diff --git a/drape_frontend/stylist.hpp b/drape_frontend/stylist.hpp index 4dd373e7cc..c9bdbab626 100644 --- a/drape_frontend/stylist.hpp +++ b/drape_frontend/stylist.hpp @@ -55,6 +55,7 @@ public: bool m_areaStyleExists = false; bool m_lineStyleExists = false; bool m_pointStyleExists = false; + int m_minOverlaysZoom = 0; public: CaptionDescription const & GetCaptionDescription() const; diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index 81efbe2126..940a19f6dd 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -54,6 +54,11 @@ void ClassifObject::AddDrawRule(drule::Key const & k) if (k == *i) return; // already exists m_drawRules.insert(i, k); + + if ((k.m_scale < m_minOverlaysZoom || m_minOverlaysZoom == 0) && + (k.m_type == drule::symbol || k.m_type == drule::caption || + k.m_type == drule::shield || k.m_type == drule::pathtext)) + m_minOverlaysZoom = k.m_scale; } ClassifObjectPtr ClassifObject::BinaryFind(std::string_view const s) const diff --git a/indexer/classificator.hpp b/indexer/classificator.hpp index 6a4a5ec76e..57bf8f5db3 100644 --- a/indexer/classificator.hpp +++ b/indexer/classificator.hpp @@ -90,6 +90,9 @@ public: std::vector const & GetDrawRules() const { return m_drawRules; } void GetSuitable(int scale, feature::GeomType gt, drule::KeysT & keys) const; + // Returns 0 if there are no overlay drules. + uint8_t GetMinOverlaysZoom() const { return m_minOverlaysZoom; } + bool IsDrawable(int scale) const; bool IsDrawableAny() const; bool IsDrawableLike(feature::GeomType gt, bool emptyName = false) const; @@ -161,6 +164,8 @@ private: std::vector m_drawRules; std::vector m_objs; VisibleMask m_visibility; + + uint8_t m_minOverlaysZoom = 0; }; inline void swap(ClassifObject & r1, ClassifObject & r2)