forked from organicmaps/organicmaps
Revert "Fixed dynamic selector"
This reverts commit 63bcb34d9fd5d0ec319b33941ecee122add0b00e.
This commit is contained in:
parent
61b6b5b639
commit
c3e2303753
1 changed files with 17 additions and 10 deletions
|
@ -69,6 +69,16 @@ 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);
|
||||
ASSERT(rule != nullptr, ());
|
||||
return !rule->TestFeature(f, zoomLevel);
|
||||
});
|
||||
}
|
||||
|
||||
class KeyFunctor
|
||||
{
|
||||
public:
|
||||
|
@ -95,11 +105,6 @@ public:
|
|||
|
||||
void ProcessKey(drule::Key const & key)
|
||||
{
|
||||
drule::BaseRule const * const dRule = drule::rules().Find(key);
|
||||
|
||||
if (!dRule->TestFeature(m_f, m_zoomLevel))
|
||||
return;
|
||||
|
||||
double depth = key.m_priority;
|
||||
if (IsMiddleTunnel(m_depthLayer, depth) &&
|
||||
IsTypeOf(key, Line | Area | Waymarker))
|
||||
|
@ -117,6 +122,9 @@ public:
|
|||
else if (IsTypeOf(key, Area))
|
||||
depth -= m_priorityModifier;
|
||||
|
||||
drule::BaseRule const * const dRule = drule::rules().Find(key);
|
||||
m_rules.push_back(make_pair(dRule, depth));
|
||||
|
||||
if (dRule->GetCaption(0) != nullptr)
|
||||
{
|
||||
InitCaptionDescription();
|
||||
|
@ -127,8 +135,6 @@ public:
|
|||
m_pointStyleFound |= (IsTypeOf(key, Symbol | Circle) || isNonEmptyCaption);
|
||||
m_lineStyleFound |= IsTypeOf(key, Line);
|
||||
m_auxCaptionFound |= (dRule->GetCaption(1) != nullptr);
|
||||
|
||||
m_rules.push_back(make_pair(dRule, depth));
|
||||
}
|
||||
|
||||
bool m_pointStyleFound;
|
||||
|
@ -363,6 +369,8 @@ bool InitStylist(FeatureType const & f, int const zoomLevel, bool buildings3d, S
|
|||
drule::KeysT keys;
|
||||
pair<int, bool> const geomType = feature::GetDrawRule(types, zoomLevel, keys);
|
||||
|
||||
FilterRulesByRuntimeSelector(f, zoomLevel, keys);
|
||||
|
||||
if (keys.empty())
|
||||
return false;
|
||||
|
||||
|
@ -395,9 +403,6 @@ bool InitStylist(FeatureType const & f, int const zoomLevel, bool buildings3d, S
|
|||
for (auto const & key : keys)
|
||||
keyFunctor.ProcessKey(key);
|
||||
|
||||
if (keyFunctor.m_rules.empty())
|
||||
return false;
|
||||
|
||||
if (keyFunctor.m_pointStyleFound)
|
||||
s.RaisePointStyleFlag();
|
||||
if (keyFunctor.m_lineStyleFound)
|
||||
|
@ -416,6 +421,8 @@ 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::EGeomType const mainGeomType = feature::EGeomType(geomType.first);
|
||||
|
||||
CaptionDescription descr;
|
||||
|
|
Loading…
Add table
Reference in a new issue