summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
commit3c99fde45db83b531c41c350ed4d0ac2a3c40c62 (patch)
treead5257daf9e41556ed73875ab56b69162dffdac1 /debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js
parentAdding upstream version 1.1.0. (diff)
downloadicingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.tar.xz
icingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.zip
Adding debian version 1.1.0-3.debian/1.1.0-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js')
-rwxr-xr-xdebian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js b/debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js
new file mode 100755
index 0000000..6ecff65
--- /dev/null
+++ b/debian/missing-sources/leaflet.js/geo/crs/CRS.Earth.js
@@ -0,0 +1,33 @@
+import {CRS} from './CRS';
+import * as Util from '../../core/Util';
+
+/*
+ * @namespace CRS
+ * @crs L.CRS.Earth
+ *
+ * Serves as the base for CRS that are global such that they cover the earth.
+ * Can only be used as the base for other CRS and cannot be used directly,
+ * since it does not have a `code`, `projection` or `transformation`. `distance()` returns
+ * meters.
+ */
+
+export var Earth = Util.extend({}, CRS, {
+ wrapLng: [-180, 180],
+
+ // Mean Earth Radius, as recommended for use by
+ // the International Union of Geodesy and Geophysics,
+ // see http://rosettacode.org/wiki/Haversine_formula
+ R: 6371000,
+
+ // distance between two geographical points using spherical law of cosines approximation
+ distance: function (latlng1, latlng2) {
+ var rad = Math.PI / 180,
+ lat1 = latlng1.lat * rad,
+ lat2 = latlng2.lat * rad,
+ sinDLat = Math.sin((latlng2.lat - latlng1.lat) * rad / 2),
+ sinDLon = Math.sin((latlng2.lng - latlng1.lng) * rad / 2),
+ a = sinDLat * sinDLat + Math.cos(lat1) * Math.cos(lat2) * sinDLon * sinDLon,
+ c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
+ return this.R * c;
+ }
+});