From 7bc4153a6312d65bf61b63610c8abd7b2ca9ae78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kom=D1=8Fpa?= Date: Fri, 16 Jul 2010 16:57:53 +0300 Subject: [PATCH] Fixed MaxZoom --- src/mapcss/Eval.py | 1 + src/mapcss/Rule.py | 2 +- src/mapcss/StyleChooser.py | 7 ++++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mapcss/Eval.py b/src/mapcss/Eval.py index a4cc4a5..4e49478 100644 --- a/src/mapcss/Eval.py +++ b/src/mapcss/Eval.py @@ -27,6 +27,7 @@ class Eval(): try: self.expr = compile (s, "MapCSS expression", "eval") except: + print "Can't compile %s" % s self.expr = compile ("0", "MapCSS expression", "eval") diff --git a/src/mapcss/Rule.py b/src/mapcss/Rule.py index dedba34..5eb6c69 100644 --- a/src/mapcss/Rule.py +++ b/src/mapcss/Rule.py @@ -20,7 +20,7 @@ class Rule(): def __init__(self, s=''): self.conditions = [] self.isAnd = True - self.minZoom = 0 #### FIXME: take from MapCSS creation thingz + self.minZoom = 0 self.maxZoom = 19 self.subject = s # "", "way", "node" or "relation" def __repr__(self): diff --git a/src/mapcss/StyleChooser.py b/src/mapcss/StyleChooser.py index 7ad86e7..d63f4db 100644 --- a/src/mapcss/StyleChooser.py +++ b/src/mapcss/StyleChooser.py @@ -122,7 +122,7 @@ class StyleChooser: "these things are arrays of float's or not in table at all" try: b = b.split(",") - b = [int(x) for x in b] + b = [float(x) for x in b] ra[a]= b except ValueError: pass @@ -233,6 +233,8 @@ class StyleChooser: adds into the current ruleChain (starting a new Rule) """ self.ruleChains[self.rcpos].append(Rule(e)) + self.ruleChains[self.rcpos][len(self.ruleChains[self.rcpos])-1].minZoom=float(self.scalepair[0]) + self.ruleChains[self.rcpos][len(self.ruleChains[self.rcpos])-1].maxZoom=float(self.scalepair[1]) @@ -251,8 +253,7 @@ class StyleChooser: adds into the current ruleChain (existing Rule) """ self.ruleChains[self.rcpos][len(self.ruleChains[self.rcpos])-1].conditions.append(c) - self.ruleChains[self.rcpos][len(self.ruleChains[self.rcpos])-1].minZoom=float(self.scalepair[0]) - self.ruleChains[self.rcpos][len(self.ruleChains[self.rcpos])-1].maxZoom=float(self.scalepair[1]) + def addStyles(self, a): """