Fixed errors with conversion between metres and world units

master
Robin Hawkes 2016-02-25 14:56:56 +00:00
rodzic 6ba625628e
commit 69654cd6f6
7 zmienionych plików z 30 dodań i 13 usunięć

17
dist/vizicities.js vendored
Wyświetl plik

@ -1976,7 +1976,12 @@ return /******/ (function(modules) { // webpackBootstrap
}
// Scale projected metres
var scaledMetres = scale * (this.transformScale * projectedMetres) / pointScale[1];
var scaledMetres = scale * (this.transformScale * projectedMetres);
// Not entirely sure why this is neccessary
if (zoom) {
scaledMetres /= pointScale[1];
}
return scaledMetres;
},
@ -1990,9 +1995,14 @@ return /******/ (function(modules) { // webpackBootstrap
scale /= 2;
}
var projectedUnits = worldUnits / scale / this.transformScale * pointScale[1];
var projectedUnits = worldUnits / scale / this.transformScale;
var realMetres = this.projectedToMetres(projectedUnits, pointScale);
// Not entirely sure why this is neccessary
if (zoom) {
realMetres *= pointScale[1];
}
return realMetres;
}
};
@ -7976,8 +7986,6 @@ return /******/ (function(modules) { // webpackBootstrap
// Point scale for tile (for unit conversion)
this._pointScale = this._world.pointScale(this._centerLatlon);
// console.log(this._center, this._centerLatlon, this._pointScale);
}
// Returns true if the tile mesh and texture are ready to be used
@ -8755,7 +8763,6 @@ return /******/ (function(modules) { // webpackBootstrap
var height = 0;
if (style.height) {
// console.log(style.height, this._world.metresToWorld(style.height, this._pointScale), this._pointScale);
height = _this3._world.metresToWorld(style.height, _this3._pointScale);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -84,7 +84,10 @@
"lodash.assign": "^4.0.2",
"lodash.throttle": "^4.0.0",
"lru-cache": "^4.0.0",
"proj4": "^2.3.12",
"reqwest": "^2.0.5",
"topojson": "^1.6.24"
"three": "^0.74.0",
"topojson": "^1.6.24",
"xhr2": "^0.1.3"
}
}

Wyświetl plik

@ -98,7 +98,12 @@ const Earth = {
}
// Scale projected metres
var scaledMetres = (scale * (this.transformScale * projectedMetres)) / pointScale[1];
var scaledMetres = (scale * (this.transformScale * projectedMetres));
// Not entirely sure why this is neccessary
if (zoom) {
scaledMetres /= pointScale[1];
}
return scaledMetres;
},
@ -112,9 +117,14 @@ const Earth = {
scale /= 2;
}
var projectedUnits = ((worldUnits / scale) / this.transformScale) * pointScale[1];
var projectedUnits = ((worldUnits / scale) / this.transformScale);
var realMetres = this.projectedToMetres(projectedUnits, pointScale);
// Not entirely sure why this is neccessary
if (zoom) {
realMetres *= pointScale[1];
}
return realMetres;
}
};

Wyświetl plik

@ -36,8 +36,6 @@ class Tile {
// Point scale for tile (for unit conversion)
this._pointScale = this._world.pointScale(this._centerLatlon);
// console.log(this._center, this._centerLatlon, this._pointScale);
}
// Returns true if the tile mesh and texture are ready to be used

Wyświetl plik

@ -235,7 +235,6 @@ class TopoJSONTile extends Tile {
var height = 0;
if (style.height) {
// console.log(style.height, this._world.metresToWorld(style.height, this._pointScale), this._pointScale);
height = this._world.metresToWorld(style.height, this._pointScale);
}