@nextgis/ngw-leaflet 1.18.15 → 1.18.21

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.18.15; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.21; 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.18.15; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.21; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -15332,26 +15332,6 @@ var NgwLeaflet = (function () {
15332
15332
  return radius;
15333
15333
  }
15334
15334
 
15335
- /**
15336
- * Copy the values of all of the enumerable own properties from one or more source objects to a
15337
- * target object. Returns the target object.
15338
- * @param target - The target object to copy to.
15339
- * @param sources - One or more source objects from which to copy properties
15340
- */
15341
- function objectAssign(target) {
15342
- var sources = [];
15343
- for (var _i = 1; _i < arguments.length; _i++) {
15344
- sources[_i - 1] = arguments[_i];
15345
- }
15346
- for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
15347
- var source = sources_1[_a];
15348
- for (var _b = 0, _c = Object.getOwnPropertyNames(source); _b < _c.length; _b++) {
15349
- var prop = _c[_b];
15350
- target[prop] = source[prop];
15351
- }
15352
- }
15353
- }
15354
-
15355
15335
  function isEqual(a, b, o, p) {
15356
15336
  if (a instanceof Array) {
15357
15337
  if (!(b instanceof Array))
@@ -21435,50 +21415,12 @@ var NgwLeaflet = (function () {
21435
21415
  });
21436
21416
  };
21437
21417
  NgwWebmapItem.prototype.initItem = function (item) {
21438
- var _this = this;
21439
- var i = item;
21440
- var options = this.getItemOptions(item);
21441
- var setNewLayer = function (l) {
21442
- i._layer = l;
21443
- _this.layer = l;
21444
- var enabled = _this.properties.get('visibility');
21445
- if (enabled) {
21446
- _this.properties.set('visibility', true);
21447
- }
21448
- if (options.opacity !== undefined) {
21449
- _this.webMap.setLayerOpacity(l, options.opacity);
21450
- }
21451
- };
21452
21418
  if (item.item_type === 'group' || item.item_type === 'root') {
21453
- if (item.children && item.children.length) {
21454
- var children = this.getChildren(item);
21455
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
21456
- var x = children_1[_i];
21457
- var children_2 = new this.constructor(this.webMap, x, this.options, this.connector, this);
21458
- this.tree.addChild(children_2);
21459
- }
21460
- }
21461
- return Promise.resolve();
21419
+ return this.initGroupItem(item);
21462
21420
  }
21463
21421
  else {
21464
- var adapter = void 0;
21465
- if (item.item_type === 'layer') {
21466
- adapter = item.adapter || item.layer_adapter.toUpperCase();
21467
- }
21468
- else if (NgwWebmapItem.GetAdapterFromLayerType[item.item_type]) {
21469
- var getAdapter = NgwWebmapItem.GetAdapterFromLayerType[item.item_type];
21470
- adapter = getAdapter(item, options, this.webMap, this.connector);
21471
- }
21472
- if (adapter) {
21473
- return this.webMap.addLayer(adapter, options).then(function (newLayer) {
21474
- setNewLayer(newLayer);
21475
- });
21476
- }
21477
- }
21478
- if (item._layer) {
21479
- return Promise.resolve(setNewLayer(item._layer));
21422
+ return this.initLayerItem(item);
21480
21423
  }
21481
- return Promise.reject('No layer added');
21482
21424
  };
21483
21425
  NgwWebmapItem.prototype.bringToFront = function () {
21484
21426
  //
@@ -21514,7 +21456,7 @@ var NgwLeaflet = (function () {
21514
21456
  }
21515
21457
  if (item.item_type === 'layer') {
21516
21458
  var maxZoom = (_a = this._getZoomRange(item), _a.maxZoom), minZoom = _a.minZoom;
21517
- objectAssign(options, {
21459
+ Object.assign(options, {
21518
21460
  updateWmsParams: item.updateWmsParams,
21519
21461
  url: item.url,
21520
21462
  headers: this.options.headers,
@@ -21523,6 +21465,7 @@ var NgwLeaflet = (function () {
21523
21465
  minZoom: minZoom,
21524
21466
  minScale: item.layer_min_scale_denom,
21525
21467
  maxScale: item.layer_max_scale_denom,
21468
+ interactive: item.layer_identifiable,
21526
21469
  });
21527
21470
  }
21528
21471
  if (opacity !== undefined) {
@@ -21536,6 +21479,49 @@ var NgwLeaflet = (function () {
21536
21479
  NgwWebmapItem.prototype._mapScaleToZoomLevel = function (scale) {
21537
21480
  return setScaleRatio(scale);
21538
21481
  };
21482
+ NgwWebmapItem.prototype.initGroupItem = function (group) {
21483
+ if (group.children && group.children.length) {
21484
+ var children = this.getChildren(group);
21485
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
21486
+ var child = children_1[_i];
21487
+ var childItem = new this.constructor(this.webMap, child, this.options, this.connector, this);
21488
+ this.tree.addChild(childItem);
21489
+ }
21490
+ }
21491
+ return Promise.resolve();
21492
+ };
21493
+ NgwWebmapItem.prototype.initLayerItem = function (layer) {
21494
+ var _this = this;
21495
+ var options = this.getItemOptions(layer);
21496
+ var setNewLayer = function (l) {
21497
+ layer._layer = l;
21498
+ _this.layer = l;
21499
+ var enabled = _this.properties.get('visibility');
21500
+ if (enabled) {
21501
+ _this.properties.set('visibility', true);
21502
+ }
21503
+ if (options.opacity !== undefined) {
21504
+ _this.webMap.setLayerOpacity(l, options.opacity);
21505
+ }
21506
+ };
21507
+ var adapter;
21508
+ if (layer.item_type === 'layer') {
21509
+ adapter = layer.adapter || layer.layer_adapter.toUpperCase();
21510
+ }
21511
+ else if (NgwWebmapItem.GetAdapterFromLayerType[layer.item_type]) {
21512
+ var getAdapter = NgwWebmapItem.GetAdapterFromLayerType[layer.item_type];
21513
+ adapter = getAdapter(layer, options, this.webMap, this.connector);
21514
+ }
21515
+ if (adapter) {
21516
+ return this.webMap.addLayer(adapter, options).then(function (newLayer) {
21517
+ setNewLayer(newLayer);
21518
+ });
21519
+ }
21520
+ if (layer._layer) {
21521
+ return Promise.resolve(setNewLayer(layer._layer));
21522
+ }
21523
+ return Promise.reject('No layer added');
21524
+ };
21539
21525
  NgwWebmapItem.prototype._getZoomRange = function (item) {
21540
21526
  var minZoomWebmap = this.options.minZoom;
21541
21527
  var maxZoomWebmap = this.options.maxZoom;
@@ -21559,8 +21545,8 @@ var NgwLeaflet = (function () {
21559
21545
  };
21560
21546
  NgwWebmapItem.prototype._sumUp = function (children, totalValue) {
21561
21547
  if (totalValue === void 0) { totalValue = 0; }
21562
- for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
21563
- var child = children_3[_i];
21548
+ for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
21549
+ var child = children_2[_i];
21564
21550
  if (child.item_type === 'layer') {
21565
21551
  totalValue += 1;
21566
21552
  child.draw_order_position = child.draw_order_position || totalValue;
@@ -21998,7 +21984,9 @@ var NgwLeaflet = (function () {
21998
21984
  deps.forEach(function (x) {
21999
21985
  var item = x.item;
22000
21986
  var parentId = item.parentId;
22001
- if (parentId !== undefined && item.item_type === 'layer') {
21987
+ if (parentId !== undefined &&
21988
+ item.item_type === 'layer' &&
21989
+ item.layer_identifiable) {
22002
21990
  var visible = x.properties.property('visibility');
22003
21991
  var isVisible = visible.get() && !visible.isBlocked();
22004
21992
  if (isVisible) {
@@ -23582,11 +23570,12 @@ var NgwLeaflet = (function () {
23582
23570
  });
23583
23571
  };
23584
23572
  NgwMap.prototype.selectFromNgwRaster = function (ev) {
23573
+ var _a;
23585
23574
  return __awaiter(this, void 0, void 0, function () {
23586
- var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
23575
+ var promises, layers, _i, layers_1, l, layer, identFunc, interactive, getIdsPromise, getIds, ids, _b, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
23587
23576
  var _this = this;
23588
- return __generator(this, function (_b) {
23589
- switch (_b.label) {
23577
+ return __generator(this, function (_c) {
23578
+ switch (_c.label) {
23590
23579
  case 0:
23591
23580
  this._emitStatusEvent('ngw:preselect');
23592
23581
  promises = [];
@@ -23603,17 +23592,21 @@ var NgwLeaflet = (function () {
23603
23592
  identFunc = typeof layer.getIdentificationIds === 'function'
23604
23593
  ? layer.getIdentificationIds
23605
23594
  : false;
23606
- if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
23595
+ interactive = (_a = layer.options.interactive) !== null && _a !== void 0 ? _a : true;
23596
+ if (identFunc &&
23597
+ layer.options.selectable &&
23598
+ interactive &&
23599
+ this.isLayerVisible(layer)) {
23607
23600
  promises.push(identFunc.call(layer));
23608
23601
  }
23609
23602
  }
23610
23603
  getIdsPromise = Promise.all(promises);
23611
23604
  return [4 /*yield*/, getIdsPromise];
23612
23605
  case 1:
23613
- getIds = _b.sent();
23606
+ getIds = _c.sent();
23614
23607
  ids = [];
23615
- for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
23616
- x = getIds_1[_a];
23608
+ for (_b = 0, getIds_1 = getIds; _b < getIds_1.length; _b++) {
23609
+ x = getIds_1[_b];
23617
23610
  if (x) {
23618
23611
  ids.push.apply(ids, x);
23619
23612
  }