diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp index 39d45dcc91..f87a697066 100644 --- a/drape_frontend/stylist.cpp +++ b/drape_frontend/stylist.cpp @@ -68,17 +68,6 @@ bool IsMiddleTunnel(int const layer, double const depth) return layer != feature::LAYER_EMPTY && depth < 19000; } -void FilterRulesByRuntimeSelector(FeatureType const & f, int zoomLevel, drule::KeysT & keys) -{ - keys.erase_if([&f, zoomLevel](drule::Key const & key)->bool - { - drule::BaseRule const * const rule = drule::rules().Find(key); - if (rule == nullptr) - return true; - return !rule->TestFeature(f, zoomLevel); - }); -} - class Aggregator { public: @@ -382,7 +371,7 @@ bool InitStylist(FeatureType const & f, int8_t deviceLang, int const zoomLevel, drule::KeysT keys; pair const geomType = feature::GetDrawRule(types, zoomLevel, keys); - FilterRulesByRuntimeSelector(f, zoomLevel, keys); + feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys); if (keys.empty()) return false; @@ -433,7 +422,7 @@ double GetFeaturePriority(FeatureType const & f, int const zoomLevel) drule::KeysT keys; pair const geomType = feature::GetDrawRule(f, zoomLevel, keys); - FilterRulesByRuntimeSelector(f, zoomLevel, keys); + feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys); feature::EGeomType const mainGeomType = feature::EGeomType(geomType.first); diff --git a/indexer/displacement_manager.hpp b/indexer/displacement_manager.hpp index ba1e8112cc..4b642a2367 100644 --- a/indexer/displacement_manager.hpp +++ b/indexer/displacement_manager.hpp @@ -185,6 +185,8 @@ private: // Calculate depth field drule::KeysT keys; feature::GetDrawRule(ft, zoomLevel, keys); + // While the function has "runtime" in its name, it merely filters by metadata-based rules. + feature::FilterRulesByRuntimeSelector(ft, zoomLevel, keys); drule::MakeUnique(keys); float depth = 0; for (size_t i = 0, count = keys.size(); i < count; ++i) diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index 1b0e5ea084..322e5bb243 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -1,6 +1,6 @@ #include "indexer/feature_visibility.hpp" #include "indexer/classificator.hpp" -#include "indexer/feature.hpp" +#include "indexer/drawing_rules.hpp" #include "indexer/scales.hpp" #include "base/assert.hpp" @@ -114,6 +114,17 @@ void GetDrawRule(vector const & types, int level, int geoType, (void)c.ProcessObjects(t, doRules); } +void FilterRulesByRuntimeSelector(FeatureType const & f, int zoomLevel, drule::KeysT & keys) +{ + keys.erase_if([&f, zoomLevel](drule::Key const & key)->bool + { + drule::BaseRule const * const rule = drule::rules().Find(key); + if (rule == nullptr) + return true; + return !rule->TestFeature(f, zoomLevel); + }); +} + namespace { class IsDrawableChecker diff --git a/indexer/feature_visibility.hpp b/indexer/feature_visibility.hpp index 0e0811d7d0..42a65aa827 100644 --- a/indexer/feature_visibility.hpp +++ b/indexer/feature_visibility.hpp @@ -1,6 +1,7 @@ #pragma once #include "indexer/drawing_rule_def.hpp" +#include "indexer/feature.hpp" #include "indexer/feature_decl.hpp" #include "base/base.hpp" @@ -64,6 +65,7 @@ namespace feature drule::KeysT & keys); void GetDrawRule(vector const & types, int level, int geoType, drule::KeysT & keys); + void FilterRulesByRuntimeSelector(FeatureType const & f, int zoomLevel, drule::KeysT & keys); /// Used to check whether user types belong to particular classificator set. class TypeSetChecker