Installed leaflet in extlib
This commit is contained in:
13
extlib/leaflet/src/geo/crs/CRS.EPSG3395.js
Normal file
13
extlib/leaflet/src/geo/crs/CRS.EPSG3395.js
Normal file
@@ -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);
|
||||
})()
|
||||
});
|
||||
17
extlib/leaflet/src/geo/crs/CRS.EPSG3857.js
Normal file
17
extlib/leaflet/src/geo/crs/CRS.EPSG3857.js
Normal file
@@ -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'
|
||||
});
|
||||
7
extlib/leaflet/src/geo/crs/CRS.EPSG4326.js
Normal file
7
extlib/leaflet/src/geo/crs/CRS.EPSG4326.js
Normal file
@@ -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)
|
||||
});
|
||||
17
extlib/leaflet/src/geo/crs/CRS.js
Normal file
17
extlib/leaflet/src/geo/crs/CRS.js
Normal file
@@ -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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user