@nextgis/ngw-leaflet 1.15.0 → 1.16.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/ngw-leaflet.esm-browser.js +168 -125
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +2 -2
- 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 +168 -125
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +2 -2
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.16.1; author: NextGIS */
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -15263,7 +15263,9 @@ function getBoundsFeature(b) {
|
|
|
15263
15263
|
|
|
15264
15264
|
var d2r = Math.PI / 180; // degrees to radians
|
|
15265
15265
|
var r2d = 180 / Math.PI; // radians to degrees
|
|
15266
|
-
function getCirclePolygonCoordinates(lng, lat,
|
|
15266
|
+
function getCirclePolygonCoordinates(lng, lat,
|
|
15267
|
+
/** In kilometers */
|
|
15268
|
+
radius, points) {
|
|
15267
15269
|
if (radius === void 0) { radius = 10; }
|
|
15268
15270
|
if (points === void 0) { points = 6; }
|
|
15269
15271
|
// find the radius in lat/lon
|
|
@@ -15313,6 +15315,14 @@ function isLngLatBoundsArray(array) {
|
|
|
15313
15315
|
array.every(function (x) { return typeof x === 'number'; }));
|
|
15314
15316
|
}
|
|
15315
15317
|
|
|
15318
|
+
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
15319
|
+
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
15320
|
+
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
15321
|
+
Math.pow(2, zoom + 8);
|
|
15322
|
+
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
15323
|
+
return radius;
|
|
15324
|
+
}
|
|
15325
|
+
|
|
15316
15326
|
/**
|
|
15317
15327
|
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
|
15318
15328
|
* target object. Returns the target object.
|
|
@@ -15613,6 +15623,24 @@ function createPropertiesPaint(propertiesPaint) {
|
|
|
15613
15623
|
return mask;
|
|
15614
15624
|
};
|
|
15615
15625
|
}
|
|
15626
|
+
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
|
|
15627
|
+
var expressionCallback = createExpressionCallback(paint);
|
|
15628
|
+
if (expressionCallback) {
|
|
15629
|
+
var expressionPaintCb = function (feature) {
|
|
15630
|
+
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
|
|
15631
|
+
};
|
|
15632
|
+
expressionPaintCb.paint = paint;
|
|
15633
|
+
return expressionPaintCb;
|
|
15634
|
+
}
|
|
15635
|
+
var newPaint = __assign({}, defaultPaint);
|
|
15636
|
+
newPaint = __assign(__assign({}, newPaint), paint);
|
|
15637
|
+
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
15638
|
+
newPaint.stroke =
|
|
15639
|
+
newPaint.stroke !== undefined
|
|
15640
|
+
? newPaint.stroke
|
|
15641
|
+
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
15642
|
+
return newPaint;
|
|
15643
|
+
}
|
|
15616
15644
|
function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
15617
15645
|
if (!paint) {
|
|
15618
15646
|
throw new Error('paint is empty');
|
|
@@ -15642,20 +15670,7 @@ function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
|
15642
15670
|
return paint;
|
|
15643
15671
|
}
|
|
15644
15672
|
else {
|
|
15645
|
-
|
|
15646
|
-
if (expressionCallback_1) {
|
|
15647
|
-
var expressionPaintCb = function (feature) {
|
|
15648
|
-
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
|
|
15649
|
-
};
|
|
15650
|
-
expressionPaintCb.paint = paint;
|
|
15651
|
-
return expressionPaintCb;
|
|
15652
|
-
}
|
|
15653
|
-
newPaint = __assign(__assign({}, newPaint), paint);
|
|
15654
|
-
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
15655
|
-
newPaint.stroke =
|
|
15656
|
-
newPaint.stroke !== undefined
|
|
15657
|
-
? newPaint.stroke
|
|
15658
|
-
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
15673
|
+
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
|
|
15659
15674
|
}
|
|
15660
15675
|
if (isPaintCallback(newPaint)) {
|
|
15661
15676
|
return newPaint;
|
|
@@ -18717,6 +18732,9 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18717
18732
|
if (this.options.route) {
|
|
18718
18733
|
this.routeStr = this.options.route;
|
|
18719
18734
|
}
|
|
18735
|
+
if (this.options.requestTransform) {
|
|
18736
|
+
this.requestTransform = this.options.requestTransform;
|
|
18737
|
+
}
|
|
18720
18738
|
this.resources = new ResourcesControl(this);
|
|
18721
18739
|
addConnector(this);
|
|
18722
18740
|
}
|
|
@@ -18724,6 +18742,9 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18724
18742
|
NgwConnector.create = function (options) {
|
|
18725
18743
|
return new this(options);
|
|
18726
18744
|
};
|
|
18745
|
+
NgwConnector.prototype.setRequestTransform = function (requestTransform) {
|
|
18746
|
+
this.requestTransform = requestTransform;
|
|
18747
|
+
};
|
|
18727
18748
|
/**
|
|
18728
18749
|
* Fast way to specify the connection address to NextGIS Web.
|
|
18729
18750
|
* The current connection will be severed.
|
|
@@ -18983,9 +19004,8 @@ var NgwConnector = /** @class */ (function () {
|
|
|
18983
19004
|
if (params) {
|
|
18984
19005
|
url = template(url, params);
|
|
18985
19006
|
}
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
return this._loadData(encodeURI(url), options);
|
|
19007
|
+
url = encodeURI(fixUrlStr(url));
|
|
19008
|
+
return this._loadData(url, options);
|
|
18989
19009
|
}
|
|
18990
19010
|
else {
|
|
18991
19011
|
throw new Error('Empty `url` not allowed');
|
|
@@ -19078,6 +19098,11 @@ var NgwConnector = /** @class */ (function () {
|
|
|
19078
19098
|
// options.withCredentials = true;
|
|
19079
19099
|
options.headers = __assign(__assign({}, _this.getAuthorizationHeaders()), options.headers);
|
|
19080
19100
|
}
|
|
19101
|
+
if (_this.requestTransform) {
|
|
19102
|
+
var _a = _this.requestTransform(url, options), transUrl = _a[0], transOptions = _a[1];
|
|
19103
|
+
url = transUrl;
|
|
19104
|
+
options = transOptions;
|
|
19105
|
+
}
|
|
19081
19106
|
loadData(url, resolve, options, reject, onCancel);
|
|
19082
19107
|
})
|
|
19083
19108
|
.then(function (resp) {
|
|
@@ -19102,6 +19127,7 @@ var NgwConnector = /** @class */ (function () {
|
|
|
19102
19127
|
typeof options.signal.addEventListener === 'function') {
|
|
19103
19128
|
options.signal.addEventListener('abort', function () {
|
|
19104
19129
|
request.cancel();
|
|
19130
|
+
_this._cleanActiveRequests(request);
|
|
19105
19131
|
});
|
|
19106
19132
|
}
|
|
19107
19133
|
this.activeRequests.push(request);
|
|
@@ -20692,10 +20718,12 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
20692
20718
|
};
|
|
20693
20719
|
if (item.item_type === 'group' || item.item_type === 'root') {
|
|
20694
20720
|
if (item.children && item.children.length) {
|
|
20695
|
-
this.getChildren(item)
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20721
|
+
var children = this.getChildren(item);
|
|
20722
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
20723
|
+
var x = children_1[_i];
|
|
20724
|
+
var children_2 = new this.constructor(this.webMap, x, this.options, this.connector, this);
|
|
20725
|
+
this.tree.addChild(children_2);
|
|
20726
|
+
}
|
|
20699
20727
|
}
|
|
20700
20728
|
return Promise.resolve();
|
|
20701
20729
|
}
|
|
@@ -20736,7 +20764,7 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
20736
20764
|
headers: this.options.headers,
|
|
20737
20765
|
crossOrigin: this.options.crossOrigin,
|
|
20738
20766
|
setViewDelay: this.options.setViewDelay,
|
|
20739
|
-
params: { resource: this.item.resourceId },
|
|
20767
|
+
params: { resource: this.item.resourceId, item: this.item },
|
|
20740
20768
|
};
|
|
20741
20769
|
if (this.options.order) {
|
|
20742
20770
|
var subOrder = this.options.drawOrderEnabled && 'draw_order_position' in item
|
|
@@ -20747,6 +20775,9 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
20747
20775
|
var subLevel = String(subOrder).padStart(4, '0');
|
|
20748
20776
|
options.order = Number((this.options.order | 0) + '.' + subLevel);
|
|
20749
20777
|
}
|
|
20778
|
+
if (this.options.popupOptions) {
|
|
20779
|
+
options.popupOptions = this.options.popupOptions;
|
|
20780
|
+
}
|
|
20750
20781
|
if (item.item_type === 'layer') {
|
|
20751
20782
|
var _a = this._getZoomRange(item), maxZoom = _a.maxZoom, minZoom = _a.minZoom;
|
|
20752
20783
|
objectAssign(options, {
|
|
@@ -20794,8 +20825,8 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
20794
20825
|
};
|
|
20795
20826
|
NgwWebmapItem.prototype._sumUp = function (children, totalValue) {
|
|
20796
20827
|
if (totalValue === void 0) { totalValue = 0; }
|
|
20797
|
-
for (var _i = 0,
|
|
20798
|
-
var child =
|
|
20828
|
+
for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
|
|
20829
|
+
var child = children_3[_i];
|
|
20799
20830
|
if (child.item_type === 'layer') {
|
|
20800
20831
|
totalValue += 1;
|
|
20801
20832
|
child.draw_order_position = child.draw_order_position || totalValue;
|
|
@@ -21102,8 +21133,6 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
21102
21133
|
this._extent &&
|
|
21103
21134
|
extentConstrained) {
|
|
21104
21135
|
this.options.webMap.setView({ maxBounds: this._extent });
|
|
21105
|
-
// @ts-ignore
|
|
21106
|
-
window.webmap = this.options.webMap;
|
|
21107
21136
|
}
|
|
21108
21137
|
return [2 /*return*/, this.layer];
|
|
21109
21138
|
}
|
|
@@ -21276,6 +21305,7 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
21276
21305
|
options.minZoom = _this.options.minZoom;
|
|
21277
21306
|
options.maxZoom = _this.options.maxZoom;
|
|
21278
21307
|
options.drawOrderEnabled = webmap_1.draw_order_enabled;
|
|
21308
|
+
options.popupOptions = _this.options.popupOptions;
|
|
21279
21309
|
var layer = new _this.NgwWebmapItem(_this.options.webMap, webmap_1.root_item, options, _this.options.connector);
|
|
21280
21310
|
layer.emitter.on('init', function () { return resolve(layer); });
|
|
21281
21311
|
})];
|
|
@@ -21406,30 +21436,34 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
21406
21436
|
};
|
|
21407
21437
|
NgwWebmapLayerAdapter.prototype._getWebMapIds = function () {
|
|
21408
21438
|
return __awaiter(this, void 0, void 0, function () {
|
|
21409
|
-
var webMapItem, layers,
|
|
21410
|
-
var _this = this;
|
|
21439
|
+
var webMapItem, layers, promises, _loop_2, this_2, _i, layers_1, x, ids;
|
|
21411
21440
|
return __generator(this, function (_a) {
|
|
21412
21441
|
switch (_a.label) {
|
|
21413
21442
|
case 0:
|
|
21414
21443
|
webMapItem = this.layer;
|
|
21415
21444
|
if (!(webMapItem && webMapItem.item.item_type === 'root')) return [3 /*break*/, 2];
|
|
21416
21445
|
layers = webMapItem.tree.getDescendants();
|
|
21417
|
-
|
|
21418
|
-
|
|
21446
|
+
promises = [];
|
|
21447
|
+
_loop_2 = function (x) {
|
|
21419
21448
|
var item = x.item;
|
|
21420
21449
|
if (item.item_type === 'layer') {
|
|
21421
21450
|
var id = item.layer_style_id;
|
|
21422
|
-
var promise =
|
|
21451
|
+
var promise = this_2.options.connector.getResource(id).then(function (y) {
|
|
21423
21452
|
if (y) {
|
|
21424
21453
|
var parentId = Number(y.resource.parent.id);
|
|
21425
21454
|
item.parentId = parentId;
|
|
21426
21455
|
return parentId;
|
|
21427
21456
|
}
|
|
21428
21457
|
});
|
|
21429
|
-
|
|
21458
|
+
promises.push(promise);
|
|
21430
21459
|
}
|
|
21431
|
-
}
|
|
21432
|
-
|
|
21460
|
+
};
|
|
21461
|
+
this_2 = this;
|
|
21462
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
21463
|
+
x = layers_1[_i];
|
|
21464
|
+
_loop_2(x);
|
|
21465
|
+
}
|
|
21466
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
21433
21467
|
case 1:
|
|
21434
21468
|
ids = _a.sent();
|
|
21435
21469
|
return [2 /*return*/, ids.filter(function (x) { return x !== undefined; })];
|
|
@@ -22356,14 +22390,6 @@ function prepareWebMapOptions(options) {
|
|
|
22356
22390
|
return options;
|
|
22357
22391
|
}
|
|
22358
22392
|
|
|
22359
|
-
function getIdentifyRadius(center, zoom, pixelRadius) {
|
|
22360
|
-
pixelRadius = pixelRadius !== null && pixelRadius !== void 0 ? pixelRadius : 10;
|
|
22361
|
-
var metresPerPixel = (40075016.686 * Math.abs(Math.cos((center[1] * 180) / Math.PI))) /
|
|
22362
|
-
Math.pow(2, zoom + 8);
|
|
22363
|
-
var radius = pixelRadius * metresPerPixel * 0.0005;
|
|
22364
|
-
return radius;
|
|
22365
|
-
}
|
|
22366
|
-
|
|
22367
22393
|
/**
|
|
22368
22394
|
* Base class containing the logic of interaction WebMap with NextGIS services.
|
|
22369
22395
|
*
|
|
@@ -22712,7 +22738,7 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
22712
22738
|
this.$$selectFromNgwRaster = function (ev) {
|
|
22713
22739
|
var count = _this._getSelectListenersCount();
|
|
22714
22740
|
if (count) {
|
|
22715
|
-
_this.
|
|
22741
|
+
_this.selectFromNgwRaster(ev);
|
|
22716
22742
|
}
|
|
22717
22743
|
};
|
|
22718
22744
|
this.$$selectFromNgwVector = function (ev) {
|
|
@@ -22784,6 +22810,72 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
22784
22810
|
}
|
|
22785
22811
|
});
|
|
22786
22812
|
};
|
|
22813
|
+
NgwMap.prototype.selectFromNgwRaster = function (ev) {
|
|
22814
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
22815
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
22816
|
+
var _this = this;
|
|
22817
|
+
return __generator(this, function (_b) {
|
|
22818
|
+
switch (_b.label) {
|
|
22819
|
+
case 0:
|
|
22820
|
+
this._emitStatusEvent('ngw:preselect');
|
|
22821
|
+
promises = [];
|
|
22822
|
+
layers = Object.values(this._ngwLayers);
|
|
22823
|
+
layers.sort(function (a, b) {
|
|
22824
|
+
if (a.layer.order && b.layer.order) {
|
|
22825
|
+
return b.layer.order - a.layer.order;
|
|
22826
|
+
}
|
|
22827
|
+
return 1;
|
|
22828
|
+
});
|
|
22829
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
22830
|
+
l = layers_1[_i];
|
|
22831
|
+
layer = l.layer;
|
|
22832
|
+
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
22833
|
+
? layer.getIdentificationIds
|
|
22834
|
+
: false;
|
|
22835
|
+
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
22836
|
+
promises.push(identFunc.call(layer));
|
|
22837
|
+
}
|
|
22838
|
+
}
|
|
22839
|
+
getIdsPromise = Promise.all(promises);
|
|
22840
|
+
return [4 /*yield*/, getIdsPromise];
|
|
22841
|
+
case 1:
|
|
22842
|
+
getIds = _b.sent();
|
|
22843
|
+
ids = [];
|
|
22844
|
+
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
22845
|
+
x = getIds_1[_a];
|
|
22846
|
+
if (x) {
|
|
22847
|
+
ids.push.apply(ids, x);
|
|
22848
|
+
}
|
|
22849
|
+
}
|
|
22850
|
+
if (!ids.length) {
|
|
22851
|
+
this._emitStatusEvent('ngw:select', null);
|
|
22852
|
+
return [2 /*return*/];
|
|
22853
|
+
}
|
|
22854
|
+
pixelRadius = this.options.pixelRadius || 10;
|
|
22855
|
+
center = this.getCenter();
|
|
22856
|
+
zoom = this.getZoom();
|
|
22857
|
+
zoom = zoom !== undefined ? zoom : 20;
|
|
22858
|
+
if (!center || !zoom) {
|
|
22859
|
+
this._emitStatusEvent('ngw:select', null);
|
|
22860
|
+
return [2 /*return*/];
|
|
22861
|
+
}
|
|
22862
|
+
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
22863
|
+
selectPromise = sendIdentifyRequest(ev, {
|
|
22864
|
+
layers: ids,
|
|
22865
|
+
connector: this.connector,
|
|
22866
|
+
radius: radius,
|
|
22867
|
+
}).then(function (resp) {
|
|
22868
|
+
var identify = __assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev });
|
|
22869
|
+
var identifyEvent = _this._prepareToIdentify(identify);
|
|
22870
|
+
_this._emitStatusEvent('ngw:select', identify);
|
|
22871
|
+
return identifyEvent;
|
|
22872
|
+
});
|
|
22873
|
+
this._addPromise('select', selectPromise);
|
|
22874
|
+
return [2 /*return*/, selectPromise];
|
|
22875
|
+
}
|
|
22876
|
+
});
|
|
22877
|
+
});
|
|
22878
|
+
};
|
|
22787
22879
|
NgwMap.prototype._addPromise = function (groupName, promise) {
|
|
22788
22880
|
var group = this._promises[groupName];
|
|
22789
22881
|
if (group && group.indexOf(promise) === -1) {
|
|
@@ -22919,70 +23011,6 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
22919
23011
|
}
|
|
22920
23012
|
}
|
|
22921
23013
|
};
|
|
22922
|
-
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
22923
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
22924
|
-
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, _a, getIds_1, x, pixelRadius, center, zoom, radius, selectPromise;
|
|
22925
|
-
var _this = this;
|
|
22926
|
-
return __generator(this, function (_b) {
|
|
22927
|
-
switch (_b.label) {
|
|
22928
|
-
case 0:
|
|
22929
|
-
this._emitStatusEvent('ngw:preselect');
|
|
22930
|
-
promises = [];
|
|
22931
|
-
layers = Object.values(this._ngwLayers);
|
|
22932
|
-
layers.sort(function (a, b) {
|
|
22933
|
-
if (a.layer.order && b.layer.order) {
|
|
22934
|
-
return b.layer.order - a.layer.order;
|
|
22935
|
-
}
|
|
22936
|
-
return 1;
|
|
22937
|
-
});
|
|
22938
|
-
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
22939
|
-
l = layers_1[_i];
|
|
22940
|
-
layer = l.layer;
|
|
22941
|
-
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
22942
|
-
? layer.getIdentificationIds
|
|
22943
|
-
: false;
|
|
22944
|
-
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
22945
|
-
promises.push(identFunc.call(layer));
|
|
22946
|
-
}
|
|
22947
|
-
}
|
|
22948
|
-
getIdsPromise = Promise.all(promises);
|
|
22949
|
-
return [4 /*yield*/, getIdsPromise];
|
|
22950
|
-
case 1:
|
|
22951
|
-
getIds = _b.sent();
|
|
22952
|
-
ids = [];
|
|
22953
|
-
for (_a = 0, getIds_1 = getIds; _a < getIds_1.length; _a++) {
|
|
22954
|
-
x = getIds_1[_a];
|
|
22955
|
-
if (x) {
|
|
22956
|
-
ids.push.apply(ids, x);
|
|
22957
|
-
}
|
|
22958
|
-
}
|
|
22959
|
-
if (!ids.length) {
|
|
22960
|
-
this._emitStatusEvent('ngw:select', null);
|
|
22961
|
-
return [2 /*return*/];
|
|
22962
|
-
}
|
|
22963
|
-
pixelRadius = this.options.pixelRadius || 10;
|
|
22964
|
-
center = this.getCenter();
|
|
22965
|
-
zoom = this.getZoom();
|
|
22966
|
-
zoom = zoom !== undefined ? zoom : 20;
|
|
22967
|
-
if (!center || !zoom) {
|
|
22968
|
-
this._emitStatusEvent('ngw:select', null);
|
|
22969
|
-
return [2 /*return*/];
|
|
22970
|
-
}
|
|
22971
|
-
radius = getIdentifyRadius(center, zoom, pixelRadius);
|
|
22972
|
-
selectPromise = sendIdentifyRequest(ev, {
|
|
22973
|
-
layers: ids,
|
|
22974
|
-
connector: this.connector,
|
|
22975
|
-
radius: radius,
|
|
22976
|
-
}).then(function (resp) {
|
|
22977
|
-
_this._emitStatusEvent('ngw:select', _this._prepareToIdentify(__assign(__assign({}, resp), { resources: ids, sourceType: 'raster', event: ev })));
|
|
22978
|
-
return resp;
|
|
22979
|
-
});
|
|
22980
|
-
this._addPromise('select', selectPromise);
|
|
22981
|
-
return [2 /*return*/, selectPromise];
|
|
22982
|
-
}
|
|
22983
|
-
});
|
|
22984
|
-
});
|
|
22985
|
-
};
|
|
22986
23014
|
NgwMap.prototype._prepareToIdentify = function (identify) {
|
|
22987
23015
|
var _this = this;
|
|
22988
23016
|
var getIdentifyItems_ = function () {
|
|
@@ -23295,12 +23323,13 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23295
23323
|
this._removeMapListener();
|
|
23296
23324
|
};
|
|
23297
23325
|
GeoJsonAdapter.prototype.select = function (findFeatureFun) {
|
|
23298
|
-
|
|
23326
|
+
this.unselect();
|
|
23299
23327
|
if (findFeatureFun) {
|
|
23300
23328
|
var def = this._layers.filter(findFeatureFun);
|
|
23301
|
-
def.
|
|
23302
|
-
|
|
23303
|
-
|
|
23329
|
+
for (var _i = 0, def_1 = def; _i < def_1.length; _i++) {
|
|
23330
|
+
var x = def_1[_i];
|
|
23331
|
+
this._selectLayer(x, 'api');
|
|
23332
|
+
}
|
|
23304
23333
|
}
|
|
23305
23334
|
else if (!this.selected) {
|
|
23306
23335
|
this.selected = true;
|
|
@@ -23713,13 +23742,13 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23713
23742
|
var _this = this;
|
|
23714
23743
|
var layer_ = this.layer;
|
|
23715
23744
|
if (layer_) {
|
|
23716
|
-
var
|
|
23745
|
+
var def_2 = __assign({ target: this, feature: feature, layer: layer }, createFeaturePositionOptions(feature));
|
|
23717
23746
|
// @ts-ignore
|
|
23718
23747
|
layer.options.pane = this.pane;
|
|
23719
|
-
this._layers.push(
|
|
23748
|
+
this._layers.push(def_2);
|
|
23720
23749
|
var ok = true;
|
|
23721
23750
|
if (this._filterFun) {
|
|
23722
|
-
ok = this._filterFun(
|
|
23751
|
+
ok = this._filterFun(def_2);
|
|
23723
23752
|
}
|
|
23724
23753
|
if (ok) {
|
|
23725
23754
|
var _a = this.options, popup_1 = _a.popup, popupOptions_1 = _a.popupOptions, selectable = _a.selectable, interactive = _a.interactive, selectOnHover = _a.selectOnHover;
|
|
@@ -23729,10 +23758,10 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23729
23758
|
if (selectable) {
|
|
23730
23759
|
if (selectOnHover) {
|
|
23731
23760
|
layer.on('mouseover', function () {
|
|
23732
|
-
_this._selectLayer(
|
|
23761
|
+
_this._selectLayer(def_2, 'hover');
|
|
23733
23762
|
});
|
|
23734
23763
|
layer.on('mouseout', function () {
|
|
23735
|
-
_this._unSelectLayer(
|
|
23764
|
+
_this._unSelectLayer(def_2);
|
|
23736
23765
|
});
|
|
23737
23766
|
}
|
|
23738
23767
|
else {
|
|
@@ -23799,10 +23828,12 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23799
23828
|
};
|
|
23800
23829
|
GeoJsonAdapter.prototype._selectLayer = function (def, type, latlng) {
|
|
23801
23830
|
var _this = this;
|
|
23802
|
-
this.
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23831
|
+
var multiselect = this.options.multiselect;
|
|
23832
|
+
if (!multiselect) {
|
|
23833
|
+
// To unselect layer on another layer click
|
|
23834
|
+
this.map._addUnselectCb(function () {
|
|
23835
|
+
_this._unSelectLayer(def);
|
|
23836
|
+
});
|
|
23806
23837
|
this._selectedLayers.forEach(function (x) { return _this._unSelectLayer(x); });
|
|
23807
23838
|
}
|
|
23808
23839
|
this._selectedLayers.push(def);
|
|
@@ -23879,14 +23910,26 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23879
23910
|
}
|
|
23880
23911
|
return geoJsonOptions;
|
|
23881
23912
|
};
|
|
23882
|
-
GeoJsonAdapter.prototype.
|
|
23913
|
+
GeoJsonAdapter.prototype._addMapClickListener = function () {
|
|
23883
23914
|
var map = this.map;
|
|
23884
23915
|
if (map) {
|
|
23885
|
-
var
|
|
23916
|
+
var unselectOnClick = this.options.unselectOnClick;
|
|
23886
23917
|
var uoc = unselectOnClick !== null && unselectOnClick !== void 0 ? unselectOnClick : true;
|
|
23887
23918
|
if (uoc) {
|
|
23888
23919
|
map.on('click', this.$unselect);
|
|
23889
23920
|
}
|
|
23921
|
+
}
|
|
23922
|
+
};
|
|
23923
|
+
GeoJsonAdapter.prototype._removeMapClickListener = function () {
|
|
23924
|
+
this.map.off('zoomend', this.$updateTooltip);
|
|
23925
|
+
this.map.off('moveend', this.$updateTooltip);
|
|
23926
|
+
this.map.off('click', this.$unselect);
|
|
23927
|
+
};
|
|
23928
|
+
GeoJsonAdapter.prototype._addMapListener = function () {
|
|
23929
|
+
var map = this.map;
|
|
23930
|
+
if (map) {
|
|
23931
|
+
var _a = this.options, labelField = _a.labelField, labelOnHover = _a.labelOnHover;
|
|
23932
|
+
this._addMapClickListener();
|
|
23890
23933
|
if (labelField && !labelOnHover) {
|
|
23891
23934
|
map.on('zoomend', this.$updateTooltip);
|
|
23892
23935
|
map.on('moveend', this.$updateTooltip);
|
|
@@ -23894,9 +23937,9 @@ var GeoJsonAdapter = /** @class */ (function (_super) {
|
|
|
23894
23937
|
}
|
|
23895
23938
|
};
|
|
23896
23939
|
GeoJsonAdapter.prototype._removeMapListener = function () {
|
|
23940
|
+
this._removeMapClickListener();
|
|
23897
23941
|
this.map.off('zoomend', this.$updateTooltip);
|
|
23898
23942
|
this.map.off('moveend', this.$updateTooltip);
|
|
23899
|
-
this.map.off('click', this.$unselect);
|
|
23900
23943
|
};
|
|
23901
23944
|
return GeoJsonAdapter;
|
|
23902
23945
|
}(BaseAdapter));
|