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