Fixed dynamic selector

This commit is contained in:
kshalnev 2016-02-15 23:21:47 +03:00
parent 3cf4dce6a1
commit 4344713012

View file

@ -69,16 +69,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);
ASSERT(rule != nullptr, ());
return !rule->TestFeature(f, zoomLevel);
});
}
class KeyFunctor
{
public:
@ -105,6 +95,11 @@ 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))
@ -122,9 +117,6 @@ 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();
@ -135,6 +127,8 @@ 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;
@ -361,8 +355,6 @@ 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,6 +387,9 @@ 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)
@ -413,8 +408,6 @@ 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;