forked from organicmaps/organicmaps
[indexer] Check for runtime selectors for static displacement
This commit is contained in:
parent
e8cb8b8361
commit
cc4e6c0a1e
4 changed files with 18 additions and 14 deletions
|
@ -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<int, bool> 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<int, bool> const geomType = feature::GetDrawRule(f, zoomLevel, keys);
|
||||
|
||||
FilterRulesByRuntimeSelector(f, zoomLevel, keys);
|
||||
feature::FilterRulesByRuntimeSelector(f, zoomLevel, keys);
|
||||
|
||||
feature::EGeomType const mainGeomType = feature::EGeomType(geomType.first);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<uint32_t> 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
|
||||
|
|
|
@ -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<uint32_t> 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
|
||||
|
|
Loading…
Add table
Reference in a new issue