0

Added a debug option to the config options in template.html. Setting this to true displays a tile boundary overlay as well as x, y, and z values for each tile, and the tile's url. Defaults to false.

This commit is contained in:
Gregory Short
2010-09-12 14:05:36 -05:00
parent 51d30a77d0
commit 70805f3a67

View File

@@ -17,7 +17,8 @@
tileSize: 384, tileSize: 384,
defaultZoom: 1, defaultZoom: 1,
maxZoom: {maxzoom}, maxZoom: {maxzoom},
cacheMinutes: {cachelife} cacheMinutes: {cachelife},
debug: false
}; };
var MCMapOptions = { var MCMapOptions = {
@@ -51,18 +52,40 @@
MCMapType.name = "MC Map"; MCMapType.name = "MC Map";
MCMapType.alt = "Minecraft Map"; MCMapType.alt = "Minecraft Map";
function CoordMapType() {
}
function CoordMapType(tileSize) {
this.tileSize = tileSize;
}
CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
var div = ownerDocument.createElement('DIV');
div.innerHTML = "(" + coord.x + ", " + coord.y + ", " + zoom + ")";
div.innerHTML += "<br />";
div.innerHTML += MCMapOptions.getTileUrl(coord, zoom);
div.style.width = this.tileSize.width + 'px';
div.style.height = this.tileSize.height + 'px';
div.style.fontSize = '10';
div.style.borderStyle = 'solid';
div.style.borderWidth = '1px';
div.style.borderColor = '#AAAAAA';
return div;
};
var map; var map;
function initialize() { function initialize() {
var mapOptions = { var mapOptions = {
zoom: config.defaultZoom, zoom: config.defaultZoom,
center: new google.maps.LatLng(-45, 90), center: new google.maps.LatLng(-45, 90),
mapTypeControlOptions: { mapTypeId: 'mcmap'
mapTypeIds: ['mcmap'],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
}
}; };
map = new google.maps.Map(document.getElementById("mcmap"), mapOptions); map = new google.maps.Map(document.getElementById("mcmap"), mapOptions);
if(config.debug) {
map.overlayMapTypes.insertAt(0, new CoordMapType(new google.maps.Size(384, 384)));
}
// Now attach the coordinate map type to the map's registry // Now attach the coordinate map type to the map's registry
map.mapTypes.set('mcmap', MCMapType); map.mapTypes.set('mcmap', MCMapType);