Permalink
Browse files

changing zoom handler to accept ranges

  • Loading branch information...
1 parent 769bb3f commit 010879f667e51b70607b0959105995cd63a2cbc7 @llimllib llimllib committed Nov 22, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 TileStache/Goodies/Providers/Composite.py
@@ -277,13 +277,16 @@ def __init__(self, layername=None, colorname=None, maskname=None, opacity=1.0,
self.opacity = opacity
self.blendmode = blendmode
self.adjustments = adjustments
- self.zoom = re.search("^\s*([><=]=?)\s*(\d+)", zoom)
+ self.zoom = re.search("^(\d+)-(\d+)$|^(\d+)$", zoom) if zoom else None
if self.zoom:
- op, level = self.zoom.groups()
- self.zoom = eval("lambda x: x %s %d" % (op, int(level)))
+ minlvl, maxlvl, level = self.zoom.groups()
+ if minlvl and maxlvl:
+ self.zoom = lambda z: int(minlvl) <= z <= int(maxlvl)
+ else:
+ self.zoom = lambda z: z == level
else:
- self.zoom = lambda: True
+ self.zoom = lambda z: True
def render(self, config, input_rgba, coord):
""" Render this image layer.

0 comments on commit 010879f

Please sign in to comment.