@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
|
@@ -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
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -1172,7 +1172,9 @@ function getBoundsFeature(b) {
|
|
|
1172
1172
|
|
|
1173
1173
|
var d2r = Math.PI / 180; // degrees to radians
|
|
1174
1174
|
var r2d = 180 / Math.PI; // radians to degrees
|
|
1175
|
-
function getCirclePolygonCoordinates(lng, lat,
|
|
1175
|
+
function getCirclePolygonCoordinates(lng, lat,
|
|
1176
|
+
/** In kilometers */
|
|
1177
|
+
radius, points) {
|
|
1176
1178
|
if (radius === void 0) { radius = 10; }
|
|
1177
1179
|
if (points === void 0) { points = 6; }
|
|
1178
1180
|
// find the radius in lat/lon
|
|
@@ -1222,6 +1224,14 @@ function isLngLatBoundsArray(array) {
|
|
|
1222
1224
|
array.every(function (x) { return typeof x === 'number'; }));
|
|
1223
1225
|
}
|
|
1224
1226
|
|
|
1227
|
+
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
1228
|
+
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
1229
|
+
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
1230
|
+
Math.pow(2, zoom + 8);
|
|
1231
|
+
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
1232
|
+
return radius;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1225
1235
|
/**
|
|
1226
1236
|
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
|
1227
1237
|
* target object. Returns the target object.
|
|
@@ -1303,6 +1313,11 @@ function objectRemoveEmpty(obj) {
|
|
|
1303
1313
|
return newObj;
|
|
1304
1314
|
}
|
|
1305
1315
|
|
|
1316
|
+
function round(val, toFixed) {
|
|
1317
|
+
var n = toFixed ? Number('1e+' + toFixed) : 1;
|
|
1318
|
+
return Math.round((val + Number.EPSILON) * n) / n;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1306
1321
|
function isObject$1(val) {
|
|
1307
1322
|
return Object.prototype.toString.call(val) === '[object Object]';
|
|
1308
1323
|
}
|
|
@@ -4209,6 +4224,65 @@ function template(str, data) {
|
|
|
4209
4224
|
});
|
|
4210
4225
|
}
|
|
4211
4226
|
|
|
4227
|
+
function apiRequest(opt) {
|
|
4228
|
+
var params = opt.params;
|
|
4229
|
+
return new CancelablePromise(function (resolve, reject) {
|
|
4230
|
+
opt.connector
|
|
4231
|
+
.connect()
|
|
4232
|
+
.then(function (apiItems) {
|
|
4233
|
+
var apiItem = apiItems && apiItems[opt.name];
|
|
4234
|
+
if (apiItem) {
|
|
4235
|
+
apiItem = __spreadArray([], apiItem, true);
|
|
4236
|
+
var url = apiItem.shift();
|
|
4237
|
+
if (apiItem.length) {
|
|
4238
|
+
var replaceParams = {};
|
|
4239
|
+
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
4240
|
+
var arg = apiItem[fry];
|
|
4241
|
+
replaceParams[fry] = '{' + arg + '}';
|
|
4242
|
+
if (params[arg] === undefined) {
|
|
4243
|
+
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
if (url) {
|
|
4247
|
+
url = template(url, replaceParams);
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
// Transfer part of the parameters from `params` to the URL string
|
|
4251
|
+
if (params) {
|
|
4252
|
+
var paramArray_1 = [];
|
|
4253
|
+
var paramList = params.paramList;
|
|
4254
|
+
if (Array.isArray(paramList)) {
|
|
4255
|
+
delete params.paramList;
|
|
4256
|
+
paramList.forEach(function (x) {
|
|
4257
|
+
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4258
|
+
});
|
|
4259
|
+
}
|
|
4260
|
+
for (var p in params) {
|
|
4261
|
+
if (apiItem.indexOf(p) === -1) {
|
|
4262
|
+
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4265
|
+
if (paramArray_1.length) {
|
|
4266
|
+
url = url + '?' + paramArray_1.join('&');
|
|
4267
|
+
}
|
|
4268
|
+
}
|
|
4269
|
+
if (url) {
|
|
4270
|
+
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
4271
|
+
}
|
|
4272
|
+
else {
|
|
4273
|
+
reject(new Error('request url is not set'));
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
else {
|
|
4277
|
+
resolve(undefined);
|
|
4278
|
+
}
|
|
4279
|
+
})
|
|
4280
|
+
.catch(function (er) {
|
|
4281
|
+
reject(er);
|
|
4282
|
+
});
|
|
4283
|
+
});
|
|
4284
|
+
}
|
|
4285
|
+
|
|
4212
4286
|
/**
|
|
4213
4287
|
* Thrown when ...
|
|
4214
4288
|
*/
|
|
@@ -4574,65 +4648,6 @@ var ResourcesControl = /** @class */ (function () {
|
|
|
4574
4648
|
return ResourcesControl;
|
|
4575
4649
|
}());
|
|
4576
4650
|
|
|
4577
|
-
function apiRequest(opt) {
|
|
4578
|
-
var params = opt.params;
|
|
4579
|
-
return new CancelablePromise(function (resolve, reject) {
|
|
4580
|
-
opt.connector
|
|
4581
|
-
.connect()
|
|
4582
|
-
.then(function (apiItems) {
|
|
4583
|
-
var apiItem = apiItems && apiItems[opt.name];
|
|
4584
|
-
if (apiItem) {
|
|
4585
|
-
apiItem = __spreadArray([], apiItem, true);
|
|
4586
|
-
var url = apiItem.shift();
|
|
4587
|
-
if (apiItem.length) {
|
|
4588
|
-
var replaceParams = {};
|
|
4589
|
-
for (var fry = 0; fry < apiItem.length; fry++) {
|
|
4590
|
-
var arg = apiItem[fry];
|
|
4591
|
-
replaceParams[fry] = '{' + arg + '}';
|
|
4592
|
-
if (params[arg] === undefined) {
|
|
4593
|
-
throw new Error('`' + arg + '`' + ' url api argument is not specified');
|
|
4594
|
-
}
|
|
4595
|
-
}
|
|
4596
|
-
if (url) {
|
|
4597
|
-
url = template(url, replaceParams);
|
|
4598
|
-
}
|
|
4599
|
-
}
|
|
4600
|
-
// Transfer part of the parameters from `params` to the URL string
|
|
4601
|
-
if (params) {
|
|
4602
|
-
var paramArray_1 = [];
|
|
4603
|
-
var paramList = params.paramList;
|
|
4604
|
-
if (Array.isArray(paramList)) {
|
|
4605
|
-
delete params.paramList;
|
|
4606
|
-
paramList.forEach(function (x) {
|
|
4607
|
-
paramArray_1.push("".concat(x[0], "=").concat(x[1]));
|
|
4608
|
-
});
|
|
4609
|
-
}
|
|
4610
|
-
for (var p in params) {
|
|
4611
|
-
if (apiItem.indexOf(p) === -1) {
|
|
4612
|
-
paramArray_1.push("".concat(p, "=").concat(params[p]));
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
if (paramArray_1.length) {
|
|
4616
|
-
url = url + '?' + paramArray_1.join('&');
|
|
4617
|
-
}
|
|
4618
|
-
}
|
|
4619
|
-
if (url) {
|
|
4620
|
-
resolve(opt.connector.makeQuery(url, params, opt.requestOptions));
|
|
4621
|
-
}
|
|
4622
|
-
else {
|
|
4623
|
-
reject(new Error('request url is not set'));
|
|
4624
|
-
}
|
|
4625
|
-
}
|
|
4626
|
-
else {
|
|
4627
|
-
resolve(undefined);
|
|
4628
|
-
}
|
|
4629
|
-
})
|
|
4630
|
-
.catch(function (er) {
|
|
4631
|
-
reject(er);
|
|
4632
|
-
});
|
|
4633
|
-
});
|
|
4634
|
-
}
|
|
4635
|
-
|
|
4636
4651
|
var ID$1 = 0;
|
|
4637
4652
|
var NgwConnector$1 = /** @class */ (function () {
|
|
4638
4653
|
function NgwConnector(options) {
|
|
@@ -4703,9 +4718,9 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4703
4718
|
if (auth) {
|
|
4704
4719
|
var login = auth.login, password = auth.password;
|
|
4705
4720
|
if (login && password) {
|
|
4706
|
-
return _this.
|
|
4721
|
+
return _this._login({ login: login, password: password })
|
|
4707
4722
|
.then(function () {
|
|
4708
|
-
makeQuery();
|
|
4723
|
+
return makeQuery();
|
|
4709
4724
|
})
|
|
4710
4725
|
.catch(function (er) { return reject(er); });
|
|
4711
4726
|
}
|
|
@@ -4723,10 +4738,10 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4723
4738
|
* Quick way to change NextGIS Web user.
|
|
4724
4739
|
* @param credentials - New user credentials
|
|
4725
4740
|
*/
|
|
4726
|
-
NgwConnector.prototype.login = function (credentials) {
|
|
4741
|
+
NgwConnector.prototype.login = function (credentials, options) {
|
|
4727
4742
|
this.logout();
|
|
4728
4743
|
addConnector(this);
|
|
4729
|
-
return this.
|
|
4744
|
+
return this._login(credentials, options);
|
|
4730
4745
|
};
|
|
4731
4746
|
/**
|
|
4732
4747
|
* Disconnecting a user. Aborting all current requests
|
|
@@ -4739,29 +4754,16 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4739
4754
|
this.emitter.emit('logout');
|
|
4740
4755
|
this.resources.cache.clean();
|
|
4741
4756
|
};
|
|
4742
|
-
NgwConnector.prototype.getUserInfo = function (credentials) {
|
|
4743
|
-
var _this = this;
|
|
4757
|
+
NgwConnector.prototype.getUserInfo = function (credentials, options) {
|
|
4744
4758
|
if (this.user && this.user.id) {
|
|
4745
4759
|
return CancelablePromise.resolve(this.user);
|
|
4746
4760
|
}
|
|
4747
4761
|
if (credentials) {
|
|
4748
4762
|
this.options.auth = credentials;
|
|
4749
4763
|
}
|
|
4750
|
-
var
|
|
4751
|
-
headers: this.getAuthorizationHeaders(credentials),
|
|
4752
|
-
// withCredentials: true
|
|
4753
|
-
};
|
|
4764
|
+
var options_ = __assign({ headers: this.getAuthorizationHeaders(credentials) }, options);
|
|
4754
4765
|
// Do not use apiRequest('auth.current_user') to avoid circular-references
|
|
4755
|
-
return this.makeQuery('/api/component/auth/current_user', {},
|
|
4756
|
-
.then(function (data) {
|
|
4757
|
-
_this.user = data;
|
|
4758
|
-
_this.emitter.emit('login', data);
|
|
4759
|
-
return data;
|
|
4760
|
-
})
|
|
4761
|
-
.catch(function (er) {
|
|
4762
|
-
_this.emitter.emit('login:error', er);
|
|
4763
|
-
throw er;
|
|
4764
|
-
});
|
|
4766
|
+
return this.makeQuery('/api/component/auth/current_user', {}, options_);
|
|
4765
4767
|
};
|
|
4766
4768
|
/**
|
|
4767
4769
|
* Obtaining the required Headers for authentication of requests in the NGW.
|
|
@@ -4827,6 +4829,7 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4827
4829
|
*/
|
|
4828
4830
|
NgwConnector.prototype.apiRequest = function (name, params_, requestOptions) {
|
|
4829
4831
|
var _this = this;
|
|
4832
|
+
var _a;
|
|
4830
4833
|
if (params_ === void 0) { params_ = {}; }
|
|
4831
4834
|
if (requestOptions === void 0) { requestOptions = {}; }
|
|
4832
4835
|
var method = requestOptions.method, headers = requestOptions.headers, withCredentials = requestOptions.withCredentials, responseType = requestOptions.responseType;
|
|
@@ -4841,7 +4844,7 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
4841
4844
|
withCredentials: withCredentials,
|
|
4842
4845
|
responseType: responseType,
|
|
4843
4846
|
baseUrl: this.options.baseUrl,
|
|
4844
|
-
|
|
4847
|
+
userId: (_a = this.user) === null || _a === void 0 ? void 0 : _a.id,
|
|
4845
4848
|
})));
|
|
4846
4849
|
}
|
|
4847
4850
|
return makeApiRequest();
|
|
@@ -5050,6 +5053,19 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
5050
5053
|
this.activeRequests.push(request);
|
|
5051
5054
|
return request;
|
|
5052
5055
|
};
|
|
5056
|
+
NgwConnector.prototype._login = function (credentials, options) {
|
|
5057
|
+
var _this = this;
|
|
5058
|
+
return this.getUserInfo(credentials, options)
|
|
5059
|
+
.then(function (data) {
|
|
5060
|
+
_this.user = data;
|
|
5061
|
+
_this.emitter.emit('login', data);
|
|
5062
|
+
return data;
|
|
5063
|
+
})
|
|
5064
|
+
.catch(function (er) {
|
|
5065
|
+
_this.emitter.emit('login:error', er);
|
|
5066
|
+
throw er;
|
|
5067
|
+
});
|
|
5068
|
+
};
|
|
5053
5069
|
NgwConnector.prototype._cleanActiveRequests = function (request) {
|
|
5054
5070
|
var activeRequestIndex = this.activeRequests.indexOf(request);
|
|
5055
5071
|
if (activeRequestIndex !== -1) {
|
|
@@ -5393,14 +5409,14 @@ function getQueries(opt, _queries, _parentAllParams) {
|
|
|
5393
5409
|
function createWktFromCoordArray(coord) {
|
|
5394
5410
|
var polygon = coord.map(function (_a) {
|
|
5395
5411
|
var lng = _a[0], lat = _a[1];
|
|
5396
|
-
var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
|
|
5412
|
+
var _b = degrees2meters(lng, lat).map(function (c) { return round(c); }), x = _b[0], y = _b[1];
|
|
5397
5413
|
return x + ' ' + y;
|
|
5398
5414
|
});
|
|
5399
5415
|
return "POLYGON((".concat(polygon.join(', '), "))");
|
|
5400
5416
|
}
|
|
5401
5417
|
function fetchNgwLayerItemsRequest(options) {
|
|
5402
5418
|
var params = __assign({}, FEATURE_REQUEST_PARAMS);
|
|
5403
|
-
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;
|
|
5419
|
+
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;
|
|
5404
5420
|
if (limit) {
|
|
5405
5421
|
if (limit !== Number.POSITIVE_INFINITY) {
|
|
5406
5422
|
params.limit = limit;
|
|
@@ -5413,6 +5429,9 @@ function fetchNgwLayerItemsRequest(options) {
|
|
|
5413
5429
|
if (offset) {
|
|
5414
5430
|
params.offset = offset;
|
|
5415
5431
|
}
|
|
5432
|
+
if (geomFormat) {
|
|
5433
|
+
params.geom_format = geomFormat;
|
|
5434
|
+
}
|
|
5416
5435
|
updateItemRequestParam(params, options);
|
|
5417
5436
|
if (orderBy) {
|
|
5418
5437
|
params.order_by = orderBy.join(',');
|
|
@@ -8319,14 +8338,6 @@ function prepareWebMapOptions(options) {
|
|
|
8319
8338
|
return options;
|
|
8320
8339
|
}
|
|
8321
8340
|
|
|
8322
|
-
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
8323
|
-
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
8324
|
-
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
8325
|
-
Math.pow(2, zoom + 8);
|
|
8326
|
-
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
8327
|
-
return radius;
|
|
8328
|
-
}
|
|
8329
|
-
|
|
8330
8341
|
/**
|
|
8331
8342
|
* Base class containing the logic of interaction WebMap with NextGIS services.
|
|
8332
8343
|
*
|
|
@@ -8675,7 +8686,7 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8675
8686
|
this.$$selectFromNgwRaster = function (ev) {
|
|
8676
8687
|
var count = _this._getSelectListenersCount();
|
|
8677
8688
|
if (count) {
|
|
8678
|
-
_this.
|
|
8689
|
+
_this.selectFromNgwRaster(ev);
|
|
8679
8690
|
}
|
|
8680
8691
|
};
|
|
8681
8692
|
this.$$selectFromNgwVector = function (ev) {
|
|
@@ -8747,6 +8758,72 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8747
8758
|
}
|
|
8748
8759
|
});
|
|
8749
8760
|
};
|
|
8761
|
+
NgwMap.prototype.selectFromNgwRaster = function (ev) {
|
|
8762
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8763
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8764
|
+
var _this = this;
|
|
8765
|
+
return __generator(this, function (_b) {
|
|
8766
|
+
switch (_b.label) {
|
|
8767
|
+
case 0:
|
|
8768
|
+
this._emitStatusEvent('ngw:preselect');
|
|
8769
|
+
promises = [];
|
|
8770
|
+
layers = Object.values(this._ngwLayers);
|
|
8771
|
+
layers.sort(function (a, b) {
|
|
8772
|
+
if (a.layer.order && b.layer.order) {
|
|
8773
|
+
return b.layer.order - a.layer.order;
|
|
8774
|
+
}
|
|
8775
|
+
return 1;
|
|
8776
|
+
});
|
|
8777
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
8778
|
+
l = layers_1[_i];
|
|
8779
|
+
layer = l.layer;
|
|
8780
|
+
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
8781
|
+
? layer.getIdentificationIds
|
|
8782
|
+
: false;
|
|
8783
|
+
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
8784
|
+
promises.push(identFunc.call(layer));
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
getIdsPromise = Promise.all(promises);
|
|
8788
|
+
return [4 /*yield*/, getIdsPromise];
|
|
8789
|
+
case 1:
|
|
8790
|
+
getIds = _b.sent();
|
|
8791
|
+
ids = [];
|
|
8792
|
+
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8793
|
+
x = getIds_1[_a];
|
|
8794
|
+
if (x) {
|
|
8795
|
+
ids.push.apply(ids, x);
|
|
8796
|
+
}
|
|
8797
|
+
}
|
|
8798
|
+
if (!ids.length) {
|
|
8799
|
+
this._emitStatusEvent('ngw:select', null);
|
|
8800
|
+
return [2 /*return*/];
|
|
8801
|
+
}
|
|
8802
|
+
pixelRadius = this.options.pixelRadius || 10;
|
|
8803
|
+
center = this.getCenter();
|
|
8804
|
+
zoom = this.getZoom();
|
|
8805
|
+
zoom = zoom !== undefined ? zoom : 20;
|
|
8806
|
+
if (!center || !zoom) {
|
|
8807
|
+
this._emitStatusEvent('ngw:select', null);
|
|
8808
|
+
return [2 /*return*/];
|
|
8809
|
+
}
|
|
8810
|
+
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
8811
|
+
selectPromise = sendIdentifyRequest(ev, {
|
|
8812
|
+
layers: ids,
|
|
8813
|
+
connector: this.connector,
|
|
8814
|
+
radius: radius,
|
|
8815
|
+
}).then(function (resp) {
|
|
8816
|
+
var identify = __assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev });
|
|
8817
|
+
var identifyEvent = _this._prepareToIdentify(identify);
|
|
8818
|
+
_this._emitStatusEvent('ngw:select', identify);
|
|
8819
|
+
return identifyEvent;
|
|
8820
|
+
});
|
|
8821
|
+
this._addPromise('select', selectPromise);
|
|
8822
|
+
return [2 /*return*/, selectPromise];
|
|
8823
|
+
}
|
|
8824
|
+
});
|
|
8825
|
+
});
|
|
8826
|
+
};
|
|
8750
8827
|
NgwMap.prototype._addPromise = function (groupName, promise) {
|
|
8751
8828
|
var group = this._promises[groupName];
|
|
8752
8829
|
if (group && group.indexOf(promise) === -1) {
|
|
@@ -8882,70 +8959,6 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8882
8959
|
}
|
|
8883
8960
|
}
|
|
8884
8961
|
};
|
|
8885
|
-
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
8886
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
8887
|
-
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
8888
|
-
var _this = this;
|
|
8889
|
-
return __generator(this, function (_b) {
|
|
8890
|
-
switch (_b.label) {
|
|
8891
|
-
case 0:
|
|
8892
|
-
this._emitStatusEvent('ngw:preselect');
|
|
8893
|
-
promises = [];
|
|
8894
|
-
layers = Object.values(this._ngwLayers);
|
|
8895
|
-
layers.sort(function (a, b) {
|
|
8896
|
-
if (a.layer.order && b.layer.order) {
|
|
8897
|
-
return b.layer.order - a.layer.order;
|
|
8898
|
-
}
|
|
8899
|
-
return 1;
|
|
8900
|
-
});
|
|
8901
|
-
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
8902
|
-
l = layers_1[_i];
|
|
8903
|
-
layer = l.layer;
|
|
8904
|
-
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
8905
|
-
? layer.getIdentificationIds
|
|
8906
|
-
: false;
|
|
8907
|
-
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
8908
|
-
promises.push(identFunc.call(layer));
|
|
8909
|
-
}
|
|
8910
|
-
}
|
|
8911
|
-
getIdsPromise = Promise.all(promises);
|
|
8912
|
-
return [4 /*yield*/, getIdsPromise];
|
|
8913
|
-
case 1:
|
|
8914
|
-
getIds = _b.sent();
|
|
8915
|
-
ids = [];
|
|
8916
|
-
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
8917
|
-
x = getIds_1[_a];
|
|
8918
|
-
if (x) {
|
|
8919
|
-
ids.push.apply(ids, x);
|
|
8920
|
-
}
|
|
8921
|
-
}
|
|
8922
|
-
if (!ids.length) {
|
|
8923
|
-
this._emitStatusEvent('ngw:select', null);
|
|
8924
|
-
return [2 /*return*/];
|
|
8925
|
-
}
|
|
8926
|
-
pixelRadius = this.options.pixelRadius || 10;
|
|
8927
|
-
center = this.getCenter();
|
|
8928
|
-
zoom = this.getZoom();
|
|
8929
|
-
zoom = zoom !== undefined ? zoom : 20;
|
|
8930
|
-
if (!center || !zoom) {
|
|
8931
|
-
this._emitStatusEvent('ngw:select', null);
|
|
8932
|
-
return [2 /*return*/];
|
|
8933
|
-
}
|
|
8934
|
-
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
8935
|
-
selectPromise = sendIdentifyRequest(ev, {
|
|
8936
|
-
layers: ids,
|
|
8937
|
-
connector: this.connector,
|
|
8938
|
-
radius: radius,
|
|
8939
|
-
}).then(function (resp) {
|
|
8940
|
-
_this._emitStatusEvent('ngw:select', _this._prepareToIdentify(__assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev })));
|
|
8941
|
-
return resp;
|
|
8942
|
-
});
|
|
8943
|
-
this._addPromise('select', selectPromise);
|
|
8944
|
-
return [2 /*return*/, selectPromise];
|
|
8945
|
-
}
|
|
8946
|
-
});
|
|
8947
|
-
});
|
|
8948
|
-
};
|
|
8949
8962
|
NgwMap.prototype._prepareToIdentify = function (identify) {
|
|
8950
8963
|
var _this = this;
|
|
8951
8964
|
var getIdentifyItems_ = function () {
|