@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 domain;
3
3
 
4
4
  // This constructor is used to store event handlers. Instantiating this is
@@ -1255,7 +1255,7 @@ let Cache = _Cache;
1255
1255
 
1256
1256
  var pkg = {
1257
1257
  name: "@nextgis/ngw-connector",
1258
- version: "2.5.2",
1258
+ version: "2.5.5",
1259
1259
  _priority: 12,
1260
1260
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
1261
1261
  main: "index.js",
@@ -1521,7 +1521,8 @@ class ResourcesControl {
1521
1521
  }
1522
1522
  return this.connector.get("resource.search", requestOptions, __spreadValues$t({
1523
1523
  serialization: "full"
1524
- }, query)).then((resources) => {
1524
+ }, query)).then((response) => {
1525
+ const resources = Array.isArray(response) ? response : response.items;
1525
1526
  if (resources) {
1526
1527
  for (const x of resources) {
1527
1528
  this.cache.add("resource.item", CancelablePromise.resolve(x), {
@@ -3785,9 +3786,9 @@ function createBasemapLayerAdapter(_0) {
3785
3786
  item
3786
3787
  }) {
3787
3788
  if (item.basemap_layer) {
3788
- const qms = item.basemap_layer.qms;
3789
- const url = item.basemap_layer.url;
3790
- if (qms) {
3789
+ const basemap = item.basemap_layer;
3790
+ const { qms, url } = basemap;
3791
+ if (qms && typeof qms === "string") {
3791
3792
  const qms_ = JSON.parse(qms);
3792
3793
  const adapter = Promise.resolve(
3793
3794
  QmsKit.utils.createQmsAdapter(webMap, void 0, {
@@ -3800,9 +3801,18 @@ function createBasemapLayerAdapter(_0) {
3800
3801
  const TileAdapter = webMap.mapAdapter.layerAdapters.TILE;
3801
3802
  if (TileAdapter) {
3802
3803
  class BasemapTileAdapter extends TileAdapter {
3804
+ constructor(map, options) {
3805
+ super(map, __spreadProps$b(__spreadValues$i({}, options), { baselayer: true, order: 0 }));
3806
+ }
3803
3807
  addLayer(opt) {
3804
3808
  return __async$h(this, null, function* () {
3805
- return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$b(__spreadValues$i({}, opt), { url }));
3809
+ var _a, _b, _c;
3810
+ return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$b(__spreadValues$i({}, opt), {
3811
+ url,
3812
+ minZoom: (_a = basemap.z_min) != null ? _a : opt.minZoom,
3813
+ maxZoom: (_b = basemap.z_max) != null ? _b : opt.maxZoom,
3814
+ attribution: (_c = basemap.copyright_text) != null ? _c : opt.attribution
3815
+ }));
3806
3816
  });
3807
3817
  }
3808
3818
  }
@@ -5318,7 +5328,6 @@ class NgwWebmapLayerAdapter {
5318
5328
  __publicField$b(this, "emitter", new EventEmitter());
5319
5329
  __publicField$b(this, "_extent");
5320
5330
  __publicField$b(this, "response");
5321
- __publicField$b(this, "_webmapLayersIds");
5322
5331
  __publicField$b(this, "_webmapBaselayersIds", []);
5323
5332
  __publicField$b(this, "_lastActiveBaselayer");
5324
5333
  const r = options.resourceId;
@@ -5363,7 +5372,6 @@ class NgwWebmapLayerAdapter {
5363
5372
  }
5364
5373
  delete this.layer;
5365
5374
  delete this.response;
5366
- delete this._webmapLayersIds;
5367
5375
  }
5368
5376
  showLayer() {
5369
5377
  return __async$9(this, null, function* () {
@@ -5454,26 +5462,19 @@ class NgwWebmapLayerAdapter {
5454
5462
  getIdentificationIds() {
5455
5463
  return __async$9(this, null, function* () {
5456
5464
  const visibleLayers = [];
5457
- let ids = this._webmapLayersIds;
5458
- if (!ids) {
5459
- ids = yield this._getWebMapIds();
5460
- this._webmapLayersIds = ids;
5461
- }
5462
- if (ids && ids.length) {
5463
- let deps = this.getDependLayers();
5464
- deps = deps.sort((a, b) => b.id - a.id);
5465
- deps.forEach((x) => {
5466
- const item = x.item;
5467
- const parentId = item.parentId;
5468
- if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
5469
- const visible = x.properties.property("visibility");
5470
- const isVisible = visible.get() && !visible.isBlocked();
5471
- if (isVisible) {
5472
- visibleLayers.push(parentId);
5473
- }
5465
+ let deps = this.getDependLayers();
5466
+ deps = deps.sort((a, b) => b.id - a.id);
5467
+ deps.forEach((x) => {
5468
+ const item = x.item;
5469
+ const parentId = item.style_parent_id;
5470
+ if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
5471
+ const visible = x.properties.property("visibility");
5472
+ const isVisible = visible.get() && !visible.isBlocked();
5473
+ if (isVisible) {
5474
+ visibleLayers.push(parentId);
5474
5475
  }
5475
- });
5476
- }
5476
+ }
5477
+ });
5477
5478
  return visibleLayers;
5478
5479
  });
5479
5480
  }
@@ -5602,31 +5603,6 @@ class NgwWebmapLayerAdapter {
5602
5603
  }
5603
5604
  return item;
5604
5605
  }
5605
- _getWebMapIds() {
5606
- return __async$9(this, null, function* () {
5607
- const webMapItem = this.layer;
5608
- if (webMapItem && webMapItem.item.item_type === "root") {
5609
- const layers = webMapItem.tree.getDescendants();
5610
- const promises = [];
5611
- for (const x of layers) {
5612
- const item = x.item;
5613
- if (item.item_type === "layer") {
5614
- const id = item.layer_style_id;
5615
- const promise = this.options.connector.getResource(id).then((y) => {
5616
- if (y) {
5617
- const parentId = Number(y.resource.parent.id);
5618
- item.parentId = parentId;
5619
- return parentId;
5620
- }
5621
- });
5622
- promises.push(promise);
5623
- }
5624
- }
5625
- const ids = yield Promise.all(promises);
5626
- return ids.filter((x) => x !== void 0);
5627
- }
5628
- });
5629
- }
5630
5606
  }
5631
5607
 
5632
5608
  var __defProp$g = Object.defineProperty;
@@ -9395,7 +9371,7 @@ const _NgwMap = class _NgwMap extends WebMap {
9395
9371
  if (mem.layer.getDependLayers) {
9396
9372
  const dependLayers = mem.layer.getDependLayers();
9397
9373
  const dependFit = dependLayers.find((x) => {
9398
- return x.item && x.item.parentId === id;
9374
+ return x.item && x.item.style_parent_id === id;
9399
9375
  });
9400
9376
  if (dependFit) {
9401
9377
  return dependFit.layer;