Sha256: 0937ac1e93d6fa0ef66837977c941475e16c9c7af87f62207c9cb988e746330e
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
/* * L.CRS is the base object for all defined CRS (Coordinate Reference Systems) in Leaflet. */ L.CRS = { // converts geo coords to pixel ones latLngToPoint: function (latlng, zoom) { var projectedPoint = this.projection.project(latlng), scale = this.scale(zoom); return this.transformation._transform(projectedPoint, scale); }, // converts pixel coords to geo coords pointToLatLng: function (point, zoom) { var scale = this.scale(zoom), untransformedPoint = this.transformation.untransform(point, scale); return this.projection.unproject(untransformedPoint); }, // converts geo coords to projection-specific coords (e.g. in meters) project: function (latlng) { return this.projection.project(latlng); }, // converts projected coords to geo coords unproject: function (point) { return this.projection.unproject(point); }, // defines how the world scales with zoom scale: function (zoom) { return 256 * Math.pow(2, zoom); }, // returns the bounds of the world in projected coords if applicable getProjectedBounds: function (zoom) { if (this.infinite) { return null; } var b = this.projection.bounds, s = this.scale(zoom), min = this.transformation.transform(b.min, s), max = this.transformation.transform(b.max, s); return L.bounds(min, max); }, // whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS // wrapLng: [min, max], // wrapLat: [min, max], // if true, the coordinate space will be unbounded (infinite in all directions) // infinite: false, // wraps geo coords in certain ranges if applicable wrapLatLng: function (latlng) { var lng = this.wrapLng ? L.Util.wrapNum(latlng.lng, this.wrapLng, true) : latlng.lng, lat = this.wrapLat ? L.Util.wrapNum(latlng.lat, this.wrapLat, true) : latlng.lat; return L.latLng(lat, lng); } };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
leaflet-js-0.8.dev2 | lib/leaflet/src/geo/crs/CRS.js |