From e1fcbe6ba46d59964ab8121ff9733215fbe9b232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kom=D1=8Fpa?= Date: Mon, 16 May 2011 20:29:13 +0300 Subject: [PATCH] Postgis hints now hints only rules that will actually render, not just modify others' --- src/mapcss/StyleChooser.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/mapcss/StyleChooser.py b/src/mapcss/StyleChooser.py index 0a35cd2..d9181e6 100644 --- a/src/mapcss/StyleChooser.py +++ b/src/mapcss/StyleChooser.py @@ -83,19 +83,21 @@ class StyleChooser: """ a = set() b = "" - for c in self.ruleChains: - - for r in c: - 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]) + needed = set(["width", "casing-width", "fill-color", "fill-image", "icon-image", "text", "extrude"]) + + if not needed.isdisjoint(set(self.styles[0].keys())): + for c in self.ruleChains: + for r in c: + 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 # // Update the current StyleList from this StyleChooser