Merge branch 'master' into py-package
Conflicts: overviewer_core/googlemap.py
This commit is contained in:
@@ -100,13 +100,14 @@ def main():
|
|||||||
parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg.", configFileOnly=True )
|
parser.add_option("--imgformat", dest="imgformat", help="The image output format to use. Currently supported: png(default), jpg.", configFileOnly=True )
|
||||||
parser.add_option("--imgquality", dest="imgquality", default=95, help="Specify the quality of image output when using imgformat=\"jpg\".", type="int", configFileOnly=True)
|
parser.add_option("--imgquality", dest="imgquality", default=95, help="Specify the quality of image output when using imgformat=\"jpg\".", type="int", configFileOnly=True)
|
||||||
parser.add_option("--bg_color", dest="bg_color", help="Configures the background color for the GoogleMap output. Specify in #RRGGBB format", configFileOnly=True, type="string", default="#1A1A1A")
|
parser.add_option("--bg_color", dest="bg_color", help="Configures the background color for the GoogleMap output. Specify in #RRGGBB format", configFileOnly=True, type="string", default="#1A1A1A")
|
||||||
parser.add_option("--optimize-img", dest="optimizeimg", help="If using png, perform image file size optimizations on the output. Specify 1 for pngcrush, 2 for pngcrush+optipng+advdef. This may double (or more) render times, but will produce up to 30% smaller images. NOTE: requires corresponding programs in $PATH or %PATH%", configFileOnly=True)
|
parser.add_option("--optimize-img", dest="optimizeimg", help="If using png, perform image file size optimizations on the output. Specify 1 for pngcrush, 2 for pngcrush+advdef and 3 for pngcrush-advdef with more agressive settings. This may double (or more) render times, but will produce up to 30% smaller images. NOTE: requires corresponding programs in $PATH or %PATH%", configFileOnly=True)
|
||||||
parser.add_option("--web-assets-hook", dest="web_assets_hook", help="If provided, run this function after the web assets have been copied, but before actual tile rendering begins. It should accept a QuadtreeGen object as its only argument.", action="store", metavar="SCRIPT", type="function", configFileOnly=True)
|
parser.add_option("--web-assets-hook", dest="web_assets_hook", help="If provided, run this function after the web assets have been copied, but before actual tile rendering begins. It should accept a QuadtreeGen object as its only argument.", action="store", metavar="SCRIPT", type="function", configFileOnly=True)
|
||||||
parser.add_option("--web-assets-path", dest="web_assets_path", help="Specifies a non-standard web_assets directory to use. Files here will overwrite the default web assets.", metavar="PATH", type="string", configFileOnly=True)
|
parser.add_option("--web-assets-path", dest="web_assets_path", help="Specifies a non-standard web_assets directory to use. Files here will overwrite the default web assets.", metavar="PATH", type="string", configFileOnly=True)
|
||||||
parser.add_option("--textures-path", dest="textures_path", help="Specifies a non-standard textures path, from which terrain.png and other textures are loaded.", metavar="PATH", type="string", configFileOnly=True)
|
parser.add_option("--textures-path", dest="textures_path", help="Specifies a non-standard textures path, from which terrain.png and other textures are loaded.", metavar="PATH", type="string", configFileOnly=True)
|
||||||
parser.add_option("-q", "--quiet", dest="quiet", action="count", default=0, help="Print less output. You can specify this option multiple times.")
|
parser.add_option("-q", "--quiet", dest="quiet", action="count", default=0, help="Print less output. You can specify this option multiple times.")
|
||||||
parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, help="Print more output. You can specify this option multiple times.")
|
parser.add_option("-v", "--verbose", dest="verbose", action="count", default=0, help="Print more output. You can specify this option multiple times.")
|
||||||
parser.add_option("--skip-js", dest="skipjs", action="store_true", help="Don't output marker.js or regions.js")
|
parser.add_option("--skip-js", dest="skipjs", action="store_true", help="Don't output marker.js or regions.js")
|
||||||
|
parser.add_option("--no-signs", dest="nosigns", action="store_true", help="Don't output signs to markers.js")
|
||||||
parser.add_option("--display-config", dest="display_config", action="store_true", help="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", help="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", help="Writes out a sample config file", commandLineOnly=True)
|
#parser.add_option("--write-config", dest="write_config", action="store_true", help="Writes out a sample config file", commandLineOnly=True)
|
||||||
|
|
||||||
|
|||||||
@@ -598,6 +598,11 @@ var overviewer = {
|
|||||||
var items = [];
|
var items = [];
|
||||||
for (i in overviewerConfig.objectGroups.signs) {
|
for (i in overviewerConfig.objectGroups.signs) {
|
||||||
var signGroup = overviewerConfig.objectGroups.signs[i];
|
var signGroup = overviewerConfig.objectGroups.signs[i];
|
||||||
|
// don't create an option for this group if empty
|
||||||
|
if (overviewer.collections.markers[signGroup.label].length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var iconURL = signGroup.icon;
|
var iconURL = signGroup.icon;
|
||||||
if(!iconURL) {
|
if(!iconURL) {
|
||||||
iconURL = overviewerConfig.CONST.image.defaultMarker;
|
iconURL = overviewerConfig.CONST.image.defaultMarker;
|
||||||
@@ -616,8 +621,12 @@ var overviewer = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only create drop down if there's used options
|
||||||
|
if (items.length > 0) {
|
||||||
overviewer.util.createDropDown('Signposts', items);
|
overviewer.util.createDropDown('Signposts', items);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if there are any regions data, lets show the option to hide/show them.
|
// if there are any regions data, lets show the option to hide/show them.
|
||||||
if (overviewerConfig.objectGroups.regions.length > 0) {
|
if (overviewerConfig.objectGroups.regions.length > 0) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import stat
|
|||||||
import cPickle
|
import cPickle
|
||||||
import Image
|
import Image
|
||||||
import shutil
|
import shutil
|
||||||
from time import strftime, gmtime
|
from time import strftime, localtime
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import util
|
import util
|
||||||
@@ -67,7 +67,8 @@ class MapGen(object):
|
|||||||
image format, and world.
|
image format, and world.
|
||||||
Note:tiledir for each quadtree should be unique. By default the tiledir is determined by the rendermode"""
|
Note:tiledir for each quadtree should be unique. By default the tiledir is determined by the rendermode"""
|
||||||
|
|
||||||
self.skipjs = configInfo.get('skipjs', None)
|
self.skipjs = configInfo.get('skipjs', False)
|
||||||
|
self.nosigns = configInfo.get('nosigns', False)
|
||||||
self.web_assets_hook = configInfo.get('web_assets_hook', None)
|
self.web_assets_hook = configInfo.get('web_assets_hook', None)
|
||||||
self.web_assets_path = configInfo.get('web_assets_path', None)
|
self.web_assets_path = configInfo.get('web_assets_path', None)
|
||||||
self.bg_color = configInfo.get('bg_color')
|
self.bg_color = configInfo.get('bg_color')
|
||||||
@@ -135,8 +136,7 @@ class MapGen(object):
|
|||||||
indexpath = os.path.join(self.destdir, "index.html")
|
indexpath = os.path.join(self.destdir, "index.html")
|
||||||
|
|
||||||
index = open(indexpath, 'r').read()
|
index = open(indexpath, 'r').read()
|
||||||
index = index.replace(
|
index = index.replace("{time}", str(strftime("%a, %d %b %Y %H:%M:%S %Z", localtime())))
|
||||||
"{time}", str(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())))
|
|
||||||
versionstr = "%s (%s)" % (overviewer_version.VERSION, overviewer_version.HASH[:7])
|
versionstr = "%s (%s)" % (overviewer_version.VERSION, overviewer_version.HASH[:7])
|
||||||
index = index.replace("{version}", versionstr)
|
index = index.replace("{version}", versionstr)
|
||||||
|
|
||||||
@@ -160,12 +160,17 @@ class MapGen(object):
|
|||||||
|
|
||||||
self.world.POI += filter(lambda x: x['type'] != 'spawn', self.world.persistentData['POI'])
|
self.world.POI += filter(lambda x: x['type'] != 'spawn', self.world.persistentData['POI'])
|
||||||
|
|
||||||
|
if self.nosigns:
|
||||||
|
markers = filter(lambda x: x['type'] != 'sign', self.world.POI)
|
||||||
|
else:
|
||||||
|
markers = self.world.POI
|
||||||
|
|
||||||
# write out the default marker table
|
# write out the default marker table
|
||||||
with open(os.path.join(self.destdir, "markers.js"), 'w') as output:
|
with open(os.path.join(self.destdir, "markers.js"), 'w') as output:
|
||||||
output.write("overviewer.collections.markerDatas.push([\n")
|
output.write("overviewer.collections.markerDatas.push([\n")
|
||||||
for marker in self.world.POI:
|
for marker in markers:
|
||||||
output.write(json.dumps(marker))
|
output.write(json.dumps(marker))
|
||||||
if marker != self.world.POI[-1]:
|
if marker != markers[-1]:
|
||||||
output.write(",")
|
output.write(",")
|
||||||
output.write("\n")
|
output.write("\n")
|
||||||
output.write("]);\n")
|
output.write("]);\n")
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def check_programs(level):
|
|||||||
result = filter(lambda x: os.path.exists(os.path.join(x, prog)), path)
|
result = filter(lambda x: os.path.exists(os.path.join(x, prog)), path)
|
||||||
return len(result) != 0
|
return len(result) != 0
|
||||||
|
|
||||||
for prog,l in [(pngcrush,1), (optipng,2), (advdef,2)]:
|
for prog,l in [(pngcrush,1), (advdef,2)]:
|
||||||
if l <= level:
|
if l <= level:
|
||||||
if (not exists_in_path(prog)) and (not exists_in_path(prog + ".exe")):
|
if (not exists_in_path(prog)) and (not exists_in_path(prog + ".exe")):
|
||||||
raise Exception("Optimization prog %s for level %d not found!" % (prog, l))
|
raise Exception("Optimization prog %s for level %d not found!" % (prog, l))
|
||||||
@@ -46,8 +46,7 @@ def optimize_image(imgpath, imgformat, optimizeimg):
|
|||||||
|
|
||||||
if optimizeimg >= 2:
|
if optimizeimg >= 2:
|
||||||
# the "-nc" it's needed to no broke the transparency of tiles
|
# the "-nc" it's needed to no broke the transparency of tiles
|
||||||
subprocess.Popen([optipng, "-nc", imgpath], stderr=subprocess.STDOUT,
|
recompress_option = "-z2" if optimizeimg == 2 else "-z4"
|
||||||
stdout=subprocess.PIPE).communicate()[0]
|
subprocess.Popen([advdef, recompress_option,imgpath], stderr=subprocess.STDOUT,
|
||||||
subprocess.Popen([advdef, "-z4",imgpath], stderr=subprocess.STDOUT,
|
|
||||||
stdout=subprocess.PIPE).communicate()[0]
|
stdout=subprocess.PIPE).communicate()[0]
|
||||||
|
|
||||||
|
|||||||
@@ -92,9 +92,11 @@ imgformat = "jpg"
|
|||||||
################################################################################
|
################################################################################
|
||||||
### optimizeimg
|
### optimizeimg
|
||||||
## If using png, perform image file size optimizations on the output. Specify 1
|
## If using png, perform image file size optimizations on the output. Specify 1
|
||||||
## for pngcrush, 2 for pngcrush+optipng+advdef. This may double (or more)
|
## for pngcrush, 2 for pngcrush+advdef, 3 for pngcrush+advdef with more agressive
|
||||||
## render times, but will produce up to 30% smaller images. NOTE: requires
|
## options. Option 1 gives around 19% of reduction, option 2 gives around 21%
|
||||||
## corresponding programs in $PATH or %PATH%
|
## (it doubles the optimizing time) and option 3 gives around 23% (it doubles,
|
||||||
|
## again, the optimizing time). Using this option may double (or more)
|
||||||
|
## render times. NOTE: requires corresponding programs in $PATH or %PATH%
|
||||||
## Default: not set
|
## Default: not set
|
||||||
## Type: integer
|
## Type: integer
|
||||||
## Example:
|
## Example:
|
||||||
|
|||||||
Reference in New Issue
Block a user