diff options
Diffstat (limited to 'extlib/leaflet/src/geo/crs')
-rw-r--r-- | extlib/leaflet/src/geo/crs/CRS.EPSG3395.js | 13 | ||||
-rw-r--r-- | extlib/leaflet/src/geo/crs/CRS.EPSG3857.js | 17 | ||||
-rw-r--r-- | extlib/leaflet/src/geo/crs/CRS.EPSG4326.js | 7 | ||||
-rw-r--r-- | extlib/leaflet/src/geo/crs/CRS.js | 17 |
4 files changed, 54 insertions, 0 deletions
diff --git a/extlib/leaflet/src/geo/crs/CRS.EPSG3395.js b/extlib/leaflet/src/geo/crs/CRS.EPSG3395.js new file mode 100644 index 00000000..426dc73c --- /dev/null +++ b/extlib/leaflet/src/geo/crs/CRS.EPSG3395.js @@ -0,0 +1,13 @@ +
+L.CRS.EPSG3395 = L.Util.extend({}, L.CRS, {
+ code: 'EPSG:3395',
+
+ projection: L.Projection.Mercator,
+ transformation: (function() {
+ var m = L.Projection.Mercator,
+ r = m.R_MAJOR,
+ r2 = m.R_MINOR;
+
+ return new L.Transformation(0.5/(Math.PI * r), 0.5, -0.5/(Math.PI * r2), 0.5);
+ })()
+});
\ No newline at end of file diff --git a/extlib/leaflet/src/geo/crs/CRS.EPSG3857.js b/extlib/leaflet/src/geo/crs/CRS.EPSG3857.js new file mode 100644 index 00000000..cbdbd03a --- /dev/null +++ b/extlib/leaflet/src/geo/crs/CRS.EPSG3857.js @@ -0,0 +1,17 @@ +
+L.CRS.EPSG3857 = L.Util.extend({}, L.CRS, {
+ code: 'EPSG:3857',
+
+ projection: L.Projection.SphericalMercator,
+ transformation: new L.Transformation(0.5/Math.PI, 0.5, -0.5/Math.PI, 0.5),
+
+ project: function(/*LatLng*/ latlng)/*-> Point*/ {
+ var projectedPoint = this.projection.project(latlng),
+ earthRadius = 6378137;
+ return projectedPoint.multiplyBy(earthRadius);
+ }
+});
+
+L.CRS.EPSG900913 = L.Util.extend({}, L.CRS.EPSG3857, {
+ code: 'EPSG:900913'
+});
\ No newline at end of file diff --git a/extlib/leaflet/src/geo/crs/CRS.EPSG4326.js b/extlib/leaflet/src/geo/crs/CRS.EPSG4326.js new file mode 100644 index 00000000..1550718d --- /dev/null +++ b/extlib/leaflet/src/geo/crs/CRS.EPSG4326.js @@ -0,0 +1,7 @@ +
+L.CRS.EPSG4326 = L.Util.extend({}, L.CRS, {
+ code: 'EPSG:4326',
+
+ projection: L.Projection.LonLat,
+ transformation: new L.Transformation(1/360, 0.5, -1/360, 0.5)
+});
\ No newline at end of file diff --git a/extlib/leaflet/src/geo/crs/CRS.js b/extlib/leaflet/src/geo/crs/CRS.js new file mode 100644 index 00000000..2dc2aa8d --- /dev/null +++ b/extlib/leaflet/src/geo/crs/CRS.js @@ -0,0 +1,17 @@ +
+L.CRS = {
+ latLngToPoint: function(/*LatLng*/ latlng, /*Number*/ scale)/*-> Point*/ {
+ var projectedPoint = this.projection.project(latlng);
+ return this.transformation._transform(projectedPoint, scale);
+ },
+
+ pointToLatLng: function(/*Point*/ point, /*Number*/ scale, /*(optional) Boolean*/ unbounded)/*-> LatLng*/ {
+ var untransformedPoint = this.transformation.untransform(point, scale);
+ return this.projection.unproject(untransformedPoint, unbounded);
+ //TODO get rid of 'unbounded' everywhere
+ },
+
+ project: function(latlng) {
+ return this.projection.project(latlng);
+ }
+};
\ No newline at end of file |