From 6c0ab7e48c4d2b4dd46e3e0b31a626ea73e37869 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 6 Nov 2011 21:08:42 -0500 Subject: [PATCH] moved tile filepath calculation to Tile object --- overviewer_core/quadtree.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/overviewer_core/quadtree.py b/overviewer_core/quadtree.py index 8cbb399..ca18dad 100644 --- a/overviewer_core/quadtree.py +++ b/overviewer_core/quadtree.py @@ -353,8 +353,7 @@ class QuadtreeGen(object): poi_queue = self.world.poi_q - path = os.path.join(self.full_tiledir, *(str(x) for x in tile.path)) - imgpath = path + "." + self.imgformat + imgpath = tile.get_filepath(self.full_tiledir, self.imgformat) # Tiles always involve 3 columns of chunks and 5 rows of tiles (end # ranges are inclusive) @@ -385,7 +384,7 @@ class QuadtreeGen(object): return None # Create the directory if not exists - dirdest = os.path.dirname(path) + dirdest = os.path.dirname(imgpath) if not os.path.exists(dirdest): try: os.makedirs(dirdest) @@ -607,6 +606,14 @@ class Tile(object): def __ne__(self, other): return not self == other + def get_filepath(self, tiledir, imgformat): + """Returns the path to this file given the directory to the tiles + + """ + path = os.path.join(tiledir, *(str(x) for x in self.path)) + imgpath = path + "." + imgformat + return imgpath + @classmethod def from_path(cls, path): """Constructor that takes a path and computes the col,row address of