Merge pull request #1 from robhawkes/feature/geo-unit-multiplier

Add geographic scale multiplier
pull/3/head
Robin Hawkes 2019-02-15 14:23:59 +00:00 zatwierdzone przez GitHub
commit 39cb3aefac
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
134 zmienionych plików z 32 dodań i 28 usunięć

0
.babelrc 100644 → 100755
Wyświetl plik

0
.editorconfig 100644 → 100755
Wyświetl plik

0
.eslintrc 100644 → 100755
Wyświetl plik

0
.github/PULL_REQUEST_TEMPLATE.md vendored 100644 → 100755
Wyświetl plik

0
.gitignore vendored 100644 → 100755
Wyświetl plik

0
.jscsrc 100644 → 100755
Wyświetl plik

0
.npmignore 100644 → 100755
Wyświetl plik

0
LICENSE 100644 → 100755
Wyświetl plik

0
README.md 100644 → 100755
Wyświetl plik

0
dist/vizicities-worker.js vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities-worker.min.js vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities-worker.min.js.map vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities.css vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities.js vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities.min.js vendored 100644 → 100755
Wyświetl plik

0
dist/vizicities.min.js.map vendored 100644 → 100755
Wyświetl plik

Wyświetl plik

0
examples/all-the-things/main.css 100644 → 100755
Wyświetl plik

0
examples/all-the-things/main.js 100644 → 100755
Wyświetl plik

0
examples/basic/index.html 100644 → 100755
Wyświetl plik

0
examples/basic/main.css 100644 → 100755
Wyświetl plik

0
examples/basic/main.js 100644 → 100755
Wyświetl plik

Wyświetl plik

Wyświetl plik

0
examples/colour-by-height/main.js 100644 → 100755
Wyświetl plik

0
examples/geojson/index.html 100644 → 100755
Wyświetl plik

0
examples/geojson/main.css 100644 → 100755
Wyświetl plik

0
examples/geojson/main.js 100644 → 100755
Wyświetl plik

0
examples/interactive/index.html 100644 → 100755
Wyświetl plik

0
examples/interactive/main.css 100644 → 100755
Wyświetl plik

0
examples/interactive/main.js 100644 → 100755
Wyświetl plik

Wyświetl plik

Wyświetl plik

0
examples/lots-of-features/main.js 100644 → 100755
Wyświetl plik

0
examples/mta-routes/index.html 100644 → 100755
Wyświetl plik

0
examples/mta-routes/main.css 100644 → 100755
Wyświetl plik

0
examples/mta-routes/main.js 100644 → 100755
Wyświetl plik

0
examples/tile-events/index.html 100644 → 100755
Wyświetl plik

0
examples/tile-events/main.css 100644 → 100755
Wyświetl plik

0
examples/tile-events/main.js 100644 → 100755
Wyświetl plik

0
examples/vendor/TweenMax.min.js vendored 100644 → 100755
Wyświetl plik

0
examples/vendor/chroma.min.js vendored 100644 → 100755
Wyświetl plik

0
examples/vendor/three.js vendored 100644 → 100755
Wyświetl plik

0
examples/vendor/three.min.js vendored 100644 → 100755
Wyświetl plik

0
examples/vendor/threex.rendererstats.js vendored 100644 → 100755
Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

Wyświetl plik

0
gulpfile.babel.js 100644 → 100755
Wyświetl plik

0
package.json 100644 → 100755
Wyświetl plik

0
src/World.js 100644 → 100755
Wyświetl plik

0
src/controls/Controls.Orbit.js 100644 → 100755
Wyświetl plik

0
src/controls/index.js 100644 → 100755
Wyświetl plik

0
src/engine/Camera.js 100644 → 100755
Wyświetl plik

0
src/engine/DOMRenderer2D.js 100644 → 100755
Wyświetl plik

0
src/engine/DOMRenderer3D.js 100644 → 100755
Wyświetl plik

0
src/engine/DOMScene2D.js 100644 → 100755
Wyświetl plik

0
src/engine/DOMScene3D.js 100644 → 100755
Wyświetl plik

0
src/engine/EffectComposer.js 100644 → 100755
Wyświetl plik

0
src/engine/Engine.js 100644 → 100755
Wyświetl plik

0
src/engine/Picking.js 100644 → 100755
Wyświetl plik

0
src/engine/PickingMaterial.js 100644 → 100755
Wyświetl plik

0
src/engine/PickingScene.js 100644 → 100755
Wyświetl plik

0
src/engine/PickingShader.js 100644 → 100755
Wyświetl plik

0
src/engine/Renderer.js 100644 → 100755
Wyświetl plik

0
src/engine/Scene.js 100644 → 100755
Wyświetl plik

50
src/geo/Geo.js 100644 → 100755
Wyświetl plik

@ -11,6 +11,20 @@ Geo.MAX_LATITUDE = 85.0511287798;
Geo.ECC = 0.081819191;
Geo.ECC2 = 0.081819191 * 0.081819191;
// Multiplier is used to expand or compress the WebGL coordinate space relative
// to the EPSG:3857 / Pseudo-Mercator coordinate space (metres).
//
// This is useful for keeping coordinate calculations to smaller numbers and
// helps increase accuracy of things like the z-buffer, object intersection,
// and camera near and far clipping.
//
// A multiplier of 1 would mean a 1:1 mapping between WebGL and EPSG:3857
// coordinates (1 EPSG:3857 metre === 1 WebGL unit)
//
// A multiplier of 0.1 would mean a 1:0.1 mapping between WebGL and EPSG:3857
// coordinates (1 EPSG:3857 metre === 0.1 WebGL units)
Geo.multiplier = 0.1;
Geo.project = function(latlon) {
var d = Math.PI / 180;
var max = Geo.MAX_LATITUDE;
@ -38,6 +52,9 @@ Geo.latLonToPoint = function(latlon) {
var projected = Geo.project(latlon);
projected.y *= -1;
projected.x *= Geo.multiplier;
projected.y *= Geo.multiplier;
return projected;
};
@ -45,6 +62,10 @@ Geo.latLonToPoint = function(latlon) {
// This just reverses the Y axis to match WebGL
Geo.pointToLatLon = function(point) {
var _point = Point(point.x, point.y * -1);
_point.x /= Geo.multiplier;
_point.y /= Geo.multiplier;
return Geo.unproject(_point);
};
@ -114,36 +135,21 @@ Geo.metresToWorld = function(metres, pointScale) {
//
// Latitude scale is chosen because it fluctuates more than longitude
var projectedMetres = Geo.metresToProjected(metres, pointScale);
var scale = Geo.scale();
// Scale projected metres
var scaledMetres = (scale * projectedMetres);
return scaledMetres;
return projectedMetres * Geo.multiplier;
};
// Convert world (WebGL) units to a value in real metres
Geo.worldToMetres = function(worldUnits, pointScale) {
var scale = Geo.scale();
var projectedUnits = worldUnits / scale;
var projectedUnits = worldUnits;
var realMetres = Geo.projectedToMetres(projectedUnits, pointScale);
return realMetres;
return realMetres / Geo.multiplier;
};
// If zoom is provided, returns the map width in pixels for a given zoom
// Else, provides fixed scale value
// Returns the world width in pixels for a given zoom, assuming tile dimensions
// of 256x256 pixels
Geo.scale = function(zoom) {
// If zoom is provided then return scale based on map tile zoom
if (zoom >= 0) {
return 256 * Math.pow(2, zoom);
// Else, return fixed scale value to expand projected coordinates from
// their 0 to 1 range into something more practical
} else {
return 1;
}
return 256 * Math.pow(2, zoom);
};
// Returns zoom level for a given scale value
@ -193,7 +199,7 @@ Geo.distance = function(latlon1, latlon2, accurate) {
};
Geo.bounds = (function() {
var d = Geo.R * Math.PI;
var d = Geo.R * Math.PI * Geo.multiplier;
return [[-d, -d], [d, d]];
})();

0
src/geo/LatLon.js 100644 → 100755
Wyświetl plik

0
src/geo/Point.js 100644 → 100755
Wyświetl plik

0
src/layer/GeoJSONLayer.js 100644 → 100755
Wyświetl plik

0
src/layer/GeoJSONWorkerLayer.js 100644 → 100755
Wyświetl plik

0
src/layer/Layer.js 100644 → 100755
Wyświetl plik

0
src/layer/LayerGroup.js 100644 → 100755
Wyświetl plik

0
src/layer/TopoJSONLayer.js 100644 → 100755
Wyświetl plik

0
src/layer/TopoJSONWorkerLayer.js 100644 → 100755
Wyświetl plik

Wyświetl plik

0
src/layer/environment/Sky.js 100644 → 100755
Wyświetl plik

0
src/layer/environment/Skybox.js 100644 → 100755
Wyświetl plik

0
src/layer/geometry/PointLayer.js 100644 → 100755
Wyświetl plik

Wyświetl plik

Wyświetl plik

0
src/layer/tile/GeoJSONTile.js 100644 → 100755
Wyświetl plik

Wyświetl plik

0
src/layer/tile/ImageTile.js 100644 → 100755
Wyświetl plik

0
src/layer/tile/ImageTileLayer.js 100644 → 100755
Wyświetl plik

Wyświetl plik

0
src/layer/tile/Tile.js 100644 → 100755
Wyświetl plik

Some files were not shown because too many files have changed in this diff Show More