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:
19
gmap.py
19
gmap.py
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user