changed JS to properly compute coords for anvil format
This commit is contained in:
@@ -235,7 +235,7 @@ overviewer.util = {
|
|||||||
*
|
*
|
||||||
* @return google.maps.LatLng
|
* @return google.maps.LatLng
|
||||||
*/
|
*/
|
||||||
'fromWorldToLatLng': function(x, z, y, model) {
|
'fromWorldToLatLng': function(x, y, z, model) {
|
||||||
|
|
||||||
var zoomLevels = model.get("zoomLevels");
|
var zoomLevels = model.get("zoomLevels");
|
||||||
var north_direction = model.get('north_direction');
|
var north_direction = model.get('north_direction');
|
||||||
@@ -248,15 +248,15 @@ overviewer.util = {
|
|||||||
|
|
||||||
if (north_direction == overviewerConfig.CONST.UPPERRIGHT){
|
if (north_direction == overviewerConfig.CONST.UPPERRIGHT){
|
||||||
temp = x;
|
temp = x;
|
||||||
x = -y+16;
|
x = -z+16;
|
||||||
y = temp;
|
z = temp;
|
||||||
} else if(north_direction == overviewerConfig.CONST.LOWERRIGHT){
|
} else if(north_direction == overviewerConfig.CONST.LOWERRIGHT){
|
||||||
x = -x+16;
|
x = -x+16;
|
||||||
y = -y+16;
|
z = -z+16;
|
||||||
} else if(north_direction == overviewerConfig.CONST.LOWERLEFT){
|
} else if(north_direction == overviewerConfig.CONST.LOWERLEFT){
|
||||||
temp = x;
|
temp = x;
|
||||||
x = y;
|
x = z;
|
||||||
y = -temp+16;
|
z = -temp+16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This information about where the center column is may change with
|
// This information about where the center column is may change with
|
||||||
@@ -278,11 +278,11 @@ overviewer.util = {
|
|||||||
lat -= 6 * x * perPixel;
|
lat -= 6 * x * perPixel;
|
||||||
|
|
||||||
// each block on Y axis adds 12px to x and adds 6px to y
|
// each block on Y axis adds 12px to x and adds 6px to y
|
||||||
lng += 12 * y * perPixel;
|
lng += 12 * z * perPixel;
|
||||||
lat += 6 * y * perPixel;
|
lat += 6 * z * perPixel;
|
||||||
|
|
||||||
// each block down along Z adds 12px to y
|
// each block down along Z adds 12px to y
|
||||||
lat += 12 * (128 - z) * perPixel;
|
lat += 12 * (256 - y) * perPixel;
|
||||||
|
|
||||||
// add on 12 px to the X coordinate to center our point
|
// add on 12 px to the X coordinate to center our point
|
||||||
lng += 12 * perPixel;
|
lng += 12 * perPixel;
|
||||||
@@ -329,9 +329,11 @@ overviewer.util = {
|
|||||||
point.z = Math.floor((lng + 2 * lat) / (24 * perPixel));
|
point.z = Math.floor((lng + 2 * lat) / (24 * perPixel));
|
||||||
|
|
||||||
// Adjust for the fact that we we can't figure out what Y is given
|
// Adjust for the fact that we we can't figure out what Y is given
|
||||||
// only latitude and longitude, so assume Y=64.
|
// only latitude and longitude, so assume Y=64. Since this is lowering
|
||||||
point.x += 64;
|
// down from the height of a chunk, it depends on the chunk height as
|
||||||
point.z -= 64;
|
// so:
|
||||||
|
point.x += 256-64;
|
||||||
|
point.z -= 256-64;
|
||||||
|
|
||||||
if(north_direction == overviewerConfig.CONST.UPPERRIGHT){
|
if(north_direction == overviewerConfig.CONST.UPPERRIGHT){
|
||||||
temp = point.z;
|
temp = point.z;
|
||||||
|
|||||||
@@ -468,9 +468,9 @@ class RotatedRegionSet(RegionSet):
|
|||||||
for section in chunk_data['Sections']:
|
for section in chunk_data['Sections']:
|
||||||
for arrayname in ['Blocks', 'Data', 'SkyLight', 'BlockLight']:
|
for arrayname in ['Blocks', 'Data', 'SkyLight', 'BlockLight']:
|
||||||
array = section[arrayname]
|
array = section[arrayname]
|
||||||
# New arrays are arranged with axes Y,Z,X
|
# Since the anvil change, arrays are arranged with axes Y,Z,X
|
||||||
# numpy.rot90 always rotates the first two axes, so for it to
|
# numpy.rot90 always rotates the first two axes, so for it to
|
||||||
# work, we need to temporarily more the X axis to the 0th axis.
|
# work, we need to temporarily move the X axis to the 0th axis.
|
||||||
array = numpy.swapaxes(array, 0,2)
|
array = numpy.swapaxes(array, 0,2)
|
||||||
array = numpy.rot90(array, self.north_dir)
|
array = numpy.rot90(array, self.north_dir)
|
||||||
array = numpy.swapaxes(array, 0,2)
|
array = numpy.swapaxes(array, 0,2)
|
||||||
|
|||||||
Reference in New Issue
Block a user