@nextgis/ngw-leaflet 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-leaflet.esm-browser.js +119 -101
- package/lib/ngw-leaflet.esm-browser.js.map +1 -1
- package/lib/ngw-leaflet.esm-browser.prod.js +1 -1
- 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 +119 -101
- package/lib/ngw-leaflet.global.js.map +1 -1
- package/lib/ngw-leaflet.global.prod.js +1 -1
- package/lib/ngw-leaflet.global.prod.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-leaflet; version: 1.13.
|
|
1
|
+
/** Bundle of @nextgis/ngw-leaflet; version: 1.13.8; author: NextGIS */
|
|
2
2
|
var NgwLeaflet = (function () {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -15597,16 +15597,17 @@ var NgwLeaflet = (function () {
|
|
|
15597
15597
|
function createPropertiesPaint(propertiesPaint) {
|
|
15598
15598
|
var mask = {};
|
|
15599
15599
|
var paintsFilters = [];
|
|
15600
|
-
propertiesPaint.
|
|
15601
|
-
|
|
15602
|
-
|
|
15603
|
-
|
|
15600
|
+
for (var _i = 0, propertiesPaint_1 = propertiesPaint; _i < propertiesPaint_1.length; _i++) {
|
|
15601
|
+
var p = propertiesPaint_1[_i];
|
|
15602
|
+
if (p) {
|
|
15603
|
+
if (Array.isArray(p)) {
|
|
15604
|
+
paintsFilters.push(p);
|
|
15604
15605
|
}
|
|
15605
15606
|
else {
|
|
15606
|
-
mask =
|
|
15607
|
+
mask = p;
|
|
15607
15608
|
}
|
|
15608
15609
|
}
|
|
15609
|
-
}
|
|
15610
|
+
}
|
|
15610
15611
|
return function (feature) {
|
|
15611
15612
|
var paint = paintsFilters.find(function (x) { return featureFilter(feature, x[0]); });
|
|
15612
15613
|
if (paint) {
|
|
@@ -15646,9 +15647,11 @@ var NgwLeaflet = (function () {
|
|
|
15646
15647
|
else {
|
|
15647
15648
|
var expressionCallback_1 = createExpressionCallback(paint);
|
|
15648
15649
|
if (expressionCallback_1) {
|
|
15649
|
-
|
|
15650
|
+
var expressionPaintCb = function (feature) {
|
|
15650
15651
|
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
|
|
15651
15652
|
};
|
|
15653
|
+
expressionPaintCb.paint = paint;
|
|
15654
|
+
return expressionPaintCb;
|
|
15652
15655
|
}
|
|
15653
15656
|
newPaint = __assign(__assign({}, newPaint), paint);
|
|
15654
15657
|
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
@@ -16919,6 +16922,7 @@ var NgwLeaflet = (function () {
|
|
|
16919
16922
|
};
|
|
16920
16923
|
/** Shortcut for {@link WebMapLayers.addLayer} to create TileLayer adapter */
|
|
16921
16924
|
WebMapLayers.prototype.addTileLayer = function (url, options) {
|
|
16925
|
+
if (options === void 0) { options = {}; }
|
|
16922
16926
|
return this.addLayer('TILE', __assign(__assign({}, options), { url: url }));
|
|
16923
16927
|
};
|
|
16924
16928
|
WebMapLayers.prototype.addImageLayer = function (urlOrOptions, options) {
|
|
@@ -19132,51 +19136,6 @@ var NgwLeaflet = (function () {
|
|
|
19132
19136
|
return NgwConnector;
|
|
19133
19137
|
}());
|
|
19134
19138
|
|
|
19135
|
-
function createPopupContent(feature, item) {
|
|
19136
|
-
// @ts-ignore
|
|
19137
|
-
{
|
|
19138
|
-
var element_1 = document.createElement('div');
|
|
19139
|
-
if (item && item.feature_layer) {
|
|
19140
|
-
item.feature_layer.fields.forEach(function (x) {
|
|
19141
|
-
if (x.grid_visibility) {
|
|
19142
|
-
var value = feature.properties && feature.properties[x.keyname];
|
|
19143
|
-
if (value) {
|
|
19144
|
-
var propElem = document.createElement('div');
|
|
19145
|
-
element_1.appendChild(propElem);
|
|
19146
|
-
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
19147
|
-
}
|
|
19148
|
-
}
|
|
19149
|
-
});
|
|
19150
|
-
}
|
|
19151
|
-
else if (feature.properties) {
|
|
19152
|
-
for (var p in feature.properties) {
|
|
19153
|
-
var propElem = document.createElement('div');
|
|
19154
|
-
element_1.appendChild(propElem);
|
|
19155
|
-
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
19156
|
-
}
|
|
19157
|
-
}
|
|
19158
|
-
return element_1;
|
|
19159
|
-
}
|
|
19160
|
-
}
|
|
19161
|
-
|
|
19162
|
-
var filterOptionsKeys = [
|
|
19163
|
-
'fields',
|
|
19164
|
-
'intersects',
|
|
19165
|
-
'limit',
|
|
19166
|
-
'orderBy',
|
|
19167
|
-
'strategy',
|
|
19168
|
-
];
|
|
19169
|
-
function getLayerFilterOptions(options) {
|
|
19170
|
-
var filterOptions = {};
|
|
19171
|
-
filterOptionsKeys.forEach(function (x) {
|
|
19172
|
-
var opt = options[x];
|
|
19173
|
-
if (opt !== undefined) {
|
|
19174
|
-
filterOptions[x] = opt;
|
|
19175
|
-
}
|
|
19176
|
-
});
|
|
19177
|
-
return filterOptions;
|
|
19178
|
-
}
|
|
19179
|
-
|
|
19180
19139
|
function getNgwWebmapExtent(webmap) {
|
|
19181
19140
|
var bottom = webmap['extent_bottom'];
|
|
19182
19141
|
var left = webmap['extent_left'];
|
|
@@ -19244,6 +19203,85 @@ var NgwLeaflet = (function () {
|
|
|
19244
19203
|
}
|
|
19245
19204
|
}
|
|
19246
19205
|
|
|
19206
|
+
var NgwResource = /** @class */ (function () {
|
|
19207
|
+
function NgwResource() {
|
|
19208
|
+
}
|
|
19209
|
+
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
19210
|
+
NgwResource.prototype.getExtent = function () {
|
|
19211
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19212
|
+
return __generator(this, function (_a) {
|
|
19213
|
+
return [2 /*return*/, this.getBounds()];
|
|
19214
|
+
});
|
|
19215
|
+
});
|
|
19216
|
+
};
|
|
19217
|
+
NgwResource.prototype.getBounds = function (options) {
|
|
19218
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19219
|
+
var _a;
|
|
19220
|
+
return __generator(this, function (_b) {
|
|
19221
|
+
switch (_b.label) {
|
|
19222
|
+
case 0:
|
|
19223
|
+
if (this._extent) {
|
|
19224
|
+
return [2 /*return*/, this._extent];
|
|
19225
|
+
}
|
|
19226
|
+
if (!this.item) return [3 /*break*/, 2];
|
|
19227
|
+
_a = this;
|
|
19228
|
+
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
|
|
19229
|
+
case 1:
|
|
19230
|
+
_a._extent = _b.sent();
|
|
19231
|
+
return [2 /*return*/, this._extent];
|
|
19232
|
+
case 2: return [2 /*return*/];
|
|
19233
|
+
}
|
|
19234
|
+
});
|
|
19235
|
+
});
|
|
19236
|
+
};
|
|
19237
|
+
return NgwResource;
|
|
19238
|
+
}());
|
|
19239
|
+
|
|
19240
|
+
function createPopupContent(feature, item) {
|
|
19241
|
+
// @ts-ignore
|
|
19242
|
+
{
|
|
19243
|
+
var element_1 = document.createElement('div');
|
|
19244
|
+
if (item && item.feature_layer) {
|
|
19245
|
+
item.feature_layer.fields.forEach(function (x) {
|
|
19246
|
+
if (x.grid_visibility) {
|
|
19247
|
+
var value = feature.properties && feature.properties[x.keyname];
|
|
19248
|
+
if (value) {
|
|
19249
|
+
var propElem = document.createElement('div');
|
|
19250
|
+
element_1.appendChild(propElem);
|
|
19251
|
+
propElem.innerHTML = "<span>".concat(x.display_name, "</span>: ").concat(value, "<span></span>");
|
|
19252
|
+
}
|
|
19253
|
+
}
|
|
19254
|
+
});
|
|
19255
|
+
}
|
|
19256
|
+
else if (feature.properties) {
|
|
19257
|
+
for (var p in feature.properties) {
|
|
19258
|
+
var propElem = document.createElement('div');
|
|
19259
|
+
element_1.appendChild(propElem);
|
|
19260
|
+
propElem.innerHTML = "<span>".concat(p, "</span>: ").concat(feature.properties[p], "<span></span>");
|
|
19261
|
+
}
|
|
19262
|
+
}
|
|
19263
|
+
return element_1;
|
|
19264
|
+
}
|
|
19265
|
+
}
|
|
19266
|
+
|
|
19267
|
+
var filterOptionsKeys = [
|
|
19268
|
+
'fields',
|
|
19269
|
+
'intersects',
|
|
19270
|
+
'limit',
|
|
19271
|
+
'orderBy',
|
|
19272
|
+
'strategy',
|
|
19273
|
+
];
|
|
19274
|
+
function getLayerFilterOptions(options) {
|
|
19275
|
+
var filterOptions = {};
|
|
19276
|
+
filterOptionsKeys.forEach(function (x) {
|
|
19277
|
+
var opt = options[x];
|
|
19278
|
+
if (opt !== undefined) {
|
|
19279
|
+
filterOptions[x] = opt;
|
|
19280
|
+
}
|
|
19281
|
+
});
|
|
19282
|
+
return filterOptions;
|
|
19283
|
+
}
|
|
19284
|
+
|
|
19247
19285
|
function resourceIdFromLayerOptions(options, connector) {
|
|
19248
19286
|
return __awaiter(this, void 0, void 0, function () {
|
|
19249
19287
|
var resource, item, keyname, resourceId, resourceItem;
|
|
@@ -19881,6 +19919,7 @@ var NgwLeaflet = (function () {
|
|
|
19881
19919
|
};
|
|
19882
19920
|
}
|
|
19883
19921
|
function ngwApiToAdapterOptions(_a) {
|
|
19922
|
+
var _b;
|
|
19884
19923
|
var options = _a.options, webMap = _a.webMap, baseUrl = _a.baseUrl;
|
|
19885
19924
|
var adapter = options.adapter || 'IMAGE';
|
|
19886
19925
|
var url;
|
|
@@ -19920,10 +19959,12 @@ var NgwLeaflet = (function () {
|
|
|
19920
19959
|
'resource=' +
|
|
19921
19960
|
resourceId +
|
|
19922
19961
|
'&simplification=' +
|
|
19923
|
-
(options.simplification
|
|
19962
|
+
((_b = options.simplification) !== null && _b !== void 0 ? _b : 8);
|
|
19924
19963
|
// url = baseUrl + '/api/resource/' + options.resourceId + '/{z}/{x}/{y}.mvt';
|
|
19925
19964
|
return {
|
|
19926
19965
|
url: url,
|
|
19966
|
+
sourceLayer: 'ngw:' + resourceId,
|
|
19967
|
+
featureIdName: '$id',
|
|
19927
19968
|
};
|
|
19928
19969
|
}
|
|
19929
19970
|
if (adapter === 'TERRAIN') {
|
|
@@ -19986,7 +20027,6 @@ var NgwLeaflet = (function () {
|
|
|
19986
20027
|
return [2 /*return*/, /** @class */ (function (_super) {
|
|
19987
20028
|
__extends(RasterAdapter, _super);
|
|
19988
20029
|
function RasterAdapter(map, _options) {
|
|
19989
|
-
var _a;
|
|
19990
20030
|
var _this = _super.call(this, map, _options) || this;
|
|
19991
20031
|
_this.map = map;
|
|
19992
20032
|
// options = {};
|
|
@@ -19998,7 +20038,7 @@ var NgwLeaflet = (function () {
|
|
|
19998
20038
|
baseUrl: connector.options.baseUrl || '',
|
|
19999
20039
|
});
|
|
20000
20040
|
if (opt) {
|
|
20001
|
-
var layerAdapterOptions = __assign(__assign({}, opt),
|
|
20041
|
+
var layerAdapterOptions = __assign(__assign(__assign({}, opt), layerOptions.adapterOptions), { params: { resource: resourceId_1 },
|
|
20002
20042
|
// @deprecated
|
|
20003
20043
|
layers: String(resourceId_1), resourceId: resourceId_1 });
|
|
20004
20044
|
if (layerOptions.adapterOptions &&
|
|
@@ -20031,11 +20071,16 @@ var NgwLeaflet = (function () {
|
|
|
20031
20071
|
return __awaiter(this, void 0, void 0, function () {
|
|
20032
20072
|
var id;
|
|
20033
20073
|
return __generator(this, function (_a) {
|
|
20034
|
-
|
|
20035
|
-
|
|
20036
|
-
|
|
20074
|
+
if (this.item) {
|
|
20075
|
+
if (adapter === 'MVT') {
|
|
20076
|
+
return [2 /*return*/, [this.item.resource.id]];
|
|
20077
|
+
}
|
|
20078
|
+
id = this.item.resource.parent.id;
|
|
20079
|
+
if (defined(id)) {
|
|
20080
|
+
return [2 /*return*/, [id]];
|
|
20081
|
+
}
|
|
20037
20082
|
}
|
|
20038
|
-
return [2 /*return
|
|
20083
|
+
return [2 /*return*/, []];
|
|
20039
20084
|
});
|
|
20040
20085
|
});
|
|
20041
20086
|
};
|
|
@@ -21441,40 +21486,6 @@ var NgwLeaflet = (function () {
|
|
|
21441
21486
|
});
|
|
21442
21487
|
}
|
|
21443
21488
|
|
|
21444
|
-
var NgwResource = /** @class */ (function () {
|
|
21445
|
-
function NgwResource() {
|
|
21446
|
-
}
|
|
21447
|
-
/** @deprecated use {@link NgwResource.getBounds} instead */
|
|
21448
|
-
NgwResource.prototype.getExtent = function () {
|
|
21449
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
21450
|
-
return __generator(this, function (_a) {
|
|
21451
|
-
return [2 /*return*/, this.getBounds()];
|
|
21452
|
-
});
|
|
21453
|
-
});
|
|
21454
|
-
};
|
|
21455
|
-
NgwResource.prototype.getBounds = function (options) {
|
|
21456
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
21457
|
-
var _a;
|
|
21458
|
-
return __generator(this, function (_b) {
|
|
21459
|
-
switch (_b.label) {
|
|
21460
|
-
case 0:
|
|
21461
|
-
if (this._extent) {
|
|
21462
|
-
return [2 /*return*/, this._extent];
|
|
21463
|
-
}
|
|
21464
|
-
if (!this.item) return [3 /*break*/, 2];
|
|
21465
|
-
_a = this;
|
|
21466
|
-
return [4 /*yield*/, fetchNgwResourceExtent(this.item, this.connector, options)];
|
|
21467
|
-
case 1:
|
|
21468
|
-
_a._extent = _b.sent();
|
|
21469
|
-
return [2 /*return*/, this._extent];
|
|
21470
|
-
case 2: return [2 /*return*/];
|
|
21471
|
-
}
|
|
21472
|
-
});
|
|
21473
|
-
});
|
|
21474
|
-
};
|
|
21475
|
-
return NgwResource;
|
|
21476
|
-
}());
|
|
21477
|
-
|
|
21478
21489
|
var alias = {
|
|
21479
21490
|
tms: 'TILE',
|
|
21480
21491
|
};
|
|
@@ -21702,7 +21713,7 @@ var NgwLeaflet = (function () {
|
|
|
21702
21713
|
}
|
|
21703
21714
|
function createAsyncAdapter(options, webMap, connector) {
|
|
21704
21715
|
return __awaiter(this, void 0, void 0, function () {
|
|
21705
|
-
var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, parentItem, parentOptions, getClassAdapter, classAdapter;
|
|
21716
|
+
var adapter, item, adapterType, resourceId, resourceOptions, itemFromResOpt, cls, layerOptions, adapterOptions, type, adapterOptions_, parentItem, parentOptions, getClassAdapter, classAdapter;
|
|
21706
21717
|
return __generator(this, function (_a) {
|
|
21707
21718
|
switch (_a.label) {
|
|
21708
21719
|
case 0:
|
|
@@ -21738,6 +21749,12 @@ var NgwLeaflet = (function () {
|
|
|
21738
21749
|
return [3 /*break*/, 11];
|
|
21739
21750
|
case 5:
|
|
21740
21751
|
if (!(cls === 'vector_layer')) return [3 /*break*/, 6];
|
|
21752
|
+
type = item.vector_layer &&
|
|
21753
|
+
vectorLayerGeomToPaintTypeAlias[item.vector_layer.geometry_type];
|
|
21754
|
+
adapterOptions_ = adapterOptions.layerOptions.adapterOptions || {};
|
|
21755
|
+
adapterOptions_.type = adapterOptions_.type || type;
|
|
21756
|
+
adapterOptions.layerOptions.adapterOptions = adapterOptions_;
|
|
21757
|
+
options.adapterOptions = adapterOptions;
|
|
21741
21758
|
if (adapterType !== undefined && adapterType !== 'GEOJSON') {
|
|
21742
21759
|
if (adapterType === 'MVT') {
|
|
21743
21760
|
adapter = createRasterAdapter(adapterOptions);
|
|
@@ -22918,7 +22935,7 @@ var NgwLeaflet = (function () {
|
|
|
22918
22935
|
};
|
|
22919
22936
|
NgwMap.prototype._selectFromNgwRaster = function (ev) {
|
|
22920
22937
|
return __awaiter(this, void 0, void 0, function () {
|
|
22921
|
-
var promises, layers, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
22938
|
+
var promises, layers, _i, layers_1, l, layer, identFunc, getIdsPromise, getIds, ids, pixelRadius, center, zoom, radius, selectPromise;
|
|
22922
22939
|
var _this = this;
|
|
22923
22940
|
return __generator(this, function (_a) {
|
|
22924
22941
|
switch (_a.label) {
|
|
@@ -22932,15 +22949,16 @@ var NgwLeaflet = (function () {
|
|
|
22932
22949
|
}
|
|
22933
22950
|
return 1;
|
|
22934
22951
|
});
|
|
22935
|
-
layers.
|
|
22936
|
-
|
|
22937
|
-
|
|
22952
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
22953
|
+
l = layers_1[_i];
|
|
22954
|
+
layer = l.layer;
|
|
22955
|
+
identFunc = typeof layer.getIdentificationIds === 'function'
|
|
22938
22956
|
? layer.getIdentificationIds
|
|
22939
22957
|
: false;
|
|
22940
|
-
if (identFunc && layer.options.selectable &&
|
|
22958
|
+
if (identFunc && layer.options.selectable && this.isLayerVisible(layer)) {
|
|
22941
22959
|
promises.push(identFunc.call(layer));
|
|
22942
22960
|
}
|
|
22943
|
-
}
|
|
22961
|
+
}
|
|
22944
22962
|
getIdsPromise = Promise.all(promises);
|
|
22945
22963
|
return [4 /*yield*/, getIdsPromise];
|
|
22946
22964
|
case 1:
|