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
path: root/tools
diff options
context:
space:
mode:
authorConstantin Shalnev <c.shalnev@corp.mail.ru>2015-08-11 12:41:17 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:00:40 +0300
commita96a172b084a375deb739622e0fab9cb83894a50 (patch)
treeafef4ece74ec599c1e1e6a439cfdd5056eb1ebd4 /tools
parent3843c26c03e8137e631099f76e09b25a29d0f57a (diff)
Removed get_sql and get_sql_hints unused functions
Diffstat (limited to 'tools')
-rw-r--r--tools/kothic/mapcss/Condition.py34
-rw-r--r--tools/kothic/mapcss/Rule.py17
-rw-r--r--tools/kothic/mapcss/StyleChooser.py23
-rw-r--r--tools/kothic/mapcss/__init__.py12
4 files changed, 0 insertions, 86 deletions
diff --git a/tools/kothic/mapcss/Condition.py b/tools/kothic/mapcss/Condition.py
index e455f7cdff..edbd7a0f7a 100644
--- a/tools/kothic/mapcss/Condition.py
+++ b/tools/kothic/mapcss/Condition.py
@@ -182,40 +182,6 @@ class Condition:
pass
return self
- def get_sql(self):
- # params = [re.escape(x) for x in self.params]
- params = self.params
- t = self.type
- if t == 'eq': # don't compare tags against sublayers
- if params[0][:2] == "::":
- return ("", "")
- try:
- if t == 'eq':
- return params[0], '"%s" = \'%s\'' % (params[0], params[1])
- if t == 'ne':
- return params[0], '("%s" != \'%s\' or "%s" IS NULL)' % (params[0], params[1], params[0])
- if t == 'regex':
- return params[0], '"%s" ~ \'%s\'' % (params[0], params[1].replace("'", "\\'"))
- if t == 'true':
- return params[0], '"%s" = \'yes\'' % (params[0])
- if t == 'untrue':
- return params[0], '"%s" = \'no\'' % (params[0])
- if t == 'set':
- return params[0], '"%s" IS NOT NULL' % (params[0])
- if t == 'unset':
- return params[0], '"%s" IS NULL' % (params[0])
-
- if t == '<':
- return params[0], """(CASE WHEN "%s" ~ E'^[-]?[[:digit:]]+([.][[:digit:]]+)?$' THEN CAST ("%s" AS FLOAT) &lt; %s ELSE false END) """ % (params[0], params[0], params[1])
- if t == '<=':
- return params[0], """(CASE WHEN "%s" ~ E'^[-]?[[:digit:]]+([.][[:digit:]]+)?$' THEN CAST ("%s" AS FLOAT) &lt;= %s ELSE false END)""" % (params[0], params[0], params[1])
- if t == '>':
- return params[0], """(CASE WHEN "%s" ~ E'^[-]?[[:digit:]]+([.][[:digit:]]+)?$' THEN CAST ("%s" AS FLOAT) > %s ELSE false END) """ % (params[0], params[0], params[1])
- if t == '>=':
- return params[0], """(CASE WHEN "%s" ~ E'^[-]?[[:digit:]]+([.][[:digit:]]+)?$' THEN CAST ("%s" AS FLOAT) >= %s ELSE false END) """ % (params[0], params[0], params[1])
- except KeyError:
- pass
-
def __repr__(self):
return "%s %s " % (self.type, repr(self.params))
diff --git a/tools/kothic/mapcss/Rule.py b/tools/kothic/mapcss/Rule.py
index e2858d86c0..4e5ecba56c 100644
--- a/tools/kothic/mapcss/Rule.py
+++ b/tools/kothic/mapcss/Rule.py
@@ -86,23 +86,6 @@ class Rule():
a.discard(False)
return a
- def get_sql_hints(self, obj, zoom):
- if obj:
- if (self.subject != '') and not _test_feature_compatibility(obj, self.subject, {":area": "yes"}):
- return set()
- if not self.test_zoom(zoom):
- return set()
- a = set()
- b = set()
- for condition in self.conditions:
- q = condition.get_sql()
- if q:
- if q[1]:
- a.add(q[0])
- b.add(q[1])
- b = " AND ".join(b)
- return a, b
-
def _test_feature_compatibility(f1, f2, tags={}):
"""
diff --git a/tools/kothic/mapcss/StyleChooser.py b/tools/kothic/mapcss/StyleChooser.py
index b2cfb723cc..db152f3438 100644
--- a/tools/kothic/mapcss/StyleChooser.py
+++ b/tools/kothic/mapcss/StyleChooser.py
@@ -131,29 +131,6 @@ class StyleChooser:
a.add("*")
return a
- def get_sql_hints(self, type, zoom):
- """
- Returns a set of tags that were used in here in form of SQL-hints.
- """
- a = set()
- b = ""
- needed = set(["width", "casing-width", "fill-color", "fill-image", "icon-image", "text", "extrude", "background-image", "background-color", "pattern-image", "shield-text"])
-
- if not needed.isdisjoint(set(self.styles[0].keys())):
- for r in self.ruleChains:
- p = r.get_sql_hints(type, zoom)
- if p:
- q = "(" + p[1] + ")" # [t[1] for t in p]
- if q == "()":
- q = ""
- if b and q:
- b += " OR " + q
- else:
- b = q
- a.update(p[0])
- # no need to check for eval's
- return a, b
-
def updateStyles(self, sl, ftype, tags, zoom, scale, zscale):
# Are any of the ruleChains fulfilled?
if self.selzooms:
diff --git a/tools/kothic/mapcss/__init__.py b/tools/kothic/mapcss/__init__.py
index 427c9dba33..a78519ffbb 100644
--- a/tools/kothic/mapcss/__init__.py
+++ b/tools/kothic/mapcss/__init__.py
@@ -186,18 +186,6 @@ class MapCSS():
tags.update(chooser.get_interesting_tags(type, zoom))
return tags
- def get_sql_hints(self, type=None, zoom=None):
- """
- Get set of interesting tags.
- """
- hints = []
- for chooser in self.choosers:
- p = chooser.get_sql_hints(type, zoom)
- if p:
- if p[0] and p[1]:
- hints.append(p)
- return hints
-
def subst_variables(self, t):
"""Expects an array from parseDeclaration."""
for k in t[0]: