@nextgis/ngw-leaflet 1.13.0 → 1.13.6
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/ngw-leaflet.esm-browser.js +82 -49
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js.map +1 -1
- package/lib/ngw-leaflet.esm-bundler.js +1 -1
- package/lib/ngw-leaflet.global.js +82 -49
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.13.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.13.6; author: NextGIS */
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -16916,6 +16916,7 @@ var WebMapLayers = /** @class */ (function (_super) {
|
|
|
16916
16916
|
};
|
|
16917
16917
|
/** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
|
|
16918
16918
|
WebMapLayers.prototype.addTileLayer = function (url, options) {
|
|
16919
|
+
if (options === void 0) { options = {}; }
|
|
16919
16920
|
return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
|
|
16920
16921
|
};
|
|
16921
16922
|
WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
|
|
@@ -18116,31 +18117,31 @@ var Cache = /** @class */ (function () {
|
|
|
18116
18117
|
/**
|
|
18117
18118
|
* Thrown when...
|
|
18118
18119
|
*/
|
|
18119
|
-
var
|
|
18120
|
-
__extends(
|
|
18121
|
-
function
|
|
18120
|
+
var NetworkError = /** @class */ (function (_super) {
|
|
18121
|
+
__extends(NetworkError, _super);
|
|
18122
|
+
function NetworkError(url) {
|
|
18122
18123
|
var _this = _super.call(this) || this;
|
|
18123
|
-
_this.name = '
|
|
18124
|
-
Object.
|
|
18125
|
-
|
|
18124
|
+
_this.name = 'NetworkError';
|
|
18125
|
+
Object.setPrototypeOf(_this, NetworkError.prototype);
|
|
18126
|
+
_this.message = "Unable to request ".concat(url, ".\n Possibly invalid NGW URL entered or CORS not configured to get request from ").concat(location.origin); // /control-panel/cors
|
|
18126
18127
|
return _this;
|
|
18127
18128
|
}
|
|
18128
|
-
return
|
|
18129
|
+
return NetworkError;
|
|
18129
18130
|
}(Error));
|
|
18130
18131
|
|
|
18131
18132
|
/**
|
|
18132
18133
|
* Thrown when...
|
|
18133
18134
|
*/
|
|
18134
|
-
var
|
|
18135
|
-
__extends(
|
|
18136
|
-
function
|
|
18135
|
+
var NgwError = /** @class */ (function (_super) {
|
|
18136
|
+
__extends(NgwError, _super);
|
|
18137
|
+
function NgwError(er) {
|
|
18137
18138
|
var _this = _super.call(this) || this;
|
|
18138
|
-
_this.name = '
|
|
18139
|
-
Object.
|
|
18140
|
-
|
|
18139
|
+
_this.name = 'NgwError';
|
|
18140
|
+
Object.assign(_this, er);
|
|
18141
|
+
Object.setPrototypeOf(_this, NgwError.prototype);
|
|
18141
18142
|
return _this;
|
|
18142
18143
|
}
|
|
18143
|
-
return
|
|
18144
|
+
return NgwError;
|
|
18144
18145
|
}(Error));
|
|
18145
18146
|
|
|
18146
18147
|
function isObject(val) {
|
|
@@ -18254,11 +18255,6 @@ var loadData;
|
|
|
18254
18255
|
xhr.abort();
|
|
18255
18256
|
});
|
|
18256
18257
|
}
|
|
18257
|
-
if (options.signal) {
|
|
18258
|
-
options.signal.addEventListener('abort', function () {
|
|
18259
|
-
xhr.abort();
|
|
18260
|
-
});
|
|
18261
|
-
}
|
|
18262
18258
|
xhr.send(data);
|
|
18263
18259
|
};
|
|
18264
18260
|
}
|
|
@@ -18709,6 +18705,7 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18709
18705
|
this.id = ID$1++;
|
|
18710
18706
|
this.emitter = new events.exports.EventEmitter();
|
|
18711
18707
|
this.routeStr = '/api/component/pyramid/route';
|
|
18708
|
+
this.activeRequests = [];
|
|
18712
18709
|
var exist = findConnector(options);
|
|
18713
18710
|
if (exist) {
|
|
18714
18711
|
return exist;
|
|
@@ -18794,6 +18791,7 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18794
18791
|
* Disconnecting a user. Aborting all current requests
|
|
18795
18792
|
*/
|
|
18796
18793
|
NgwConnector.prototype.logout = function () {
|
|
18794
|
+
this.abort();
|
|
18797
18795
|
removeConnector(this);
|
|
18798
18796
|
this.options.auth = undefined;
|
|
18799
18797
|
this.user = undefined;
|
|
@@ -18846,6 +18844,17 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18846
18844
|
}
|
|
18847
18845
|
}
|
|
18848
18846
|
};
|
|
18847
|
+
/** Stop all api requests */
|
|
18848
|
+
NgwConnector.prototype.abort = function () {
|
|
18849
|
+
for (var _i = 0, _a = this.activeRequests; _i < _a.length; _i++) {
|
|
18850
|
+
var req = _a[_i];
|
|
18851
|
+
req.cancel();
|
|
18852
|
+
}
|
|
18853
|
+
this.activeRequests = [];
|
|
18854
|
+
};
|
|
18855
|
+
NgwConnector.prototype.getActiveApiRequests = function () {
|
|
18856
|
+
return __spreadArray([], this.activeRequests, true);
|
|
18857
|
+
};
|
|
18849
18858
|
/**
|
|
18850
18859
|
* Send request to NGW api router.
|
|
18851
18860
|
* @param name - NGW route name from {@link https://docs.nextgis.com/docs_ngweb_dev/doc/developer/resource.html#routes | routes}
|
|
@@ -19060,14 +19069,20 @@ var NgwConnector = /** @class */ (function () {
|
|
|
19060
19069
|
NgwConnector.prototype._loadData = function (url, options) {
|
|
19061
19070
|
var _this = this;
|
|
19062
19071
|
options.responseType = options.responseType || 'json';
|
|
19063
|
-
|
|
19072
|
+
var request = new CancelablePromise(function (resolve, reject, onCancel) {
|
|
19064
19073
|
if (_this.user) {
|
|
19065
19074
|
options = options || {};
|
|
19066
19075
|
// options.withCredentials = true;
|
|
19067
19076
|
options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
|
|
19068
19077
|
}
|
|
19069
19078
|
loadData(url, resolve, options, reject, onCancel);
|
|
19070
|
-
})
|
|
19079
|
+
})
|
|
19080
|
+
.then(function (resp) {
|
|
19081
|
+
_this._cleanActiveRequests(request);
|
|
19082
|
+
return resp;
|
|
19083
|
+
})
|
|
19084
|
+
.catch(function (httpError) {
|
|
19085
|
+
_this._cleanActiveRequests(request);
|
|
19071
19086
|
if (httpError instanceof CancelablePromise.CancelError) ;
|
|
19072
19087
|
else {
|
|
19073
19088
|
// @ts-ignore
|
|
@@ -19080,6 +19095,20 @@ var NgwConnector = /** @class */ (function () {
|
|
|
19080
19095
|
}
|
|
19081
19096
|
}
|
|
19082
19097
|
});
|
|
19098
|
+
if (options.signal &&
|
|
19099
|
+
typeof options.signal.addEventListener === 'function') {
|
|
19100
|
+
options.signal.addEventListener('abort', function () {
|
|
19101
|
+
request.cancel();
|
|
19102
|
+
});
|
|
19103
|
+
}
|
|
19104
|
+
this.activeRequests.push(request);
|
|
19105
|
+
return request;
|
|
19106
|
+
};
|
|
19107
|
+
NgwConnector.prototype._cleanActiveRequests = function (request) {
|
|
19108
|
+
var activeRequestIndex = this.activeRequests.indexOf(request);
|
|
19109
|
+
if (activeRequestIndex !== -1) {
|
|
19110
|
+
this.activeRequests.splice(activeRequestIndex, 1);
|
|
19111
|
+
}
|
|
19083
19112
|
};
|
|
19084
19113
|
NgwConnector.prototype._handleHttpError = function (er) {
|
|
19085
19114
|
if (er) {
|
|
@@ -19189,12 +19218,12 @@ function fetchNgwLayerItemExtent(_a) {
|
|
|
19189
19218
|
function fetchNgwExtent(options) {
|
|
19190
19219
|
return options.connector.getResource(options.resourceId).then(function (resource) {
|
|
19191
19220
|
if (resource) {
|
|
19192
|
-
return fetchNgwResourceExtent(resource, options.connector);
|
|
19221
|
+
return fetchNgwResourceExtent(resource, options.connector, options);
|
|
19193
19222
|
}
|
|
19194
19223
|
});
|
|
19195
19224
|
}
|
|
19196
19225
|
/** @deprecated use {@link fetchNgwExtent} instead */
|
|
19197
|
-
function fetchNgwResourceExtent(item, connector) {
|
|
19226
|
+
function fetchNgwResourceExtent(item, connector, options) {
|
|
19198
19227
|
if (item.webmap) {
|
|
19199
19228
|
return CancelablePromise.resolve(getNgwWebmapExtent(item.webmap));
|
|
19200
19229
|
}
|
|
@@ -19203,15 +19232,12 @@ function fetchNgwResourceExtent(item, connector) {
|
|
|
19203
19232
|
if (resource.cls && resource.cls.indexOf('style') !== -1) {
|
|
19204
19233
|
return connector.getResource(resource.parent.id).then(function (res) {
|
|
19205
19234
|
if (res) {
|
|
19206
|
-
return fetchNgwLayerExtent({
|
|
19207
|
-
resourceId: res.resource.id,
|
|
19208
|
-
connector: connector,
|
|
19209
|
-
});
|
|
19235
|
+
return fetchNgwLayerExtent(__assign(__assign({}, options), { resourceId: res.resource.id, connector: connector }));
|
|
19210
19236
|
}
|
|
19211
19237
|
});
|
|
19212
19238
|
}
|
|
19213
19239
|
else {
|
|
19214
|
-
return fetchNgwLayerExtent({ resourceId: resource.id, connector: connector });
|
|
19240
|
+
return fetchNgwLayerExtent(__assign(__assign({}, options), { resourceId: resource.id, connector: connector }));
|
|
19215
19241
|
}
|
|
19216
19242
|
}
|
|
19217
19243
|
}
|
|
@@ -19382,7 +19408,7 @@ function createWktFromCoordArray(coord) {
|
|
|
19382
19408
|
}
|
|
19383
19409
|
function fetchNgwLayerItemsRequest(options) {
|
|
19384
19410
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
19385
|
-
var limit = options.limit, offset = options.offset, orderBy = options.orderBy, paramList = options.paramList, connector = options.connector, intersects = options.intersects, resourceId = options.resourceId;
|
|
19411
|
+
var limit = options.limit, cache = options.cache, signal = options.signal, offset = options.offset, orderBy = options.orderBy, paramList = options.paramList, connector = options.connector, intersects = options.intersects, resourceId = options.resourceId;
|
|
19386
19412
|
if (limit) {
|
|
19387
19413
|
if (limit !== Number.POSITIVE_INFINITY) {
|
|
19388
19414
|
params.limit = limit;
|
|
@@ -19412,11 +19438,10 @@ function fetchNgwLayerItemsRequest(options) {
|
|
|
19412
19438
|
params.paramList = paramList;
|
|
19413
19439
|
}
|
|
19414
19440
|
var reqParams = __assign({ id: resourceId }, params);
|
|
19415
|
-
return connector.get('feature_layer.feature.collection', { cache:
|
|
19441
|
+
return connector.get('feature_layer.feature.collection', { cache: cache, signal: signal }, reqParams);
|
|
19416
19442
|
}
|
|
19417
19443
|
|
|
19418
19444
|
function prepareNgwFieldsToPropertiesFilter(fields) {
|
|
19419
|
-
console.log(fields);
|
|
19420
19445
|
var f;
|
|
19421
19446
|
var _loop_1 = function () {
|
|
19422
19447
|
var field = fields[f];
|
|
@@ -21425,7 +21450,7 @@ var NgwResource = /** @class */ (function () {
|
|
|
21425
21450
|
});
|
|
21426
21451
|
});
|
|
21427
21452
|
};
|
|
21428
|
-
NgwResource.prototype.getBounds = function () {
|
|
21453
|
+
NgwResource.prototype.getBounds = function (options) {
|
|
21429
21454
|
return __awaiter(this, void 0, void 0, function () {
|
|
21430
21455
|
var _a;
|
|
21431
21456
|
return __generator(this, function (_b) {
|
|
@@ -21436,7 +21461,7 @@ var NgwResource = /** @class */ (function () {
|
|
|
21436
21461
|
}
|
|
21437
21462
|
if (!this.item) return [3 /*break*/, 2];
|
|
21438
21463
|
_a = this;
|
|
21439
|
-
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector)];
|
|
21464
|
+
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
|
|
21440
21465
|
case 1:
|
|
21441
21466
|
_a._extent = _b.sent();
|
|
21442
21467
|
return [2 /*return*/, this._extent];
|
|
@@ -22078,7 +22103,7 @@ function createParamsFromFeatures(features, resourceId, multiple) {
|
|
|
22078
22103
|
return featureParams;
|
|
22079
22104
|
}
|
|
22080
22105
|
function fetchIdentifyGeoJson(options) {
|
|
22081
|
-
var connector = options.connector, identify = options.identify;
|
|
22106
|
+
var connector = options.connector, identify = options.identify, requestOptions = options.requestOptions;
|
|
22082
22107
|
for (var l in identify) {
|
|
22083
22108
|
var id = Number(l);
|
|
22084
22109
|
if (!isNaN(id)) {
|
|
@@ -22094,7 +22119,7 @@ function fetchIdentifyGeoJson(options) {
|
|
|
22094
22119
|
}
|
|
22095
22120
|
var params = getIdentifyItems(identify);
|
|
22096
22121
|
if (params && params.length) {
|
|
22097
|
-
return fetchNgwLayerFeature(__assign({ connector: connector }, params[0]));
|
|
22122
|
+
return fetchNgwLayerFeature(__assign(__assign(__assign({}, requestOptions), { connector: connector }), params[0]));
|
|
22098
22123
|
}
|
|
22099
22124
|
return CancelablePromise.resolve(undefined);
|
|
22100
22125
|
}
|
|
@@ -22107,21 +22132,25 @@ function fetchIdentifyItem(options) {
|
|
|
22107
22132
|
return CancelablePromise.resolve(undefined);
|
|
22108
22133
|
}
|
|
22109
22134
|
function featureLayerIdentify(options) {
|
|
22110
|
-
var
|
|
22111
|
-
var
|
|
22112
|
-
if (Array.isArray(
|
|
22113
|
-
|
|
22135
|
+
var geom = options.geom, signal = options.signal, cache = options.cache;
|
|
22136
|
+
var geom_ = [];
|
|
22137
|
+
if (Array.isArray(geom)) {
|
|
22138
|
+
geom_ = geom;
|
|
22114
22139
|
}
|
|
22115
22140
|
else {
|
|
22116
|
-
var polygon =
|
|
22141
|
+
var polygon = geom.type === 'Feature'
|
|
22142
|
+
? geom.geometry
|
|
22143
|
+
: geom.type === 'Polygon'
|
|
22144
|
+
? geom
|
|
22145
|
+
: false;
|
|
22117
22146
|
if (polygon) {
|
|
22118
|
-
|
|
22147
|
+
geom_ = polygon.coordinates[0];
|
|
22119
22148
|
}
|
|
22120
22149
|
}
|
|
22121
|
-
if (
|
|
22150
|
+
if (geom_) {
|
|
22122
22151
|
// create wkt string
|
|
22123
22152
|
var polygonStr = [];
|
|
22124
|
-
for (var _i = 0, geom_1 =
|
|
22153
|
+
for (var _i = 0, geom_1 = geom_; _i < geom_1.length; _i++) {
|
|
22125
22154
|
var _a = geom_1[_i], lng = _a[0], lat = _a[1];
|
|
22126
22155
|
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
22127
22156
|
polygonStr.push(x + ' ' + y);
|
|
@@ -22133,18 +22162,22 @@ function featureLayerIdentify(options) {
|
|
|
22133
22162
|
srs: 3857,
|
|
22134
22163
|
layers: layers,
|
|
22135
22164
|
};
|
|
22136
|
-
return options.connector.post('feature_layer.identify', {
|
|
22165
|
+
return options.connector.post('feature_layer.identify', {
|
|
22166
|
+
data: data,
|
|
22167
|
+
signal: signal,
|
|
22168
|
+
cache: cache,
|
|
22169
|
+
});
|
|
22137
22170
|
}
|
|
22138
22171
|
else {
|
|
22139
22172
|
throw new Error('Not valid geometry format to make intersection');
|
|
22140
22173
|
}
|
|
22141
22174
|
}
|
|
22142
22175
|
function sendIdentifyRequest(ev, options) {
|
|
22143
|
-
var _a;
|
|
22144
22176
|
deprecatedMapClick(ev);
|
|
22145
|
-
var
|
|
22146
|
-
var geom =
|
|
22147
|
-
|
|
22177
|
+
var _a = ev.lngLat, lng = _a[0], lat = _a[1];
|
|
22178
|
+
var geom = options.geom, radius = options.radius, signal = options.signal, cache = options.cache;
|
|
22179
|
+
var geom_ = geom !== null && geom !== void 0 ? geom : getCirclePolygonCoordinates(lng, lat, radius);
|
|
22180
|
+
return featureLayerIdentify(__assign(__assign({}, options), { geom: geom_, signal: signal, cache: cache }));
|
|
22148
22181
|
}
|
|
22149
22182
|
function createIdentifyItem(opt) {
|
|
22150
22183
|
return new IdentifyItem(opt);
|