@nextgis/ngw-map 2.5.2 → 2.5.5

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: 2.5.2; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 2.5.5; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -1258,7 +1258,7 @@ var NgwMap = (function (exports) {
1258
1258
 
1259
1259
  var pkg = {
1260
1260
  name: "@nextgis/ngw-connector",
1261
- version: "2.5.2",
1261
+ version: "2.5.5",
1262
1262
  _priority: 12,
1263
1263
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1264
1264
  main: "index.js",
@@ -1524,7 +1524,8 @@ var NgwMap = (function (exports) {
1524
1524
  }
1525
1525
  return this.connector.get("resource.search", requestOptions, __spreadValues$t({
1526
1526
  serialization: "full"
1527
- }, query)).then((resources) => {
1527
+ }, query)).then((response) => {
1528
+ const resources = Array.isArray(response) ? response : response.items;
1528
1529
  if (resources) {
1529
1530
  for (const x of resources) {
1530
1531
  this.cache.add("resource.item", CancelablePromise.resolve(x), {
@@ -3788,9 +3789,9 @@ var NgwMap = (function (exports) {
3788
3789
  item
3789
3790
  }) {
3790
3791
  if (item.basemap_layer) {
3791
- const qms = item.basemap_layer.qms;
3792
- const url = item.basemap_layer.url;
3793
- if (qms) {
3792
+ const basemap = item.basemap_layer;
3793
+ const { qms, url } = basemap;
3794
+ if (qms && typeof qms === "string") {
3794
3795
  const qms_ = JSON.parse(qms);
3795
3796
  const adapter = Promise.resolve(
3796
3797
  QmsKit.utils.createQmsAdapter(webMap, void 0, {
@@ -3803,9 +3804,18 @@ var NgwMap = (function (exports) {
3803
3804
  const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
3804
3805
  if (TileAdapter) {
3805
3806
  class BasemapTileAdapter extends TileAdapter {
3807
+ constructor(map, options) {
3808
+ super(map, __spreadProps$b(__spreadValues$i({}, options), { baselayer: true, order: 0 }));
3809
+ }
3806
3810
  addLayer(opt) {
3807
3811
  return __async$h(this, null, function* () {
3808
- return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$b(__spreadValues$i({}, opt), { url }));
3812
+ var _a, _b, _c;
3813
+ return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$b(__spreadValues$i({}, opt), {
3814
+ url,
3815
+ minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
3816
+ maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
3817
+ attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
3818
+ }));
3809
3819
  });
3810
3820
  }
3811
3821
  }
@@ -5321,7 +5331,6 @@ var NgwMap = (function (exports) {
5321
5331
  __publicField$b(this, "emitter", new EventEmitter());
5322
5332
  __publicField$b(this, "_extent");
5323
5333
  __publicField$b(this, "response");
5324
- __publicField$b(this, "_webmapLayersIds");
5325
5334
  __publicField$b(this, "_webmapBaselayersIds", []);
5326
5335
  __publicField$b(this, "_lastActiveBaselayer");
5327
5336
  const r = options.resourceId;
@@ -5366,7 +5375,6 @@ var NgwMap = (function (exports) {
5366
5375
  }
5367
5376
  delete this.layer;
5368
5377
  delete this.response;
5369
- delete this._webmapLayersIds;
5370
5378
  }
5371
5379
  showLayer() {
5372
5380
  return __async$9(this, null, function* () {
@@ -5457,26 +5465,19 @@ var NgwMap = (function (exports) {
5457
5465
  getIdentificationIds() {
5458
5466
  return __async$9(this, null, function* () {
5459
5467
  const visibleLayers = [];
5460
- let ids = this._webmapLayersIds;
5461
- if (!ids) {
5462
- ids = yield this._getWebMapIds();
5463
- this._webmapLayersIds = ids;
5464
- }
5465
- if (ids && ids.length) {
5466
- let deps = this.getDependLayers();
5467
- deps = deps.sort((a, b) => b.id - a.id);
5468
- deps.forEach((x) => {
5469
- const item = x.item;
5470
- const parentId = item.parentId;
5471
- if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
5472
- const visible = x.properties.property("visibility");
5473
- const isVisible = visible.get() && !visible.isBlocked();
5474
- if (isVisible) {
5475
- visibleLayers.push(parentId);
5476
- }
5468
+ let deps = this.getDependLayers();
5469
+ deps = deps.sort((a, b) => b.id - a.id);
5470
+ deps.forEach((x) => {
5471
+ const item = x.item;
5472
+ const parentId = item.style_parent_id;
5473
+ if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
5474
+ const visible = x.properties.property("visibility");
5475
+ const isVisible = visible.get() && !visible.isBlocked();
5476
+ if (isVisible) {
5477
+ visibleLayers.push(parentId);
5477
5478
  }
5478
- });
5479
- }
5479
+ }
5480
+ });
5480
5481
  return visibleLayers;
5481
5482
  });
5482
5483
  }
@@ -5605,31 +5606,6 @@ var NgwMap = (function (exports) {
5605
5606
  }
5606
5607
  return item;
5607
5608
  }
5608
- _getWebMapIds() {
5609
- return __async$9(this, null, function* () {
5610
- const webMapItem = this.layer;
5611
- if (webMapItem && webMapItem.item.item_type === "root") {
5612
- const layers = webMapItem.tree.getDescendants();
5613
- const promises = [];
5614
- for (const x of layers) {
5615
- const item = x.item;
5616
- if (item.item_type === "layer") {
5617
- const id = item.layer_style_id;
5618
- const promise = this.options.connector.getResource(id).then((y) => {
5619
- if (y) {
5620
- const parentId = Number(y.resource.parent.id);
5621
- item.parentId = parentId;
5622
- return parentId;
5623
- }
5624
- });
5625
- promises.push(promise);
5626
- }
5627
- }
5628
- const ids = yield Promise.all(promises);
5629
- return ids.filter((x) => x !== void 0);
5630
- }
5631
- });
5632
- }
5633
5609
  }
5634
5610
 
5635
5611
  var __defProp$g = Object.defineProperty;
@@ -9398,7 +9374,7 @@ var NgwMap = (function (exports) {
9398
9374
  if (mem.layer.getDependLayers) {
9399
9375
  const dependLayers = mem.layer.getDependLayers();
9400
9376
  const dependFit = dependLayers.find((x) => {
9401
- return x.item && x.item.parentId === id;
9377
+ return x.item && x.item.style_parent_id === id;
9402
9378
  });
9403
9379
  if (dependFit) {
9404
9380
  return dependFit.layer;