@nextgis/leaflet-map-adapter 1.18.21 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 1.18.21; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 1.19.1; author: NextGIS */
2
2
  var LeafletMapAdapter = (function () {
3
3
  'use strict';
4
4
 
@@ -14651,17 +14651,26 @@ var LeafletMapAdapter = (function () {
14651
14651
 
14652
14652
  } (leafletSrc, leafletSrc.exports));
14653
14653
 
14654
- function convertMapClickEvent(evt) {
14655
- var coord = evt.containerPoint;
14656
- var latLng = evt.latlng;
14657
- var lat = latLng.lat, lng = latLng.lng;
14658
- return {
14659
- latLng: latLng,
14660
- lngLat: [lng, lat],
14661
- pixel: { left: coord.x, top: coord.y },
14662
- source: evt,
14663
- };
14664
- }
14654
+ var AttributionControl = /** @class */ (function (_super) {
14655
+ __extends(AttributionControl, _super);
14656
+ // options: AttributionControlOptions
14657
+ function AttributionControl(options) {
14658
+ var _this = _super.call(this, options) || this;
14659
+ var customAttribution = options && options.customAttribution;
14660
+ if (customAttribution) {
14661
+ var attributions = [];
14662
+ if (Array.isArray(customAttribution)) {
14663
+ attributions = customAttribution;
14664
+ }
14665
+ else if (customAttribution) {
14666
+ attributions = [customAttribution];
14667
+ }
14668
+ attributions.forEach(function (x) { return _this.addAttribution(x); });
14669
+ }
14670
+ return _this;
14671
+ }
14672
+ return AttributionControl;
14673
+ }(leafletSrc.exports.Control.Attribution));
14665
14674
 
14666
14675
  function createControl(control, options, map) {
14667
14676
  if (options === void 0) { options = {}; }
@@ -14736,27 +14745,6 @@ var LeafletMapAdapter = (function () {
14736
14745
  }, { bar: true }, map);
14737
14746
  }
14738
14747
 
14739
- var AttributionControl = /** @class */ (function (_super) {
14740
- __extends(AttributionControl, _super);
14741
- // options: AttributionControlOptions
14742
- function AttributionControl(options) {
14743
- var _this = _super.call(this, options) || this;
14744
- var customAttribution = options && options.customAttribution;
14745
- if (customAttribution) {
14746
- var attributions = [];
14747
- if (Array.isArray(customAttribution)) {
14748
- attributions = customAttribution;
14749
- }
14750
- else if (customAttribution) {
14751
- attributions = [customAttribution];
14752
- }
14753
- attributions.forEach(function (x) { return _this.addAttribution(x); });
14754
- }
14755
- return _this;
14756
- }
14757
- return AttributionControl;
14758
- }(leafletSrc.exports.Control.Attribution));
14759
-
14760
14748
  /**
14761
14749
  * from https://github.com/CesiumGS/cesium/blob/master/Source/Core/defined.js
14762
14750
  *
@@ -14807,6 +14795,39 @@ var LeafletMapAdapter = (function () {
14807
14795
  return [sw.lng, sw.lat, ne.lng, ne.lat];
14808
14796
  }
14809
14797
 
14798
+ function findMostFrequentGeomType(arr) {
14799
+ var counts = {};
14800
+ for (var fry = 0; fry < arr.length; fry++) {
14801
+ counts[arr[fry]] = 1 + (counts[arr[fry]] || 0);
14802
+ }
14803
+ var maxName = '';
14804
+ for (var c in counts) {
14805
+ var maxCount = maxName ? counts[maxName] : 0;
14806
+ if (counts[c] > maxCount) {
14807
+ maxName = c;
14808
+ }
14809
+ }
14810
+ return maxName;
14811
+ }
14812
+ function detectType(geojson) {
14813
+ var geometry;
14814
+ if (geojson.type === 'FeatureCollection') {
14815
+ var featuresTypes = geojson.features.map(function (f) { return f.geometry.type; });
14816
+ geometry = findMostFrequentGeomType(featuresTypes);
14817
+ }
14818
+ else if (geojson.type === 'GeometryCollection') {
14819
+ var geometryTypes = geojson.geometries.map(function (g) { return g.type; });
14820
+ geometry = findMostFrequentGeomType(geometryTypes);
14821
+ }
14822
+ else if (geojson.type === 'Feature') {
14823
+ geometry = geojson.geometry.type;
14824
+ }
14825
+ else {
14826
+ geometry = geojson.type;
14827
+ }
14828
+ return geometry;
14829
+ }
14830
+
14810
14831
  var typeAlias = {
14811
14832
  Point: 'point',
14812
14833
  LineString: 'line',
@@ -14872,39 +14893,6 @@ var LeafletMapAdapter = (function () {
14872
14893
  };
14873
14894
  }
14874
14895
 
14875
- function findMostFrequentGeomType(arr) {
14876
- var counts = {};
14877
- for (var fry = 0; fry < arr.length; fry++) {
14878
- counts[arr[fry]] = 1 + (counts[arr[fry]] || 0);
14879
- }
14880
- var maxName = '';
14881
- for (var c in counts) {
14882
- var maxCount = maxName ? counts[maxName] : 0;
14883
- if (counts[c] > maxCount) {
14884
- maxName = c;
14885
- }
14886
- }
14887
- return maxName;
14888
- }
14889
- function detectType(geojson) {
14890
- var geometry;
14891
- if (geojson.type === 'FeatureCollection') {
14892
- var featuresTypes = geojson.features.map(function (f) { return f.geometry.type; });
14893
- geometry = findMostFrequentGeomType(featuresTypes);
14894
- }
14895
- else if (geojson.type === 'GeometryCollection') {
14896
- var geometryTypes = geojson.geometries.map(function (g) { return g.type; });
14897
- geometry = findMostFrequentGeomType(geometryTypes);
14898
- }
14899
- else if (geojson.type === 'Feature') {
14900
- geometry = geojson.geometry.type;
14901
- }
14902
- else {
14903
- geometry = geojson.type;
14904
- }
14905
- return geometry;
14906
- }
14907
-
14908
14896
  var BaseAdapter = /** @class */ (function () {
14909
14897
  function BaseAdapter(map, options) {
14910
14898
  this.map = map;
@@ -14927,6 +14915,18 @@ var LeafletMapAdapter = (function () {
14927
14915
  return BaseAdapter;
14928
14916
  }());
14929
14917
 
14918
+ function convertMapClickEvent(evt) {
14919
+ var coord = evt.containerPoint;
14920
+ var latLng = evt.latlng;
14921
+ var lat = latLng.lat, lng = latLng.lng;
14922
+ return {
14923
+ latLng: latLng,
14924
+ lngLat: [lng, lat],
14925
+ pixel: { left: coord.x, top: coord.y },
14926
+ source: evt,
14927
+ };
14928
+ }
14929
+
14930
14930
  function createMouseEvent(_a) {
14931
14931
  var layer = _a.layer, source = _a.source;
14932
14932
  var layer_ = source.target;
@@ -16019,6 +16019,18 @@ var LeafletMapAdapter = (function () {
16019
16019
  return TileAdapter;
16020
16020
  }(BaseAdapter));
16021
16021
 
16022
+ var OsmAdapter = /** @class */ (function (_super) {
16023
+ __extends(OsmAdapter, _super);
16024
+ function OsmAdapter() {
16025
+ return _super !== null && _super.apply(this, arguments) || this;
16026
+ }
16027
+ OsmAdapter.prototype.addLayer = function (options) {
16028
+ var url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
16029
+ return _super.prototype.addLayer.call(this, __assign(__assign({ name: 'OpenStreetMap', attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }, options), { url: url }));
16030
+ };
16031
+ return OsmAdapter;
16032
+ }(TileAdapter));
16033
+
16022
16034
  var WmsLayerBase = /** @class */ (function (_super) {
16023
16035
  __extends(WmsLayerBase, _super);
16024
16036
  function WmsLayerBase(urlTemplate, options) {
@@ -16051,18 +16063,6 @@ var LeafletMapAdapter = (function () {
16051
16063
  return WmsAdapter;
16052
16064
  }(BaseAdapter));
16053
16065
 
16054
- var OsmAdapter = /** @class */ (function (_super) {
16055
- __extends(OsmAdapter, _super);
16056
- function OsmAdapter() {
16057
- return _super !== null && _super.apply(this, arguments) || this;
16058
- }
16059
- OsmAdapter.prototype.addLayer = function (options) {
16060
- var url = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
16061
- return _super.prototype.addLayer.call(this, __assign(__assign({ name: 'OpenStreetMap', attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }, options), { url: url }));
16062
- };
16063
- return OsmAdapter;
16064
- }(TileAdapter));
16065
-
16066
16066
  function arrayToBoundsExpression(bounds) {
16067
16067
  var e = bounds;
16068
16068
  // top, left, bottom, right