2011-07-16 23:53:15 +02:00
|
|
|
var FlatProjection = DynmapProjection.extend({
|
|
|
|
fromLocationToLatLng: function(location) {
|
2011-07-24 17:11:34 +02:00
|
|
|
return new L.LatLng(
|
2011-07-27 17:07:28 +02:00
|
|
|
-location.z / (1 << this.options.mapzoomout),
|
|
|
|
location.x / (1 << this.options.mapzoomout),
|
2011-07-24 17:11:34 +02:00
|
|
|
true);
|
2011-08-03 17:21:29 +02:00
|
|
|
},
|
|
|
|
fromLatLngToLocation: function(latlon, y) {
|
|
|
|
var z = -latlon.lat * (1 << this.options.mapzoomout);
|
|
|
|
var x = latlon.lng * (1 << this.options.mapzoomout);
|
|
|
|
return { x: x, y: y, z: z };
|
2011-07-16 23:53:15 +02:00
|
|
|
}
|
2011-08-03 17:21:29 +02:00
|
|
|
|
2011-07-16 23:53:15 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var FlatMapType = DynmapTileLayer.extend({
|
|
|
|
options: {
|
|
|
|
minZoom: 0,
|
2011-08-02 07:07:17 +02:00
|
|
|
maxZoom: 4,
|
2011-08-14 07:11:57 +02:00
|
|
|
errorTileUrl: 'images/blank.png',
|
|
|
|
continuousWorld: true
|
2011-07-16 23:53:15 +02:00
|
|
|
},
|
|
|
|
initialize: function(options) {
|
2011-08-03 04:51:00 +02:00
|
|
|
options.maxZoom = options.mapzoomin + options.mapzoomout;
|
2011-07-16 23:53:15 +02:00
|
|
|
L.Util.setOptions(this, options);
|
2011-07-24 17:11:34 +02:00
|
|
|
this.projection = new FlatProjection({mapzoomout: options.mapzoomout});
|
2011-07-16 23:53:15 +02:00
|
|
|
},
|
|
|
|
getTileName: function(tilePoint, zoom) {
|
2011-07-24 17:11:34 +02:00
|
|
|
return namedReplace(this.options.bigmap
|
2011-08-02 17:48:04 +02:00
|
|
|
? '{prefix}{nightday}_128/{scaledx}_{scaledy}/{zoomprefix}{x}_{y}.png'
|
2011-07-24 17:11:34 +02:00
|
|
|
: '{zoom}{prefix}{nightday}_128_{x}_{y}.png'
|
|
|
|
, this.getTileInfo(tilePoint, zoom));
|
2011-07-16 23:53:15 +02:00
|
|
|
}
|
2011-07-18 03:40:24 +02:00
|
|
|
});
|
2011-03-01 01:59:33 +01:00
|
|
|
|
2011-07-16 23:53:15 +02:00
|
|
|
maptypes.FlatMapType = function(options) { return new FlatMapType(options); };
|