@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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.
|
|
2
|
-
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.15.1; author: NextGIS */
|
|
2
|
+
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
5
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1861,7 +1861,7 @@ function clearObject(obj) {
|
|
|
1861
1861
|
var ID$2 = 0;
|
|
1862
1862
|
var OPTIONS$1 = {
|
|
1863
1863
|
minZoom: 0,
|
|
1864
|
-
maxZoom:
|
|
1864
|
+
maxZoom: 22,
|
|
1865
1865
|
paint: {
|
|
1866
1866
|
color: '#0000ff',
|
|
1867
1867
|
opacity: 0.4,
|
|
@@ -4437,6 +4437,29 @@ var ResourcesControl = /** @class */ (function () {
|
|
|
4437
4437
|
return _this._getChildrenOf(parent, requestOptions);
|
|
4438
4438
|
});
|
|
4439
4439
|
};
|
|
4440
|
+
ResourcesControl.prototype.update = function (resource, data) {
|
|
4441
|
+
var _this = this;
|
|
4442
|
+
return this.getId(resource).then(function (id) {
|
|
4443
|
+
if (id !== undefined) {
|
|
4444
|
+
return _this.connector.put('resource.item', { data: data }, { id: id });
|
|
4445
|
+
}
|
|
4446
|
+
});
|
|
4447
|
+
};
|
|
4448
|
+
/**
|
|
4449
|
+
* Fast way to delete resource from NGW and clean cache.
|
|
4450
|
+
* @param resource - Resource definition
|
|
4451
|
+
*/
|
|
4452
|
+
ResourcesControl.prototype.delete = function (resource) {
|
|
4453
|
+
var _this = this;
|
|
4454
|
+
return this.getId(resource).then(function (id) {
|
|
4455
|
+
if (id !== undefined) {
|
|
4456
|
+
return _this.connector.delete('resource.item', null, { id: id }).then(function () {
|
|
4457
|
+
_this._cleanResourceItemCache(id);
|
|
4458
|
+
return undefined;
|
|
4459
|
+
});
|
|
4460
|
+
}
|
|
4461
|
+
});
|
|
4462
|
+
};
|
|
4440
4463
|
ResourcesControl.prototype._getChildrenOf = function (parent, requestOptions, _items) {
|
|
4441
4464
|
var _this = this;
|
|
4442
4465
|
if (_items === void 0) { _items = []; }
|
|
@@ -4464,29 +4487,6 @@ var ResourcesControl = /** @class */ (function () {
|
|
|
4464
4487
|
return _items;
|
|
4465
4488
|
});
|
|
4466
4489
|
};
|
|
4467
|
-
ResourcesControl.prototype.update = function (resource, data) {
|
|
4468
|
-
var _this = this;
|
|
4469
|
-
return this.getId(resource).then(function (id) {
|
|
4470
|
-
if (id !== undefined) {
|
|
4471
|
-
return _this.connector.put('resource.item', { data: data }, { id: id });
|
|
4472
|
-
}
|
|
4473
|
-
});
|
|
4474
|
-
};
|
|
4475
|
-
/**
|
|
4476
|
-
* Fast way to delete resource from NGW and clean cache.
|
|
4477
|
-
* @param resource - Resource definition
|
|
4478
|
-
*/
|
|
4479
|
-
ResourcesControl.prototype.delete = function (resource) {
|
|
4480
|
-
var _this = this;
|
|
4481
|
-
return this.getId(resource).then(function (id) {
|
|
4482
|
-
if (id !== undefined) {
|
|
4483
|
-
return _this.connector.delete('resource.item', null, { id: id }).then(function () {
|
|
4484
|
-
_this._cleanResourceItemCache(id);
|
|
4485
|
-
return undefined;
|
|
4486
|
-
});
|
|
4487
|
-
}
|
|
4488
|
-
});
|
|
4489
|
-
};
|
|
4490
4490
|
ResourcesControl.prototype._cleanResourceItemCache = function (id) {
|
|
4491
4491
|
return __awaiter(this, void 0, void 0, function () {
|
|
4492
4492
|
var all, toDelete, _i, all_1, c, cid, rid, _a, toDelete_1, d;
|
|
@@ -4644,6 +4644,9 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4644
4644
|
if (this.options.route) {
|
|
4645
4645
|
this.routeStr = this.options.route;
|
|
4646
4646
|
}
|
|
4647
|
+
if (this.options.requestTransform) {
|
|
4648
|
+
this.requestTransform = this.options.requestTransform;
|
|
4649
|
+
}
|
|
4647
4650
|
this.resources = new ResourcesControl(this);
|
|
4648
4651
|
addConnector(this);
|
|
4649
4652
|
}
|
|
@@ -4651,6 +4654,9 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4651
4654
|
NgwConnector.create = function (options) {
|
|
4652
4655
|
return new this(options);
|
|
4653
4656
|
};
|
|
4657
|
+
NgwConnector.prototype.setRequestTransform = function (requestTransform) {
|
|
4658
|
+
this.requestTransform = requestTransform;
|
|
4659
|
+
};
|
|
4654
4660
|
/**
|
|
4655
4661
|
* Fast way to specify the connection address to NextGIS Web.
|
|
4656
4662
|
* The current connection will be severed.
|
|
@@ -4910,9 +4916,8 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4910
4916
|
if (params) {
|
|
4911
4917
|
url = template(url, params);
|
|
4912
4918
|
}
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
return this._loadData(encodeURI(url), options);
|
|
4919
|
+
url = encodeURI(fixUrlStr(url));
|
|
4920
|
+
return this._loadData(url, options);
|
|
4916
4921
|
}
|
|
4917
4922
|
else {
|
|
4918
4923
|
throw new Error('Empty `url` not allowed');
|
|
@@ -5005,6 +5010,11 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
5005
5010
|
// options.withCredentials = true;
|
|
5006
5011
|
options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
|
|
5007
5012
|
}
|
|
5013
|
+
if (_this.requestTransform) {
|
|
5014
|
+
var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
|
|
5015
|
+
url = transUrl;
|
|
5016
|
+
options = transOptions;
|
|
5017
|
+
}
|
|
5008
5018
|
loadData(url, resolve, options, reject, onCancel);
|
|
5009
5019
|
})
|
|
5010
5020
|
.then(function (resp) {
|
|
@@ -5029,6 +5039,7 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
5029
5039
|
typeof options.signal.addEventListener === 'function') {
|
|
5030
5040
|
options.signal.addEventListener('abort', function () {
|
|
5031
5041
|
request.cancel();
|
|
5042
|
+
_this._cleanActiveRequests(request);
|
|
5032
5043
|
});
|
|
5033
5044
|
}
|
|
5034
5045
|
this.activeRequests.push(request);
|
|
@@ -5895,7 +5906,7 @@ function ngwApiToAdapterOptions(_a) {
|
|
|
5895
5906
|
'resource=' +
|
|
5896
5907
|
resourceId +
|
|
5897
5908
|
'&simplification=' +
|
|
5898
|
-
((_b = options.simplification) !== null && _b !== void 0 ? _b :
|
|
5909
|
+
((_b = options.simplification) !== null && _b !== void 0 ? _b : 6);
|
|
5899
5910
|
// url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
|
|
5900
5911
|
return {
|
|
5901
5912
|
url: url,
|
|
@@ -5974,29 +5985,13 @@ function createRasterAdapter(_a) {
|
|
|
5974
5985
|
baseUrl: connector.options.baseUrl || '',
|
|
5975
5986
|
});
|
|
5976
5987
|
if (opt) {
|
|
5977
|
-
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
|
|
5978
|
-
// @deprecated
|
|
5979
|
-
layers: String(resourceId_1), resourceId: resourceId_1 });
|
|
5988
|
+
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 }, layers: opt.layers || String(resourceId_1), resourceId: resourceId_1 });
|
|
5980
5989
|
if (layerOptions.adapterOptions &&
|
|
5981
5990
|
defined(layerOptions.adapterOptions.setViewDelay)) {
|
|
5982
5991
|
layerAdapterOptions.setViewDelay =
|
|
5983
5992
|
layerOptions.adapterOptions.setViewDelay;
|
|
5984
5993
|
}
|
|
5985
5994
|
_this.options = __assign(__assign({}, _this.options), layerAdapterOptions);
|
|
5986
|
-
// if (true) {
|
|
5987
|
-
// Object.defineProperty(this.options, 'layers', {
|
|
5988
|
-
// get: () => {
|
|
5989
|
-
// console.warn('Do not use `layers` in ImageAdapterOptions');
|
|
5990
|
-
// return String(resourceId);
|
|
5991
|
-
// },
|
|
5992
|
-
// });
|
|
5993
|
-
// Object.defineProperty(this.options, 'resourceId', {
|
|
5994
|
-
// get: () => {
|
|
5995
|
-
// console.warn('Do not use `resourceId` in ImageAdapterOptions');
|
|
5996
|
-
// return resourceId;
|
|
5997
|
-
// },
|
|
5998
|
-
// });
|
|
5999
|
-
// }
|
|
6000
5995
|
}
|
|
6001
5996
|
return _this;
|
|
6002
5997
|
}
|
|
@@ -7800,10 +7795,8 @@ function extendNgwWebmapLayerAdapter(opt) {
|
|
|
7800
7795
|
var A = /** @class */ (function (_super) {
|
|
7801
7796
|
__extends(A, _super);
|
|
7802
7797
|
function A(map, options) {
|
|
7803
|
-
var _this = this;
|
|
7804
7798
|
options = __assign(__assign({}, opt), options);
|
|
7805
|
-
|
|
7806
|
-
return _this;
|
|
7799
|
+
return _super.call(this, map, options) || this;
|
|
7807
7800
|
}
|
|
7808
7801
|
return A;
|
|
7809
7802
|
}(NgwWebmapLayerAdapter));
|
|
@@ -8667,13 +8660,14 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8667
8660
|
var _this = this;
|
|
8668
8661
|
if (!this.$$selectFromNgwRaster) {
|
|
8669
8662
|
this.$$selectFromNgwRaster = function (ev) {
|
|
8670
|
-
var count = _this.
|
|
8663
|
+
var count = _this._getSelectListenersCount();
|
|
8671
8664
|
if (count) {
|
|
8672
8665
|
_this._selectFromNgwRaster(ev);
|
|
8673
8666
|
}
|
|
8674
8667
|
};
|
|
8675
8668
|
this.$$selectFromNgwVector = function (ev) {
|
|
8676
|
-
|
|
8669
|
+
var count = _this._getSelectListenersCount();
|
|
8670
|
+
if (count) {
|
|
8677
8671
|
_this._selectFromNgwVector(ev);
|
|
8678
8672
|
}
|
|
8679
8673
|
};
|
|
@@ -8684,8 +8678,10 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8684
8678
|
NgwMap.prototype.disableSelection = function () {
|
|
8685
8679
|
if (this.$$selectFromNgwRaster) {
|
|
8686
8680
|
this.emitter.removeListener('click', this.$$selectFromNgwRaster);
|
|
8687
|
-
this.emitter.removeListener('click', this._selectFromNgwVector);
|
|
8688
8681
|
this.$$selectFromNgwRaster = undefined;
|
|
8682
|
+
}
|
|
8683
|
+
if (this.$$selectFromNgwVector) {
|
|
8684
|
+
this.emitter.removeListener('layer:click', this.$$selectFromNgwVector);
|
|
8689
8685
|
this.$$selectFromNgwVector = undefined;
|
|
8690
8686
|
}
|
|
8691
8687
|
};
|
|
@@ -8841,7 +8837,11 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8841
8837
|
NgwMap.prototype._selectFromNgwVector = function (ev) {
|
|
8842
8838
|
var _a;
|
|
8843
8839
|
var layer = ev.layer;
|
|
8844
|
-
|
|
8840
|
+
var selectable = layer.options.selectable && this.isLayerVisible(layer);
|
|
8841
|
+
if (!selectable) {
|
|
8842
|
+
return undefined;
|
|
8843
|
+
}
|
|
8844
|
+
// Item property means layer is NgwResource
|
|
8845
8845
|
var id = layer.item && layer.item.resource.id;
|
|
8846
8846
|
var feature = ev.feature;
|
|
8847
8847
|
if (id !== undefined && feature) {
|
|
@@ -8871,10 +8871,10 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8871
8871
|
};
|
|
8872
8872
|
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
8873
8873
|
return __awaiter(this, void 0, void 0, function () {
|
|
8874
|
-
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
8874
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8875
8875
|
var _this = this;
|
|
8876
|
-
return __generator(this, function (
|
|
8877
|
-
switch (
|
|
8876
|
+
return __generator(this, function (_b) {
|
|
8877
|
+
switch (_b.label) {
|
|
8878
8878
|
case 0:
|
|
8879
8879
|
this._emitStatusEvent('ngw:preselect');
|
|
8880
8880
|
promises = [];
|
|
@@ -8898,13 +8898,14 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8898
8898
|
getIdsPromise = Promise.all(promises);
|
|
8899
8899
|
return [4 /*yield*/, getIdsPromise];
|
|
8900
8900
|
case 1:
|
|
8901
|
-
getIds =
|
|
8901
|
+
getIds = _b.sent();
|
|
8902
8902
|
ids = [];
|
|
8903
|
-
getIds.
|
|
8903
|
+
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8904
|
+
x = getIds_1[_a];
|
|
8904
8905
|
if (x) {
|
|
8905
|
-
|
|
8906
|
+
ids.push.apply(ids, x);
|
|
8906
8907
|
}
|
|
8907
|
-
}
|
|
8908
|
+
}
|
|
8908
8909
|
if (!ids.length) {
|
|
8909
8910
|
this._emitStatusEvent('ngw:select', null);
|
|
8910
8911
|
return [2 /*return*/];
|
|
@@ -8944,6 +8945,9 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8944
8945
|
};
|
|
8945
8946
|
return __assign(__assign({}, identify), { getIdentifyItems: getIdentifyItems_ });
|
|
8946
8947
|
};
|
|
8948
|
+
NgwMap.prototype._getSelectListenersCount = function () {
|
|
8949
|
+
return this.emitter.listenerCount('ngw:select');
|
|
8950
|
+
};
|
|
8947
8951
|
NgwMap.prototype._whiteLabel = function () {
|
|
8948
8952
|
return __awaiter(this, void 0, void 0, function () {
|
|
8949
8953
|
var container, logo;
|