0

added command line option for web_assets postprocessing hook

This commit is contained in:
Aaron Griffith
2011-03-19 20:45:40 -04:00
parent edf34f6d59
commit 38deb98d5a
3 changed files with 35 additions and 3 deletions

View File

@@ -81,7 +81,7 @@ def catch_keyboardinterrupt(func):
return newfunc
class QuadtreeGen(object):
def __init__(self, worldobj, destdir, depth=None, imgformat=None, optimizeimg=None):
def __init__(self, worldobj, destdir, depth=None, imgformat=None, optimizeimg=None, web_assets_hook=None):
"""Generates a quadtree from the world given into the
given dest directory
@@ -94,6 +94,7 @@ class QuadtreeGen(object):
assert(imgformat)
self.imgformat = imgformat
self.optimizeimg = optimizeimg
self.web_assets_hook = web_assets_hook
# Make the destination dir
if not os.path.exists(destdir):
@@ -182,6 +183,8 @@ class QuadtreeGen(object):
output.write(index)
if skipjs:
if self.web_assets_hook:
self.web_assets_hook(self)
return
# since we will only discover PointsOfInterest in chunks that need to be
@@ -210,6 +213,9 @@ class QuadtreeGen(object):
output.write(' // ]},\n')
output.write('];')
if self.web_assets_hook:
self.web_assets_hook(self)
def _get_cur_depth(self):
"""How deep is the quadtree currently in the destdir? This glances in
config.js to see what maxZoom is set to.