From 736f9a8b29c1ebbfe2dbccc5ec46c9c1439bf5ac Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Tue, 21 Mar 2023 09:43:14 +0000 Subject: [PATCH] [core] Delete unused types-related code Signed-off-by: Konstantin Pastbin --- drape_frontend/stylist.cpp | 20 -------------------- drape_frontend/stylist.hpp | 2 -- indexer/classificator.cpp | 18 ++++++++++-------- indexer/classificator.hpp | 2 +- indexer/map_object.cpp | 2 +- map/place_page_info.cpp | 2 -- map/place_page_info.hpp | 2 -- 7 files changed, 12 insertions(+), 36 deletions(-) diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp index 3da5ad815d..ec515e587f 100644 --- a/drape_frontend/stylist.cpp +++ b/drape_frontend/stylist.cpp @@ -367,24 +367,4 @@ bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool b return true; } -double GetFeaturePriority(FeatureType & f, int const zoomLevel) -{ - feature::TypesHolder types(f); - drule::KeysT keys; - feature::GetDrawRule(types, zoomLevel, keys); - - feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys); - - Aggregator aggregator(f, types.GetGeomType(), zoomLevel, keys.size()); - aggregator.AggregateKeys(keys); - - float maxPriority = kMinPriority; - for (auto const & rule : aggregator.m_rules) - { - if (rule.m_depth > maxPriority) - maxPriority = rule.m_depth; - } - - return maxPriority; -} } // namespace df diff --git a/drape_frontend/stylist.hpp b/drape_frontend/stylist.hpp index 6654935835..f239e68673 100644 --- a/drape_frontend/stylist.hpp +++ b/drape_frontend/stylist.hpp @@ -89,6 +89,4 @@ private: bool InitStylist(FeatureType & f, int8_t deviceLang, int const zoomLevel, bool buildings3d, Stylist & s); - -double GetFeaturePriority(FeatureType & f, int const zoomLevel); } // namespace df diff --git a/indexer/classificator.cpp b/indexer/classificator.cpp index 9bd8d29b56..221d39688a 100644 --- a/indexer/classificator.cpp +++ b/indexer/classificator.cpp @@ -51,11 +51,11 @@ ClassifObject * ClassifObject::Find(string const & s) void ClassifObject::AddDrawRule(drule::Key const & k) { - auto i = lower_bound(m_drawRule.begin(), m_drawRule.end(), k.m_scale, less_scales()); - for (; i != m_drawRule.end() && i->m_scale == k.m_scale; ++i) + auto i = lower_bound(m_drawRules.begin(), m_drawRules.end(), k.m_scale, less_scales()); + for (; i != m_drawRules.end() && i->m_scale == k.m_scale; ++i) if (k == *i) return; // already exists - m_drawRule.insert(i, k); + m_drawRules.insert(i, k); } ClassifObjectPtr ClassifObject::BinaryFind(std::string_view const s) const @@ -84,7 +84,7 @@ void ClassifObject::LoadPolicy::EndChilds() void ClassifObject::Sort() { - sort(m_drawRule.begin(), m_drawRule.end(), less_scales()); + sort(m_drawRules.begin(), m_drawRules.end(), less_scales()); sort(m_objs.begin(), m_objs.end(), LessName()); for (auto & obj : m_objs) obj.Sort(); @@ -93,7 +93,7 @@ void ClassifObject::Sort() void ClassifObject::Swap(ClassifObject & r) { swap(m_name, r.m_name); - swap(m_drawRule, r.m_drawRule); + swap(m_drawRules, r.m_drawRules); swap(m_objs, r.m_objs); swap(m_visibility, r.m_visibility); } @@ -237,6 +237,7 @@ namespace void add_rule(int ft, iter_t i) { static const int visible[3][drule::count_of_rules] = { + //{ line, area, symbol, caption, circle, pathtext, waymarker, shield } { 0, 0, 1, 1, 1, 0, 0, 0 }, // fpoint { 1, 0, 0, 0, 0, 1, 0, 1 }, // fline { 1, 1, 1, 1, 1, 0, 0, 0 } // farea @@ -270,7 +271,7 @@ void ClassifObject::GetSuitable(int scale, feature::GeomType gt, drule::KeysT & return; // find rules for 'scale' - suitable_getter rulesGetter(m_drawRule, keys); + suitable_getter rulesGetter(m_drawRules, keys); rulesGetter.find(static_cast(gt), scale); } @@ -281,7 +282,7 @@ bool ClassifObject::IsDrawable(int scale) const bool ClassifObject::IsDrawableAny() const { - return (m_visibility != VisibleMask() && !m_drawRule.empty()); + return (m_visibility != VisibleMask() && !m_drawRules.empty()); } bool ClassifObject::IsDrawableLike(feature::GeomType gt, bool emptyName) const @@ -293,12 +294,13 @@ bool ClassifObject::IsDrawableLike(feature::GeomType gt, bool emptyName) const return false; static const int visible[3][drule::count_of_rules] = { + //{ line, area, symbol, caption, circle, pathtext, waymarker, shield } {0, 0, 1, 1, 1, 0, 0, 0}, // fpoint {1, 0, 0, 0, 0, 1, 0, 1}, // fline {0, 1, 0, 0, 0, 0, 0, 0} // farea (!!! key difference with GetSuitable !!!) }; - for (auto const & k : m_drawRule) + for (auto const & k : m_drawRules) { ASSERT_LESS(k.m_type, drule::count_of_rules, ()); diff --git a/indexer/classificator.hpp b/indexer/classificator.hpp index 20637cc6c6..4382a0e224 100644 --- a/indexer/classificator.hpp +++ b/indexer/classificator.hpp @@ -158,7 +158,7 @@ public: private: std::string m_name; - std::vector m_drawRule; + std::vector m_drawRules; std::vector m_objs; VisibleMask m_visibility; }; diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index 528c7eb157..85b56e05a8 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -111,7 +111,7 @@ string MapObject::GetLocalizedType() const feature::TypesHolder copy(m_types); copy.SortBySpec(); - return platform::GetLocalizedTypeName(classif().GetReadableObjectName(*copy.begin())); + return platform::GetLocalizedTypeName(classif().GetReadableObjectName(copy.GetBestType())); } std::string_view MapObject::GetMetadata(MetadataID type) const diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index 23d6e4becd..d2633fc186 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -49,8 +49,6 @@ void Info::SetFromFeatureType(FeatureType & ft) true /* allowTranslit */} , out); } - m_sortedTypes = m_types; - m_sortedTypes.SortBySpec(); m_primaryFeatureName = out.GetPrimary(); if (IsBookmark()) { diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 7473442c91..576ea588fe 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -274,8 +274,6 @@ private: /// Feature status FeatureStatus m_featureStatus = FeatureStatus::Untouched; - feature::TypesHolder m_sortedTypes; - std::optional m_hotelType; uint8_t m_popularity = 0;