mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-01-13 03:10:39 +01:00
Projection fixes
This commit is contained in:
parent
d312f43e5c
commit
239f13326b
@ -1,22 +1,23 @@
|
|||||||
var HDProjection = DynmapProjection.extend({
|
var HDProjection = DynmapProjection.extend({
|
||||||
fromLocationToLatLng: function(location) {
|
fromLocationToLatLng: function(location) {
|
||||||
var wtp = this.options.worldtomap;
|
var wtp = this.options.worldtomap;
|
||||||
var xx = wtp[0]*location.x + wtp[1]*location.y + wtp[2]*location.z;
|
lat = wtp[3] * location.x + wtp[4] * location.y + wtp[5] * location.z,
|
||||||
var yy = wtp[3]*location.x + wtp[4]*location.y + wtp[5]*location.z;
|
lng = wtp[0] * location.x + wtp[1] * location.y + wtp[2] * location.z;
|
||||||
|
|
||||||
return new L.LatLng(
|
return new L.LatLng(
|
||||||
xx / (1 << this.options.mapzoomout)
|
-((128 - lat) / (1 << this.options.mapzoomout))
|
||||||
, (128-yy) / (1 << this.options.mapzoomout)
|
, lng / (1 << this.options.mapzoomout)
|
||||||
, true);
|
, location.y);
|
||||||
},
|
},
|
||||||
fromLatLngToLocation: function(latlon, y) {
|
fromLatLngToLocation: function(latlon, y) {
|
||||||
var ptw = this.options.maptoworld;
|
var ptw = this.options.maptoworld,
|
||||||
var lat = latlon.lat * (1 << this.options.mapzoomout);
|
lat = 128 + latlon.lat * (1 << this.options.mapzoomout),
|
||||||
var lon = 128 - latlon.lng * (1 << this.options.mapzoomout);
|
lng = latlon.lng * (1 << this.options.mapzoomout),
|
||||||
var x = ptw[0]*lat + ptw[1]*lon + ptw[2]*y;
|
x = ptw[0] * lng + ptw[1] * lat + ptw[2] * y,
|
||||||
var z = ptw[6]*lat + ptw[7]*lon + ptw[8]*y;
|
z = ptw[6] * lng + ptw[7] * lat + ptw[8] * y;
|
||||||
|
|
||||||
return { x: x, y: y, z: z };
|
return { x: x, y: y, z: z };
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var HDMapType = DynmapTileLayer.extend({
|
var HDMapType = DynmapTileLayer.extend({
|
||||||
|
Loading…
Reference in New Issue
Block a user