@nextgis/ngw-leaflet 1.16.0 → 1.16.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/ngw-leaflet; version: 1.16.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.16.1; author: NextGIS */
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -15263,7 +15263,9 @@ function getBoundsFeature(b) {
15263
15263
 
15264
15264
  var d2r = Math.PI / 180; // degrees to radians
15265
15265
  var r2d = 180 / Math.PI; // radians to degrees
15266
- function getCirclePolygonCoordinates(lng, lat, radius, points) {
15266
+ function getCirclePolygonCoordinates(lng, lat,
15267
+ /** In kilometers */
15268
+ radius, points) {
15267
15269
  if (radius === void 0) { radius = 10; }
15268
15270
  if (points === void 0) { points = 6; }
15269
15271
  // find the radius in lat/lon
@@ -15313,6 +15315,14 @@ function isLngLatBoundsArray(array) {
15313
15315
  array.every(function (x) { return typeof x === 'number'; }));
15314
15316
  }
15315
15317
 
15318
+ function getIdentifyRadius(center, zoom, pixelRadius) {
15319
+ pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
15320
+ var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
15321
+ Math.pow(2, zoom + 8);
15322
+ var radius = pixelRadius * metresPerPixel * 0.0005;
15323
+ return radius;
15324
+ }
15325
+
15316
15326
  /**
15317
15327
  * Copy the values of all of the enumerable own properties from one or more source objects to a
15318
15328
  * target object. Returns the target object.
@@ -22380,14 +22390,6 @@ function prepareWebMapOptions(options) {
22380
22390
  return options;
22381
22391
  }
22382
22392
 
22383
- function getIdentifyRadius(center, zoom, pixelRadius) {
22384
- pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
22385
- var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
22386
- Math.pow(2, zoom + 8);
22387
- var radius = pixelRadius * metresPerPixel * 0.0005;
22388
- return radius;
22389
- }
22390
-
22391
22393
  /**
22392
22394
  * Base class containing the logic of interaction WebMap with NextGIS services.
22393
22395
  *
@@ -22736,7 +22738,7 @@ var NgwMap = /** @class */ (function (_super) {
22736
22738
  this.$$selectFromNgwRaster = function (ev) {
22737
22739
  var count = _this._getSelectListenersCount();
22738
22740
  if (count) {
22739
- _this._selectFromNgwRaster(ev);
22741
+ _this.selectFromNgwRaster(ev);
22740
22742
  }
22741
22743
  };
22742
22744
  this.$$selectFromNgwVector = function (ev) {
@@ -22808,6 +22810,72 @@ var NgwMap = /** @class */ (function (_super) {
22808
22810
  }
22809
22811
  });
22810
22812
  };
22813
+ NgwMap.prototype.selectFromNgwRaster = function (ev) {
22814
+ return __awaiter(this, void 0, void 0, function () {
22815
+ var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
22816
+ var _this = this;
22817
+ return __generator(this, function (_b) {
22818
+ switch (_b.label) {
22819
+ case 0:
22820
+ this._emitStatusEvent('ngw:preselect');
22821
+ promises = [];
22822
+ layers = Object.values(this._ngwLayers);
22823
+ layers.sort(function (a, b) {
22824
+ if (a.layer.order && b.layer.order) {
22825
+ return b.layer.order - a.layer.order;
22826
+ }
22827
+ return 1;
22828
+ });
22829
+ for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
22830
+ l = layers_1[_i];
22831
+ layer = l.layer;
22832
+ identFunc = typeof layer.getIdentificationIds === 'function'
22833
+ ? layer.getIdentificationIds
22834
+ : false;
22835
+ if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22836
+ promises.push(identFunc.call(layer));
22837
+ }
22838
+ }
22839
+ getIdsPromise = Promise.all(promises);
22840
+ return [4 /*yield*/, getIdsPromise];
22841
+ case 1:
22842
+ getIds = _b.sent();
22843
+ ids = [];
22844
+ for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
22845
+ x = getIds_1[_a];
22846
+ if (x) {
22847
+ ids.push.apply(ids, x);
22848
+ }
22849
+ }
22850
+ if (!ids.length) {
22851
+ this._emitStatusEvent('ngw:select', null);
22852
+ return [2 /*return*/];
22853
+ }
22854
+ pixelRadius = this.options.pixelRadius || 10;
22855
+ center = this.getCenter();
22856
+ zoom = this.getZoom();
22857
+ zoom = zoom !== undefined ? zoom : 20;
22858
+ if (!center || !zoom) {
22859
+ this._emitStatusEvent('ngw:select', null);
22860
+ return [2 /*return*/];
22861
+ }
22862
+ radius = getIdentifyRadius(center, zoom, pixelRadius);
22863
+ selectPromise = sendIdentifyRequest(ev, {
22864
+ layers: ids,
22865
+ connector: this.connector,
22866
+ radius: radius,
22867
+ }).then(function (resp) {
22868
+ var identify = __assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev });
22869
+ var identifyEvent = _this._prepareToIdentify(identify);
22870
+ _this._emitStatusEvent('ngw:select', identify);
22871
+ return identifyEvent;
22872
+ });
22873
+ this._addPromise('select', selectPromise);
22874
+ return [2 /*return*/, selectPromise];
22875
+ }
22876
+ });
22877
+ });
22878
+ };
22811
22879
  NgwMap.prototype._addPromise = function (groupName, promise) {
22812
22880
  var group = this._promises[groupName];
22813
22881
  if (group && group.indexOf(promise) === -1) {
@@ -22943,70 +23011,6 @@ var NgwMap = /** @class */ (function (_super) {
22943
23011
  }
22944
23012
  }
22945
23013
  };
22946
- NgwMap.prototype._selectFromNgwRaster = function (ev) {
22947
- return __awaiter(this, void 0, void 0, function () {
22948
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
22949
- var _this = this;
22950
- return __generator(this, function (_b) {
22951
- switch (_b.label) {
22952
- case 0:
22953
- this._emitStatusEvent('ngw:preselect');
22954
- promises = [];
22955
- layers = Object.values(this._ngwLayers);
22956
- layers.sort(function (a, b) {
22957
- if (a.layer.order && b.layer.order) {
22958
- return b.layer.order - a.layer.order;
22959
- }
22960
- return 1;
22961
- });
22962
- for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
22963
- l = layers_1[_i];
22964
- layer = l.layer;
22965
- identFunc = typeof layer.getIdentificationIds === 'function'
22966
- ? layer.getIdentificationIds
22967
- : false;
22968
- if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
22969
- promises.push(identFunc.call(layer));
22970
- }
22971
- }
22972
- getIdsPromise = Promise.all(promises);
22973
- return [4 /*yield*/, getIdsPromise];
22974
- case 1:
22975
- getIds = _b.sent();
22976
- ids = [];
22977
- for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
22978
- x = getIds_1[_a];
22979
- if (x) {
22980
- ids.push.apply(ids, x);
22981
- }
22982
- }
22983
- if (!ids.length) {
22984
- this._emitStatusEvent('ngw:select', null);
22985
- return [2 /*return*/];
22986
- }
22987
- pixelRadius = this.options.pixelRadius || 10;
22988
- center = this.getCenter();
22989
- zoom = this.getZoom();
22990
- zoom = zoom !== undefined ? zoom : 20;
22991
- if (!center || !zoom) {
22992
- this._emitStatusEvent('ngw:select', null);
22993
- return [2 /*return*/];
22994
- }
22995
- radius = getIdentifyRadius(center, zoom, pixelRadius);
22996
- selectPromise = sendIdentifyRequest(ev, {
22997
- layers: ids,
22998
- connector: this.connector,
22999
- radius: radius,
23000
- }).then(function (resp) {
23001
- _this._emitStatusEvent('ngw:select', _this._prepareToIdentify(__assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev })));
23002
- return resp;
23003
- });
23004
- this._addPromise('select', selectPromise);
23005
- return [2 /*return*/, selectPromise];
23006
- }
23007
- });
23008
- });
23009
- };
23010
23014
  NgwMap.prototype._prepareToIdentify = function (identify) {
23011
23015
  var _this = this;
23012
23016
  var getIdentifyItems_ = function () {