From c81d11d9341e73043c1be0de51fe61b8831a8197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Mon, 23 Feb 2015 20:38:05 +0100 Subject: [PATCH] Compile DB Selects: bugfix resolve set statements, filter zoom min/max --- pgmapcss/compiler/compile_db_selects.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pgmapcss/compiler/compile_db_selects.py b/pgmapcss/compiler/compile_db_selects.py index fdf9f845..d73a3be4 100644 --- a/pgmapcss/compiler/compile_db_selects.py +++ b/pgmapcss/compiler/compile_db_selects.py @@ -21,7 +21,9 @@ def resolve_set_statements(statement, done, stat): # check if there are any statements which assign the current condition key filter = { 'has_set_tag': condition['key'], - 'max_id': statement['id'] + 'max_id': statement['id'], + 'min_scale': statement['selector']['min_scale'], + 'max_scale': statement['selector']['max_scale'] or 10E+10, } set_statements = stat.filter_statements(filter) @@ -132,7 +134,7 @@ def check_is_sub_selector(selector, master_selector): return is_sub -def compile_selectors_db(statements, selector_index, stat): +def compile_selectors_db(statements, selector_index, stat, filter=None): selectors = {} for i in statements: @@ -141,6 +143,11 @@ def compile_selectors_db(statements, selector_index, stat): else: _statement = i + if filter: + _statement = copy.deepcopy(_statement) + _statement['selector']['min_scale'] = filter['min_scale'] + _statement['selector']['max_scale'] = filter['max_scale'] + for selector in resolve_set_statements(_statement, [], stat): if selector_index is not None: selector = selector[selector_index] @@ -218,7 +225,7 @@ def compile_db_selects(id, stat): filter = { 'min_scale': min_scale, 'max_scale': max_scale or 10E+10} current_selectors = filter_selectors(filter, stat) - conditions = compile_selectors_db(current_selectors, None, stat) + conditions = compile_selectors_db(current_selectors, None, stat, filter) max_scale = min_scale