@nextgis/ngw-map 1.16.0 → 1.16.2
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 +2 -1
- package/lib/ngw-map.cjs.js +68 -74
- 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 +170 -157
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +69 -75
- package/lib/ngw-map.esm-bundler.js.map +1 -1
- package/lib/ngw-map.esm-bundler.prod.js +1 -1
- package/lib/ngw-map.esm-bundler.prod.js.map +1 -1
- package/lib/ngw-map.global.js +170 -157
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +9 -9
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.16.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.16.2; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -1175,7 +1175,9 @@ var NgwMap = (function (exports) {
|
|
|
1175
1175
|
|
|
1176
1176
|
var d2r = Math.PI / 180; // degrees to radians
|
|
1177
1177
|
var r2d = 180 / Math.PI; // radians to degrees
|
|
1178
|
-
function getCirclePolygonCoordinates(lng, lat,
|
|
1178
|
+
function getCirclePolygonCoordinates(lng, lat,
|
|
1179
|
+
/** In kilometers */
|
|
1180
|
+
radius, points) {
|
|
1179
1181
|
if (radius === void 0) { radius = 10; }
|
|
1180
1182
|
if (points === void 0) { points = 6; }
|
|
1181
1183
|
// find the radius in lat/lon
|
|
@@ -1225,6 +1227,14 @@ var NgwMap = (function (exports) {
|
|
|
1225
1227
|
array.every(function (x) { return typeof x === 'number'; }));
|
|
1226
1228
|
}
|
|
1227
1229
|
|
|
1230
|
+
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
1231
|
+
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
1232
|
+
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
1233
|
+
Math.pow(2, zoom + 8);
|
|
1234
|
+
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
1235
|
+
return radius;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1228
1238
|
/**
|
|
1229
1239
|
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
|
1230
1240
|
* target object. Returns the target object.
|
|
@@ -1306,6 +1316,11 @@ var NgwMap = (function (exports) {
|
|
|
1306
1316
|
return newObj;
|
|
1307
1317
|
}
|
|
1308
1318
|
|
|
1319
|
+
function round(val, toFixed) {
|
|
1320
|
+
var n = toFixed ? Number('1e+' + toFixed) : 1;
|
|
1321
|
+
return Math.round((val + Number.EPSILON) * n) / n;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1309
1324
|
function isObject$1(val) {
|
|
1310
1325
|
return Object.prototype.toString.call(val) === '[object Object]';
|
|
1311
1326
|
}
|
|
@@ -4212,6 +4227,65 @@ var NgwMap = (function (exports) {
|
|
|
4212
4227
|
});
|
|
4213
4228
|
}
|
|
4214
4229
|
|
|
4230
|
+
function apiRequest(opt) {
|
|
4231
|
+
var params = opt.params;
|
|
4232
|
+
return new CancelablePromise(function (resolve, reject) {
|
|
4233
|
+
opt.connector
|
|
4234
|
+
.connect()
|
|
4235
|
+
.then(function (apiItems) {
|
|
4236
|
+
var apiItem = apiItems && apiItems[opt.name];
|
|
4237
|
+
if (apiItem) {
|
|
4238
|
+
apiItem = __spreadArray([], apiItem, true);
|
|
4239
|
+
var url = apiItem.shift();
|
|
4240
|
+
if (apiItem.length) {
|
|
4241
|
+
var replaceParams = {};
|
|
4242
|
+
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
4243
|
+
var arg = apiItem[fry];
|
|
4244
|
+
replaceParams[fry] = '{' + arg + '}';
|
|
4245
|
+
if (params[arg] === undefined) {
|
|
4246
|
+
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4249
|
+
if (url) {
|
|
4250
|
+
url = template(url, replaceParams);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
// Transfer part of the parameters from `params` to the URL string
|
|
4254
|
+
if (params) {
|
|
4255
|
+
var paramArray_1 = [];
|
|
4256
|
+
var paramList = params.paramList;
|
|
4257
|
+
if (Array.isArray(paramList)) {
|
|
4258
|
+
delete params.paramList;
|
|
4259
|
+
paramList.forEach(function (x) {
|
|
4260
|
+
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
for (var p in params) {
|
|
4264
|
+
if (apiItem.indexOf(p) === -1) {
|
|
4265
|
+
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4268
|
+
if (paramArray_1.length) {
|
|
4269
|
+
url = url + '?' + paramArray_1.join('&');
|
|
4270
|
+
}
|
|
4271
|
+
}
|
|
4272
|
+
if (url) {
|
|
4273
|
+
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
4274
|
+
}
|
|
4275
|
+
else {
|
|
4276
|
+
reject(new Error('request url is not set'));
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
else {
|
|
4280
|
+
resolve(undefined);
|
|
4281
|
+
}
|
|
4282
|
+
})
|
|
4283
|
+
.catch(function (er) {
|
|
4284
|
+
reject(er);
|
|
4285
|
+
});
|
|
4286
|
+
});
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4215
4289
|
/**
|
|
4216
4290
|
* Thrown when ...
|
|
4217
4291
|
*/
|
|
@@ -4577,65 +4651,6 @@ var NgwMap = (function (exports) {
|
|
|
4577
4651
|
return ResourcesControl;
|
|
4578
4652
|
}());
|
|
4579
4653
|
|
|
4580
|
-
function apiRequest(opt) {
|
|
4581
|
-
var params = opt.params;
|
|
4582
|
-
return new CancelablePromise(function (resolve, reject) {
|
|
4583
|
-
opt.connector
|
|
4584
|
-
.connect()
|
|
4585
|
-
.then(function (apiItems) {
|
|
4586
|
-
var apiItem = apiItems && apiItems[opt.name];
|
|
4587
|
-
if (apiItem) {
|
|
4588
|
-
apiItem = __spreadArray([], apiItem, true);
|
|
4589
|
-
var url = apiItem.shift();
|
|
4590
|
-
if (apiItem.length) {
|
|
4591
|
-
var replaceParams = {};
|
|
4592
|
-
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
4593
|
-
var arg = apiItem[fry];
|
|
4594
|
-
replaceParams[fry] = '{' + arg + '}';
|
|
4595
|
-
if (params[arg] === undefined) {
|
|
4596
|
-
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
4597
|
-
}
|
|
4598
|
-
}
|
|
4599
|
-
if (url) {
|
|
4600
|
-
url = template(url, replaceParams);
|
|
4601
|
-
}
|
|
4602
|
-
}
|
|
4603
|
-
// Transfer part of the parameters from `params` to the URL string
|
|
4604
|
-
if (params) {
|
|
4605
|
-
var paramArray_1 = [];
|
|
4606
|
-
var paramList = params.paramList;
|
|
4607
|
-
if (Array.isArray(paramList)) {
|
|
4608
|
-
delete params.paramList;
|
|
4609
|
-
paramList.forEach(function (x) {
|
|
4610
|
-
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4611
|
-
});
|
|
4612
|
-
}
|
|
4613
|
-
for (var p in params) {
|
|
4614
|
-
if (apiItem.indexOf(p) === -1) {
|
|
4615
|
-
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4616
|
-
}
|
|
4617
|
-
}
|
|
4618
|
-
if (paramArray_1.length) {
|
|
4619
|
-
url = url + '?' + paramArray_1.join('&');
|
|
4620
|
-
}
|
|
4621
|
-
}
|
|
4622
|
-
if (url) {
|
|
4623
|
-
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
4624
|
-
}
|
|
4625
|
-
else {
|
|
4626
|
-
reject(new Error('request url is not set'));
|
|
4627
|
-
}
|
|
4628
|
-
}
|
|
4629
|
-
else {
|
|
4630
|
-
resolve(undefined);
|
|
4631
|
-
}
|
|
4632
|
-
})
|
|
4633
|
-
.catch(function (er) {
|
|
4634
|
-
reject(er);
|
|
4635
|
-
});
|
|
4636
|
-
});
|
|
4637
|
-
}
|
|
4638
|
-
|
|
4639
4654
|
var ID$1 = 0;
|
|
4640
4655
|
var NgwConnector$1 = /** @class */ (function () {
|
|
4641
4656
|
function NgwConnector(options) {
|
|
@@ -4706,9 +4721,9 @@ var NgwMap = (function (exports) {
|
|
|
4706
4721
|
if (auth) {
|
|
4707
4722
|
var login = auth.login, password = auth.password;
|
|
4708
4723
|
if (login && password) {
|
|
4709
|
-
return _this.
|
|
4724
|
+
return _this._login({ login: login, password: password })
|
|
4710
4725
|
.then(function () {
|
|
4711
|
-
makeQuery();
|
|
4726
|
+
return makeQuery();
|
|
4712
4727
|
})
|
|
4713
4728
|
.catch(function (er) { return reject(er); });
|
|
4714
4729
|
}
|
|
@@ -4726,10 +4741,10 @@ var NgwMap = (function (exports) {
|
|
|
4726
4741
|
* Quick way to change NextGIS Web user.
|
|
4727
4742
|
* @param credentials - New user credentials
|
|
4728
4743
|
*/
|
|
4729
|
-
NgwConnector.prototype.login = function (credentials) {
|
|
4744
|
+
NgwConnector.prototype.login = function (credentials, options) {
|
|
4730
4745
|
this.logout();
|
|
4731
4746
|
addConnector(this);
|
|
4732
|
-
return this.
|
|
4747
|
+
return this._login(credentials, options);
|
|
4733
4748
|
};
|
|
4734
4749
|
/**
|
|
4735
4750
|
* Disconnecting a user. Aborting all current requests
|
|
@@ -4742,29 +4757,16 @@ var NgwMap = (function (exports) {
|
|
|
4742
4757
|
this.emitter.emit('logout');
|
|
4743
4758
|
this.resources.cache.clean();
|
|
4744
4759
|
};
|
|
4745
|
-
NgwConnector.prototype.getUserInfo = function (credentials) {
|
|
4746
|
-
var _this = this;
|
|
4760
|
+
NgwConnector.prototype.getUserInfo = function (credentials, options) {
|
|
4747
4761
|
if (this.user && this.user.id) {
|
|
4748
4762
|
return CancelablePromise.resolve(this.user);
|
|
4749
4763
|
}
|
|
4750
4764
|
if (credentials) {
|
|
4751
4765
|
this.options.auth = credentials;
|
|
4752
4766
|
}
|
|
4753
|
-
var
|
|
4754
|
-
headers: this.getAuthorizationHeaders(credentials),
|
|
4755
|
-
// withCredentials: true
|
|
4756
|
-
};
|
|
4767
|
+
var options_ = __assign({ headers: this.getAuthorizationHeaders(credentials) }, options);
|
|
4757
4768
|
// Do not use apiRequest('auth.current_user') to avoid circular-references
|
|
4758
|
-
return this.makeQuery('/api/component/auth/current_user', {},
|
|
4759
|
-
.then(function (data) {
|
|
4760
|
-
_this.user = data;
|
|
4761
|
-
_this.emitter.emit('login', data);
|
|
4762
|
-
return data;
|
|
4763
|
-
})
|
|
4764
|
-
.catch(function (er) {
|
|
4765
|
-
_this.emitter.emit('login:error', er);
|
|
4766
|
-
throw er;
|
|
4767
|
-
});
|
|
4769
|
+
return this.makeQuery('/api/component/auth/current_user', {}, options_);
|
|
4768
4770
|
};
|
|
4769
4771
|
/**
|
|
4770
4772
|
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
@@ -4830,6 +4832,7 @@ var NgwMap = (function (exports) {
|
|
|
4830
4832
|
*/
|
|
4831
4833
|
NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
|
|
4832
4834
|
var _this = this;
|
|
4835
|
+
var _a;
|
|
4833
4836
|
if (params_ === void 0) { params_ = {}; }
|
|
4834
4837
|
if (requestOptions === void 0) { requestOptions = {}; }
|
|
4835
4838
|
var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
|
|
@@ -4844,7 +4847,7 @@ var NgwMap = (function (exports) {
|
|
|
4844
4847
|
withCredentials: withCredentials,
|
|
4845
4848
|
responseType: responseType,
|
|
4846
4849
|
baseUrl: this.options.baseUrl,
|
|
4847
|
-
|
|
4850
|
+
userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
|
|
4848
4851
|
})));
|
|
4849
4852
|
}
|
|
4850
4853
|
return makeApiRequest();
|
|
@@ -5053,6 +5056,19 @@ var NgwMap = (function (exports) {
|
|
|
5053
5056
|
this.activeRequests.push(request);
|
|
5054
5057
|
return request;
|
|
5055
5058
|
};
|
|
5059
|
+
NgwConnector.prototype._login = function (credentials, options) {
|
|
5060
|
+
var _this = this;
|
|
5061
|
+
return this.getUserInfo(credentials, options)
|
|
5062
|
+
.then(function (data) {
|
|
5063
|
+
_this.user = data;
|
|
5064
|
+
_this.emitter.emit('login', data);
|
|
5065
|
+
return data;
|
|
5066
|
+
})
|
|
5067
|
+
.catch(function (er) {
|
|
5068
|
+
_this.emitter.emit('login:error', er);
|
|
5069
|
+
throw er;
|
|
5070
|
+
});
|
|
5071
|
+
};
|
|
5056
5072
|
NgwConnector.prototype._cleanActiveRequests = function (request) {
|
|
5057
5073
|
var activeRequestIndex = this.activeRequests.indexOf(request);
|
|
5058
5074
|
if (activeRequestIndex !== -1) {
|
|
@@ -5396,14 +5412,14 @@ var NgwMap = (function (exports) {
|
|
|
5396
5412
|
function createWktFromCoordArray(coord) {
|
|
5397
5413
|
var polygon = coord.map(function (_a) {
|
|
5398
5414
|
var lng = _a[0], lat = _a[1];
|
|
5399
|
-
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
5415
|
+
var _b = degrees2meters(lng, lat).map(function (c) { return round(c); }), x = _b[0], y = _b[1];
|
|
5400
5416
|
return x + ' ' + y;
|
|
5401
5417
|
});
|
|
5402
5418
|
return "POLYGON((".concat(polygon.join(', '), "))");
|
|
5403
5419
|
}
|
|
5404
5420
|
function fetchNgwLayerItemsRequest(options) {
|
|
5405
5421
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
5406
|
-
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;
|
|
5422
|
+
var limit = options.limit, cache = options.cache, signal = options.signal, offset = options.offset, orderBy = options.orderBy, paramList = options.paramList, connector = options.connector, geomFormat = options.geomFormat, intersects = options.intersects, resourceId = options.resourceId;
|
|
5407
5423
|
if (limit) {
|
|
5408
5424
|
if (limit !== Number.POSITIVE_INFINITY) {
|
|
5409
5425
|
params.limit = limit;
|
|
@@ -5416,6 +5432,9 @@ var NgwMap = (function (exports) {
|
|
|
5416
5432
|
if (offset) {
|
|
5417
5433
|
params.offset = offset;
|
|
5418
5434
|
}
|
|
5435
|
+
if (geomFormat) {
|
|
5436
|
+
params.geom_format = geomFormat;
|
|
5437
|
+
}
|
|
5419
5438
|
updateItemRequestParam(params, options);
|
|
5420
5439
|
if (orderBy) {
|
|
5421
5440
|
params.order_by = orderBy.join(',');
|
|
@@ -8322,14 +8341,6 @@ var NgwMap = (function (exports) {
|
|
|
8322
8341
|
return options;
|
|
8323
8342
|
}
|
|
8324
8343
|
|
|
8325
|
-
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
8326
|
-
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
8327
|
-
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
8328
|
-
Math.pow(2, zoom + 8);
|
|
8329
|
-
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
8330
|
-
return radius;
|
|
8331
|
-
}
|
|
8332
|
-
|
|
8333
8344
|
/**
|
|
8334
8345
|
* Base class containing the logic of interaction WebMap with NextGIS services.
|
|
8335
8346
|
*
|
|
@@ -8678,7 +8689,7 @@ var NgwMap = (function (exports) {
|
|
|
8678
8689
|
this.$$selectFromNgwRaster = function (ev) {
|
|
8679
8690
|
var count = _this._getSelectListenersCount();
|
|
8680
8691
|
if (count) {
|
|
8681
|
-
_this.
|
|
8692
|
+
_this.selectFromNgwRaster(ev);
|
|
8682
8693
|
}
|
|
8683
8694
|
};
|
|
8684
8695
|
this.$$selectFromNgwVector = function (ev) {
|
|
@@ -8750,6 +8761,72 @@ var NgwMap = (function (exports) {
|
|
|
8750
8761
|
}
|
|
8751
8762
|
});
|
|
8752
8763
|
};
|
|
8764
|
+
NgwMap.prototype.selectFromNgwRaster = function (ev) {
|
|
8765
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8766
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8767
|
+
var _this = this;
|
|
8768
|
+
return __generator(this, function (_b) {
|
|
8769
|
+
switch (_b.label) {
|
|
8770
|
+
case 0:
|
|
8771
|
+
this._emitStatusEvent('ngw:preselect');
|
|
8772
|
+
promises = [];
|
|
8773
|
+
layers = Object.values(this._ngwLayers);
|
|
8774
|
+
layers.sort(function (a, b) {
|
|
8775
|
+
if (a.layer.order && b.layer.order) {
|
|
8776
|
+
return b.layer.order - a.layer.order;
|
|
8777
|
+
}
|
|
8778
|
+
return 1;
|
|
8779
|
+
});
|
|
8780
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
8781
|
+
l = layers_1[_i];
|
|
8782
|
+
layer = l.layer;
|
|
8783
|
+
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
8784
|
+
? layer.getIdentificationIds
|
|
8785
|
+
: false;
|
|
8786
|
+
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
8787
|
+
promises.push(identFunc.call(layer));
|
|
8788
|
+
}
|
|
8789
|
+
}
|
|
8790
|
+
getIdsPromise = Promise.all(promises);
|
|
8791
|
+
return [4 /*yield*/, getIdsPromise];
|
|
8792
|
+
case 1:
|
|
8793
|
+
getIds = _b.sent();
|
|
8794
|
+
ids = [];
|
|
8795
|
+
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8796
|
+
x = getIds_1[_a];
|
|
8797
|
+
if (x) {
|
|
8798
|
+
ids.push.apply(ids, x);
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8801
|
+
if (!ids.length) {
|
|
8802
|
+
this._emitStatusEvent('ngw:select', null);
|
|
8803
|
+
return [2 /*return*/];
|
|
8804
|
+
}
|
|
8805
|
+
pixelRadius = this.options.pixelRadius || 10;
|
|
8806
|
+
center = this.getCenter();
|
|
8807
|
+
zoom = this.getZoom();
|
|
8808
|
+
zoom = zoom !== undefined ? zoom : 20;
|
|
8809
|
+
if (!center || !zoom) {
|
|
8810
|
+
this._emitStatusEvent('ngw:select', null);
|
|
8811
|
+
return [2 /*return*/];
|
|
8812
|
+
}
|
|
8813
|
+
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
8814
|
+
selectPromise = sendIdentifyRequest(ev, {
|
|
8815
|
+
layers: ids,
|
|
8816
|
+
connector: this.connector,
|
|
8817
|
+
radius: radius,
|
|
8818
|
+
}).then(function (resp) {
|
|
8819
|
+
var identify = __assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev });
|
|
8820
|
+
var identifyEvent = _this._prepareToIdentify(identify);
|
|
8821
|
+
_this._emitStatusEvent('ngw:select', identify);
|
|
8822
|
+
return identifyEvent;
|
|
8823
|
+
});
|
|
8824
|
+
this._addPromise('select', selectPromise);
|
|
8825
|
+
return [2 /*return*/, selectPromise];
|
|
8826
|
+
}
|
|
8827
|
+
});
|
|
8828
|
+
});
|
|
8829
|
+
};
|
|
8753
8830
|
NgwMap.prototype._addPromise = function (groupName, promise) {
|
|
8754
8831
|
var group = this._promises[groupName];
|
|
8755
8832
|
if (group && group.indexOf(promise) === -1) {
|
|
@@ -8885,70 +8962,6 @@ var NgwMap = (function (exports) {
|
|
|
8885
8962
|
}
|
|
8886
8963
|
}
|
|
8887
8964
|
};
|
|
8888
|
-
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
8889
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8890
|
-
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8891
|
-
var _this = this;
|
|
8892
|
-
return __generator(this, function (_b) {
|
|
8893
|
-
switch (_b.label) {
|
|
8894
|
-
case 0:
|
|
8895
|
-
this._emitStatusEvent('ngw:preselect');
|
|
8896
|
-
promises = [];
|
|
8897
|
-
layers = Object.values(this._ngwLayers);
|
|
8898
|
-
layers.sort(function (a, b) {
|
|
8899
|
-
if (a.layer.order && b.layer.order) {
|
|
8900
|
-
return b.layer.order - a.layer.order;
|
|
8901
|
-
}
|
|
8902
|
-
return 1;
|
|
8903
|
-
});
|
|
8904
|
-
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
8905
|
-
l = layers_1[_i];
|
|
8906
|
-
layer = l.layer;
|
|
8907
|
-
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
8908
|
-
? layer.getIdentificationIds
|
|
8909
|
-
: false;
|
|
8910
|
-
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
8911
|
-
promises.push(identFunc.call(layer));
|
|
8912
|
-
}
|
|
8913
|
-
}
|
|
8914
|
-
getIdsPromise = Promise.all(promises);
|
|
8915
|
-
return [4 /*yield*/, getIdsPromise];
|
|
8916
|
-
case 1:
|
|
8917
|
-
getIds = _b.sent();
|
|
8918
|
-
ids = [];
|
|
8919
|
-
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8920
|
-
x = getIds_1[_a];
|
|
8921
|
-
if (x) {
|
|
8922
|
-
ids.push.apply(ids, x);
|
|
8923
|
-
}
|
|
8924
|
-
}
|
|
8925
|
-
if (!ids.length) {
|
|
8926
|
-
this._emitStatusEvent('ngw:select', null);
|
|
8927
|
-
return [2 /*return*/];
|
|
8928
|
-
}
|
|
8929
|
-
pixelRadius = this.options.pixelRadius || 10;
|
|
8930
|
-
center = this.getCenter();
|
|
8931
|
-
zoom = this.getZoom();
|
|
8932
|
-
zoom = zoom !== undefined ? zoom : 20;
|
|
8933
|
-
if (!center || !zoom) {
|
|
8934
|
-
this._emitStatusEvent('ngw:select', null);
|
|
8935
|
-
return [2 /*return*/];
|
|
8936
|
-
}
|
|
8937
|
-
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
8938
|
-
selectPromise = sendIdentifyRequest(ev, {
|
|
8939
|
-
layers: ids,
|
|
8940
|
-
connector: this.connector,
|
|
8941
|
-
radius: radius,
|
|
8942
|
-
}).then(function (resp) {
|
|
8943
|
-
_this._emitStatusEvent('ngw:select', _this._prepareToIdentify(__assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev })));
|
|
8944
|
-
return resp;
|
|
8945
|
-
});
|
|
8946
|
-
this._addPromise('select', selectPromise);
|
|
8947
|
-
return [2 /*return*/, selectPromise];
|
|
8948
|
-
}
|
|
8949
|
-
});
|
|
8950
|
-
});
|
|
8951
|
-
};
|
|
8952
8965
|
NgwMap.prototype._prepareToIdentify = function (identify) {
|
|
8953
8966
|
var _this = this;
|
|
8954
8967
|
var getIdentifyItems_ = function () {
|