@nextgis/ngw-map 1.13.5 → 1.13.8
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 +8 -7
- 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 +119 -101
- 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 +8 -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 +119 -101
- 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 +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.13.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.13.8; author: NextGIS */
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -1503,16 +1503,17 @@ function updatePaintOptionFromCallback(paint, getPaintFunctions) {
|
|
|
1503
1503
|
function createPropertiesPaint(propertiesPaint) {
|
|
1504
1504
|
var mask = {};
|
|
1505
1505
|
var paintsFilters = [];
|
|
1506
|
-
propertiesPaint.
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1506
|
+
for (var _i = 0, propertiesPaint_1 = propertiesPaint; _i < propertiesPaint_1.length; _i++) {
|
|
1507
|
+
var p = propertiesPaint_1[_i];
|
|
1508
|
+
if (p) {
|
|
1509
|
+
if (Array.isArray(p)) {
|
|
1510
|
+
paintsFilters.push(p);
|
|
1510
1511
|
}
|
|
1511
1512
|
else {
|
|
1512
|
-
mask =
|
|
1513
|
+
mask = p;
|
|
1513
1514
|
}
|
|
1514
1515
|
}
|
|
1515
|
-
}
|
|
1516
|
+
}
|
|
1516
1517
|
return function (feature) {
|
|
1517
1518
|
var paint = paintsFilters.find(function (x) { return featureFilter(feature, x[0]); });
|
|
1518
1519
|
if (paint) {
|
|
@@ -1552,9 +1553,11 @@ function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
|
1552
1553
|
else {
|
|
1553
1554
|
var expressionCallback_1 = createExpressionCallback(paint);
|
|
1554
1555
|
if (expressionCallback_1) {
|
|
1555
|
-
|
|
1556
|
+
var expressionPaintCb = function (feature) {
|
|
1556
1557
|
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
|
|
1557
1558
|
};
|
|
1559
|
+
expressionPaintCb.paint = paint;
|
|
1560
|
+
return expressionPaintCb;
|
|
1558
1561
|
}
|
|
1559
1562
|
newPaint = __assign(__assign({}, newPaint), paint);
|
|
1560
1563
|
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
@@ -2825,6 +2828,7 @@ var WebMapLayers = /** @class */ (function (_super) {
|
|
|
2825
2828
|
};
|
|
2826
2829
|
/** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
|
|
2827
2830
|
WebMapLayers.prototype.addTileLayer = function (url, options) {
|
|
2831
|
+
if (options === void 0) { options = {}; }
|
|
2828
2832
|
return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
|
|
2829
2833
|
};
|
|
2830
2834
|
WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
|
|
@@ -5068,51 +5072,6 @@ var NgwConnector$1 = /** @class */ (function () {
|
|
|
5068
5072
|
// export { NgwConnector };
|
|
5069
5073
|
var NgwConnector = NgwConnector$1;
|
|
5070
5074
|
|
|
5071
|
-
function createPopupContent(feature, item) {
|
|
5072
|
-
// @ts-ignore
|
|
5073
|
-
{
|
|
5074
|
-
var element_1 = document.createElement('div');
|
|
5075
|
-
if (item && item.feature_layer) {
|
|
5076
|
-
item.feature_layer.fields.forEach(function (x) {
|
|
5077
|
-
if (x.grid_visibility) {
|
|
5078
|
-
var value = feature.properties && feature.properties[x.keyname];
|
|
5079
|
-
if (value) {
|
|
5080
|
-
var propElem = document.createElement('div');
|
|
5081
|
-
element_1.appendChild(propElem);
|
|
5082
|
-
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
5083
|
-
}
|
|
5084
|
-
}
|
|
5085
|
-
});
|
|
5086
|
-
}
|
|
5087
|
-
else if (feature.properties) {
|
|
5088
|
-
for (var p in feature.properties) {
|
|
5089
|
-
var propElem = document.createElement('div');
|
|
5090
|
-
element_1.appendChild(propElem);
|
|
5091
|
-
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
5092
|
-
}
|
|
5093
|
-
}
|
|
5094
|
-
return element_1;
|
|
5095
|
-
}
|
|
5096
|
-
}
|
|
5097
|
-
|
|
5098
|
-
var filterOptionsKeys = [
|
|
5099
|
-
'fields',
|
|
5100
|
-
'intersects',
|
|
5101
|
-
'limit',
|
|
5102
|
-
'orderBy',
|
|
5103
|
-
'strategy',
|
|
5104
|
-
];
|
|
5105
|
-
function getLayerFilterOptions(options) {
|
|
5106
|
-
var filterOptions = {};
|
|
5107
|
-
filterOptionsKeys.forEach(function (x) {
|
|
5108
|
-
var opt = options[x];
|
|
5109
|
-
if (opt !== undefined) {
|
|
5110
|
-
filterOptions[x] = opt;
|
|
5111
|
-
}
|
|
5112
|
-
});
|
|
5113
|
-
return filterOptions;
|
|
5114
|
-
}
|
|
5115
|
-
|
|
5116
5075
|
function getNgwWebmapExtent(webmap) {
|
|
5117
5076
|
var bottom = webmap['extent_bottom'];
|
|
5118
5077
|
var left = webmap['extent_left'];
|
|
@@ -5180,6 +5139,85 @@ function fetchNgwResourceExtent(item, connector, options) {
|
|
|
5180
5139
|
}
|
|
5181
5140
|
}
|
|
5182
5141
|
|
|
5142
|
+
var NgwResource = /** @class */ (function () {
|
|
5143
|
+
function NgwResource() {
|
|
5144
|
+
}
|
|
5145
|
+
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
5146
|
+
NgwResource.prototype.getExtent = function () {
|
|
5147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5148
|
+
return __generator(this, function (_a) {
|
|
5149
|
+
return [2 /*return*/, this.getBounds()];
|
|
5150
|
+
});
|
|
5151
|
+
});
|
|
5152
|
+
};
|
|
5153
|
+
NgwResource.prototype.getBounds = function (options) {
|
|
5154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5155
|
+
var _a;
|
|
5156
|
+
return __generator(this, function (_b) {
|
|
5157
|
+
switch (_b.label) {
|
|
5158
|
+
case 0:
|
|
5159
|
+
if (this._extent) {
|
|
5160
|
+
return [2 /*return*/, this._extent];
|
|
5161
|
+
}
|
|
5162
|
+
if (!this.item) return [3 /*break*/, 2];
|
|
5163
|
+
_a = this;
|
|
5164
|
+
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
|
|
5165
|
+
case 1:
|
|
5166
|
+
_a._extent = _b.sent();
|
|
5167
|
+
return [2 /*return*/, this._extent];
|
|
5168
|
+
case 2: return [2 /*return*/];
|
|
5169
|
+
}
|
|
5170
|
+
});
|
|
5171
|
+
});
|
|
5172
|
+
};
|
|
5173
|
+
return NgwResource;
|
|
5174
|
+
}());
|
|
5175
|
+
|
|
5176
|
+
function createPopupContent(feature, item) {
|
|
5177
|
+
// @ts-ignore
|
|
5178
|
+
{
|
|
5179
|
+
var element_1 = document.createElement('div');
|
|
5180
|
+
if (item && item.feature_layer) {
|
|
5181
|
+
item.feature_layer.fields.forEach(function (x) {
|
|
5182
|
+
if (x.grid_visibility) {
|
|
5183
|
+
var value = feature.properties && feature.properties[x.keyname];
|
|
5184
|
+
if (value) {
|
|
5185
|
+
var propElem = document.createElement('div');
|
|
5186
|
+
element_1.appendChild(propElem);
|
|
5187
|
+
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
5188
|
+
}
|
|
5189
|
+
}
|
|
5190
|
+
});
|
|
5191
|
+
}
|
|
5192
|
+
else if (feature.properties) {
|
|
5193
|
+
for (var p in feature.properties) {
|
|
5194
|
+
var propElem = document.createElement('div');
|
|
5195
|
+
element_1.appendChild(propElem);
|
|
5196
|
+
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
5197
|
+
}
|
|
5198
|
+
}
|
|
5199
|
+
return element_1;
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5203
|
+
var filterOptionsKeys = [
|
|
5204
|
+
'fields',
|
|
5205
|
+
'intersects',
|
|
5206
|
+
'limit',
|
|
5207
|
+
'orderBy',
|
|
5208
|
+
'strategy',
|
|
5209
|
+
];
|
|
5210
|
+
function getLayerFilterOptions(options) {
|
|
5211
|
+
var filterOptions = {};
|
|
5212
|
+
filterOptionsKeys.forEach(function (x) {
|
|
5213
|
+
var opt = options[x];
|
|
5214
|
+
if (opt !== undefined) {
|
|
5215
|
+
filterOptions[x] = opt;
|
|
5216
|
+
}
|
|
5217
|
+
});
|
|
5218
|
+
return filterOptions;
|
|
5219
|
+
}
|
|
5220
|
+
|
|
5183
5221
|
function resourceIdFromLayerOptions(options, connector) {
|
|
5184
5222
|
return __awaiter(this, void 0, void 0, function () {
|
|
5185
5223
|
var resource, item, keyname, resourceId, resourceItem;
|
|
@@ -5817,6 +5855,7 @@ function getImageAdapterOptions(_a) {
|
|
|
5817
5855
|
};
|
|
5818
5856
|
}
|
|
5819
5857
|
function ngwApiToAdapterOptions(_a) {
|
|
5858
|
+
var _b;
|
|
5820
5859
|
var options = _a.options, webMap = _a.webMap, baseUrl = _a.baseUrl;
|
|
5821
5860
|
var adapter = options.adapter || 'IMAGE';
|
|
5822
5861
|
var url;
|
|
@@ -5856,10 +5895,12 @@ function ngwApiToAdapterOptions(_a) {
|
|
|
5856
5895
|
'resource=' +
|
|
5857
5896
|
resourceId +
|
|
5858
5897
|
'&simplification=' +
|
|
5859
|
-
(options.simplification
|
|
5898
|
+
((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
|
|
5860
5899
|
// url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
|
|
5861
5900
|
return {
|
|
5862
5901
|
url: url,
|
|
5902
|
+
sourceLayer: 'ngw:' + resourceId,
|
|
5903
|
+
featureIdName: '$id',
|
|
5863
5904
|
};
|
|
5864
5905
|
}
|
|
5865
5906
|
if (adapter === 'TERRAIN') {
|
|
@@ -5922,7 +5963,6 @@ function createRasterAdapter(_a) {
|
|
|
5922
5963
|
return [2 /*return*/, /** @class */ (function (_super) {
|
|
5923
5964
|
__extends(RasterAdapter, _super);
|
|
5924
5965
|
function RasterAdapter(map, _options) {
|
|
5925
|
-
var _a;
|
|
5926
5966
|
var _this = _super.call(this, map, _options) || this;
|
|
5927
5967
|
_this.map = map;
|
|
5928
5968
|
// options = {};
|
|
@@ -5934,7 +5974,7 @@ function createRasterAdapter(_a) {
|
|
|
5934
5974
|
baseUrl: connector.options.baseUrl || '',
|
|
5935
5975
|
});
|
|
5936
5976
|
if (opt) {
|
|
5937
|
-
var layerAdapterOptions = __assign(__assign({}, opt),
|
|
5977
|
+
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
|
|
5938
5978
|
// @deprecated
|
|
5939
5979
|
layers: String(resourceId_1), resourceId: resourceId_1 });
|
|
5940
5980
|
if (layerOptions.adapterOptions &&
|
|
@@ -5967,11 +6007,16 @@ function createRasterAdapter(_a) {
|
|
|
5967
6007
|
return __awaiter(this, void 0, void 0, function () {
|
|
5968
6008
|
var id;
|
|
5969
6009
|
return __generator(this, function (_a) {
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
6010
|
+
if (this.item) {
|
|
6011
|
+
if (adapter === 'MVT') {
|
|
6012
|
+
return [2 /*return*/, [this.item.resource.id]];
|
|
6013
|
+
}
|
|
6014
|
+
id = this.item.resource.parent.id;
|
|
6015
|
+
if (defined(id)) {
|
|
6016
|
+
return [2 /*return*/, [id]];
|
|
6017
|
+
}
|
|
5973
6018
|
}
|
|
5974
|
-
return [2 /*return
|
|
6019
|
+
return [2 /*return*/, []];
|
|
5975
6020
|
});
|
|
5976
6021
|
});
|
|
5977
6022
|
};
|
|
@@ -7377,40 +7422,6 @@ function createWebMapAdapter(_a) {
|
|
|
7377
7422
|
});
|
|
7378
7423
|
}
|
|
7379
7424
|
|
|
7380
|
-
var NgwResource = /** @class */ (function () {
|
|
7381
|
-
function NgwResource() {
|
|
7382
|
-
}
|
|
7383
|
-
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
7384
|
-
NgwResource.prototype.getExtent = function () {
|
|
7385
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
7386
|
-
return __generator(this, function (_a) {
|
|
7387
|
-
return [2 /*return*/, this.getBounds()];
|
|
7388
|
-
});
|
|
7389
|
-
});
|
|
7390
|
-
};
|
|
7391
|
-
NgwResource.prototype.getBounds = function (options) {
|
|
7392
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
7393
|
-
var _a;
|
|
7394
|
-
return __generator(this, function (_b) {
|
|
7395
|
-
switch (_b.label) {
|
|
7396
|
-
case 0:
|
|
7397
|
-
if (this._extent) {
|
|
7398
|
-
return [2 /*return*/, this._extent];
|
|
7399
|
-
}
|
|
7400
|
-
if (!this.item) return [3 /*break*/, 2];
|
|
7401
|
-
_a = this;
|
|
7402
|
-
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
|
|
7403
|
-
case 1:
|
|
7404
|
-
_a._extent = _b.sent();
|
|
7405
|
-
return [2 /*return*/, this._extent];
|
|
7406
|
-
case 2: return [2 /*return*/];
|
|
7407
|
-
}
|
|
7408
|
-
});
|
|
7409
|
-
});
|
|
7410
|
-
};
|
|
7411
|
-
return NgwResource;
|
|
7412
|
-
}());
|
|
7413
|
-
|
|
7414
7425
|
var alias = {
|
|
7415
7426
|
tms: 'TILE',
|
|
7416
7427
|
};
|
|
@@ -7638,7 +7649,7 @@ function createAdapterFromFirstStyle(_a) {
|
|
|
7638
7649
|
}
|
|
7639
7650
|
function createAsyncAdapter(options, webMap, connector) {
|
|
7640
7651
|
return __awaiter(this, void 0, void 0, function () {
|
|
7641
|
-
var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, parentItem, parentOptions, getClassAdapter, classAdapter;
|
|
7652
|
+
var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, type, adapterOptions_, parentItem, parentOptions, getClassAdapter, classAdapter;
|
|
7642
7653
|
return __generator(this, function (_a) {
|
|
7643
7654
|
switch (_a.label) {
|
|
7644
7655
|
case 0:
|
|
@@ -7674,6 +7685,12 @@ function createAsyncAdapter(options, webMap, connector) {
|
|
|
7674
7685
|
return [3 /*break*/, 11];
|
|
7675
7686
|
case 5:
|
|
7676
7687
|
if (!(cls === 'vector_layer')) return [3 /*break*/, 6];
|
|
7688
|
+
type = item.vector_layer &&
|
|
7689
|
+
vectorLayerGeomToPaintTypeAlias[item.vector_layer.geometry_type];
|
|
7690
|
+
adapterOptions_ = adapterOptions.layerOptions.adapterOptions || {};
|
|
7691
|
+
adapterOptions_.type = adapterOptions_.type || type;
|
|
7692
|
+
adapterOptions.layerOptions.adapterOptions = adapterOptions_;
|
|
7693
|
+
options.adapterOptions = adapterOptions;
|
|
7677
7694
|
if (adapterType !== undefined && adapterType !== 'GEOJSON') {
|
|
7678
7695
|
if (adapterType === 'MVT') {
|
|
7679
7696
|
adapter = createRasterAdapter(adapterOptions);
|
|
@@ -8854,7 +8871,7 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8854
8871
|
};
|
|
8855
8872
|
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
8856
8873
|
return __awaiter(this, void 0, void 0, function () {
|
|
8857
|
-
var promises, layers, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
8874
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
8858
8875
|
var _this = this;
|
|
8859
8876
|
return __generator(this, function (_a) {
|
|
8860
8877
|
switch (_a.label) {
|
|
@@ -8868,15 +8885,16 @@ var NgwMap = /** @class */ (function (_super) {
|
|
|
8868
8885
|
}
|
|
8869
8886
|
return 1;
|
|
8870
8887
|
});
|
|
8871
|
-
layers.
|
|
8872
|
-
|
|
8873
|
-
|
|
8888
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
8889
|
+
l = layers_1[_i];
|
|
8890
|
+
layer = l.layer;
|
|
8891
|
+
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
8874
8892
|
? layer.getIdentificationIds
|
|
8875
8893
|
: false;
|
|
8876
|
-
if (identFunc && layer.options.selectable &&
|
|
8894
|
+
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
8877
8895
|
promises.push(identFunc.call(layer));
|
|
8878
8896
|
}
|
|
8879
|
-
}
|
|
8897
|
+
}
|
|
8880
8898
|
getIdsPromise = Promise.all(promises);
|
|
8881
8899
|
return [4 /*yield*/, getIdsPromise];
|
|
8882
8900
|
case 1:
|