@nextgis/ngw-map 1.5.1 → 1.8.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-map.cjs.js +6 -6
- 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 +176 -59
- 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 +7 -7
- 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 +248 -92
- 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.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.8.1; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -2416,13 +2416,14 @@ var NgwMap = (function (exports) {
|
|
|
2416
2416
|
*/
|
|
2417
2417
|
WebMapLayers.prototype.fitLayer = function (layerDef, options) {
|
|
2418
2418
|
return __awaiter(this, void 0, void 0, function () {
|
|
2419
|
-
var layer, extent;
|
|
2419
|
+
var layer, getBounds, extent;
|
|
2420
2420
|
return __generator(this, function (_a) {
|
|
2421
2421
|
switch (_a.label) {
|
|
2422
2422
|
case 0:
|
|
2423
2423
|
layer = this.getLayer(layerDef);
|
|
2424
|
-
|
|
2425
|
-
return [
|
|
2424
|
+
getBounds = layer && (layer.getBounds || layer.getExtent);
|
|
2425
|
+
if (!getBounds) return [3 /*break*/, 2];
|
|
2426
|
+
return [4 /*yield*/, getBounds.call(layer)];
|
|
2426
2427
|
case 1:
|
|
2427
2428
|
extent = _a.sent();
|
|
2428
2429
|
if (extent) {
|
|
@@ -2546,7 +2547,7 @@ var NgwMap = (function (exports) {
|
|
|
2546
2547
|
var _a, _b;
|
|
2547
2548
|
if (options === void 0) { options = {}; }
|
|
2548
2549
|
return __awaiter(this, void 0, void 0, function () {
|
|
2549
|
-
var id, _order, adapterEngine, geoJsonOptions, _c, maxZoom, minZoom, visibility, modified, _adapter, layerId, layer, opacity, extent;
|
|
2550
|
+
var id, _order, adapterEngine, geoJsonOptions, _c, maxZoom, minZoom, visibility, modified, _adapter, layerId, layer, opacity, getBounds, extent;
|
|
2550
2551
|
return __generator(this, function (_d) {
|
|
2551
2552
|
switch (_d.label) {
|
|
2552
2553
|
case 0:
|
|
@@ -2649,8 +2650,9 @@ var NgwMap = (function (exports) {
|
|
|
2649
2650
|
if (opacity !== undefined && opacity <= 1) {
|
|
2650
2651
|
this.setLayerOpacity(_adapter, opacity);
|
|
2651
2652
|
}
|
|
2652
|
-
|
|
2653
|
-
return [
|
|
2653
|
+
getBounds = layer && (_adapter.getBounds || _adapter.getExtent);
|
|
2654
|
+
if (!(options.fit && getBounds)) return [3 /*break*/, 11];
|
|
2655
|
+
return [4 /*yield*/, getBounds.call(_adapter)];
|
|
2654
2656
|
case 9:
|
|
2655
2657
|
extent = _d.sent();
|
|
2656
2658
|
if (!extent) return [3 /*break*/, 11];
|
|
@@ -2790,11 +2792,19 @@ var NgwMap = (function (exports) {
|
|
|
2790
2792
|
opt.paint = opt.paint || {};
|
|
2791
2793
|
return this.addLayer(adapter || 'GEOJSON', opt);
|
|
2792
2794
|
};
|
|
2793
|
-
/** Shortcut for {@link WebMapLayers.addGeoJsonLayer} to
|
|
2795
|
+
/** Shortcut for {@link WebMapLayers.addGeoJsonLayer} to create GeoJson adapter with generic types for working in typescript */
|
|
2794
2796
|
WebMapLayers.prototype.addFeatureLayer = function (options) {
|
|
2795
2797
|
if (options === void 0) { options = {}; }
|
|
2796
2798
|
return this.addGeoJsonLayer(options);
|
|
2797
2799
|
};
|
|
2800
|
+
/** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
|
|
2801
|
+
WebMapLayers.prototype.addTileLayer = function (url, options) {
|
|
2802
|
+
return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
|
|
2803
|
+
};
|
|
2804
|
+
/** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
|
|
2805
|
+
WebMapLayers.prototype.addImageLayer = function (url, options) {
|
|
2806
|
+
return this.addLayer('IMAGE', __assign(__assign({}, options), { url: url }));
|
|
2807
|
+
};
|
|
2798
2808
|
/**
|
|
2799
2809
|
* Show added layer on the map by it definition.
|
|
2800
2810
|
*/
|
|
@@ -2830,7 +2840,7 @@ var NgwMap = (function (exports) {
|
|
|
2830
2840
|
var toStatus = status !== undefined ? status : !onMap;
|
|
2831
2841
|
var silent = options.silent !== undefined ? options.silent : false;
|
|
2832
2842
|
var action = function (l) { return __awaiter(_this, void 0, void 0, function () {
|
|
2833
|
-
var id, preEventName, eventName, order,
|
|
2843
|
+
var id, preEventName, eventName, order, anotherVisibleBaselayers, _i, anotherVisibleBaselayers_1, bl;
|
|
2834
2844
|
var _this = this;
|
|
2835
2845
|
return __generator(this, function (_a) {
|
|
2836
2846
|
switch (_a.label) {
|
|
@@ -2842,18 +2852,25 @@ var NgwMap = (function (exports) {
|
|
|
2842
2852
|
this._emitLayerEvent(preEventName, id, l);
|
|
2843
2853
|
this._emitLayerEvent('layer:pretoggle', id, l);
|
|
2844
2854
|
}
|
|
2845
|
-
if (!(toStatus && this.mapAdapter)) return [3 /*break*/,
|
|
2855
|
+
if (!(toStatus && this.mapAdapter)) return [3 /*break*/, 5];
|
|
2846
2856
|
order = l.options.baselayer ? 0 : l.options.order;
|
|
2847
|
-
if (!(l.options.baselayer && this._baselayers.length)) return [3 /*break*/,
|
|
2848
|
-
|
|
2857
|
+
if (!(l.options.baselayer && this._baselayers.length)) return [3 /*break*/, 4];
|
|
2858
|
+
anotherVisibleBaselayers = this._baselayers.filter(function (x) {
|
|
2849
2859
|
return x !== l.id && _this.isLayerVisible(x);
|
|
2850
2860
|
});
|
|
2851
|
-
|
|
2852
|
-
|
|
2861
|
+
_i = 0, anotherVisibleBaselayers_1 = anotherVisibleBaselayers;
|
|
2862
|
+
_a.label = 1;
|
|
2853
2863
|
case 1:
|
|
2854
|
-
|
|
2855
|
-
|
|
2864
|
+
if (!(_i < anotherVisibleBaselayers_1.length)) return [3 /*break*/, 4];
|
|
2865
|
+
bl = anotherVisibleBaselayers_1[_i];
|
|
2866
|
+
return [4 /*yield*/, this.hideLayer(bl)];
|
|
2856
2867
|
case 2:
|
|
2868
|
+
_a.sent();
|
|
2869
|
+
_a.label = 3;
|
|
2870
|
+
case 3:
|
|
2871
|
+
_i++;
|
|
2872
|
+
return [3 /*break*/, 1];
|
|
2873
|
+
case 4:
|
|
2857
2874
|
if (l.showLayer) {
|
|
2858
2875
|
l.showLayer.call(l, l.layer);
|
|
2859
2876
|
}
|
|
@@ -2863,16 +2880,16 @@ var NgwMap = (function (exports) {
|
|
|
2863
2880
|
if (order !== undefined) {
|
|
2864
2881
|
this.mapAdapter.setLayerOrder(l.layer, order, this._layers);
|
|
2865
2882
|
}
|
|
2866
|
-
return [3 /*break*/,
|
|
2867
|
-
case
|
|
2883
|
+
return [3 /*break*/, 6];
|
|
2884
|
+
case 5:
|
|
2868
2885
|
if (l.hideLayer) {
|
|
2869
2886
|
l.hideLayer.call(l, l.layer);
|
|
2870
2887
|
}
|
|
2871
2888
|
else if (l.layer !== undefined) {
|
|
2872
2889
|
this.mapAdapter.hideLayer(l.layer);
|
|
2873
2890
|
}
|
|
2874
|
-
_a.label =
|
|
2875
|
-
case
|
|
2891
|
+
_a.label = 6;
|
|
2892
|
+
case 6:
|
|
2876
2893
|
if (!silent) {
|
|
2877
2894
|
this._emitLayerEvent(eventName, id, l);
|
|
2878
2895
|
this._emitLayerEvent('layer:toggle', id, l);
|
|
@@ -4853,6 +4870,18 @@ var NgwMap = (function (exports) {
|
|
|
4853
4870
|
}
|
|
4854
4871
|
});
|
|
4855
4872
|
}
|
|
4873
|
+
function fetchNgwLayerItemExtent(_a) {
|
|
4874
|
+
var resourceId = _a.resourceId, featureId = _a.featureId, connector = _a.connector, _b = _a.cache, cache = _b === void 0 ? true : _b;
|
|
4875
|
+
return connector
|
|
4876
|
+
.get('feature_layer.feature.item_extent', { cache: cache }, { id: resourceId, fid: featureId })
|
|
4877
|
+
.then(function (resp) {
|
|
4878
|
+
if (resp) {
|
|
4879
|
+
var _a = resp.extent, maxLat = _a.maxLat, maxLon = _a.maxLon, minLat = _a.minLat, minLon = _a.minLon;
|
|
4880
|
+
var extentArray = [minLon, minLat, maxLon, maxLat];
|
|
4881
|
+
return extentArray;
|
|
4882
|
+
}
|
|
4883
|
+
});
|
|
4884
|
+
}
|
|
4856
4885
|
function fetchNgwResourceExtent(item, connector) {
|
|
4857
4886
|
if (item.webmap) {
|
|
4858
4887
|
return CancelablePromise.resolve(getNgwWebmapExtent(item.webmap));
|
|
@@ -4965,7 +4994,7 @@ var NgwMap = (function (exports) {
|
|
|
4965
4994
|
if (logic === 'any') {
|
|
4966
4995
|
filters_.forEach(function (f) {
|
|
4967
4996
|
if (checkIfPropertyFilter(f)) {
|
|
4968
|
-
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams), [createParam(f)]) })));
|
|
4997
|
+
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), [createParam(f)]) })));
|
|
4969
4998
|
}
|
|
4970
4999
|
else {
|
|
4971
5000
|
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: f }), _queries, __spreadArray([], _parentAllParams));
|
|
@@ -4987,11 +5016,11 @@ var NgwMap = (function (exports) {
|
|
|
4987
5016
|
if (propertiesFilterList.length) {
|
|
4988
5017
|
for (var _a = 0, propertiesFilterList_1 = propertiesFilterList; _a < propertiesFilterList_1.length; _a++) {
|
|
4989
5018
|
var x = propertiesFilterList_1[_a];
|
|
4990
|
-
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams), filters_2));
|
|
5019
|
+
createFeatureFieldFilterQueries(__assign(__assign({}, opt), { filters: x }), _queries, __spreadArray(__spreadArray([], _parentAllParams, true), filters_2));
|
|
4991
5020
|
}
|
|
4992
5021
|
}
|
|
4993
5022
|
else {
|
|
4994
|
-
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams), filters_2) })));
|
|
5023
|
+
_queries.push(fetchNgwLayerItemsRequest(__assign(__assign({}, opt), { paramList: __spreadArray(__spreadArray([], _parentAllParams, true), filters_2) })));
|
|
4995
5024
|
}
|
|
4996
5025
|
}
|
|
4997
5026
|
return CancelablePromise.all(_queries).then(function (itemsParts) {
|
|
@@ -5214,16 +5243,26 @@ var NgwMap = (function (exports) {
|
|
|
5214
5243
|
});
|
|
5215
5244
|
});
|
|
5216
5245
|
};
|
|
5246
|
+
/** @deprecated use {@link NgwGeoJsonAdapter.getBounds} instead */
|
|
5217
5247
|
NgwGeoJsonAdapter.prototype.getExtent = function () {
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5248
|
+
return this.getBounds();
|
|
5249
|
+
};
|
|
5250
|
+
NgwGeoJsonAdapter.prototype.getBounds = function () {
|
|
5251
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5252
|
+
var hasData;
|
|
5253
|
+
return __generator(this, function (_a) {
|
|
5254
|
+
hasData = this.getLayers && this.getLayers().length;
|
|
5255
|
+
if (this.options.strategy === 'BBOX' || hasData) {
|
|
5256
|
+
return [2 /*return*/, fetchNgwResourceExtent(item, connector)];
|
|
5257
|
+
}
|
|
5258
|
+
else {
|
|
5259
|
+
if (_super.prototype.getBounds) {
|
|
5260
|
+
return [2 /*return*/, _super.prototype.getBounds.call(this)];
|
|
5261
|
+
}
|
|
5262
|
+
}
|
|
5263
|
+
return [2 /*return*/];
|
|
5264
|
+
});
|
|
5265
|
+
});
|
|
5227
5266
|
};
|
|
5228
5267
|
NgwGeoJsonAdapter.prototype.beforeRemove = function () {
|
|
5229
5268
|
removed = true;
|
|
@@ -5390,10 +5429,11 @@ var NgwMap = (function (exports) {
|
|
|
5390
5429
|
});
|
|
5391
5430
|
}
|
|
5392
5431
|
|
|
5393
|
-
function
|
|
5432
|
+
function ngwApiToAdapterOptions(_a) {
|
|
5433
|
+
var options = _a.options, webMap = _a.webMap, baseUrl = _a.baseUrl;
|
|
5394
5434
|
var adapter = options.adapter || 'IMAGE';
|
|
5395
5435
|
var url;
|
|
5396
|
-
var layerAdapters = webMap.getLayerAdapters();
|
|
5436
|
+
var layerAdapters = webMap && webMap.getLayerAdapters();
|
|
5397
5437
|
var isImageAllowed = layerAdapters ? layerAdapters.IMAGE : true;
|
|
5398
5438
|
var resourceId = options.resource;
|
|
5399
5439
|
var nd = options.tileNoData ? options.tileNoData : 200;
|
|
@@ -5469,7 +5509,7 @@ var NgwMap = (function (exports) {
|
|
|
5469
5509
|
function createRasterAdapter(_a) {
|
|
5470
5510
|
var layerOptions = _a.layerOptions, webMap = _a.webMap, connector = _a.connector, item = _a.item;
|
|
5471
5511
|
return __awaiter(this, void 0, void 0, function () {
|
|
5472
|
-
var resourceCls, clsAdapterAlias, adapter, layerAdapters, isImageAllowed,
|
|
5512
|
+
var resourceCls, clsAdapterAlias, adapter, layerAdapters, isImageAllowed, AdapterClass, resourceId_1;
|
|
5473
5513
|
return __generator(this, function (_b) {
|
|
5474
5514
|
switch (_b.label) {
|
|
5475
5515
|
case 0:
|
|
@@ -5491,21 +5531,25 @@ var NgwMap = (function (exports) {
|
|
|
5491
5531
|
adapter = 'TILE';
|
|
5492
5532
|
}
|
|
5493
5533
|
}
|
|
5494
|
-
|
|
5495
|
-
if (!
|
|
5534
|
+
AdapterClass = webMap.mapAdapter.layerAdapters[adapter];
|
|
5535
|
+
if (!AdapterClass) return [3 /*break*/, 2];
|
|
5496
5536
|
return [4 /*yield*/, resourceIdFromLayerOptions(layerOptions, connector)];
|
|
5497
5537
|
case 1:
|
|
5498
5538
|
resourceId_1 = _b.sent();
|
|
5499
5539
|
return [2 /*return*/, /** @class */ (function (_super) {
|
|
5500
|
-
__extends(
|
|
5501
|
-
function
|
|
5540
|
+
__extends(RasterAdapter, _super);
|
|
5541
|
+
function RasterAdapter(map, _options) {
|
|
5502
5542
|
var _a;
|
|
5503
5543
|
var _this = _super.call(this, map, _options) || this;
|
|
5504
5544
|
_this.map = map;
|
|
5505
5545
|
// options = {};
|
|
5506
5546
|
_this.item = item;
|
|
5507
5547
|
_this.resourceId = resourceId_1;
|
|
5508
|
-
var opt =
|
|
5548
|
+
var opt = ngwApiToAdapterOptions({
|
|
5549
|
+
options: layerOptions,
|
|
5550
|
+
webMap: webMap,
|
|
5551
|
+
baseUrl: connector.options.baseUrl || '',
|
|
5552
|
+
});
|
|
5509
5553
|
if (opt) {
|
|
5510
5554
|
var layerAdapterOptions = __assign(__assign({}, opt), { setViewDelay: (_a = layerOptions.adapterOptions) === null || _a === void 0 ? void 0 : _a.setViewDelay, params: { resource: resourceId_1 },
|
|
5511
5555
|
// @deprecated
|
|
@@ -5533,10 +5577,10 @@ var NgwMap = (function (exports) {
|
|
|
5533
5577
|
}
|
|
5534
5578
|
return _this;
|
|
5535
5579
|
}
|
|
5536
|
-
|
|
5580
|
+
RasterAdapter.prototype.addLayer = function (addOptions) {
|
|
5537
5581
|
return _super.prototype.addLayer.call(this, __assign(__assign({}, this.options), addOptions));
|
|
5538
5582
|
};
|
|
5539
|
-
|
|
5583
|
+
RasterAdapter.prototype.getIdentificationIds = function () {
|
|
5540
5584
|
return __awaiter(this, void 0, void 0, function () {
|
|
5541
5585
|
var id;
|
|
5542
5586
|
return __generator(this, function (_a) {
|
|
@@ -5548,8 +5592,8 @@ var NgwMap = (function (exports) {
|
|
|
5548
5592
|
});
|
|
5549
5593
|
});
|
|
5550
5594
|
};
|
|
5551
|
-
return
|
|
5552
|
-
}(
|
|
5595
|
+
return RasterAdapter;
|
|
5596
|
+
}(AdapterClass))];
|
|
5553
5597
|
case 2: throw new Error(adapter + ' not supported yet. Only TILE');
|
|
5554
5598
|
}
|
|
5555
5599
|
});
|
|
@@ -5759,6 +5803,9 @@ var NgwMap = (function (exports) {
|
|
|
5759
5803
|
BaseProperty.prototype.getParent = function () {
|
|
5760
5804
|
return this.item.tree.getParent();
|
|
5761
5805
|
};
|
|
5806
|
+
BaseProperty.prototype.getChildren = function () {
|
|
5807
|
+
return this.item.tree.getChildren();
|
|
5808
|
+
};
|
|
5762
5809
|
BaseProperty.prototype.isGroup = function () {
|
|
5763
5810
|
var children = this.item.tree.getDescendants();
|
|
5764
5811
|
return children.length;
|
|
@@ -5879,6 +5926,26 @@ var NgwMap = (function (exports) {
|
|
|
5879
5926
|
return property && property.get();
|
|
5880
5927
|
}));
|
|
5881
5928
|
};
|
|
5929
|
+
CheckProperty.prototype.block = function (options) {
|
|
5930
|
+
this._blocked = true;
|
|
5931
|
+
this._block(options);
|
|
5932
|
+
};
|
|
5933
|
+
CheckProperty.prototype.unBlock = function (options) {
|
|
5934
|
+
this._blocked = false;
|
|
5935
|
+
if (this.getValue()) {
|
|
5936
|
+
this._unBlock(options);
|
|
5937
|
+
}
|
|
5938
|
+
};
|
|
5939
|
+
CheckProperty.prototype.blockChild = function (options) {
|
|
5940
|
+
var _this = this;
|
|
5941
|
+
this.item.tree
|
|
5942
|
+
.getDescendants()
|
|
5943
|
+
.forEach(function (x) { return _this._blockChild(x, options); });
|
|
5944
|
+
};
|
|
5945
|
+
CheckProperty.prototype.unblockChild = function (options) {
|
|
5946
|
+
var _this = this;
|
|
5947
|
+
this.item.tree.getChildren().forEach(function (x) { return _this._unBlockChild(x, options); });
|
|
5948
|
+
};
|
|
5882
5949
|
CheckProperty.prototype._prepareValue = function (value) {
|
|
5883
5950
|
return value;
|
|
5884
5951
|
};
|
|
@@ -5900,32 +5967,12 @@ var NgwMap = (function (exports) {
|
|
|
5900
5967
|
this.unblockChild(options);
|
|
5901
5968
|
}
|
|
5902
5969
|
};
|
|
5903
|
-
CheckProperty.prototype.block = function (options) {
|
|
5904
|
-
this._blocked = true;
|
|
5905
|
-
this._block(options);
|
|
5906
|
-
};
|
|
5907
5970
|
CheckProperty.prototype._block = function (options) {
|
|
5908
5971
|
this._turnOff(options);
|
|
5909
5972
|
};
|
|
5910
|
-
CheckProperty.prototype.unBlock = function (options) {
|
|
5911
|
-
this._blocked = false;
|
|
5912
|
-
if (this.getValue()) {
|
|
5913
|
-
this._unBlock(options);
|
|
5914
|
-
}
|
|
5915
|
-
};
|
|
5916
5973
|
CheckProperty.prototype._unBlock = function (options) {
|
|
5917
5974
|
this._turnOn(options);
|
|
5918
5975
|
};
|
|
5919
|
-
CheckProperty.prototype.blockChild = function (options) {
|
|
5920
|
-
var _this = this;
|
|
5921
|
-
this.item.tree
|
|
5922
|
-
.getDescendants()
|
|
5923
|
-
.forEach(function (x) { return _this._blockChild(x, options); });
|
|
5924
|
-
};
|
|
5925
|
-
CheckProperty.prototype.unblockChild = function (options) {
|
|
5926
|
-
var _this = this;
|
|
5927
|
-
this.item.tree.getChildren().forEach(function (x) { return _this._unBlockChild(x, options); });
|
|
5928
|
-
};
|
|
5929
5976
|
CheckProperty.prototype._blockChild = function (item, options) {
|
|
5930
5977
|
var prop = item.properties &&
|
|
5931
5978
|
item.properties.property(this.name);
|
|
@@ -5981,22 +6028,22 @@ var NgwMap = (function (exports) {
|
|
|
5981
6028
|
};
|
|
5982
6029
|
ItemProperties.prototype._setPropertyHandler = function (propOpt) {
|
|
5983
6030
|
var handlers = ItemProperties.handlers;
|
|
5984
|
-
var
|
|
5985
|
-
if (!
|
|
6031
|
+
var Handler = propOpt.handler;
|
|
6032
|
+
if (!Handler && propOpt.type) {
|
|
5986
6033
|
switch (propOpt.type) {
|
|
5987
6034
|
case 'boolean':
|
|
5988
|
-
|
|
6035
|
+
Handler = handlers.CheckProperty;
|
|
5989
6036
|
break;
|
|
5990
6037
|
case 'string':
|
|
5991
|
-
|
|
6038
|
+
Handler = handlers.BaseProperty;
|
|
5992
6039
|
break;
|
|
5993
6040
|
default:
|
|
5994
|
-
|
|
6041
|
+
Handler = handlers.BaseProperty;
|
|
5995
6042
|
}
|
|
5996
6043
|
}
|
|
5997
|
-
if (
|
|
6044
|
+
if (Handler && propOpt.name) {
|
|
5998
6045
|
var options = __assign({}, (propOpt || {}));
|
|
5999
|
-
this._properties[propOpt.name] = new
|
|
6046
|
+
this._properties[propOpt.name] = new Handler(propOpt.name, this.item, options);
|
|
6000
6047
|
this._propertiesList.push(propOpt.name);
|
|
6001
6048
|
}
|
|
6002
6049
|
};
|
|
@@ -6055,6 +6102,62 @@ var NgwMap = (function (exports) {
|
|
|
6055
6102
|
return Item;
|
|
6056
6103
|
}());
|
|
6057
6104
|
|
|
6105
|
+
var WebmapLayerOpacityPropertyHandler = /** @class */ (function (_super) {
|
|
6106
|
+
__extends(WebmapLayerOpacityPropertyHandler, _super);
|
|
6107
|
+
function WebmapLayerOpacityPropertyHandler() {
|
|
6108
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6109
|
+
}
|
|
6110
|
+
WebmapLayerOpacityPropertyHandler.prototype.getProperty = function () {
|
|
6111
|
+
var layer = this.item.layer;
|
|
6112
|
+
if (layer) {
|
|
6113
|
+
return layer && layer.options && layer.options.opacity !== undefined
|
|
6114
|
+
? layer.options.opacity
|
|
6115
|
+
: 1;
|
|
6116
|
+
}
|
|
6117
|
+
return 1;
|
|
6118
|
+
};
|
|
6119
|
+
WebmapLayerOpacityPropertyHandler.prototype.update = function (value, options) {
|
|
6120
|
+
var _this = this;
|
|
6121
|
+
options = options || {};
|
|
6122
|
+
if (this.isGroup()) {
|
|
6123
|
+
this._value = this._prepareValue(value, options);
|
|
6124
|
+
var children = this.getChildren();
|
|
6125
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
6126
|
+
var child = children_1[_i];
|
|
6127
|
+
var property = child.properties.property(this.name);
|
|
6128
|
+
if (property) {
|
|
6129
|
+
if (options.propagation) {
|
|
6130
|
+
property.set(value, options);
|
|
6131
|
+
}
|
|
6132
|
+
else {
|
|
6133
|
+
property.update(property.get(), options);
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
var layer = this.item.layer;
|
|
6139
|
+
if (layer) {
|
|
6140
|
+
var parents = this.getParents();
|
|
6141
|
+
var coef = parents.reduce(function (s, x) {
|
|
6142
|
+
var prop = x.properties.property(_this.name);
|
|
6143
|
+
var multiplier = prop ? prop.getValue() : 1;
|
|
6144
|
+
return s * multiplier;
|
|
6145
|
+
}, 1);
|
|
6146
|
+
var val = value * coef;
|
|
6147
|
+
this.item.webMap.setLayerOpacity(layer, this._prepareValue(val));
|
|
6148
|
+
}
|
|
6149
|
+
};
|
|
6150
|
+
WebmapLayerOpacityPropertyHandler.prototype._prepareValue = function (value, options) {
|
|
6151
|
+
if (options && options.propagation && this.isGroup()) {
|
|
6152
|
+
return 1;
|
|
6153
|
+
}
|
|
6154
|
+
// value = Number(value);
|
|
6155
|
+
// return value < 0.1 ? 0.1 : value;
|
|
6156
|
+
return Number(value);
|
|
6157
|
+
};
|
|
6158
|
+
return WebmapLayerOpacityPropertyHandler;
|
|
6159
|
+
}(BaseProperty));
|
|
6160
|
+
|
|
6058
6161
|
var NgwWebmapItem = /** @class */ (function (_super) {
|
|
6059
6162
|
__extends(NgwWebmapItem, _super);
|
|
6060
6163
|
function NgwWebmapItem(webMap, item, options, connector, parent, noInit) {
|
|
@@ -6149,6 +6252,9 @@ var NgwMap = (function (exports) {
|
|
|
6149
6252
|
NgwWebmapItem.prototype.fit = function () {
|
|
6150
6253
|
if (this.item.item_type === 'layer') ;
|
|
6151
6254
|
};
|
|
6255
|
+
NgwWebmapItem.prototype.getLayer = function () {
|
|
6256
|
+
return this.layer;
|
|
6257
|
+
};
|
|
6152
6258
|
NgwWebmapItem.prototype.getItemOptions = function (item) {
|
|
6153
6259
|
var transparency = item.item_type === 'layer' && item.layer_transparency;
|
|
6154
6260
|
var opacity = typeof transparency === 'number' ? (100 - transparency) / 100 : undefined;
|
|
@@ -6252,6 +6358,10 @@ var NgwMap = (function (exports) {
|
|
|
6252
6358
|
}
|
|
6253
6359
|
},
|
|
6254
6360
|
},
|
|
6361
|
+
{
|
|
6362
|
+
name: 'opacity',
|
|
6363
|
+
handler: WebmapLayerOpacityPropertyHandler,
|
|
6364
|
+
},
|
|
6255
6365
|
],
|
|
6256
6366
|
};
|
|
6257
6367
|
return NgwWebmapItem;
|
|
@@ -6480,16 +6590,40 @@ var NgwMap = (function (exports) {
|
|
|
6480
6590
|
delete this._webmapLayersIds;
|
|
6481
6591
|
};
|
|
6482
6592
|
NgwWebmapLayerAdapter.prototype.showLayer = function () {
|
|
6483
|
-
|
|
6484
|
-
this
|
|
6485
|
-
|
|
6593
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6594
|
+
return __generator(this, function (_a) {
|
|
6595
|
+
if (this.layer && this.layer.properties) {
|
|
6596
|
+
return [2 /*return*/, this.layer.properties.property('visibility').set(true)];
|
|
6597
|
+
}
|
|
6598
|
+
return [2 /*return*/];
|
|
6599
|
+
});
|
|
6600
|
+
});
|
|
6486
6601
|
};
|
|
6487
6602
|
NgwWebmapLayerAdapter.prototype.hideLayer = function () {
|
|
6488
|
-
|
|
6489
|
-
this
|
|
6490
|
-
|
|
6603
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6604
|
+
return __generator(this, function (_a) {
|
|
6605
|
+
if (this.layer && this.layer.properties) {
|
|
6606
|
+
return [2 /*return*/, this.layer.properties.property('visibility').set(false)];
|
|
6607
|
+
}
|
|
6608
|
+
return [2 /*return*/];
|
|
6609
|
+
});
|
|
6610
|
+
});
|
|
6491
6611
|
};
|
|
6612
|
+
NgwWebmapLayerAdapter.prototype.setOpacity = function (val) {
|
|
6613
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6614
|
+
return __generator(this, function (_a) {
|
|
6615
|
+
if (this.layer && this.layer.properties) {
|
|
6616
|
+
return [2 /*return*/, this.layer.properties.property('opacity').set(val)];
|
|
6617
|
+
}
|
|
6618
|
+
return [2 /*return*/];
|
|
6619
|
+
});
|
|
6620
|
+
});
|
|
6621
|
+
};
|
|
6622
|
+
/** @deprecated use {@link NgwWebmapLayerAdapter.getBounds} instead */
|
|
6492
6623
|
NgwWebmapLayerAdapter.prototype.getExtent = function () {
|
|
6624
|
+
return this.getBounds();
|
|
6625
|
+
};
|
|
6626
|
+
NgwWebmapLayerAdapter.prototype.getBounds = function () {
|
|
6493
6627
|
var webmap = this.response && this.response.webmap;
|
|
6494
6628
|
if (webmap) {
|
|
6495
6629
|
return getNgwWebmapExtent(webmap);
|
|
@@ -6690,10 +6824,14 @@ var NgwMap = (function (exports) {
|
|
|
6690
6824
|
return updateImageParams(params, resourceId_1);
|
|
6691
6825
|
};
|
|
6692
6826
|
var adapter = item.layer_adapter.toUpperCase();
|
|
6693
|
-
var layerAdapterOptions =
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6827
|
+
var layerAdapterOptions = ngwApiToAdapterOptions({
|
|
6828
|
+
options: {
|
|
6829
|
+
adapter: adapter,
|
|
6830
|
+
resource: resourceId_1,
|
|
6831
|
+
},
|
|
6832
|
+
webMap: webMap,
|
|
6833
|
+
baseUrl: this.options.connector.options.baseUrl || '',
|
|
6834
|
+
});
|
|
6697
6835
|
item = __assign(__assign({}, item), layerAdapterOptions);
|
|
6698
6836
|
}
|
|
6699
6837
|
}
|
|
@@ -6765,7 +6903,15 @@ var NgwMap = (function (exports) {
|
|
|
6765
6903
|
var NgwResource = /** @class */ (function () {
|
|
6766
6904
|
function NgwResource() {
|
|
6767
6905
|
}
|
|
6906
|
+
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
6768
6907
|
NgwResource.prototype.getExtent = function () {
|
|
6908
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6909
|
+
return __generator(this, function (_a) {
|
|
6910
|
+
return [2 /*return*/, this.getBounds()];
|
|
6911
|
+
});
|
|
6912
|
+
});
|
|
6913
|
+
};
|
|
6914
|
+
NgwResource.prototype.getBounds = function () {
|
|
6769
6915
|
return __awaiter(this, void 0, void 0, function () {
|
|
6770
6916
|
var _a;
|
|
6771
6917
|
return __generator(this, function (_b) {
|
|
@@ -6776,7 +6922,7 @@ var NgwMap = (function (exports) {
|
|
|
6776
6922
|
}
|
|
6777
6923
|
if (!this.item) return [3 /*break*/, 2];
|
|
6778
6924
|
_a = this;
|
|
6779
|
-
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector)
|
|
6925
|
+
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector)];
|
|
6780
6926
|
case 1:
|
|
6781
6927
|
_a._extent = _b.sent();
|
|
6782
6928
|
return [2 /*return*/, this._extent];
|
|
@@ -7149,7 +7295,7 @@ var NgwMap = (function (exports) {
|
|
|
7149
7295
|
MULTILINESTRINGZ: 'line',
|
|
7150
7296
|
MULTIPOLYGONZ: 'polygon',
|
|
7151
7297
|
};
|
|
7152
|
-
function
|
|
7298
|
+
function createNgwLayerAdapter(options, webMap, connector) {
|
|
7153
7299
|
var headers = connector.getAuthorizationHeaders();
|
|
7154
7300
|
if (headers) {
|
|
7155
7301
|
options.headers = headers;
|
|
@@ -7283,11 +7429,11 @@ var NgwMap = (function (exports) {
|
|
|
7283
7429
|
function IdentifyItem(options) {
|
|
7284
7430
|
var f = options.feature;
|
|
7285
7431
|
this.id = f.id;
|
|
7432
|
+
this.geom = f.geom;
|
|
7286
7433
|
this.label = f.label;
|
|
7287
|
-
this.layerId = f.layerId;
|
|
7288
7434
|
this.parent = f.parent;
|
|
7289
7435
|
this.fields = f.fields;
|
|
7290
|
-
this.
|
|
7436
|
+
this.layerId = f.layerId;
|
|
7291
7437
|
this.connector = options.connector;
|
|
7292
7438
|
}
|
|
7293
7439
|
IdentifyItem.prototype.identify = function (options) {
|
|
@@ -7313,6 +7459,16 @@ var NgwMap = (function (exports) {
|
|
|
7313
7459
|
return _this._resource.feature_layer;
|
|
7314
7460
|
});
|
|
7315
7461
|
};
|
|
7462
|
+
IdentifyItem.prototype.getBounds = function () {
|
|
7463
|
+
if (this._extent) {
|
|
7464
|
+
return CancelablePromise.resolve(this._extent);
|
|
7465
|
+
}
|
|
7466
|
+
return fetchNgwLayerItemExtent({
|
|
7467
|
+
connector: this.connector,
|
|
7468
|
+
featureId: this.id,
|
|
7469
|
+
resourceId: this.layerId,
|
|
7470
|
+
});
|
|
7471
|
+
};
|
|
7316
7472
|
IdentifyItem.prototype.geojson = function () {
|
|
7317
7473
|
var _this = this;
|
|
7318
7474
|
if (this._geojson) {
|
|
@@ -7757,7 +7913,7 @@ var NgwMap = (function (exports) {
|
|
|
7757
7913
|
options.adapterOptions.setViewDelay = this.options.setViewDelay;
|
|
7758
7914
|
}
|
|
7759
7915
|
}
|
|
7760
|
-
adapter =
|
|
7916
|
+
adapter = createNgwLayerAdapter(options, this, this.connector);
|
|
7761
7917
|
adapterOpts = __assign(__assign({ visibility: true }, options), options.adapterOptions);
|
|
7762
7918
|
return [4 /*yield*/, this.addLayer(adapter, adapterOpts)];
|
|
7763
7919
|
case 3:
|
|
@@ -7916,7 +8072,7 @@ var NgwMap = (function (exports) {
|
|
|
7916
8072
|
*/
|
|
7917
8073
|
NgwMap.prototype.fitLayer = function (layerDef, options) {
|
|
7918
8074
|
return __awaiter(this, void 0, void 0, function () {
|
|
7919
|
-
var id, ngwLayer,
|
|
8075
|
+
var id, ngwLayer, bounds, item, resourceId;
|
|
7920
8076
|
var _this = this;
|
|
7921
8077
|
return __generator(this, function (_a) {
|
|
7922
8078
|
switch (_a.label) {
|
|
@@ -7929,12 +8085,12 @@ var NgwMap = (function (exports) {
|
|
|
7929
8085
|
}
|
|
7930
8086
|
ngwLayer = id && this._ngwLayers[id];
|
|
7931
8087
|
if (!ngwLayer) return [3 /*break*/, 7];
|
|
7932
|
-
if (!ngwLayer.layer.
|
|
7933
|
-
return [4 /*yield*/, ngwLayer.layer.
|
|
8088
|
+
if (!ngwLayer.layer.getBounds) return [3 /*break*/, 2];
|
|
8089
|
+
return [4 /*yield*/, ngwLayer.layer.getBounds()];
|
|
7934
8090
|
case 1:
|
|
7935
|
-
|
|
7936
|
-
if (
|
|
7937
|
-
this.fitBounds(
|
|
8091
|
+
bounds = _a.sent();
|
|
8092
|
+
if (bounds) {
|
|
8093
|
+
this.fitBounds(bounds, options);
|
|
7938
8094
|
}
|
|
7939
8095
|
return [3 /*break*/, 6];
|
|
7940
8096
|
case 2:
|