0

Moved html generation to happen before quadtree generation. This way, you can open up the html file immediately and browse the map as it is being generated! This necessitated pulling the zoom-depth determination out into its own function.

This commit is contained in:
Gregory Short
2010-09-06 20:51:06 -05:00
parent bf07d3d10c
commit 9e11071b35
2 changed files with 30 additions and 20 deletions

19
gmap.py
View File

@@ -36,22 +36,21 @@ def main():
print "processing chunks in background"
results = world.render_chunks_async(chunks, False, options.procs)
print "Generating quad tree. This may take a while and has no progress bar right now, so sit tight."
print "Writing out html file"
if not os.path.exists(destdir):
os.mkdir(destdir)
tiledir = os.path.join(destdir, "tiles");
if not os.path.exists(tiledir):
os.mkdir(tiledir)
zoom = world.get_quadtree_depth(mincol, maxcol, minrow, maxrow)
write_html(destdir, zoom+1)
zoom = world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir)
print "Generating quad tree. This may take a while and has no progress bar right now, so sit tight."
tiledir = os.path.join(destdir, "tiles");
if not os.path.exists(tiledir):
os.mkdir(tiledir)
world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir)
print "DONE"
print "Writing out html file"
write_html(destdir, zoom+1)
def write_html(path, zoomlevel):
templatepath = os.path.join(os.path.split(__file__)[0], "template.html")
html = open(templatepath, 'r').read()