Merge pull request #361 from mikeprimm/master

Fix flat and kzed 'bigworld' support
This commit is contained in:
mikeprimm 2011-08-02 08:48:45 -07:00
commit 8cef3fb478
3 changed files with 262 additions and 262 deletions

View File

@ -151,7 +151,6 @@ var DynmapTileLayer = L.TileLayer.extend({
var izoom = this.options.maxZoom - zoom; var izoom = this.options.maxZoom - zoom;
var zoomoutlevel = Math.max(0, izoom - this.options.mapzoomin); var zoomoutlevel = Math.max(0, izoom - this.options.mapzoomin);
var scale = 1 << zoomoutlevel; var scale = 1 << zoomoutlevel;
var zoomprefix = this.zoomprefix(zoomoutlevel);
var x = scale*tilePoint.x; var x = scale*tilePoint.x;
var y = scale*tilePoint.y; var y = scale*tilePoint.y;
return { return {
@ -160,6 +159,7 @@ var DynmapTileLayer = L.TileLayer.extend({
scaledx: x >> 5, scaledx: x >> 5,
scaledy: y >> 5, scaledy: y >> 5,
zoom: this.zoomprefix(zoomoutlevel), zoom: this.zoomprefix(zoomoutlevel),
zoomprefix: (zoomoutlevel==0)?"":(this.zoomprefix(zoomoutlevel)+"_"),
x: x, x: x,
y: y y: y
}; };

View File

@ -21,7 +21,7 @@ var FlatMapType = DynmapTileLayer.extend({
}, },
getTileName: function(tilePoint, zoom) { getTileName: function(tilePoint, zoom) {
return namedReplace(this.options.bigmap return namedReplace(this.options.bigmap
? '{prefix}{nightday}_128/{scaledx}_{scaledy}/{zoom}_{x}_{y}.png' ? '{prefix}{nightday}_128/{scaledx}_{scaledy}/{zoomprefix}{x}_{y}.png'
: '{zoom}{prefix}{nightday}_128_{x}_{y}.png' : '{zoom}{prefix}{nightday}_128_{x}_{y}.png'
, this.getTileInfo(tilePoint, zoom)); , this.getTileInfo(tilePoint, zoom));
} }

View File

@ -28,7 +28,7 @@ var KzedMapType = DynmapTileLayer.extend({
getTileName: function(tilePoint, zoom) { getTileName: function(tilePoint, zoom) {
var info = this.getTileInfo(tilePoint, zoom); var info = this.getTileInfo(tilePoint, zoom);
return namedReplace(this.options.bigmap return namedReplace(this.options.bigmap
? '{prefix}{nightday}/{scaledx}_{scaledy}/{zoom}_{x}_{y}.png' ? '{prefix}{nightday}/{scaledx}_{scaledy}/{zoomprefix}{x}_{y}.png'
: '{zoom}{prefix}{nightday}_{x}_{y}.png' : '{zoom}{prefix}{nightday}_{x}_{y}.png'
, this.getTileInfo(tilePoint, zoom)); , this.getTileInfo(tilePoint, zoom));
}, },
@ -37,7 +37,6 @@ var KzedMapType = DynmapTileLayer.extend({
var izoom = this.options.maxZoom - zoom; var izoom = this.options.maxZoom - zoom;
var zoomoutlevel = Math.max(0, izoom - this.options.mapzoomin); var zoomoutlevel = Math.max(0, izoom - this.options.mapzoomin);
var scale = 1 << zoomoutlevel; var scale = 1 << zoomoutlevel;
var zoomprefix = this.zoomprefix(zoomoutlevel);
var x = -scale*tilePoint.x*128; var x = -scale*tilePoint.x*128;
var y = scale*tilePoint.y*128; var y = scale*tilePoint.y*128;
return { return {
@ -46,6 +45,7 @@ var KzedMapType = DynmapTileLayer.extend({
scaledx: x >> 12, scaledx: x >> 12,
scaledy: y >> 12, scaledy: y >> 12,
zoom: this.zoomprefix(zoomoutlevel), zoom: this.zoomprefix(zoomoutlevel),
zoomprefix: (zoomoutlevel==0)?"":(this.zoomprefix(zoomoutlevel)+"_"),
x: x, x: x,
y: y y: y
}; };