Fixed nightday and making use of options.mapzoomin and options.mapzoomout.
This commit is contained in:
parent
9f19ccf50c
commit
4f75bf691a
5 changed files with 58 additions and 52 deletions
|
|
@ -3,9 +3,10 @@ var HDProjection = DynmapProjection.extend({
|
|||
var wtp = this.options.worldtomap;
|
||||
var xx = wtp[0]*location.x + wtp[1]*location.y + wtp[2]*location.z;
|
||||
var yy = wtp[3]*location.x + wtp[4]*location.y + wtp[5]*location.z;
|
||||
var lat = xx / (8 << this.options.extrazoom);
|
||||
var lng = (128-yy) / (8 << this.options.extrazoom);
|
||||
return new L.LatLng(lat, lng, true);
|
||||
return new L.LatLng(
|
||||
xx / (1 << this.options.mapzoomout)
|
||||
, (128-yy) / (1 << this.options.mapzoomout)
|
||||
, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -13,37 +14,15 @@ var HDMapType = DynmapTileLayer.extend({
|
|||
projection: undefined,
|
||||
options: {
|
||||
minZoom: 0,
|
||||
maxZoom: 3
|
||||
maxZoom: 0
|
||||
},
|
||||
initialize: function(options) {
|
||||
options.maxZoom = options.mapzoomin + options.world.extrazoomout;
|
||||
options.maxZoom = options.mapzoomin + options.mapzoomout;
|
||||
L.Util.setOptions(this, options);
|
||||
this.projection = new HDProjection({worldtomap: options.worldtomap})
|
||||
this.projection = new HDProjection($.extend({map: this}, options));
|
||||
},
|
||||
getTileName: function(tilePoint, zoom) {
|
||||
var tileName;
|
||||
|
||||
var dnprefix = '';
|
||||
if(this.options.nightandday && this.options.dynmap.serverday) {
|
||||
dnprefix = '_day';
|
||||
}
|
||||
|
||||
var extrazoom = this.options.mapzoomout;
|
||||
if(zoom < extrazoom) {
|
||||
var scale = 1 << (extrazoom-zoom);
|
||||
var zprefix = "zzzzzzzzzzzzzzzzzzzzzz".substring(0, extrazoom-zoom);
|
||||
tileName = this.options.prefix + dnprefix + '/' + ((scale*tilePoint.x) >> 5) + '_' + ((-scale*tilePoint.y) >> 5) + '/' + zprefix + "_" + (scale*tilePoint.x) + '_' + (-scale*tilePoint.y) + '.png';
|
||||
} else {
|
||||
tileName = this.options.prefix + dnprefix + '/' + (tilePoint.x >> 5) + '_' + ((-tilePoint.y) >> 5) + '/' + tilePoint.x + '_' + (-tilePoint.y) + '.png';
|
||||
}
|
||||
return tileName;
|
||||
},
|
||||
calculateTileSize: function(zoom) {
|
||||
var extrazoom = this.options.mapzoomout;
|
||||
console.log(zoom <= extrazoom, zoom, extrazoom);
|
||||
return (zoom <= extrazoom)
|
||||
? 128
|
||||
: Math.pow(2, 7+zoom-extrazoom);
|
||||
return namedReplace('{prefix}{nightday}/{scaledx}_{scaledy}/{zoom}{x}_{y}.png', this.getTileInfo(tilePoint, zoom));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue