loleaflet/build/deps.js                                      |   24 
 loleaflet/src/geo/crs/CRS.EPSG3395.js                        |   14 
 loleaflet/src/geo/crs/CRS.EPSG3857.js                        |   18 
 loleaflet/src/geo/crs/CRS.EPSG4326.js                        |   10 
 loleaflet/src/geo/crs/CRS.Earth.js                           |   21 
 loleaflet/src/geo/projection/Projection.Mercator.js          |   44 -
 loleaflet/src/geo/projection/Projection.SphericalMercator.js |   32 -
 loleaflet/src/layer/GeoJSON.js                               |  269 -----------
 loleaflet/src/map/ext/Map.Geolocation.js                     |   92 ---
 9 files changed, 524 deletions(-)

New commits:
commit 83130d1e45b7b5706835c7cb7ee057f0fc34fb9c
Author:     Henry Castro <[email protected]>
AuthorDate: Tue Feb 12 14:57:19 2019 -0400
Commit:     Henry Castro <[email protected]>
CommitDate: Tue Mar 5 23:46:29 2019 -0400

    loleaflet: remove unused map geolocation code
    
    Change-Id: I14f4ca2bade957f0105f31838efe26601d965943

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index a050edf47..933c39c6d 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -19,25 +19,14 @@ var deps = {
                      'geo/LatLng.js',
                      'geo/LatLngBounds.js',
                      'geo/projection/Projection.LonLat.js',
-                     'geo/projection/Projection.SphericalMercator.js',
                      'geo/crs/CRS.js',
                      'geo/crs/CRS.Simple.js',
-                     'geo/crs/CRS.Earth.js',
-                     'geo/crs/CRS.EPSG3857.js',
-                     'geo/crs/CRS.EPSG4326.js',
                      'map/Map.js',
                      'layer/Layer.js'
                      ],
                desc: 'The core of the library, including OOP, events, DOM 
facilities, basic units, projections (EPSG:3857 and EPSG:4326) and the base Map 
class.'
        },
 
-       EPSG3395: {
-               src: ['geo/projection/Projection.Mercator.js',
-                     'geo/crs/CRS.EPSG3395.js'],
-               desc: 'EPSG:3395 projection (used by some map providers).',
-               heading: 'Additional projections'
-       },
-
        GridLayer: {
                src: ['layer/tile/GridLayer.js'],
                desc: 'Used as base class for grid-like layers like TileLayer.',
@@ -191,13 +180,6 @@ var deps = {
                desc: 'Canvas backend for vector layers.'
        },
 
-       GeoJSON: {
-               src: ['layer/GeoJSON.js'],
-               deps: ['Polygon', 'Circle', 'CircleMarker', 'Marker', 
'FeatureGroup'],
-               desc: 'GeoJSON layer, parses the data and adds corresponding 
layers above.'
-       },
-
-
        MapDrag: {
                src: ['dom/DomEvent.js',
                      'dom/Draggable.js',
@@ -462,12 +444,6 @@ var deps = {
                desc: 'Smooth zooming animation. Works only on browsers that 
support CSS3 Transitions.'
        },
 
-       Geolocation: {
-               src: ['map/ext/Map.Geolocation.js'],
-               desc: 'Adds Map#locate method and related events to make 
geolocation easier.',
-               heading: 'Misc'
-       },
-
        AnnotationManager: {
                src: ['layer/AnnotationManager.js'],
                desc: 'Group Annotations to put on the map.'
diff --git a/loleaflet/src/geo/crs/CRS.EPSG3395.js 
b/loleaflet/src/geo/crs/CRS.EPSG3395.js
deleted file mode 100644
index be1429c7f..000000000
--- a/loleaflet/src/geo/crs/CRS.EPSG3395.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.EPSG3857 (World Mercator) CRS implementation.
- */
-
-L.CRS.EPSG3395 = L.extend({}, L.CRS.Earth, {
-       code: 'EPSG:3395',
-       projection: L.Projection.Mercator,
-
-       transformation: (function () {
-               var scale = 0.5 / (Math.PI * L.Projection.Mercator.R);
-               return new L.Transformation(scale, 0.5, -scale, 0.5);
-       }())
-});
diff --git a/loleaflet/src/geo/crs/CRS.EPSG3857.js 
b/loleaflet/src/geo/crs/CRS.EPSG3857.js
deleted file mode 100644
index 3373d6630..000000000
--- a/loleaflet/src/geo/crs/CRS.EPSG3857.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.EPSG3857 (Spherical Mercator) is the most common CRS for web mapping 
and is used by Leaflet by default.
- */
-
-L.CRS.EPSG3857 = L.extend({}, L.CRS.Earth, {
-       code: 'EPSG:3857',
-       projection: L.Projection.SphericalMercator,
-
-       transformation: (function () {
-               var scale = 0.5 / (Math.PI * L.Projection.SphericalMercator.R);
-               return new L.Transformation(scale, 0.5, -scale, 0.5);
-       }())
-});
-
-L.CRS.EPSG900913 = L.extend({}, L.CRS.EPSG3857, {
-       code: 'EPSG:900913'
-});
diff --git a/loleaflet/src/geo/crs/CRS.EPSG4326.js 
b/loleaflet/src/geo/crs/CRS.EPSG4326.js
deleted file mode 100644
index 0f90029ac..000000000
--- a/loleaflet/src/geo/crs/CRS.EPSG4326.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.EPSG4326 is a CRS popular among advanced GIS specialists.
- */
-
-L.CRS.EPSG4326 = L.extend({}, L.CRS.Earth, {
-       code: 'EPSG:4326',
-       projection: L.Projection.LonLat,
-       transformation: new L.Transformation(1 / 180, 1, -1 / 180, 0.5)
-});
diff --git a/loleaflet/src/geo/crs/CRS.Earth.js 
b/loleaflet/src/geo/crs/CRS.Earth.js
deleted file mode 100644
index e8b0374b9..000000000
--- a/loleaflet/src/geo/crs/CRS.Earth.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.CRS.Earth is the base class for all CRS representing Earth.
- */
-
-L.CRS.Earth = L.extend({}, L.CRS, {
-       wrapLng: [-180, 180],
-
-       R: 6378137,
-
-       // 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,
-                   a = Math.sin(lat1) * Math.sin(lat2) +
-                       Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlng2.lng 
- latlng1.lng) * rad);
-
-               return this.R * Math.acos(Math.min(a, 1));
-       }
-});
diff --git a/loleaflet/src/geo/projection/Projection.Mercator.js 
b/loleaflet/src/geo/projection/Projection.Mercator.js
deleted file mode 100644
index 65caaf566..000000000
--- a/loleaflet/src/geo/projection/Projection.Mercator.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * Mercator projection that takes into account that the Earth is not a perfect 
sphere.
- * Less popular than spherical mercator; used by projections like EPSG:3395.
- */
-
-L.Projection.Mercator = {
-       R: 6378137,
-       R_MINOR: 6356752.314245179,
-
-       bounds: L.bounds([-20037508.34279, -15496570.73972], [20037508.34279, 
18764656.23138]),
-
-       project: function (latlng) {
-               var d = Math.PI / 180,
-                   r = this.R,
-                   y = latlng.lat * d,
-                   tmp = this.R_MINOR / r,
-                   e = Math.sqrt(1 - tmp * tmp),
-                   con = e * Math.sin(y);
-
-               var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / 
(1 + con), e / 2);
-               y = -r * Math.log(Math.max(ts, 1E-10));
-
-               return new L.Point(latlng.lng * d * r, y);
-       },
-
-       unproject: function (point) {
-               var d = 180 / Math.PI,
-                   r = this.R,
-                   tmp = this.R_MINOR / r,
-                   e = Math.sqrt(1 - tmp * tmp),
-                   ts = Math.exp(-point.y / r),
-                   phi = Math.PI / 2 - 2 * Math.atan(ts);
-
-               for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 
1e-7; i++) {
-                       con = e * Math.sin(phi);
-                       con = Math.pow((1 - con) / (1 + con), e / 2);
-                       dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;
-                       phi += dphi;
-               }
-
-               return new L.LatLng(phi * d, point.x * d / r);
-       }
-};
diff --git a/loleaflet/src/geo/projection/Projection.SphericalMercator.js 
b/loleaflet/src/geo/projection/Projection.SphericalMercator.js
deleted file mode 100644
index 0e95cc510..000000000
--- a/loleaflet/src/geo/projection/Projection.SphericalMercator.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * Spherical Mercator is the most popular map projection, used by EPSG:3857 
CRS used by default.
- */
-
-L.Projection.SphericalMercator = {
-
-       R: 6378137,
-
-       project: function (latlng) {
-               var d = Math.PI / 180,
-                   max = 1 - 1E-15,
-                   sin = Math.max(Math.min(Math.sin(latlng.lat * d), max), 
-max);
-
-               return new L.Point(
-                               this.R * latlng.lng * d,
-                               this.R * Math.log((1 + sin) / (1 - sin)) / 2);
-       },
-
-       unproject: function (point) {
-               var d = 180 / Math.PI;
-
-               return new L.LatLng(
-                       (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 
2)) * d,
-                       point.x * d / this.R);
-       },
-
-       bounds: (function () {
-               var d = 6378137 * Math.PI;
-               return L.bounds([-d, -d], [d, d]);
-       })()
-};
diff --git a/loleaflet/src/layer/GeoJSON.js b/loleaflet/src/layer/GeoJSON.js
deleted file mode 100644
index 7458da924..000000000
--- a/loleaflet/src/layer/GeoJSON.js
+++ /dev/null
@@ -1,269 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * L.GeoJSON turns any GeoJSON data into a Leaflet layer.
- */
-
-L.GeoJSON = L.FeatureGroup.extend({
-
-       initialize: function (geojson, options) {
-               L.setOptions(this, options);
-
-               this._layers = {};
-
-               if (geojson) {
-                       this.addData(geojson);
-               }
-       },
-
-       addData: function (geojson) {
-               var features = L.Util.isArray(geojson) ? geojson : 
geojson.features,
-                   i, len, feature;
-
-               if (features) {
-                       for (i = 0, len = features.length; i < len; i++) {
-                               // only add this if geometry or geometries are 
set and not null
-                               feature = features[i];
-                               if (feature.geometries || feature.geometry || 
feature.features || feature.coordinates) {
-                                       this.addData(feature);
-                               }
-                       }
-                       return this;
-               }
-
-               var options = this.options;
-
-               if (options.filter && !options.filter(geojson)) { return this; }
-
-               var layer = L.GeoJSON.geometryToLayer(geojson, options);
-               layer.feature = L.GeoJSON.asFeature(geojson);
-
-               layer.defaultOptions = layer.options;
-               this.resetStyle(layer);
-
-               if (options.onEachFeature) {
-                       options.onEachFeature(geojson, layer);
-               }
-
-               return this.addLayer(layer);
-       },
-
-       resetStyle: function (layer) {
-               // reset any custom styles
-               layer.options = layer.defaultOptions;
-               this._setLayerStyle(layer, this.options.style);
-               return this;
-       },
-
-       setStyle: function (style) {
-               return this.eachLayer(function (layer) {
-                       this._setLayerStyle(layer, style);
-               }, this);
-       },
-
-       _setLayerStyle: function (layer, style) {
-               if (typeof style === 'function') {
-                       style = style(layer.feature);
-               }
-               if (layer.setStyle) {
-                       layer.setStyle(style);
-               }
-       }
-});
-
-L.extend(L.GeoJSON, {
-       geometryToLayer: function (geojson, options) {
-
-               var geometry = geojson.type === 'Feature' ? geojson.geometry : 
geojson,
-                   coords = geometry.coordinates,
-                   layers = [],
-                   pointToLayer = options && options.pointToLayer,
-                   coordsToLatLng = options && options.coordsToLatLng || 
this.coordsToLatLng,
-                   latlng, latlngs, i, len;
-
-               switch (geometry.type) {
-               case 'Point':
-                       latlng = coordsToLatLng(coords);
-                       return pointToLayer ? pointToLayer(geojson, latlng) : 
new L.Marker(latlng);
-
-               case 'MultiPoint':
-                       for (i = 0, len = coords.length; i < len; i++) {
-                               latlng = coordsToLatLng(coords[i]);
-                               layers.push(pointToLayer ? 
pointToLayer(geojson, latlng) : new L.Marker(latlng));
-                       }
-                       return new L.FeatureGroup(layers);
-
-               case 'LineString':
-               case 'MultiLineString':
-                       latlngs = this.coordsToLatLngs(coords, geometry.type 
=== 'LineString' ? 0 : 1, coordsToLatLng);
-                       return new L.Polyline(latlngs, options);
-
-               case 'Polygon':
-               case 'MultiPolygon':
-                       latlngs = this.coordsToLatLngs(coords, geometry.type 
=== 'Polygon' ? 1 : 2, coordsToLatLng);
-                       return new L.Polygon(latlngs, options);
-
-               case 'GeometryCollection':
-                       for (i = 0, len = geometry.geometries.length; i < len; 
i++) {
-
-                               layers.push(this.geometryToLayer({
-                                       geometry: geometry.geometries[i],
-                                       type: 'Feature',
-                                       properties: geojson.properties
-                               }, options));
-                       }
-                       return new L.FeatureGroup(layers);
-
-               default:
-                       throw new Error('Invalid GeoJSON object.');
-               }
-       },
-
-       coordsToLatLng: function (coords) {
-               return new L.LatLng(coords[1], coords[0], coords[2]);
-       },
-
-       coordsToLatLngs: function (coords, levelsDeep, coordsToLatLng) {
-               var latlngs = [];
-
-               for (var i = 0, len = coords.length, latlng; i < len; i++) {
-                       latlng = levelsDeep ?
-                               this.coordsToLatLngs(coords[i], levelsDeep - 1, 
coordsToLatLng) :
-                               (coordsToLatLng || 
this.coordsToLatLng)(coords[i]);
-
-                       latlngs.push(latlng);
-               }
-
-               return latlngs;
-       },
-
-       latLngToCoords: function (latlng) {
-               return latlng.alt !== undefined ?
-                               [latlng.lng, latlng.lat, latlng.alt] :
-                               [latlng.lng, latlng.lat];
-       },
-
-       latLngsToCoords: function (latlngs, levelsDeep, closed) {
-               var coords = [];
-
-               for (var i = 0, len = latlngs.length; i < len; i++) {
-                       coords.push(levelsDeep ?
-                               L.GeoJSON.latLngsToCoords(latlngs[i], 
levelsDeep - 1, closed) :
-                               L.GeoJSON.latLngToCoords(latlngs[i]));
-               }
-
-               if (!levelsDeep && closed) {
-                       coords.push(coords[0]);
-               }
-
-               return coords;
-       },
-
-       getFeature: function (layer, newGeometry) {
-               return layer.feature ?
-                               L.extend({}, layer.feature, {geometry: 
newGeometry}) :
-                               L.GeoJSON.asFeature(newGeometry);
-       },
-
-       asFeature: function (geoJSON) {
-               if (geoJSON.type === 'Feature') {
-                       return geoJSON;
-               }
-
-               return {
-                       type: 'Feature',
-                       properties: {},
-                       geometry: geoJSON
-               };
-       }
-});
-
-var PointToGeoJSON = {
-       toGeoJSON: function () {
-               return L.GeoJSON.getFeature(this, {
-                       type: 'Point',
-                       coordinates: L.GeoJSON.latLngToCoords(this.getLatLng())
-               });
-       }
-};
-
-L.Marker.include(PointToGeoJSON);
-L.Circle.include(PointToGeoJSON);
-L.CircleMarker.include(PointToGeoJSON);
-
-L.Polyline.prototype.toGeoJSON = function () {
-       var multi = !this._flat(this._latlngs);
-
-       var coords = L.GeoJSON.latLngsToCoords(this._latlngs, multi ? 1 : 0);
-
-       return L.GeoJSON.getFeature(this, {
-               type: (multi ? 'Multi' : '') + 'LineString',
-               coordinates: coords
-       });
-};
-
-L.Polygon.prototype.toGeoJSON = function () {
-       var holes = !this._flat(this._latlngs),
-           multi = holes && !this._flat(this._latlngs[0]);
-
-       var coords = L.GeoJSON.latLngsToCoords(this._latlngs, multi ? 2 : holes 
? 1 : 0, true);
-
-       if (!holes) {
-               coords = [coords];
-       }
-
-       return L.GeoJSON.getFeature(this, {
-               type: (multi ? 'Multi' : '') + 'Polygon',
-               coordinates: coords
-       });
-};
-
-
-L.LayerGroup.include({
-       toMultiPoint: function () {
-               var coords = [];
-
-               this.eachLayer(function (layer) {
-                       coords.push(layer.toGeoJSON().geometry.coordinates);
-               });
-
-               return L.GeoJSON.getFeature(this, {
-                       type: 'MultiPoint',
-                       coordinates: coords
-               });
-       },
-
-       toGeoJSON: function () {
-
-               var type = this.feature && this.feature.geometry && 
this.feature.geometry.type;
-
-               if (type === 'MultiPoint') {
-                       return this.toMultiPoint();
-               }
-
-               var isGeometryCollection = type === 'GeometryCollection',
-                   jsons = [];
-
-               this.eachLayer(function (layer) {
-                       if (layer.toGeoJSON) {
-                               var json = layer.toGeoJSON();
-                               jsons.push(isGeometryCollection ? json.geometry 
: L.GeoJSON.asFeature(json));
-                       }
-               });
-
-               if (isGeometryCollection) {
-                       return L.GeoJSON.getFeature(this, {
-                               geometries: jsons,
-                               type: 'GeometryCollection'
-                       });
-               }
-
-               return {
-                       type: 'FeatureCollection',
-                       features: jsons
-               };
-       }
-});
-
-L.geoJson = function (geojson, options) {
-       return new L.GeoJSON(geojson, options);
-};
diff --git a/loleaflet/src/map/ext/Map.Geolocation.js 
b/loleaflet/src/map/ext/Map.Geolocation.js
deleted file mode 100644
index 97985a838..000000000
--- a/loleaflet/src/map/ext/Map.Geolocation.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- js-indent-level: 8 -*- */
-/*
- * Provides L.Map with convenient shortcuts for using browser geolocation 
features.
- */
-
-L.Map.include({
-       _defaultLocateOptions: {
-               timeout: 10000,
-               watch: false
-               // setView: false
-               // maxZoom: <Number>
-               // maximumAge: 0
-               // enableHighAccuracy: false
-       },
-
-       locate: function (/*Object*/ options) {
-
-               options = this._locateOptions = L.extend({}, 
this._defaultLocateOptions, options);
-
-               if (!navigator.geolocation) {
-                       this._handleGeolocationError({
-                               code: 0,
-                               message: 'Geolocation not supported.'
-                       });
-                       return this;
-               }
-
-               var onResponse = L.bind(this._handleGeolocationResponse, this),
-                   onError = L.bind(this._handleGeolocationError, this);
-
-               if (options.watch) {
-                       this._locationWatchId =
-                               navigator.geolocation.watchPosition(onResponse, 
onError, options);
-               } else {
-                       navigator.geolocation.getCurrentPosition(onResponse, 
onError, options);
-               }
-               return this;
-       },
-
-       stopLocate: function () {
-               if (navigator.geolocation) {
-                       navigator.geolocation.clearWatch(this._locationWatchId);
-               }
-               if (this._locateOptions) {
-                       this._locateOptions.setView = false;
-               }
-               return this;
-       },
-
-       _handleGeolocationError: function (error) {
-               var c = error.code,
-                   message = error.message ||
-                           (c === 1 ? 'permission denied' :
-                           (c === 2 ? 'position unavailable' : 'timeout'));
-
-               if (this._locateOptions.setView && !this._loaded) {
-                       this.fitWorld();
-               }
-
-               this.fire('locationerror', {
-                       code: c,
-                       message: 'Geolocation error: ' + message + '.'
-               });
-       },
-
-       _handleGeolocationResponse: function (pos) {
-               var lat = pos.coords.latitude,
-                   lng = pos.coords.longitude,
-                   latlng = new L.LatLng(lat, lng),
-                   bounds = latlng.toBounds(pos.coords.accuracy),
-                   options = this._locateOptions;
-
-               if (options.setView) {
-                       var zoom = this.getBoundsZoom(bounds);
-                       this.setView(latlng, options.maxZoom ? Math.min(zoom, 
options.maxZoom) : zoom);
-               }
-
-               var data = {
-                       latlng: latlng,
-                       bounds: bounds,
-                       timestamp: pos.timestamp
-               };
-
-               for (var i in pos.coords) {
-                       if (typeof pos.coords[i] === 'number') {
-                               data[i] = pos.coords[i];
-                       }
-               }
-
-               this.fire('locationfound', data);
-       }
-});
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to