@nextgis/ngw-map 1.13.8 → 1.15.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.
- package/lib/index.d.ts +1 -6
- package/lib/ngw-map.cjs.js +24 -13
- package/lib/ngw-map.cjs.js.map +1 -1
- package/lib/ngw-map.cjs.prod.js +1 -1
- package/lib/ngw-map.cjs.prod.js.map +1 -1
- package/lib/ngw-map.esm-browser.js +65 -61
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -15
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +24 -13
- package/lib/ngw-map.esm-bundler.js.map +1 -1
- package/lib/ngw-map.esm-bundler.prod.js +1 -15
- package/lib/ngw-map.esm-bundler.prod.js.map +1 -1
- package/lib/ngw-map.global.js +65 -61
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -15
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +9 -9
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.15.1; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/******************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation.
|
|
7
7
|
|
|
8
8
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1864,7 +1864,7 @@ var NgwMap = (function (exports) {
|
|
|
1864
1864
|
var ID$2 = 0;
|
|
1865
1865
|
var OPTIONS$1 = {
|
|
1866
1866
|
minZoom: 0,
|
|
1867
|
-
maxZoom:
|
|
1867
|
+
maxZoom: 22,
|
|
1868
1868
|
paint: {
|
|
1869
1869
|
color: '#0000ff',
|
|
1870
1870
|
opacity: 0.4,
|
|
@@ -4440,6 +4440,29 @@ var NgwMap = (function (exports) {
|
|
|
4440
4440
|
return _this._getChildrenOf(parent, requestOptions);
|
|
4441
4441
|
});
|
|
4442
4442
|
};
|
|
4443
|
+
ResourcesControl.prototype.update = function (resource, data) {
|
|
4444
|
+
var _this = this;
|
|
4445
|
+
return this.getId(resource).then(function (id) {
|
|
4446
|
+
if (id !== undefined) {
|
|
4447
|
+
return _this.connector.put('resource.item', { data: data }, { id: id });
|
|
4448
|
+
}
|
|
4449
|
+
});
|
|
4450
|
+
};
|
|
4451
|
+
/**
|
|
4452
|
+
* Fast way to delete resource from NGW and clean cache.
|
|
4453
|
+
* @param resource - Resource definition
|
|
4454
|
+
*/
|
|
4455
|
+
ResourcesControl.prototype.delete = function (resource) {
|
|
4456
|
+
var _this = this;
|
|
4457
|
+
return this.getId(resource).then(function (id) {
|
|
4458
|
+
if (id !== undefined) {
|
|
4459
|
+
return _this.connector.delete('resource.item', null, { id: id }).then(function () {
|
|
4460
|
+
_this._cleanResourceItemCache(id);
|
|
4461
|
+
return undefined;
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
});
|
|
4465
|
+
};
|
|
4443
4466
|
ResourcesControl.prototype._getChildrenOf = function (parent, requestOptions, _items) {
|
|
4444
4467
|
var _this = this;
|
|
4445
4468
|
if (_items === void 0) { _items = []; }
|
|
@@ -4467,29 +4490,6 @@ var NgwMap = (function (exports) {
|
|
|
4467
4490
|
return _items;
|
|
4468
4491
|
});
|
|
4469
4492
|
};
|
|
4470
|
-
ResourcesControl.prototype.update = function (resource, data) {
|
|
4471
|
-
var _this = this;
|
|
4472
|
-
return this.getId(resource).then(function (id) {
|
|
4473
|
-
if (id !== undefined) {
|
|
4474
|
-
return _this.connector.put('resource.item', { data: data }, { id: id });
|
|
4475
|
-
}
|
|
4476
|
-
});
|
|
4477
|
-
};
|
|
4478
|
-
/**
|
|
4479
|
-
* Fast way to delete resource from NGW and clean cache.
|
|
4480
|
-
* @param resource - Resource definition
|
|
4481
|
-
*/
|
|
4482
|
-
ResourcesControl.prototype.delete = function (resource) {
|
|
4483
|
-
var _this = this;
|
|
4484
|
-
return this.getId(resource).then(function (id) {
|
|
4485
|
-
if (id !== undefined) {
|
|
4486
|
-
return _this.connector.delete('resource.item', null, { id: id }).then(function () {
|
|
4487
|
-
_this._cleanResourceItemCache(id);
|
|
4488
|
-
return undefined;
|
|
4489
|
-
});
|
|
4490
|
-
}
|
|
4491
|
-
});
|
|
4492
|
-
};
|
|
4493
4493
|
ResourcesControl.prototype._cleanResourceItemCache = function (id) {
|
|
4494
4494
|
return __awaiter(this, void 0, void 0, function () {
|
|
4495
4495
|
var all, toDelete, _i, all_1, c, cid, rid, _a, toDelete_1, d;
|
|
@@ -4647,6 +4647,9 @@ var NgwMap = (function (exports) {
|
|
|
4647
4647
|
if (this.options.route) {
|
|
4648
4648
|
this.routeStr = this.options.route;
|
|
4649
4649
|
}
|
|
4650
|
+
if (this.options.requestTransform) {
|
|
4651
|
+
this.requestTransform = this.options.requestTransform;
|
|
4652
|
+
}
|
|
4650
4653
|
this.resources = new ResourcesControl(this);
|
|
4651
4654
|
addConnector(this);
|
|
4652
4655
|
}
|
|
@@ -4654,6 +4657,9 @@ var NgwMap = (function (exports) {
|
|
|
4654
4657
|
NgwConnector.create = function (options) {
|
|
4655
4658
|
return new this(options);
|
|
4656
4659
|
};
|
|
4660
|
+
NgwConnector.prototype.setRequestTransform = function (requestTransform) {
|
|
4661
|
+
this.requestTransform = requestTransform;
|
|
4662
|
+
};
|
|
4657
4663
|
/**
|
|
4658
4664
|
* Fast way to specify the connection address to NextGIS Web.
|
|
4659
4665
|
* The current connection will be severed.
|
|
@@ -4913,9 +4919,8 @@ var NgwMap = (function (exports) {
|
|
|
4913
4919
|
if (params) {
|
|
4914
4920
|
url = template(url, params);
|
|
4915
4921
|
}
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
return this._loadData(encodeURI(url), options);
|
|
4922
|
+
url = encodeURI(fixUrlStr(url));
|
|
4923
|
+
return this._loadData(url, options);
|
|
4919
4924
|
}
|
|
4920
4925
|
else {
|
|
4921
4926
|
throw new Error('Empty `url` not allowed');
|
|
@@ -5008,6 +5013,11 @@ var NgwMap = (function (exports) {
|
|
|
5008
5013
|
// options.withCredentials = true;
|
|
5009
5014
|
options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
|
|
5010
5015
|
}
|
|
5016
|
+
if (_this.requestTransform) {
|
|
5017
|
+
var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
|
|
5018
|
+
url = transUrl;
|
|
5019
|
+
options = transOptions;
|
|
5020
|
+
}
|
|
5011
5021
|
loadData(url, resolve, options, reject, onCancel);
|
|
5012
5022
|
})
|
|
5013
5023
|
.then(function (resp) {
|
|
@@ -5032,6 +5042,7 @@ var NgwMap = (function (exports) {
|
|
|
5032
5042
|
typeof options.signal.addEventListener === 'function') {
|
|
5033
5043
|
options.signal.addEventListener('abort', function () {
|
|
5034
5044
|
request.cancel();
|
|
5045
|
+
_this._cleanActiveRequests(request);
|
|
5035
5046
|
});
|
|
5036
5047
|
}
|
|
5037
5048
|
this.activeRequests.push(request);
|
|
@@ -5898,7 +5909,7 @@ var NgwMap = (function (exports) {
|
|
|
5898
5909
|
'resource=' +
|
|
5899
5910
|
resourceId +
|
|
5900
5911
|
'&simplification=' +
|
|
5901
|
-
((_b = options.simplification) !== null && _b !== void 0 ? _b :
|
|
5912
|
+
((_b = options.simplification) !== null && _b !== void 0 ? _b : 6);
|
|
5902
5913
|
// url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
|
|
5903
5914
|
return {
|
|
5904
5915
|
url: url,
|
|
@@ -5977,29 +5988,13 @@ var NgwMap = (function (exports) {
|
|
|
5977
5988
|
baseUrl: connector.options.baseUrl || '',
|
|
5978
5989
|
});
|
|
5979
5990
|
if (opt) {
|
|
5980
|
-
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
|
|
5981
|
-
// @deprecated
|
|
5982
|
-
layers: String(resourceId_1), resourceId: resourceId_1 });
|
|
5991
|
+
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 }, layers: opt.layers || String(resourceId_1), resourceId: resourceId_1 });
|
|
5983
5992
|
if (layerOptions.adapterOptions &&
|
|
5984
5993
|
defined(layerOptions.adapterOptions.setViewDelay)) {
|
|
5985
5994
|
layerAdapterOptions.setViewDelay =
|
|
5986
5995
|
layerOptions.adapterOptions.setViewDelay;
|
|
5987
5996
|
}
|
|
5988
5997
|
_this.options = __assign(__assign({}, _this.options), layerAdapterOptions);
|
|
5989
|
-
// if (true) {
|
|
5990
|
-
// Object.defineProperty(this.options, 'layers', {
|
|
5991
|
-
// get: () => {
|
|
5992
|
-
// console.warn('Do not use `layers` in ImageAdapterOptions');
|
|
5993
|
-
// return String(resourceId);
|
|
5994
|
-
// },
|
|
5995
|
-
// });
|
|
5996
|
-
// Object.defineProperty(this.options, 'resourceId', {
|
|
5997
|
-
// get: () => {
|
|
5998
|
-
// console.warn('Do not use `resourceId` in ImageAdapterOptions');
|
|
5999
|
-
// return resourceId;
|
|
6000
|
-
// },
|
|
6001
|
-
// });
|
|
6002
|
-
// }
|
|
6003
5998
|
}
|
|
6004
5999
|
return _this;
|
|
6005
6000
|
}
|
|
@@ -7803,10 +7798,8 @@ var NgwMap = (function (exports) {
|
|
|
7803
7798
|
var A = /** @class */ (function (_super) {
|
|
7804
7799
|
__extends(A, _super);
|
|
7805
7800
|
function A(map, options) {
|
|
7806
|
-
var _this = this;
|
|
7807
7801
|
options = __assign(__assign({}, opt), options);
|
|
7808
|
-
|
|
7809
|
-
return _this;
|
|
7802
|
+
return _super.call(this, map, options) || this;
|
|
7810
7803
|
}
|
|
7811
7804
|
return A;
|
|
7812
7805
|
}(NgwWebmapLayerAdapter));
|
|
@@ -8670,13 +8663,14 @@ var NgwMap = (function (exports) {
|
|
|
8670
8663
|
var _this = this;
|
|
8671
8664
|
if (!this.$$selectFromNgwRaster) {
|
|
8672
8665
|
this.$$selectFromNgwRaster = function (ev) {
|
|
8673
|
-
var count = _this.
|
|
8666
|
+
var count = _this._getSelectListenersCount();
|
|
8674
8667
|
if (count) {
|
|
8675
8668
|
_this._selectFromNgwRaster(ev);
|
|
8676
8669
|
}
|
|
8677
8670
|
};
|
|
8678
8671
|
this.$$selectFromNgwVector = function (ev) {
|
|
8679
|
-
|
|
8672
|
+
var count = _this._getSelectListenersCount();
|
|
8673
|
+
if (count) {
|
|
8680
8674
|
_this._selectFromNgwVector(ev);
|
|
8681
8675
|
}
|
|
8682
8676
|
};
|
|
@@ -8687,8 +8681,10 @@ var NgwMap = (function (exports) {
|
|
|
8687
8681
|
NgwMap.prototype.disableSelection = function () {
|
|
8688
8682
|
if (this.$$selectFromNgwRaster) {
|
|
8689
8683
|
this.emitter.removeListener('click', this.$$selectFromNgwRaster);
|
|
8690
|
-
this.emitter.removeListener('click', this._selectFromNgwVector);
|
|
8691
8684
|
this.$$selectFromNgwRaster = undefined;
|
|
8685
|
+
}
|
|
8686
|
+
if (this.$$selectFromNgwVector) {
|
|
8687
|
+
this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
|
|
8692
8688
|
this.$$selectFromNgwVector = undefined;
|
|
8693
8689
|
}
|
|
8694
8690
|
};
|
|
@@ -8844,7 +8840,11 @@ var NgwMap = (function (exports) {
|
|
|
8844
8840
|
NgwMap.prototype._selectFromNgwVector = function (ev) {
|
|
8845
8841
|
var _a;
|
|
8846
8842
|
var layer = ev.layer;
|
|
8847
|
-
|
|
8843
|
+
var selectable = layer.options.selectable && this.isLayerVisible(layer);
|
|
8844
|
+
if (!selectable) {
|
|
8845
|
+
return undefined;
|
|
8846
|
+
}
|
|
8847
|
+
// Item property means layer is NgwResource
|
|
8848
8848
|
var id = layer.item && layer.item.resource.id;
|
|
8849
8849
|
var feature = ev.feature;
|
|
8850
8850
|
if (id !== undefined && feature) {
|
|
@@ -8874,10 +8874,10 @@ var NgwMap = (function (exports) {
|
|
|
8874
8874
|
};
|
|
8875
8875
|
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
8876
8876
|
return __awaiter(this, void 0, void 0, function () {
|
|
8877
|
-
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
8877
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8878
8878
|
var _this = this;
|
|
8879
|
-
return __generator(this, function (
|
|
8880
|
-
switch (
|
|
8879
|
+
return __generator(this, function (_b) {
|
|
8880
|
+
switch (_b.label) {
|
|
8881
8881
|
case 0:
|
|
8882
8882
|
this._emitStatusEvent('ngw:preselect');
|
|
8883
8883
|
promises = [];
|
|
@@ -8901,13 +8901,14 @@ var NgwMap = (function (exports) {
|
|
|
8901
8901
|
getIdsPromise = Promise.all(promises);
|
|
8902
8902
|
return [4 /*yield*/, getIdsPromise];
|
|
8903
8903
|
case 1:
|
|
8904
|
-
getIds =
|
|
8904
|
+
getIds = _b.sent();
|
|
8905
8905
|
ids = [];
|
|
8906
|
-
getIds.
|
|
8906
|
+
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8907
|
+
x = getIds_1[_a];
|
|
8907
8908
|
if (x) {
|
|
8908
|
-
|
|
8909
|
+
ids.push.apply(ids, x);
|
|
8909
8910
|
}
|
|
8910
|
-
}
|
|
8911
|
+
}
|
|
8911
8912
|
if (!ids.length) {
|
|
8912
8913
|
this._emitStatusEvent('ngw:select', null);
|
|
8913
8914
|
return [2 /*return*/];
|
|
@@ -8947,6 +8948,9 @@ var NgwMap = (function (exports) {
|
|
|
8947
8948
|
};
|
|
8948
8949
|
return __assign(__assign({}, identify), { getIdentifyItems: getIdentifyItems_ });
|
|
8949
8950
|
};
|
|
8951
|
+
NgwMap.prototype._getSelectListenersCount = function () {
|
|
8952
|
+
return this.emitter.listenerCount('ngw:select');
|
|
8953
|
+
};
|
|
8950
8954
|
NgwMap.prototype._whiteLabel = function () {
|
|
8951
8955
|
return __awaiter(this, void 0, void 0, function () {
|
|
8952
8956
|
var container, logo;
|