@nextgis/ngw-map 1.15.1 → 1.16.0
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 +1 -1
- package/lib/ngw-map.esm-browser.js +45 -32
- 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 +1 -1
- package/lib/ngw-map.global.js +45 -32
- 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 +7 -7
package/lib/ngw-map.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.16.0; author: NextGIS */
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -1522,6 +1522,24 @@ function createPropertiesPaint(propertiesPaint) {
|
|
|
1522
1522
|
return mask;
|
|
1523
1523
|
};
|
|
1524
1524
|
}
|
|
1525
|
+
function expressionCallback(paint, defaultPaint, getPaintFunctions) {
|
|
1526
|
+
var expressionCallback = createExpressionCallback(paint);
|
|
1527
|
+
if (expressionCallback) {
|
|
1528
|
+
var expressionPaintCb = function (feature) {
|
|
1529
|
+
return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
|
|
1530
|
+
};
|
|
1531
|
+
expressionPaintCb.paint = paint;
|
|
1532
|
+
return expressionPaintCb;
|
|
1533
|
+
}
|
|
1534
|
+
var newPaint = __assign({}, defaultPaint);
|
|
1535
|
+
newPaint = __assign(__assign({}, newPaint), paint);
|
|
1536
|
+
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
1537
|
+
newPaint.stroke =
|
|
1538
|
+
newPaint.stroke !== undefined
|
|
1539
|
+
? newPaint.stroke
|
|
1540
|
+
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
1541
|
+
return newPaint;
|
|
1542
|
+
}
|
|
1525
1543
|
function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
1526
1544
|
if (!paint) {
|
|
1527
1545
|
throw new Error('paint is empty');
|
|
@@ -1551,20 +1569,7 @@ function preparePaint(paint, defaultPaint, getPaintFunctions) {
|
|
|
1551
1569
|
return paint;
|
|
1552
1570
|
}
|
|
1553
1571
|
else {
|
|
1554
|
-
|
|
1555
|
-
if (expressionCallback_1) {
|
|
1556
|
-
var expressionPaintCb = function (feature) {
|
|
1557
|
-
return preparePaint(expressionCallback_1(feature), defaultPaint, getPaintFunctions);
|
|
1558
|
-
};
|
|
1559
|
-
expressionPaintCb.paint = paint;
|
|
1560
|
-
return expressionPaintCb;
|
|
1561
|
-
}
|
|
1562
|
-
newPaint = __assign(__assign({}, newPaint), paint);
|
|
1563
|
-
newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
|
|
1564
|
-
newPaint.stroke =
|
|
1565
|
-
newPaint.stroke !== undefined
|
|
1566
|
-
? newPaint.stroke
|
|
1567
|
-
: !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
|
|
1572
|
+
newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
|
|
1568
1573
|
}
|
|
1569
1574
|
if (isPaintCallback(newPaint)) {
|
|
1570
1575
|
return newPaint;
|
|
@@ -6642,10 +6647,12 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
6642
6647
|
};
|
|
6643
6648
|
if (item.item_type === 'group' || item.item_type === 'root') {
|
|
6644
6649
|
if (item.children && item.children.length) {
|
|
6645
|
-
this.getChildren(item)
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6650
|
+
var children = this.getChildren(item);
|
|
6651
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
6652
|
+
var x = children_1[_i];
|
|
6653
|
+
var children_2 = new this.constructor(this.webMap, x, this.options, this.connector, this);
|
|
6654
|
+
this.tree.addChild(children_2);
|
|
6655
|
+
}
|
|
6649
6656
|
}
|
|
6650
6657
|
return Promise.resolve();
|
|
6651
6658
|
}
|
|
@@ -6686,7 +6693,7 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
6686
6693
|
headers: this.options.headers,
|
|
6687
6694
|
crossOrigin: this.options.crossOrigin,
|
|
6688
6695
|
setViewDelay: this.options.setViewDelay,
|
|
6689
|
-
params: { resource: this.item.resourceId },
|
|
6696
|
+
params: { resource: this.item.resourceId, item: this.item },
|
|
6690
6697
|
};
|
|
6691
6698
|
if (this.options.order) {
|
|
6692
6699
|
var subOrder = this.options.drawOrderEnabled && 'draw_order_position' in item
|
|
@@ -6697,6 +6704,9 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
6697
6704
|
var subLevel = String(subOrder).padStart(4, '0');
|
|
6698
6705
|
options.order = Number((this.options.order | 0) + '.' + subLevel);
|
|
6699
6706
|
}
|
|
6707
|
+
if (this.options.popupOptions) {
|
|
6708
|
+
options.popupOptions = this.options.popupOptions;
|
|
6709
|
+
}
|
|
6700
6710
|
if (item.item_type === 'layer') {
|
|
6701
6711
|
var _a = this._getZoomRange(item), maxZoom = _a.maxZoom, minZoom = _a.minZoom;
|
|
6702
6712
|
objectAssign(options, {
|
|
@@ -6744,8 +6754,8 @@ var NgwWebmapItem = /** @class */ (function (_super) {
|
|
|
6744
6754
|
};
|
|
6745
6755
|
NgwWebmapItem.prototype._sumUp = function (children, totalValue) {
|
|
6746
6756
|
if (totalValue === void 0) { totalValue = 0; }
|
|
6747
|
-
for (var _i = 0,
|
|
6748
|
-
var child =
|
|
6757
|
+
for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
|
|
6758
|
+
var child = children_3[_i];
|
|
6749
6759
|
if (child.item_type === 'layer') {
|
|
6750
6760
|
totalValue += 1;
|
|
6751
6761
|
child.draw_order_position = child.draw_order_position || totalValue;
|
|
@@ -7052,8 +7062,6 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
7052
7062
|
this._extent &&
|
|
7053
7063
|
extentConstrained) {
|
|
7054
7064
|
this.options.webMap.setView({ maxBounds: this._extent });
|
|
7055
|
-
// @ts-ignore
|
|
7056
|
-
window.webmap = this.options.webMap;
|
|
7057
7065
|
}
|
|
7058
7066
|
return [2 /*return*/, this.layer];
|
|
7059
7067
|
}
|
|
@@ -7226,6 +7234,7 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
7226
7234
|
options.minZoom = _this.options.minZoom;
|
|
7227
7235
|
options.maxZoom = _this.options.maxZoom;
|
|
7228
7236
|
options.drawOrderEnabled = webmap_1.draw_order_enabled;
|
|
7237
|
+
options.popupOptions = _this.options.popupOptions;
|
|
7229
7238
|
var layer = new _this.NgwWebmapItem(_this.options.webMap, webmap_1.root_item, options, _this.options.connector);
|
|
7230
7239
|
layer.emitter.on('init', function () { return resolve(layer); });
|
|
7231
7240
|
})];
|
|
@@ -7356,30 +7365,34 @@ var NgwWebmapLayerAdapter = /** @class */ (function () {
|
|
|
7356
7365
|
};
|
|
7357
7366
|
NgwWebmapLayerAdapter.prototype._getWebMapIds = function () {
|
|
7358
7367
|
return __awaiter(this, void 0, void 0, function () {
|
|
7359
|
-
var webMapItem, layers,
|
|
7360
|
-
var _this = this;
|
|
7368
|
+
var webMapItem, layers, promises, _loop_2, this_2, _i, layers_1, x, ids;
|
|
7361
7369
|
return __generator(this, function (_a) {
|
|
7362
7370
|
switch (_a.label) {
|
|
7363
7371
|
case 0:
|
|
7364
7372
|
webMapItem = this.layer;
|
|
7365
7373
|
if (!(webMapItem && webMapItem.item.item_type === 'root')) return [3 /*break*/, 2];
|
|
7366
7374
|
layers = webMapItem.tree.getDescendants();
|
|
7367
|
-
|
|
7368
|
-
|
|
7375
|
+
promises = [];
|
|
7376
|
+
_loop_2 = function (x) {
|
|
7369
7377
|
var item = x.item;
|
|
7370
7378
|
if (item.item_type === 'layer') {
|
|
7371
7379
|
var id = item.layer_style_id;
|
|
7372
|
-
var promise =
|
|
7380
|
+
var promise = this_2.options.connector.getResource(id).then(function (y) {
|
|
7373
7381
|
if (y) {
|
|
7374
7382
|
var parentId = Number(y.resource.parent.id);
|
|
7375
7383
|
item.parentId = parentId;
|
|
7376
7384
|
return parentId;
|
|
7377
7385
|
}
|
|
7378
7386
|
});
|
|
7379
|
-
|
|
7387
|
+
promises.push(promise);
|
|
7380
7388
|
}
|
|
7381
|
-
}
|
|
7382
|
-
|
|
7389
|
+
};
|
|
7390
|
+
this_2 = this;
|
|
7391
|
+
for (_i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
7392
|
+
x = layers_1[_i];
|
|
7393
|
+
_loop_2(x);
|
|
7394
|
+
}
|
|
7395
|
+
return [4 /*yield*/, Promise.all(promises)];
|
|
7383
7396
|
case 1:
|
|
7384
7397
|
ids = _a.sent();
|
|
7385
7398
|
return [2 /*return*/, ids.filter(function (x) { return x !== undefined; })];
|