@nextgis/ngw-map 1.18.12 → 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-map; version: 1.18.12; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.18.21; author: NextGIS */
2
2
  var events = {exports: {}};
3
3
 
4
4
  var R = typeof Reflect === 'object' ? Reflect : null;
@@ -1074,20 +1074,6 @@ function getIdentifyRadius(center, zoom, pixelRadius) {
1074
1074
  return radius;
1075
1075
  }
1076
1076
 
1077
- /**
1078
- * Copy the values of all of the enumerable own properties from one or more source objects to a
1079
- * target object. Returns the target object.
1080
- * @param target - The target object to copy to.
1081
- * @param sources - One or more source objects from which to copy properties
1082
- */
1083
- function objectAssign(target, ...sources) {
1084
- for (const source of sources) {
1085
- for (const prop of Object.getOwnPropertyNames(source)) {
1086
- target[prop] = source[prop];
1087
- }
1088
- }
1089
- }
1090
-
1091
1077
  function isEqual(a, b, o, p) {
1092
1078
  if (a instanceof Array) {
1093
1079
  if (!(b instanceof Array))
@@ -6722,48 +6708,12 @@ class NgwWebmapItem extends Item {
6722
6708
  return ngwWebmapItem;
6723
6709
  }
6724
6710
  initItem(item) {
6725
- const i = item;
6726
- const options = this.getItemOptions(item);
6727
- const setNewLayer = (l) => {
6728
- i._layer = l;
6729
- this.layer = l;
6730
- const enabled = this.properties.get('visibility');
6731
- if (enabled) {
6732
- this.properties.set('visibility', true);
6733
- }
6734
- if (options.opacity !== undefined) {
6735
- this.webMap.setLayerOpacity(l, options.opacity);
6736
- }
6737
- };
6738
6711
  if (item.item_type === 'group' || item.item_type === 'root') {
6739
- if (item.children && item.children.length) {
6740
- const children = this.getChildren(item);
6741
- for (const x of children) {
6742
- const children = new this.constructor(this.webMap, x, this.options, this.connector, this);
6743
- this.tree.addChild(children);
6744
- }
6745
- }
6746
- return Promise.resolve();
6712
+ return this.initGroupItem(item);
6747
6713
  }
6748
6714
  else {
6749
- let adapter;
6750
- if (item.item_type === 'layer') {
6751
- adapter = item.adapter || item.layer_adapter.toUpperCase();
6752
- }
6753
- else if (NgwWebmapItem.GetAdapterFromLayerType[item.item_type]) {
6754
- const getAdapter = NgwWebmapItem.GetAdapterFromLayerType[item.item_type];
6755
- adapter = getAdapter(item, options, this.webMap, this.connector);
6756
- }
6757
- if (adapter) {
6758
- return this.webMap.addLayer(adapter, options).then((newLayer) => {
6759
- setNewLayer(newLayer);
6760
- });
6761
- }
6762
- }
6763
- if (item._layer) {
6764
- return Promise.resolve(setNewLayer(item._layer));
6715
+ return this.initLayerItem(item);
6765
6716
  }
6766
- return Promise.reject('No layer added');
6767
6717
  }
6768
6718
  bringToFront() {
6769
6719
  //
@@ -6798,7 +6748,7 @@ class NgwWebmapItem extends Item {
6798
6748
  }
6799
6749
  if (item.item_type === 'layer') {
6800
6750
  const { maxZoom, minZoom } = this._getZoomRange(item);
6801
- objectAssign(options, {
6751
+ Object.assign(options, {
6802
6752
  updateWmsParams: item.updateWmsParams,
6803
6753
  url: item.url,
6804
6754
  headers: this.options.headers,
@@ -6807,6 +6757,7 @@ class NgwWebmapItem extends Item {
6807
6757
  minZoom,
6808
6758
  minScale: item.layer_min_scale_denom,
6809
6759
  maxScale: item.layer_max_scale_denom,
6760
+ interactive: item.layer_identifiable,
6810
6761
  });
6811
6762
  }
6812
6763
  if (opacity !== undefined) {
@@ -6820,6 +6771,47 @@ class NgwWebmapItem extends Item {
6820
6771
  _mapScaleToZoomLevel(scale) {
6821
6772
  return setScaleRatio(scale);
6822
6773
  }
6774
+ initGroupItem(group) {
6775
+ if (group.children && group.children.length) {
6776
+ const children = this.getChildren(group);
6777
+ for (const child of children) {
6778
+ const childItem = new this.constructor(this.webMap, child, this.options, this.connector, this);
6779
+ this.tree.addChild(childItem);
6780
+ }
6781
+ }
6782
+ return Promise.resolve();
6783
+ }
6784
+ initLayerItem(layer) {
6785
+ const options = this.getItemOptions(layer);
6786
+ const setNewLayer = (l) => {
6787
+ layer._layer = l;
6788
+ this.layer = l;
6789
+ const enabled = this.properties.get('visibility');
6790
+ if (enabled) {
6791
+ this.properties.set('visibility', true);
6792
+ }
6793
+ if (options.opacity !== undefined) {
6794
+ this.webMap.setLayerOpacity(l, options.opacity);
6795
+ }
6796
+ };
6797
+ let adapter;
6798
+ if (layer.item_type === 'layer') {
6799
+ adapter = layer.adapter || layer.layer_adapter.toUpperCase();
6800
+ }
6801
+ else if (NgwWebmapItem.GetAdapterFromLayerType[layer.item_type]) {
6802
+ const getAdapter = NgwWebmapItem.GetAdapterFromLayerType[layer.item_type];
6803
+ adapter = getAdapter(layer, options, this.webMap, this.connector);
6804
+ }
6805
+ if (adapter) {
6806
+ return this.webMap.addLayer(adapter, options).then((newLayer) => {
6807
+ setNewLayer(newLayer);
6808
+ });
6809
+ }
6810
+ if (layer._layer) {
6811
+ return Promise.resolve(setNewLayer(layer._layer));
6812
+ }
6813
+ return Promise.reject('No layer added');
6814
+ }
6823
6815
  _getZoomRange(item) {
6824
6816
  const minZoomWebmap = this.options.minZoom;
6825
6817
  const maxZoomWebmap = this.options.maxZoom;
@@ -7177,7 +7169,9 @@ class NgwWebmapLayerAdapter {
7177
7169
  deps.forEach((x) => {
7178
7170
  const item = x.item;
7179
7171
  const parentId = item.parentId;
7180
- if (parentId !== undefined && item.item_type === 'layer') {
7172
+ if (parentId !== undefined &&
7173
+ item.item_type === 'layer' &&
7174
+ item.layer_identifiable) {
7181
7175
  const visible = x.properties.property('visibility');
7182
7176
  const isVisible = visible.get() && !visible.isBlocked();
7183
7177
  if (isVisible) {
@@ -8588,6 +8582,7 @@ class NgwMap extends WebMap {
8588
8582
  });
8589
8583
  }
8590
8584
  async selectFromNgwRaster(ev) {
8585
+ var _a;
8591
8586
  this._emitStatusEvent('ngw:preselect');
8592
8587
  const promises = [];
8593
8588
  const layers = Object.values(this._ngwLayers);
@@ -8602,7 +8597,11 @@ class NgwMap extends WebMap {
8602
8597
  const identFunc = typeof layer.getIdentificationIds === 'function'
8603
8598
  ? layer.getIdentificationIds
8604
8599
  : false;
8605
- if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
8600
+ const interactive = (_a = layer.options.interactive) !== null && _a !== void 0 ? _a : true;
8601
+ if (identFunc &&
8602
+ layer.options.selectable &&
8603
+ interactive &&
8604
+ this.isLayerVisible(layer)) {
8606
8605
  promises.push(identFunc.call(layer));
8607
8606
  }
8608
8607
  }