now defaults to the map's current north direction unless otherwise specified
This commit is contained in:
@@ -198,6 +198,9 @@ Options
|
|||||||
--north-direction=NORTH_DIRECTION
|
--north-direction=NORTH_DIRECTION
|
||||||
Specifies which corner of the screen north will point to.
|
Specifies which corner of the screen north will point to.
|
||||||
Valid options are: lower-left, upper-left, upper-right, lower-right.
|
Valid options are: lower-left, upper-left, upper-right, lower-right.
|
||||||
|
If you do not specify this option, it will default to whatever direction
|
||||||
|
the existing map uses. For new maps, it defaults to lower-left for
|
||||||
|
historical reasons.
|
||||||
|
|
||||||
--settings=PATH
|
--settings=PATH
|
||||||
Use this option to load settings from a file. The format of this file is
|
Use this option to load settings from a file. The format of this file is
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ def main():
|
|||||||
cpus = 1
|
cpus = 1
|
||||||
|
|
||||||
avail_rendermodes = c_overviewer.get_render_modes()
|
avail_rendermodes = c_overviewer.get_render_modes()
|
||||||
avail_north_dirs = ['lower-left', 'upper-left', 'upper-right', 'lower-right']
|
avail_north_dirs = ['lower-left', 'upper-left', 'upper-right', 'lower-right', 'auto']
|
||||||
|
|
||||||
parser = ConfigOptionParser(usage=helptext, config="settings.py")
|
parser = ConfigOptionParser(usage=helptext, config="settings.py")
|
||||||
parser.add_option("-V", "--version", dest="version", helptext="Displays version information and then exits", action="store_true")
|
parser.add_option("-V", "--version", dest="version", helptext="Displays version information and then exits", action="store_true")
|
||||||
@@ -117,7 +117,7 @@ def main():
|
|||||||
parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, helptext="Print more output. You can specify this option multiple times.")
|
parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, helptext="Print more output. You can specify this option multiple times.")
|
||||||
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
parser.add_option("--skip-js", dest="skipjs", action="store_true", helptext="Don't output marker.js or regions.js")
|
||||||
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
parser.add_option("--no-signs", dest="nosigns", action="store_true", helptext="Don't output signs to markers.js")
|
||||||
parser.add_option("--north-direction", dest="north_direction", action="store", helptext="Specifies which corner of the screen north will point to. Valid options are: " + ", ".join(avail_north_dirs) + ".", type="choice", default=avail_north_dirs[0], choices=avail_north_dirs)
|
parser.add_option("--north-direction", dest="north_direction", action="store", helptext="Specifies which corner of the screen north will point to. Defaults to whatever the current map uses, or lower-left for new maps. Valid options are: " + ", ".join(avail_north_dirs) + ".", type="choice", default="auto", choices=avail_north_dirs)
|
||||||
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
parser.add_option("--display-config", dest="display_config", action="store_true", helptext="Display the configuration parameters, but don't render the map. Requires all required options to be specified", commandLineOnly=True)
|
||||||
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
#parser.add_option("--write-config", dest="write_config", action="store_true", helptext="Writes out a sample config file", commandLineOnly=True)
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ def main():
|
|||||||
if options.north_direction:
|
if options.north_direction:
|
||||||
north_direction = options.north_direction
|
north_direction = options.north_direction
|
||||||
else:
|
else:
|
||||||
north_direction = 'lower-left'
|
north_direction = 'auto'
|
||||||
|
|
||||||
logging.getLogger().setLevel(
|
logging.getLogger().setLevel(
|
||||||
logging.getLogger().level + 10*options.quiet)
|
logging.getLogger().level + 10*options.quiet)
|
||||||
@@ -241,7 +241,10 @@ def main():
|
|||||||
|
|
||||||
# First do world-level preprocessing
|
# First do world-level preprocessing
|
||||||
w = world.World(worlddir, destdir, useBiomeData=useBiomeData, regionlist=regionlist, north_direction=north_direction)
|
w = world.World(worlddir, destdir, useBiomeData=useBiomeData, regionlist=regionlist, north_direction=north_direction)
|
||||||
if not (w.persistentData['north_direction'] == north_direction) and not options.forcerender:
|
if north_direction == 'auto':
|
||||||
|
north_direction = w.persistentData['north_direction']
|
||||||
|
options.north_direction = north_direction
|
||||||
|
elif w.persistentData['north_direction'] != north_direction and not options.forcerender:
|
||||||
logging.error("Conflicting north-direction setting!")
|
logging.error("Conflicting north-direction setting!")
|
||||||
logging.error("Overviewer.dat gives previous north-direction as "+w.persistentData['north_direction'])
|
logging.error("Overviewer.dat gives previous north-direction as "+w.persistentData['north_direction'])
|
||||||
logging.error("Requested north-direction was "+north_direction)
|
logging.error("Requested north-direction was "+north_direction)
|
||||||
|
|||||||
@@ -69,33 +69,11 @@ class World(object):
|
|||||||
|
|
||||||
mincol = maxcol = minrow = maxrow = 0
|
mincol = maxcol = minrow = maxrow = 0
|
||||||
|
|
||||||
def __init__(self, worlddir, outputdir, useBiomeData=False, regionlist=None, north_direction="lower-left"):
|
def __init__(self, worlddir, outputdir, useBiomeData=False, regionlist=None, north_direction="auto"):
|
||||||
self.worlddir = worlddir
|
self.worlddir = worlddir
|
||||||
self.outputdir = outputdir
|
self.outputdir = outputdir
|
||||||
self.useBiomeData = useBiomeData
|
self.useBiomeData = useBiomeData
|
||||||
self.north_direction = north_direction
|
self.north_direction = north_direction
|
||||||
|
|
||||||
#find region files, or load the region list
|
|
||||||
#this also caches all the region file header info
|
|
||||||
logging.info("Scanning regions")
|
|
||||||
regionfiles = {}
|
|
||||||
self.regions = {}
|
|
||||||
if regionlist:
|
|
||||||
self.regionlist = map(os.path.abspath, regionlist) # a list of paths
|
|
||||||
else:
|
|
||||||
self.regionlist = None
|
|
||||||
for x, y, regionfile in self._iterate_regionfiles(regionlist):
|
|
||||||
mcr = self.reload_region(regionfile)
|
|
||||||
mcr.get_chunk_info()
|
|
||||||
regionfiles[(x,y)] = (x,y,regionfile,mcr)
|
|
||||||
self.regionfiles = regionfiles
|
|
||||||
# set the number of region file handles we will permit open at any time before we start closing them
|
|
||||||
# self.regionlimit = 1000
|
|
||||||
# the max number of chunks we will keep before removing them (includes emptry chunks)
|
|
||||||
self.chunklimit = 1024
|
|
||||||
self.chunkcount = 0
|
|
||||||
self.empty_chunk = [None,None]
|
|
||||||
logging.debug("Done scanning regions")
|
|
||||||
|
|
||||||
# figure out chunk format is in use
|
# figure out chunk format is in use
|
||||||
# if not mcregion, error out early
|
# if not mcregion, error out early
|
||||||
@@ -136,10 +114,38 @@ class World(object):
|
|||||||
with open(self.pickleFile,"rb") as p:
|
with open(self.pickleFile,"rb") as p:
|
||||||
self.persistentData = cPickle.load(p)
|
self.persistentData = cPickle.load(p)
|
||||||
if not self.persistentData.get('north_direction', False):
|
if not self.persistentData.get('north_direction', False):
|
||||||
self.persistentData['north_direction']=='lower-left'
|
# this is a pre-configurable-north map, so add the north_direction key
|
||||||
|
self.persistentData['north_direction'] = 'lower-left'
|
||||||
else:
|
else:
|
||||||
# some defaults
|
# some defaults, presumably a new map
|
||||||
self.persistentData = dict(POI=[], north_direction=self.north_direction)
|
self.persistentData = dict(POI=[], north_direction='lower-left')
|
||||||
|
|
||||||
|
# handle 'auto' north
|
||||||
|
if self.north_direction == 'auto':
|
||||||
|
self.north_direction = self.persistentData['north_direction']
|
||||||
|
north_direction = self.north_direction
|
||||||
|
|
||||||
|
#find region files, or load the region list
|
||||||
|
#this also caches all the region file header info
|
||||||
|
logging.info("Scanning regions")
|
||||||
|
regionfiles = {}
|
||||||
|
self.regions = {}
|
||||||
|
if regionlist:
|
||||||
|
self.regionlist = map(os.path.abspath, regionlist) # a list of paths
|
||||||
|
else:
|
||||||
|
self.regionlist = None
|
||||||
|
for x, y, regionfile in self._iterate_regionfiles(regionlist):
|
||||||
|
mcr = self.reload_region(regionfile)
|
||||||
|
mcr.get_chunk_info()
|
||||||
|
regionfiles[(x,y)] = (x,y,regionfile,mcr)
|
||||||
|
self.regionfiles = regionfiles
|
||||||
|
# set the number of region file handles we will permit open at any time before we start closing them
|
||||||
|
# self.regionlimit = 1000
|
||||||
|
# the max number of chunks we will keep before removing them (includes emptry chunks)
|
||||||
|
self.chunklimit = 1024
|
||||||
|
self.chunkcount = 0
|
||||||
|
self.empty_chunk = [None,None]
|
||||||
|
logging.debug("Done scanning regions")
|
||||||
|
|
||||||
|
|
||||||
def get_region_path(self, chunkX, chunkY):
|
def get_region_path(self, chunkX, chunkY):
|
||||||
|
|||||||
Reference in New Issue
Block a user