Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Shalnev <c.shalnev@corp.mail.ru>2016-02-29 18:55:11 +0300
committerSergey Yershov <yershov@corp.mail.ru>2016-03-23 16:49:28 +0300
commitc3e230375311e00312f91e78d0bf6d2e74e084ab (patch)
treee4d10e614541f933e15bb593e46960cda9209590 /drape_frontend/stylist.cpp
parent61b6b5b6396694c364e0e8e2bac8e82f7a987dfb (diff)
Revert "Fixed dynamic selector"
This reverts commit 63bcb34d9fd5d0ec319b33941ecee122add0b00e.
Diffstat (limited to 'drape_frontend/stylist.cpp')
-rw-r--r--drape_frontend/stylist.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/drape_frontend/stylist.cpp b/drape_frontend/stylist.cpp
index 7a459dd3cc..b91392d97e 100644
--- a/drape_frontend/stylist.cpp
+++ b/drape_frontend/stylist.cpp
@@ -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;