0

renamed innertile to uppertile (makes more sense)

also changed a few "rendertile" to "worldtile"
This commit is contained in:
Andrew Brown
2011-12-10 17:44:07 -05:00
parent 6cbcd73532
commit d4c6e40d59
2 changed files with 23 additions and 23 deletions

View File

@@ -264,7 +264,7 @@ class QuadtreeGen(object):
return chunklist return chunklist
def get_innertiles(self,zoom): def get_uppertiles(self,zoom):
"""Returns the inner tiles at the given zoom level that need to be rendered """Returns the inner tiles at the given zoom level that need to be rendered
""" """
@@ -276,7 +276,7 @@ class QuadtreeGen(object):
yield [self,tilepath, name] yield [self,tilepath, name]
def render_innertile(self, dest, name): def render_uppertile(self, dest, name):
""" """
Renders a tile at os.path.join(dest, name)+".ext" by taking tiles from Renders a tile at os.path.join(dest, name)+".ext" by taking tiles from
os.path.join(dest, name, "{0,1,2,3}.png") os.path.join(dest, name, "{0,1,2,3}.png")
@@ -331,7 +331,7 @@ class QuadtreeGen(object):
# quit now if we don't need rerender # quit now if we don't need rerender
if not needs_rerender: if not needs_rerender:
return return
#logging.debug("writing out innertile {0}".format(imgpath)) #logging.debug("writing out uppertile {0}".format(imgpath))
# Create the actual image now # Create the actual image now
img = Image.new("RGBA", (384, 384), self.bgcolor) img = Image.new("RGBA", (384, 384), self.bgcolor)
@@ -819,7 +819,7 @@ class Tile(object):
"""A simple container class that represents a single render-tile. """A simple container class that represents a single render-tile.
A render-tile is a tile that is rendered, not a tile composed of other A render-tile is a tile that is rendered, not a tile composed of other
tiles. tiles (upper-tile).
""" """
__slots__ = ("col", "row", "path") __slots__ = ("col", "row", "path")

View File

@@ -174,7 +174,7 @@ class RenderNode(object):
# directories to find what needs to be rendered. We get from this the # directories to find what needs to be rendered. We get from this the
# total tiles that need to be rendered (at the highest level across all # total tiles that need to be rendered (at the highest level across all
# quadtrees) as well as a list of [qtree, DirtyTiles object] # quadtrees) as well as a list of [qtree, DirtyTiles object]
total_rendertiles, dirty_list = self._get_dirty_tiles(procs) total_worldtiles, dirty_list = self._get_dirty_tiles(procs)
# Create a pool # Create a pool
logging.debug("Parent process {0}".format(os.getpid())) logging.debug("Parent process {0}".format(os.getpid()))
@@ -221,7 +221,7 @@ class RenderNode(object):
logging.info("Rendering {0} rendermode{1}".format(len(quadtrees),'s' if len(quadtrees) > 1 else '' )) logging.info("Rendering {0} rendermode{1}".format(len(quadtrees),'s' if len(quadtrees) > 1 else '' ))
logging.info("Started {0} worker process{1}".format( logging.info("Started {0} worker process{1}".format(
procs, "es" if procs != 1 else "")) procs, "es" if procs != 1 else ""))
logging.info("There are {0} tiles to render at this level".format(total_rendertiles)) logging.info("There are {0} tiles to render at this level".format(total_worldtiles))
logging.info("There are {0} total levels".format(self.max_p)) logging.info("There are {0} total levels".format(self.max_p))
# results is a queue of multiprocessing.AsyncResult objects. They are # results is a queue of multiprocessing.AsyncResult objects. They are
@@ -240,8 +240,8 @@ class RenderNode(object):
# which in this case, is render_worldtile_batch() # which in this case, is render_worldtile_batch()
timestamp = time.time() timestamp = time.time()
if total_rendertiles > 0: if total_worldtiles > 0:
self.print_statusline(0, total_rendertiles, 1, True) self.print_statusline(0, total_worldtiles, 1, True)
for result in self._apply_render_worldtiles(dirty_list, pool, batch_size): for result in self._apply_render_worldtiles(dirty_list, pool, batch_size):
results.append(result) results.append(result)
@@ -289,7 +289,7 @@ class RenderNode(object):
while count_to_remove > 0: while count_to_remove > 0:
count_to_remove -= 1 count_to_remove -= 1
complete += results.popleft().get() complete += results.popleft().get()
self.print_statusline(complete, total_rendertiles, 1) self.print_statusline(complete, total_worldtiles, 1)
# If the results queue is getting too big, drain all but # If the results queue is getting too big, drain all but
# 500//batch_size items from it # 500//batch_size items from it
@@ -298,7 +298,7 @@ class RenderNode(object):
# required has an upper bound # required has an upper bound
while len(results) > (500//batch_size): while len(results) > (500//batch_size):
complete += results.popleft().get() complete += results.popleft().get()
self.print_statusline(complete, total_rendertiles, 1) self.print_statusline(complete, total_worldtiles, 1)
# Loop back to the top, add more items to the queue, and repeat # Loop back to the top, add more items to the queue, and repeat
@@ -306,7 +306,7 @@ class RenderNode(object):
# results to come in before continuing # results to come in before continuing
while len(results) > 0: while len(results) > 0:
complete += results.popleft().get() complete += results.popleft().get()
self.print_statusline(complete, total_rendertiles, 1) self.print_statusline(complete, total_worldtiles, 1)
# Now drain the point of interest queues for each world # Now drain the point of interest queues for each world
for world in self.worlds: for world in self.worlds:
@@ -327,8 +327,8 @@ class RenderNode(object):
pass pass
# Print the final status line almost unconditionally # Print the final status line almost unconditionally
if total_rendertiles > 0: if total_worldtiles > 0:
self.print_statusline(complete, total_rendertiles, 1, True) self.print_statusline(complete, total_worldtiles, 1, True)
########################################## ##########################################
# The highest zoom level has been rendered. # The highest zoom level has been rendered.
@@ -353,13 +353,13 @@ class RenderNode(object):
self.print_statusline(0, total, level, True) self.print_statusline(0, total, level, True)
# Same deal as above. _apply_render_innertile adds tiles in batch # Same deal as above. _apply_render_uppertile adds tiles in batch
# to the worker pool and yields result objects that return the # to the worker pool and yields result objects that return the
# number of tiles rendered. # number of tiles rendered.
# #
# XXX Some quadtrees may not have tiles at this zoom level if we're # XXX Some quadtrees may not have tiles at this zoom level if we're
# not assuming they all have the same depth!! # not assuming they all have the same depth!!
for result in self._apply_render_innertile(pool, zoom,batch_size): for result in self._apply_render_uppertile(pool, zoom,batch_size):
results.append(result) results.append(result)
# every second drain some of the queue # every second drain some of the queue
timestamp2 = time.time() timestamp2 = time.time()
@@ -389,7 +389,7 @@ class RenderNode(object):
# Do the final one right here: # Do the final one right here:
for q in quadtrees: for q in quadtrees:
q.render_innertile(os.path.join(q.destdir, q.tiledir), "base") q.render_uppertile(os.path.join(q.destdir, q.tiledir), "base")
def _get_dirty_tiles(self, procs): def _get_dirty_tiles(self, procs):
"""Returns two items: """Returns two items:
@@ -489,8 +489,8 @@ class RenderNode(object):
if len(batch): if len(batch):
yield pool.apply_async(func=render_worldtile_batch, args= [batch]) yield pool.apply_async(func=render_worldtile_batch, args= [batch])
def _apply_render_innertile(self, pool, zoom,batch_size): def _apply_render_uppertile(self, pool, zoom,batch_size):
"""Same as _apply_render_worltiles but for the innertile routine. """Same as _apply_render_worltiles but for the uppertile routine.
Returns an iterator that yields result objects from tasks that have Returns an iterator that yields result objects from tasks that have
been applied to the pool. been applied to the pool.
""" """
@@ -500,7 +500,7 @@ class RenderNode(object):
batch = [] batch = []
jobcount = 0 jobcount = 0
# roundrobin add tiles to a batch job (thus they should all roughly work on similar chunks) # roundrobin add tiles to a batch job (thus they should all roughly work on similar chunks)
iterables = [q.get_innertiles(zoom) for q in self.quadtrees if zoom <= q.p] iterables = [q.get_uppertiles(zoom) for q in self.quadtrees if zoom <= q.p]
for job in util.roundrobin(iterables): for job in util.roundrobin(iterables):
# fixup so the worker knows which quadtree this is # fixup so the worker knows which quadtree this is
job[0] = job[0]._render_index job[0] = job[0]._render_index
@@ -509,11 +509,11 @@ class RenderNode(object):
jobcount += 1 jobcount += 1
if jobcount >= batch_size: if jobcount >= batch_size:
jobcount = 0 jobcount = 0
yield pool.apply_async(func=render_innertile_batch, args= [batch]) yield pool.apply_async(func=render_uppertile_batch, args= [batch])
batch = [] batch = []
if jobcount > 0: if jobcount > 0:
yield pool.apply_async(func=render_innertile_batch, args= [batch]) yield pool.apply_async(func=render_uppertile_batch, args= [batch])
######################################################################################## ########################################################################################
@@ -542,7 +542,7 @@ def render_worldtile_batch(batch):
return count return count
@catch_keyboardinterrupt @catch_keyboardinterrupt
def render_innertile_batch(batch): def render_uppertile_batch(batch):
global child_rendernode global child_rendernode
rendernode = child_rendernode rendernode = child_rendernode
count = 0 count = 0
@@ -551,7 +551,7 @@ def render_innertile_batch(batch):
count += 1 count += 1
quadtree = rendernode.quadtrees[job[0]] quadtree = rendernode.quadtrees[job[0]]
dest = quadtree.full_tiledir+os.sep+job[1] dest = quadtree.full_tiledir+os.sep+job[1]
quadtree.render_innertile(dest=dest,name=job[2]) quadtree.render_uppertile(dest=dest,name=job[2])
return count return count
@catch_keyboardinterrupt @catch_keyboardinterrupt