Avoid digging into the tileset when writing out config.js
This commit is contained in:
@@ -296,7 +296,7 @@ dir but you forgot to put quotes around the directory, since it contains spaces.
|
||||
os.mkdir(tileset_dir)
|
||||
|
||||
# only pass to the TileSet the options it really cares about
|
||||
tileSetOpts = util.dict_subset(render, ["name", "imgformat", "renderchecks", "rerenderprob", "bgcolor", "imgquality", "optimizeimg", "rendermode"])
|
||||
tileSetOpts = util.dict_subset(render, ["name", "imgformat", "renderchecks", "rerenderprob", "bgcolor", "imgquality", "optimizeimg", "rendermode", "worldname_orig", "title"])
|
||||
tset = tileset.TileSet(rset, assetMrg, tex, tileSetOpts, tileset_dir)
|
||||
tilesets.append(tset)
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ directory.
|
||||
# TODO based on the type, so something
|
||||
POI[regionset.name].append
|
||||
|
||||
|
||||
def finalize(self, tilesets):
|
||||
|
||||
# dictionary to hold the overviewerConfig.js settings that we will dumps
|
||||
@@ -108,27 +107,13 @@ directory.
|
||||
|
||||
dump['tilesets'] = []
|
||||
|
||||
def bgcolorformat(color):
|
||||
return "#%02x%02x%02x" % color[0:3]
|
||||
|
||||
for tileset in tilesets:
|
||||
js_tileset = dict()
|
||||
js_tileset['name'] = tileset.options.get('title')
|
||||
js_tileset['zoomLevels'] = tileset.treedepth
|
||||
js_tileset['minZoom'] = 0
|
||||
js_tileset['defaultZoom'] = 1
|
||||
js_tileset['maxZoom'] = tileset.treedepth
|
||||
js_tileset['path'] = tileset.options.get('name')
|
||||
js_tileset['base'] = ''
|
||||
js_tileset['bgcolor'] = bgcolorformat(tileset.options.get('bgcolor'))
|
||||
js_tileset['world'] = tileset.options.get('worldname_orig')
|
||||
js_tileset['last_rendertime'] = tileset.this_rendertime
|
||||
js_tileset['north_direction'] = 'upper-left'
|
||||
dump['tilesets'].append(js_tileset)
|
||||
dump['tilesets'].append(tileset.get_persistent_data())
|
||||
|
||||
# write a blank image
|
||||
blank = Image.new("RGBA", (1,1), tileset.options.get('bgcolor'))
|
||||
blank.save(os.path.join(self.outputdir, tileset.options.get('name'), "blank."+tileset.options.get('imgformat')))
|
||||
blank.save(os.path.join(self.outputdir, tileset.options.get('name'), "blank." + tileset.options.get('imgformat')))
|
||||
|
||||
|
||||
jsondump = json.dumps(dump, indent=4)
|
||||
|
||||
@@ -380,7 +380,22 @@ class TileSet(object):
|
||||
TileSet. Typically this is called by AssetManager
|
||||
|
||||
"""
|
||||
return None
|
||||
def bgcolorformat(color):
|
||||
return "#%02x%02x%02x" % color[0:3]
|
||||
d = dict(name = self.options.get('title'),
|
||||
zoomLevels = self.treedepth,
|
||||
minZoom = 0,
|
||||
defaultZoom = 1,
|
||||
maxZoom = self.treedepth,
|
||||
path = self.options.get('name'),
|
||||
base = '',
|
||||
bgcolor = bgcolorformat(self.options.get('bgcolor')),
|
||||
world = self.options.get('worldname_orig'),
|
||||
last_rendertime = self.this_rendertime,
|
||||
north_direction = 'upper-left')
|
||||
print "get_persistent_data: %r" % d
|
||||
return d
|
||||
|
||||
|
||||
def _find_chunk_range(self):
|
||||
"""Finds the chunk range in rows/columns and stores them in
|
||||
@@ -1301,6 +1316,7 @@ class RenderTile(object):
|
||||
imgpath = ".".join((path, imgformat))
|
||||
return imgpath
|
||||
|
||||
|
||||
@classmethod
|
||||
def from_path(cls, path):
|
||||
"""Constructor that takes a path and computes the col,row address of
|
||||
|
||||
Reference in New Issue
Block a user