0

Merge branch 'master' of https://github.com/aheadley/Minecraft-Overviewer into aheadley-master

This commit is contained in:
Andrew Chin
2011-02-04 21:01:24 -05:00
2 changed files with 9 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
defaultZoom: 1, defaultZoom: 1,
maxZoom: {maxzoom}, maxZoom: {maxzoom},
cacheMinutes: 0, // Change this to have browsers automatically request new images every x minutes cacheMinutes: 0, // Change this to have browsers automatically request new images every x minutes
bg_color: '#1A1A1A',
debug: false debug: false
}; };
@@ -36,12 +37,14 @@ var signGroups = [
* Required: * Required:
* label : string. Displayed on the control. * label : string. Displayed on the control.
* path : string. Location of the rendered tiles. * path : string. Location of the rendered tiles.
* Optional:
* base : string. Base of the url path for tile locations, useful for serving tiles from a different server than the js/html server.
*/ */
var mapTypeData=[ var mapTypeData=[
{'label': 'Unlit', 'path': 'tiles'}, {'label': 'Unlit', 'path': 'tiles'},
// {'label': 'Day', 'path': 'lighting/tiles'}, // {'label': 'Day', 'path': 'lighting/tiles'},
// {'label': 'Night', 'path': 'night/tiles'}, // {'label': 'Night', 'path': 'night/tiles'},
// {'label': 'Spawn', 'path': 'spawn/tiles'} // {'label': 'Spawn', 'path': 'spawn/tiles', 'base': 'http://example.cdn.amazon.com/'}
]; ];
// Please leave the following variables here: // Please leave the following variables here:

View File

@@ -280,6 +280,7 @@ function initialize() {
}, },
mapTypeId: mapTypeIdDefault, mapTypeId: mapTypeIdDefault,
streetViewControl: false, streetViewControl: false,
backgroundColor: config.bg_color,
}; };
map = new google.maps.Map(document.getElementById('mcmap'), mapOptions); map = new google.maps.Map(document.getElementById('mcmap'), mapOptions);
@@ -383,9 +384,10 @@ function initialize() {
return new google.maps.LatLng(lat, lng); return new google.maps.LatLng(lat, lng);
} }
function getTileUrlGenerator(path) { function getTileUrlGenerator(path, path_base) {
return function(tile, zoom) { return function(tile, zoom) {
var url = path; var url = path;
var url_base = ( path_base ? path_base : '' );
if(tile.x < 0 || tile.x >= Math.pow(2, zoom) || tile.y < 0 || tile.y >= Math.pow(2, zoom)) { if(tile.x < 0 || tile.x >= Math.pow(2, zoom) || tile.y < 0 || tile.y >= Math.pow(2, zoom)) {
url += '/blank'; url += '/blank';
} else if(zoom == 0) { } else if(zoom == 0) {
@@ -402,7 +404,7 @@ function getTileUrlGenerator(path) {
var d = new Date(); var d = new Date();
url += '?c=' + Math.floor(d.getTime() / (1000 * 60 * config.cacheMinutes)); url += '?c=' + Math.floor(d.getTime() / (1000 * 60 * config.cacheMinutes));
} }
return(url); return(url_base + url);
} }
} }
@@ -414,7 +416,7 @@ for (idx in mapTypeData) {
var view = mapTypeData[idx]; var view = mapTypeData[idx];
MCMapOptions[view.label] = { MCMapOptions[view.label] = {
getTileUrl: getTileUrlGenerator(view.path), getTileUrl: getTileUrlGenerator(view.path, view.base),
tileSize: new google.maps.Size(config.tileSize, config.tileSize), tileSize: new google.maps.Size(config.tileSize, config.tileSize),
maxZoom: config.maxZoom, maxZoom: config.maxZoom,
minZoom: 0, minZoom: 0,