bruce-cesium 3.4.1 → 3.4.3
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/dist/bruce-cesium.es5.js +440 -154
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +439 -153
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +122 -50
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +122 -50
- package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +122 -50
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +26 -2
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +46 -0
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/visuals-register.d.ts +2 -0
- package/dist/types/utils/cesium-entity-styler.d.ts +5 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -742,6 +742,52 @@
|
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
CesiumEntityStyler.UpdateColorSetting = UpdateColorSetting;
|
|
745
|
+
function Refresh(params) {
|
|
746
|
+
var viewer = params.viewer, entity = params.entity, requestRender = params.requestRender;
|
|
747
|
+
if (!entity) {
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
751
|
+
entity: entity
|
|
752
|
+
});
|
|
753
|
+
for (var i = 0; i < parts.length; i++) {
|
|
754
|
+
var part = parts[i];
|
|
755
|
+
if (!isAlive(viewer, part)) {
|
|
756
|
+
continue;
|
|
757
|
+
}
|
|
758
|
+
if (part instanceof Cesium.Cesium3DTileFeature) {
|
|
759
|
+
var opacity = getAppliedOpacity(part);
|
|
760
|
+
refreshColor(viewer, part, opacity);
|
|
761
|
+
}
|
|
762
|
+
else if (part instanceof Cesium.Entity) {
|
|
763
|
+
if (part.billboard) {
|
|
764
|
+
refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
|
|
765
|
+
}
|
|
766
|
+
if (part.model) {
|
|
767
|
+
refreshColor(viewer, part.model, getAppliedOpacity(part.model));
|
|
768
|
+
}
|
|
769
|
+
if (part.polyline) {
|
|
770
|
+
refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
|
|
771
|
+
}
|
|
772
|
+
if (part.polygon) {
|
|
773
|
+
refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
|
|
774
|
+
}
|
|
775
|
+
if (part.corridor) {
|
|
776
|
+
refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
|
|
777
|
+
}
|
|
778
|
+
if (part.point) {
|
|
779
|
+
refreshColor(viewer, part.point, getAppliedOpacity(part.point));
|
|
780
|
+
}
|
|
781
|
+
if (part.ellipse) {
|
|
782
|
+
refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (requestRender != false) {
|
|
787
|
+
viewer.scene.requestRender();
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
CesiumEntityStyler.Refresh = Refresh;
|
|
745
791
|
/**
|
|
746
792
|
* Updates the default colour of a graphic.
|
|
747
793
|
* This will not change the graphic's state to use it if the entity is selected/highlighted.
|
|
@@ -6466,16 +6512,40 @@
|
|
|
6466
6512
|
};
|
|
6467
6513
|
Register.prototype.ForceUpdate = function (params) {
|
|
6468
6514
|
var _a;
|
|
6469
|
-
var entityIds = params.entityIds;
|
|
6515
|
+
var entityIds = params.entityIds, requestRender = params.requestRender, refreshColors = params.refreshColors;
|
|
6516
|
+
var selectedIds = this.selectedIds;
|
|
6517
|
+
var highlightedIds = this.highlightedIds;
|
|
6470
6518
|
for (var i = 0; i < entityIds.length; i++) {
|
|
6471
6519
|
var entityId = entityIds[i];
|
|
6472
6520
|
updateEntity(this.viewer, entityId, this);
|
|
6521
|
+
if (refreshColors) {
|
|
6522
|
+
if (selectedIds.includes(entityId)) {
|
|
6523
|
+
CesiumEntityStyler.Select({
|
|
6524
|
+
entity: this.GetRego({
|
|
6525
|
+
entityId: entityId
|
|
6526
|
+
}).visual,
|
|
6527
|
+
viewer: this.viewer,
|
|
6528
|
+
requestRender: false
|
|
6529
|
+
});
|
|
6530
|
+
}
|
|
6531
|
+
else if (highlightedIds.includes(entityId)) {
|
|
6532
|
+
CesiumEntityStyler.Highlight({
|
|
6533
|
+
entity: this.GetRego({
|
|
6534
|
+
entityId: entityId
|
|
6535
|
+
}).visual,
|
|
6536
|
+
viewer: this.viewer,
|
|
6537
|
+
requestRender: false
|
|
6538
|
+
});
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6473
6541
|
(_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
|
|
6474
6542
|
type: EVisualUpdateType.Update,
|
|
6475
6543
|
entityId: entityId
|
|
6476
6544
|
});
|
|
6477
6545
|
}
|
|
6478
|
-
|
|
6546
|
+
if (requestRender != false) {
|
|
6547
|
+
this.viewer.scene.requestRender();
|
|
6548
|
+
}
|
|
6479
6549
|
};
|
|
6480
6550
|
/**
|
|
6481
6551
|
* Marks given entityIds as either labelled or not labelled.
|
|
@@ -8146,6 +8216,10 @@
|
|
|
8146
8216
|
}
|
|
8147
8217
|
];
|
|
8148
8218
|
}
|
|
8219
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
8220
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
8221
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
8222
|
+
}
|
|
8149
8223
|
var isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
|
|
8150
8224
|
var tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
|
|
8151
8225
|
if (!tagsToRender) {
|
|
@@ -8329,6 +8403,10 @@
|
|
|
8329
8403
|
}
|
|
8330
8404
|
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
8331
8405
|
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
8406
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
8407
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
8408
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
8409
|
+
}
|
|
8332
8410
|
this.setGetter();
|
|
8333
8411
|
}
|
|
8334
8412
|
if (queueRerender != false) {
|
|
@@ -8423,11 +8501,11 @@
|
|
|
8423
8501
|
var _a;
|
|
8424
8502
|
if (force === void 0) { force = false; }
|
|
8425
8503
|
return __awaiter(this, void 0, void 0, function () {
|
|
8426
|
-
var typeId_1, e_3;
|
|
8504
|
+
var typeId_1, zoomItem, e_3;
|
|
8427
8505
|
return __generator(this, function (_b) {
|
|
8428
8506
|
switch (_b.label) {
|
|
8429
8507
|
case 0:
|
|
8430
|
-
_b.trys.push([0,
|
|
8508
|
+
_b.trys.push([0, 8, , 9]);
|
|
8431
8509
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
8432
8510
|
return [2 /*return*/];
|
|
8433
8511
|
}
|
|
@@ -8435,21 +8513,30 @@
|
|
|
8435
8513
|
if (typeId_1) {
|
|
8436
8514
|
entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
|
|
8437
8515
|
}
|
|
8438
|
-
if (!this.useGeojson) return [3 /*break*/,
|
|
8439
|
-
|
|
8516
|
+
if (!this.useGeojson) return [3 /*break*/, 5];
|
|
8517
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
8518
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
|
|
8519
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
8520
|
+
return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
8440
8521
|
case 1:
|
|
8522
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
8441
8523
|
_b.sent();
|
|
8442
8524
|
return [3 /*break*/, 4];
|
|
8443
|
-
case 2: return [4 /*yield*/, this.
|
|
8525
|
+
case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
8444
8526
|
case 3:
|
|
8445
8527
|
_b.sent();
|
|
8446
8528
|
_b.label = 4;
|
|
8447
|
-
case 4: return [3 /*break*/,
|
|
8448
|
-
case 5:
|
|
8529
|
+
case 4: return [3 /*break*/, 7];
|
|
8530
|
+
case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
8531
|
+
case 6:
|
|
8532
|
+
_b.sent();
|
|
8533
|
+
_b.label = 7;
|
|
8534
|
+
case 7: return [3 /*break*/, 9];
|
|
8535
|
+
case 8:
|
|
8449
8536
|
e_3 = _b.sent();
|
|
8450
8537
|
console.error(e_3);
|
|
8451
|
-
return [3 /*break*/,
|
|
8452
|
-
case
|
|
8538
|
+
return [3 /*break*/, 9];
|
|
8539
|
+
case 9: return [2 /*return*/];
|
|
8453
8540
|
}
|
|
8454
8541
|
});
|
|
8455
8542
|
});
|
|
@@ -8461,12 +8548,12 @@
|
|
|
8461
8548
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
8462
8549
|
*/
|
|
8463
8550
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
8464
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
8551
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
8465
8552
|
return __awaiter(this, void 0, void 0, function () {
|
|
8466
|
-
var zoomItem, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
8553
|
+
var zoomItem, lods, withLods_1, individuals, style, e_4, entityTypeId, entityType, e_5, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
8467
8554
|
var _this = this;
|
|
8468
|
-
return __generator(this, function (
|
|
8469
|
-
switch (
|
|
8555
|
+
return __generator(this, function (_o) {
|
|
8556
|
+
switch (_o.label) {
|
|
8470
8557
|
case 0:
|
|
8471
8558
|
entities = entities.filter(function (entity) {
|
|
8472
8559
|
var _a;
|
|
@@ -8478,52 +8565,93 @@
|
|
|
8478
8565
|
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
8479
8566
|
});
|
|
8480
8567
|
zoomItem = this.item.CameraZoomSettings[0];
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8568
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
|
|
8569
|
+
return [4 /*yield*/, bruceModels.EntityLod.GetLods({
|
|
8570
|
+
api: this.apiGetter.getApi(),
|
|
8571
|
+
filter: {
|
|
8572
|
+
externalSources: false,
|
|
8573
|
+
Items: entities.map(function (x) {
|
|
8574
|
+
var _a, _b;
|
|
8575
|
+
return {
|
|
8576
|
+
entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
|
|
8577
|
+
categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
|
|
8578
|
+
group: "DEFAULT",
|
|
8579
|
+
level: Number(zoomItem.LODLevel)
|
|
8580
|
+
};
|
|
8581
|
+
}),
|
|
8582
|
+
strict: false
|
|
8583
|
+
}
|
|
8584
|
+
})];
|
|
8484
8585
|
case 1:
|
|
8485
|
-
|
|
8586
|
+
lods = (_o.sent()).lods;
|
|
8587
|
+
if (this.disposed) {
|
|
8588
|
+
this.doDispose();
|
|
8589
|
+
return [2 /*return*/];
|
|
8590
|
+
}
|
|
8591
|
+
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
8592
|
+
individuals = entities.filter(function (entity) {
|
|
8593
|
+
var _a;
|
|
8594
|
+
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
8595
|
+
});
|
|
8596
|
+
if (individuals.length) {
|
|
8597
|
+
this.renderAsIndividuals(individuals, force);
|
|
8598
|
+
}
|
|
8599
|
+
// Now we proceed with what is left.
|
|
8600
|
+
entities = entities.filter(function (entity) {
|
|
8601
|
+
var _a;
|
|
8602
|
+
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
8603
|
+
});
|
|
8604
|
+
_o.label = 2;
|
|
8605
|
+
case 2:
|
|
8606
|
+
if (!entities.length) {
|
|
8607
|
+
return [2 /*return*/];
|
|
8608
|
+
}
|
|
8609
|
+
style = null;
|
|
8610
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
8611
|
+
_o.label = 3;
|
|
8612
|
+
case 3:
|
|
8613
|
+
_o.trys.push([3, 5, , 6]);
|
|
8486
8614
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
8487
8615
|
api: this.apiGetter.getApi(),
|
|
8488
8616
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
8489
8617
|
})];
|
|
8490
|
-
case 2:
|
|
8491
|
-
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
8492
|
-
return [3 /*break*/, 4];
|
|
8493
|
-
case 3:
|
|
8494
|
-
e_4 = _m.sent();
|
|
8495
|
-
console.error(e_4);
|
|
8496
|
-
return [3 /*break*/, 4];
|
|
8497
8618
|
case 4:
|
|
8619
|
+
style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
8620
|
+
return [3 /*break*/, 6];
|
|
8621
|
+
case 5:
|
|
8622
|
+
e_4 = _o.sent();
|
|
8623
|
+
console.error(e_4);
|
|
8624
|
+
return [3 /*break*/, 6];
|
|
8625
|
+
case 6:
|
|
8498
8626
|
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
8499
8627
|
if (!entityTypeId) {
|
|
8500
8628
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
8501
8629
|
}
|
|
8502
|
-
if (!entityTypeId) return [3 /*break*/,
|
|
8503
|
-
|
|
8504
|
-
case
|
|
8505
|
-
|
|
8630
|
+
if (!entityTypeId) return [3 /*break*/, 12];
|
|
8631
|
+
_o.label = 7;
|
|
8632
|
+
case 7:
|
|
8633
|
+
_o.trys.push([7, 11, , 12]);
|
|
8506
8634
|
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
8507
8635
|
entityTypeId: entityTypeId,
|
|
8508
8636
|
api: this.apiGetter.getApi()
|
|
8509
8637
|
})];
|
|
8510
|
-
case
|
|
8511
|
-
entityType = (_e = (
|
|
8512
|
-
if (!(!style && entityType)) return [3 /*break*/,
|
|
8513
|
-
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/,
|
|
8638
|
+
case 8:
|
|
8639
|
+
entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
8640
|
+
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
8641
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
8514
8642
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
8515
8643
|
api: this.apiGetter.getApi(),
|
|
8516
8644
|
styleId: entityType["DisplaySetting.ID"]
|
|
8517
8645
|
})];
|
|
8518
|
-
case 7:
|
|
8519
|
-
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
8520
|
-
_m.label = 8;
|
|
8521
|
-
case 8: return [3 /*break*/, 10];
|
|
8522
8646
|
case 9:
|
|
8523
|
-
|
|
8647
|
+
style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
8648
|
+
_o.label = 10;
|
|
8649
|
+
case 10: return [3 /*break*/, 12];
|
|
8650
|
+
case 11:
|
|
8651
|
+
e_5 = _o.sent();
|
|
8524
8652
|
console.error(e_5);
|
|
8525
|
-
return [3 /*break*/,
|
|
8526
|
-
case
|
|
8653
|
+
return [3 /*break*/, 12];
|
|
8654
|
+
case 12:
|
|
8527
8655
|
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
8528
8656
|
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
8529
8657
|
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
@@ -8548,7 +8676,16 @@
|
|
|
8548
8676
|
// No points.
|
|
8549
8677
|
allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
|
|
8550
8678
|
});
|
|
8551
|
-
|
|
8679
|
+
notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
|
|
8680
|
+
return !geojson.features.some(function (feature) {
|
|
8681
|
+
var _a, _b, _c;
|
|
8682
|
+
return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
|
|
8683
|
+
});
|
|
8684
|
+
});
|
|
8685
|
+
if (notRendered.length) {
|
|
8686
|
+
this.renderAsIndividuals(notRendered, force);
|
|
8687
|
+
}
|
|
8688
|
+
if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
8552
8689
|
return [2 /*return*/];
|
|
8553
8690
|
}
|
|
8554
8691
|
return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
|
|
@@ -8557,8 +8694,8 @@
|
|
|
8557
8694
|
strokeWidth: lineWidthPx,
|
|
8558
8695
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
8559
8696
|
})];
|
|
8560
|
-
case
|
|
8561
|
-
source =
|
|
8697
|
+
case 13:
|
|
8698
|
+
source = _o.sent();
|
|
8562
8699
|
this.viewer.dataSources.add(source);
|
|
8563
8700
|
this.sources.push(source);
|
|
8564
8701
|
if (this.disposed) {
|
|
@@ -8622,6 +8759,7 @@
|
|
|
8622
8759
|
thing.polyline.width = width;
|
|
8623
8760
|
}
|
|
8624
8761
|
};
|
|
8762
|
+
toForceUpdate = [];
|
|
8625
8763
|
register = function (thing) {
|
|
8626
8764
|
var _a, _b, _c, _d;
|
|
8627
8765
|
// See if the cesium entity already exists in a group.
|
|
@@ -8634,7 +8772,6 @@
|
|
|
8634
8772
|
if (!entityId) {
|
|
8635
8773
|
return;
|
|
8636
8774
|
}
|
|
8637
|
-
var needsUpdate = false;
|
|
8638
8775
|
// Find group for the nextspace entity ID.
|
|
8639
8776
|
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
8640
8777
|
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
@@ -8649,6 +8786,7 @@
|
|
|
8649
8786
|
rego: null
|
|
8650
8787
|
};
|
|
8651
8788
|
groups.push(group);
|
|
8789
|
+
applyStyle(thing, entityId, group.data);
|
|
8652
8790
|
var rego = {
|
|
8653
8791
|
entityId: entityId,
|
|
8654
8792
|
menuItemId: _this.item.id,
|
|
@@ -8673,6 +8811,7 @@
|
|
|
8673
8811
|
}
|
|
8674
8812
|
// Found a group. We flag this as a sibling entity of the primary.
|
|
8675
8813
|
else {
|
|
8814
|
+
applyStyle(thing, entityId, group.data);
|
|
8676
8815
|
group.siblings.push(thing);
|
|
8677
8816
|
group.visual._siblingGraphics = group.siblings;
|
|
8678
8817
|
thing._parentEntity = group.visual;
|
|
@@ -8680,21 +8819,24 @@
|
|
|
8680
8819
|
_this.visualsManager.RefreshMark({
|
|
8681
8820
|
rego: group.rego
|
|
8682
8821
|
});
|
|
8683
|
-
|
|
8822
|
+
if (!toForceUpdate.includes(entityId)) {
|
|
8823
|
+
toForceUpdate.push(entityId);
|
|
8824
|
+
}
|
|
8684
8825
|
}
|
|
8685
8826
|
}
|
|
8686
|
-
applyStyle(thing, entityId, group.data);
|
|
8687
|
-
if (needsUpdate) {
|
|
8688
|
-
_this.visualsManager.ForceUpdate({
|
|
8689
|
-
entityIds: [entityId],
|
|
8690
|
-
});
|
|
8691
|
-
}
|
|
8692
8827
|
};
|
|
8693
8828
|
sEntities = source.entities.values;
|
|
8694
8829
|
for (i = 0; i < sEntities.length; i++) {
|
|
8695
8830
|
cEntity = sEntities[i];
|
|
8696
8831
|
register(cEntity);
|
|
8697
8832
|
}
|
|
8833
|
+
if (toForceUpdate.length) {
|
|
8834
|
+
this.visualsManager.ForceUpdate({
|
|
8835
|
+
entityIds: toForceUpdate,
|
|
8836
|
+
refreshColors: true,
|
|
8837
|
+
requestRender: false
|
|
8838
|
+
});
|
|
8839
|
+
}
|
|
8698
8840
|
this.viewer.scene.requestRender();
|
|
8699
8841
|
return [2 /*return*/];
|
|
8700
8842
|
}
|
|
@@ -8998,6 +9140,10 @@
|
|
|
8998
9140
|
}
|
|
8999
9141
|
];
|
|
9000
9142
|
}
|
|
9143
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
9144
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
9145
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
9146
|
+
}
|
|
9001
9147
|
this.recreateGetter();
|
|
9002
9148
|
};
|
|
9003
9149
|
/**
|
|
@@ -9085,6 +9231,10 @@
|
|
|
9085
9231
|
}
|
|
9086
9232
|
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
9087
9233
|
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
9234
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
9235
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
9236
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
9237
|
+
}
|
|
9088
9238
|
}
|
|
9089
9239
|
if (queueRerender != false) {
|
|
9090
9240
|
var entityIds = Object.keys(this.renderedEntities);
|
|
@@ -9151,12 +9301,12 @@
|
|
|
9151
9301
|
Manager.prototype.onGetterUpdate = function (entities, force) {
|
|
9152
9302
|
if (force === void 0) { force = false; }
|
|
9153
9303
|
return __awaiter(this, void 0, void 0, function () {
|
|
9154
|
-
var isEntityInItem_1, e_2;
|
|
9304
|
+
var isEntityInItem_1, zoomItem, e_2;
|
|
9155
9305
|
var _this = this;
|
|
9156
9306
|
return __generator(this, function (_a) {
|
|
9157
9307
|
switch (_a.label) {
|
|
9158
9308
|
case 0:
|
|
9159
|
-
_a.trys.push([0,
|
|
9309
|
+
_a.trys.push([0, 8, , 9]);
|
|
9160
9310
|
if (this.disposed || this.viewer.isDestroyed()) {
|
|
9161
9311
|
return [2 /*return*/];
|
|
9162
9312
|
}
|
|
@@ -9170,21 +9320,30 @@
|
|
|
9170
9320
|
var _a;
|
|
9171
9321
|
return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
9172
9322
|
});
|
|
9173
|
-
if (!this.useGeojson) return [3 /*break*/,
|
|
9174
|
-
|
|
9323
|
+
if (!this.useGeojson) return [3 /*break*/, 5];
|
|
9324
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
9325
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
|
|
9326
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
9327
|
+
return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9175
9328
|
case 1:
|
|
9329
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
9176
9330
|
_a.sent();
|
|
9177
9331
|
return [3 /*break*/, 4];
|
|
9178
|
-
case 2: return [4 /*yield*/, this.
|
|
9332
|
+
case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
9179
9333
|
case 3:
|
|
9180
9334
|
_a.sent();
|
|
9181
9335
|
_a.label = 4;
|
|
9182
|
-
case 4: return [3 /*break*/,
|
|
9183
|
-
case 5:
|
|
9336
|
+
case 4: return [3 /*break*/, 7];
|
|
9337
|
+
case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9338
|
+
case 6:
|
|
9339
|
+
_a.sent();
|
|
9340
|
+
_a.label = 7;
|
|
9341
|
+
case 7: return [3 /*break*/, 9];
|
|
9342
|
+
case 8:
|
|
9184
9343
|
e_2 = _a.sent();
|
|
9185
9344
|
console.error(e_2);
|
|
9186
|
-
return [3 /*break*/,
|
|
9187
|
-
case
|
|
9345
|
+
return [3 /*break*/, 9];
|
|
9346
|
+
case 9: return [2 /*return*/];
|
|
9188
9347
|
}
|
|
9189
9348
|
});
|
|
9190
9349
|
});
|
|
@@ -9196,12 +9355,12 @@
|
|
|
9196
9355
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
9197
9356
|
*/
|
|
9198
9357
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
9199
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9358
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9200
9359
|
return __awaiter(this, void 0, void 0, function () {
|
|
9201
|
-
var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
9360
|
+
var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
9202
9361
|
var _this = this;
|
|
9203
|
-
return __generator(this, function (
|
|
9204
|
-
switch (
|
|
9362
|
+
return __generator(this, function (_o) {
|
|
9363
|
+
switch (_o.label) {
|
|
9205
9364
|
case 0:
|
|
9206
9365
|
entities = entities.filter(function (entity) {
|
|
9207
9366
|
var _a;
|
|
@@ -9213,52 +9372,93 @@
|
|
|
9213
9372
|
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
9214
9373
|
});
|
|
9215
9374
|
zoomItem = this.item.CameraZoomSettings[0];
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9375
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
|
|
9376
|
+
return [4 /*yield*/, bruceModels.EntityLod.GetLods({
|
|
9377
|
+
api: this.apiGetter.getApi(),
|
|
9378
|
+
filter: {
|
|
9379
|
+
externalSources: false,
|
|
9380
|
+
Items: entities.map(function (x) {
|
|
9381
|
+
var _a, _b;
|
|
9382
|
+
return {
|
|
9383
|
+
entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
|
|
9384
|
+
categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
|
|
9385
|
+
group: "DEFAULT",
|
|
9386
|
+
level: Number(zoomItem.LODLevel)
|
|
9387
|
+
};
|
|
9388
|
+
}),
|
|
9389
|
+
strict: false
|
|
9390
|
+
}
|
|
9391
|
+
})];
|
|
9219
9392
|
case 1:
|
|
9220
|
-
|
|
9393
|
+
lods = (_o.sent()).lods;
|
|
9394
|
+
if (this.disposed) {
|
|
9395
|
+
this.doDispose();
|
|
9396
|
+
return [2 /*return*/];
|
|
9397
|
+
}
|
|
9398
|
+
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
9399
|
+
individuals = entities.filter(function (entity) {
|
|
9400
|
+
var _a;
|
|
9401
|
+
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
9402
|
+
});
|
|
9403
|
+
if (individuals.length) {
|
|
9404
|
+
this.renderAsIndividuals(individuals, force);
|
|
9405
|
+
}
|
|
9406
|
+
// Now we proceed with what is left.
|
|
9407
|
+
entities = entities.filter(function (entity) {
|
|
9408
|
+
var _a;
|
|
9409
|
+
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
9410
|
+
});
|
|
9411
|
+
_o.label = 2;
|
|
9412
|
+
case 2:
|
|
9413
|
+
if (!entities.length) {
|
|
9414
|
+
return [2 /*return*/];
|
|
9415
|
+
}
|
|
9416
|
+
style = null;
|
|
9417
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
9418
|
+
_o.label = 3;
|
|
9419
|
+
case 3:
|
|
9420
|
+
_o.trys.push([3, 5, , 6]);
|
|
9221
9421
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
9222
9422
|
api: this.apiGetter.getApi(),
|
|
9223
9423
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
9224
9424
|
})];
|
|
9225
|
-
case 2:
|
|
9226
|
-
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
9227
|
-
return [3 /*break*/, 4];
|
|
9228
|
-
case 3:
|
|
9229
|
-
e_3 = _m.sent();
|
|
9230
|
-
console.error(e_3);
|
|
9231
|
-
return [3 /*break*/, 4];
|
|
9232
9425
|
case 4:
|
|
9426
|
+
style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
9427
|
+
return [3 /*break*/, 6];
|
|
9428
|
+
case 5:
|
|
9429
|
+
e_3 = _o.sent();
|
|
9430
|
+
console.error(e_3);
|
|
9431
|
+
return [3 /*break*/, 6];
|
|
9432
|
+
case 6:
|
|
9233
9433
|
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
9234
9434
|
if (!entityTypeId) {
|
|
9235
9435
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
9236
9436
|
}
|
|
9237
|
-
if (!entityTypeId) return [3 /*break*/,
|
|
9238
|
-
|
|
9239
|
-
case
|
|
9240
|
-
|
|
9437
|
+
if (!entityTypeId) return [3 /*break*/, 12];
|
|
9438
|
+
_o.label = 7;
|
|
9439
|
+
case 7:
|
|
9440
|
+
_o.trys.push([7, 11, , 12]);
|
|
9241
9441
|
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
9242
9442
|
entityTypeId: entityTypeId,
|
|
9243
9443
|
api: this.apiGetter.getApi()
|
|
9244
9444
|
})];
|
|
9245
|
-
case
|
|
9246
|
-
entityType = (_e = (
|
|
9247
|
-
if (!(!style && entityType)) return [3 /*break*/,
|
|
9248
|
-
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/,
|
|
9445
|
+
case 8:
|
|
9446
|
+
entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
9447
|
+
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
9448
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
9249
9449
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
9250
9450
|
api: this.apiGetter.getApi(),
|
|
9251
9451
|
styleId: entityType["DisplaySetting.ID"]
|
|
9252
9452
|
})];
|
|
9253
|
-
case 7:
|
|
9254
|
-
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
9255
|
-
_m.label = 8;
|
|
9256
|
-
case 8: return [3 /*break*/, 10];
|
|
9257
9453
|
case 9:
|
|
9258
|
-
|
|
9454
|
+
style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
9455
|
+
_o.label = 10;
|
|
9456
|
+
case 10: return [3 /*break*/, 12];
|
|
9457
|
+
case 11:
|
|
9458
|
+
e_4 = _o.sent();
|
|
9259
9459
|
console.error(e_4);
|
|
9260
|
-
return [3 /*break*/,
|
|
9261
|
-
case
|
|
9460
|
+
return [3 /*break*/, 12];
|
|
9461
|
+
case 12:
|
|
9262
9462
|
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
9263
9463
|
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
9264
9464
|
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
@@ -9283,7 +9483,16 @@
|
|
|
9283
9483
|
// No points.
|
|
9284
9484
|
allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
|
|
9285
9485
|
});
|
|
9286
|
-
|
|
9486
|
+
notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
|
|
9487
|
+
return !geojson.features.some(function (feature) {
|
|
9488
|
+
var _a, _b, _c;
|
|
9489
|
+
return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
|
|
9490
|
+
});
|
|
9491
|
+
});
|
|
9492
|
+
if (notRendered.length) {
|
|
9493
|
+
this.renderAsIndividuals(notRendered, force);
|
|
9494
|
+
}
|
|
9495
|
+
if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
9287
9496
|
return [2 /*return*/];
|
|
9288
9497
|
}
|
|
9289
9498
|
return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
|
|
@@ -9292,8 +9501,8 @@
|
|
|
9292
9501
|
strokeWidth: lineWidthPx,
|
|
9293
9502
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
9294
9503
|
})];
|
|
9295
|
-
case
|
|
9296
|
-
source =
|
|
9504
|
+
case 13:
|
|
9505
|
+
source = _o.sent();
|
|
9297
9506
|
this.viewer.dataSources.add(source);
|
|
9298
9507
|
this.sources.push(source);
|
|
9299
9508
|
if (this.disposed) {
|
|
@@ -9357,6 +9566,7 @@
|
|
|
9357
9566
|
thing.polyline.width = width;
|
|
9358
9567
|
}
|
|
9359
9568
|
};
|
|
9569
|
+
toForceUpdate = [];
|
|
9360
9570
|
register = function (thing) {
|
|
9361
9571
|
var _a, _b, _c, _d;
|
|
9362
9572
|
// See if the cesium entity already exists in a group.
|
|
@@ -9369,7 +9579,6 @@
|
|
|
9369
9579
|
if (!entityId) {
|
|
9370
9580
|
return;
|
|
9371
9581
|
}
|
|
9372
|
-
var needsUpdate = false;
|
|
9373
9582
|
// Find group for the nextspace entity ID.
|
|
9374
9583
|
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
9375
9584
|
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
@@ -9384,6 +9593,7 @@
|
|
|
9384
9593
|
rego: null
|
|
9385
9594
|
};
|
|
9386
9595
|
groups.push(group);
|
|
9596
|
+
applyStyle(thing, entityId, group.data);
|
|
9387
9597
|
var rego = {
|
|
9388
9598
|
entityId: entityId,
|
|
9389
9599
|
menuItemId: _this.item.id,
|
|
@@ -9408,6 +9618,7 @@
|
|
|
9408
9618
|
}
|
|
9409
9619
|
// Found a group. We flag this as a sibling entity of the primary.
|
|
9410
9620
|
else {
|
|
9621
|
+
applyStyle(thing, entityId, group.data);
|
|
9411
9622
|
group.siblings.push(thing);
|
|
9412
9623
|
group.visual._siblingGraphics = group.siblings;
|
|
9413
9624
|
thing._parentEntity = group.visual;
|
|
@@ -9415,21 +9626,24 @@
|
|
|
9415
9626
|
_this.visualsManager.RefreshMark({
|
|
9416
9627
|
rego: group.rego
|
|
9417
9628
|
});
|
|
9418
|
-
|
|
9629
|
+
if (!toForceUpdate.includes(entityId)) {
|
|
9630
|
+
toForceUpdate.push(entityId);
|
|
9631
|
+
}
|
|
9419
9632
|
}
|
|
9420
9633
|
}
|
|
9421
|
-
applyStyle(thing, entityId, group.data);
|
|
9422
|
-
if (needsUpdate) {
|
|
9423
|
-
_this.visualsManager.ForceUpdate({
|
|
9424
|
-
entityIds: [entityId],
|
|
9425
|
-
});
|
|
9426
|
-
}
|
|
9427
9634
|
};
|
|
9428
9635
|
sEntities = source.entities.values;
|
|
9429
9636
|
for (i = 0; i < sEntities.length; i++) {
|
|
9430
9637
|
cEntity = sEntities[i];
|
|
9431
9638
|
register(cEntity);
|
|
9432
9639
|
}
|
|
9640
|
+
if (toForceUpdate.length) {
|
|
9641
|
+
this.visualsManager.ForceUpdate({
|
|
9642
|
+
entityIds: toForceUpdate,
|
|
9643
|
+
refreshColors: true,
|
|
9644
|
+
requestRender: false
|
|
9645
|
+
});
|
|
9646
|
+
}
|
|
9433
9647
|
this.viewer.scene.requestRender();
|
|
9434
9648
|
return [2 /*return*/];
|
|
9435
9649
|
}
|
|
@@ -9574,6 +9788,10 @@
|
|
|
9574
9788
|
}
|
|
9575
9789
|
];
|
|
9576
9790
|
}
|
|
9791
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
9792
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
9793
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
9794
|
+
}
|
|
9577
9795
|
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
|
|
9578
9796
|
this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
|
|
9579
9797
|
_this.onGetterUpdate(ids);
|
|
@@ -9642,6 +9860,10 @@
|
|
|
9642
9860
|
}
|
|
9643
9861
|
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
9644
9862
|
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
9863
|
+
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
9864
|
+
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
9865
|
+
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
9866
|
+
}
|
|
9645
9867
|
}
|
|
9646
9868
|
if (queueRerender != false) {
|
|
9647
9869
|
var entityIds = Object.keys(this.renderedEntities);
|
|
@@ -9688,7 +9910,7 @@
|
|
|
9688
9910
|
Manager.prototype.renderEntities = function (entities, force) {
|
|
9689
9911
|
if (force === void 0) { force = false; }
|
|
9690
9912
|
return __awaiter(this, void 0, void 0, function () {
|
|
9691
|
-
var e_2;
|
|
9913
|
+
var zoomItem, e_2;
|
|
9692
9914
|
return __generator(this, function (_a) {
|
|
9693
9915
|
switch (_a.label) {
|
|
9694
9916
|
case 0:
|
|
@@ -9697,22 +9919,31 @@
|
|
|
9697
9919
|
}
|
|
9698
9920
|
_a.label = 1;
|
|
9699
9921
|
case 1:
|
|
9700
|
-
_a.trys.push([1,
|
|
9701
|
-
if (!this.useGeojson) return [3 /*break*/,
|
|
9702
|
-
|
|
9922
|
+
_a.trys.push([1, 9, , 10]);
|
|
9923
|
+
if (!this.useGeojson) return [3 /*break*/, 6];
|
|
9924
|
+
zoomItem = this.item.CameraZoomSettings[0];
|
|
9925
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Point)) return [3 /*break*/, 3];
|
|
9926
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
9927
|
+
return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9703
9928
|
case 2:
|
|
9929
|
+
// We'll just render these as individuals since we don't support point geojson.
|
|
9704
9930
|
_a.sent();
|
|
9705
9931
|
return [3 /*break*/, 5];
|
|
9706
|
-
case 3: return [4 /*yield*/, this.
|
|
9932
|
+
case 3: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
|
|
9707
9933
|
case 4:
|
|
9708
9934
|
_a.sent();
|
|
9709
9935
|
_a.label = 5;
|
|
9710
|
-
case 5: return [3 /*break*/,
|
|
9711
|
-
case 6:
|
|
9936
|
+
case 5: return [3 /*break*/, 8];
|
|
9937
|
+
case 6: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
|
|
9938
|
+
case 7:
|
|
9939
|
+
_a.sent();
|
|
9940
|
+
_a.label = 8;
|
|
9941
|
+
case 8: return [3 /*break*/, 10];
|
|
9942
|
+
case 9:
|
|
9712
9943
|
e_2 = _a.sent();
|
|
9713
9944
|
console.error(e_2);
|
|
9714
|
-
return [3 /*break*/,
|
|
9715
|
-
case
|
|
9945
|
+
return [3 /*break*/, 10];
|
|
9946
|
+
case 10: return [2 /*return*/];
|
|
9716
9947
|
}
|
|
9717
9948
|
});
|
|
9718
9949
|
});
|
|
@@ -9724,12 +9955,12 @@
|
|
|
9724
9955
|
* @param force TODO: This should re-render entities that are already rendered.
|
|
9725
9956
|
*/
|
|
9726
9957
|
Manager.prototype.renderAsGeojson = function (entities, force) {
|
|
9727
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
9958
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9728
9959
|
return __awaiter(this, void 0, void 0, function () {
|
|
9729
|
-
var zoomItem, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, source, groups, applyStyle, register, sEntities, i, cEntity;
|
|
9960
|
+
var zoomItem, lods, withLods_1, individuals, style, e_3, entityTypeId, entityType, e_4, pStyle, lStyle, polygonsClamped, bFillColor, cFillColor, bLineColor, cLineColor, lineWidthPx, geojson, notRendered, source, groups, applyStyle, toForceUpdate, register, sEntities, i, cEntity;
|
|
9730
9961
|
var _this = this;
|
|
9731
|
-
return __generator(this, function (
|
|
9732
|
-
switch (
|
|
9962
|
+
return __generator(this, function (_o) {
|
|
9963
|
+
switch (_o.label) {
|
|
9733
9964
|
case 0:
|
|
9734
9965
|
entities = entities.filter(function (entity) {
|
|
9735
9966
|
var _a;
|
|
@@ -9741,52 +9972,93 @@
|
|
|
9741
9972
|
_this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
9742
9973
|
});
|
|
9743
9974
|
zoomItem = this.item.CameraZoomSettings[0];
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9975
|
+
if (!(zoomItem.DisplayType == bruceModels.ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
|
|
9976
|
+
return [4 /*yield*/, bruceModels.EntityLod.GetLods({
|
|
9977
|
+
api: this.apiGetter.getApi(),
|
|
9978
|
+
filter: {
|
|
9979
|
+
externalSources: false,
|
|
9980
|
+
Items: entities.map(function (x) {
|
|
9981
|
+
var _a, _b;
|
|
9982
|
+
return {
|
|
9983
|
+
entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
|
|
9984
|
+
categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
|
|
9985
|
+
group: "DEFAULT",
|
|
9986
|
+
level: Number(zoomItem.LODLevel)
|
|
9987
|
+
};
|
|
9988
|
+
}),
|
|
9989
|
+
strict: false
|
|
9990
|
+
}
|
|
9991
|
+
})];
|
|
9747
9992
|
case 1:
|
|
9748
|
-
|
|
9993
|
+
lods = (_o.sent()).lods;
|
|
9994
|
+
if (this.disposed) {
|
|
9995
|
+
this.doDispose();
|
|
9996
|
+
return [2 /*return*/];
|
|
9997
|
+
}
|
|
9998
|
+
withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
|
|
9999
|
+
individuals = entities.filter(function (entity) {
|
|
10000
|
+
var _a;
|
|
10001
|
+
return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
10002
|
+
});
|
|
10003
|
+
if (individuals.length) {
|
|
10004
|
+
this.renderAsIndividuals(individuals, force);
|
|
10005
|
+
}
|
|
10006
|
+
// Now we proceed with what is left.
|
|
10007
|
+
entities = entities.filter(function (entity) {
|
|
10008
|
+
var _a;
|
|
10009
|
+
return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
10010
|
+
});
|
|
10011
|
+
_o.label = 2;
|
|
10012
|
+
case 2:
|
|
10013
|
+
if (!entities.length) {
|
|
10014
|
+
return [2 /*return*/];
|
|
10015
|
+
}
|
|
10016
|
+
style = null;
|
|
10017
|
+
if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
|
|
10018
|
+
_o.label = 3;
|
|
10019
|
+
case 3:
|
|
10020
|
+
_o.trys.push([3, 5, , 6]);
|
|
9749
10021
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
9750
10022
|
api: this.apiGetter.getApi(),
|
|
9751
10023
|
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
9752
10024
|
})];
|
|
9753
|
-
case 2:
|
|
9754
|
-
style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
9755
|
-
return [3 /*break*/, 4];
|
|
9756
|
-
case 3:
|
|
9757
|
-
e_3 = _m.sent();
|
|
9758
|
-
console.error(e_3);
|
|
9759
|
-
return [3 /*break*/, 4];
|
|
9760
10025
|
case 4:
|
|
10026
|
+
style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
10027
|
+
return [3 /*break*/, 6];
|
|
10028
|
+
case 5:
|
|
10029
|
+
e_3 = _o.sent();
|
|
10030
|
+
console.error(e_3);
|
|
10031
|
+
return [3 /*break*/, 6];
|
|
10032
|
+
case 6:
|
|
9761
10033
|
entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
9762
10034
|
if (!entityTypeId) {
|
|
9763
10035
|
entityTypeId = (_d = (_c = entities.find(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
9764
10036
|
}
|
|
9765
|
-
if (!entityTypeId) return [3 /*break*/,
|
|
9766
|
-
|
|
9767
|
-
case
|
|
9768
|
-
|
|
10037
|
+
if (!entityTypeId) return [3 /*break*/, 12];
|
|
10038
|
+
_o.label = 7;
|
|
10039
|
+
case 7:
|
|
10040
|
+
_o.trys.push([7, 11, , 12]);
|
|
9769
10041
|
return [4 /*yield*/, bruceModels.EntityType.Get({
|
|
9770
10042
|
entityTypeId: entityTypeId,
|
|
9771
10043
|
api: this.apiGetter.getApi()
|
|
9772
10044
|
})];
|
|
9773
|
-
case
|
|
9774
|
-
entityType = (_e = (
|
|
9775
|
-
if (!(!style && entityType)) return [3 /*break*/,
|
|
9776
|
-
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/,
|
|
10045
|
+
case 8:
|
|
10046
|
+
entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
10047
|
+
if (!(!style && entityType)) return [3 /*break*/, 10];
|
|
10048
|
+
if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
|
|
9777
10049
|
return [4 /*yield*/, bruceModels.Style.Get({
|
|
9778
10050
|
api: this.apiGetter.getApi(),
|
|
9779
10051
|
styleId: entityType["DisplaySetting.ID"]
|
|
9780
10052
|
})];
|
|
9781
|
-
case 7:
|
|
9782
|
-
style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
9783
|
-
_m.label = 8;
|
|
9784
|
-
case 8: return [3 /*break*/, 10];
|
|
9785
10053
|
case 9:
|
|
9786
|
-
|
|
10054
|
+
style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
10055
|
+
_o.label = 10;
|
|
10056
|
+
case 10: return [3 /*break*/, 12];
|
|
10057
|
+
case 11:
|
|
10058
|
+
e_4 = _o.sent();
|
|
9787
10059
|
console.error(e_4);
|
|
9788
|
-
return [3 /*break*/,
|
|
9789
|
-
case
|
|
10060
|
+
return [3 /*break*/, 12];
|
|
10061
|
+
case 12:
|
|
9790
10062
|
pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
9791
10063
|
lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
9792
10064
|
polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
@@ -9811,7 +10083,16 @@
|
|
|
9811
10083
|
// No points.
|
|
9812
10084
|
allowedDisplayTypes: [bruceModels.ZoomControl.EDisplayType.Geometry]
|
|
9813
10085
|
});
|
|
9814
|
-
|
|
10086
|
+
notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
|
|
10087
|
+
return !geojson.features.some(function (feature) {
|
|
10088
|
+
var _a, _b, _c;
|
|
10089
|
+
return ((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.ID);
|
|
10090
|
+
});
|
|
10091
|
+
});
|
|
10092
|
+
if (notRendered.length) {
|
|
10093
|
+
this.renderAsIndividuals(notRendered, force);
|
|
10094
|
+
}
|
|
10095
|
+
if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
|
|
9815
10096
|
return [2 /*return*/];
|
|
9816
10097
|
}
|
|
9817
10098
|
return [4 /*yield*/, Cesium.GeoJsonDataSource.load(geojson, {
|
|
@@ -9820,8 +10101,8 @@
|
|
|
9820
10101
|
strokeWidth: lineWidthPx,
|
|
9821
10102
|
clampToGround: lineWidthPx <= 0 && polygonsClamped
|
|
9822
10103
|
})];
|
|
9823
|
-
case
|
|
9824
|
-
source =
|
|
10104
|
+
case 13:
|
|
10105
|
+
source = _o.sent();
|
|
9825
10106
|
this.viewer.dataSources.add(source);
|
|
9826
10107
|
this.sources.push(source);
|
|
9827
10108
|
if (this.disposed) {
|
|
@@ -9885,6 +10166,7 @@
|
|
|
9885
10166
|
thing.polyline.width = width;
|
|
9886
10167
|
}
|
|
9887
10168
|
};
|
|
10169
|
+
toForceUpdate = [];
|
|
9888
10170
|
register = function (thing) {
|
|
9889
10171
|
var _a, _b, _c, _d;
|
|
9890
10172
|
// See if the cesium entity already exists in a group.
|
|
@@ -9897,7 +10179,6 @@
|
|
|
9897
10179
|
if (!entityId) {
|
|
9898
10180
|
return;
|
|
9899
10181
|
}
|
|
9900
|
-
var needsUpdate = false;
|
|
9901
10182
|
// Find group for the nextspace entity ID.
|
|
9902
10183
|
group = groups.find(function (x) { return x.entityId == entityId; });
|
|
9903
10184
|
// No group yet. We can designate this as the primary entity and create a new group for it.
|
|
@@ -9912,6 +10193,7 @@
|
|
|
9912
10193
|
rego: null
|
|
9913
10194
|
};
|
|
9914
10195
|
groups.push(group);
|
|
10196
|
+
applyStyle(thing, entityId, group.data);
|
|
9915
10197
|
var rego = {
|
|
9916
10198
|
entityId: entityId,
|
|
9917
10199
|
menuItemId: _this.item.id,
|
|
@@ -9936,6 +10218,7 @@
|
|
|
9936
10218
|
}
|
|
9937
10219
|
// Found a group. We flag this as a sibling entity of the primary.
|
|
9938
10220
|
else {
|
|
10221
|
+
applyStyle(thing, entityId, group.data);
|
|
9939
10222
|
group.siblings.push(thing);
|
|
9940
10223
|
group.visual._siblingGraphics = group.siblings;
|
|
9941
10224
|
thing._parentEntity = group.visual;
|
|
@@ -9943,21 +10226,24 @@
|
|
|
9943
10226
|
_this.visualsManager.RefreshMark({
|
|
9944
10227
|
rego: group.rego
|
|
9945
10228
|
});
|
|
9946
|
-
|
|
10229
|
+
if (!toForceUpdate.includes(entityId)) {
|
|
10230
|
+
toForceUpdate.push(entityId);
|
|
10231
|
+
}
|
|
9947
10232
|
}
|
|
9948
10233
|
}
|
|
9949
|
-
applyStyle(thing, entityId, group.data);
|
|
9950
|
-
if (needsUpdate) {
|
|
9951
|
-
_this.visualsManager.ForceUpdate({
|
|
9952
|
-
entityIds: [entityId],
|
|
9953
|
-
});
|
|
9954
|
-
}
|
|
9955
10234
|
};
|
|
9956
10235
|
sEntities = source.entities.values;
|
|
9957
10236
|
for (i = 0; i < sEntities.length; i++) {
|
|
9958
10237
|
cEntity = sEntities[i];
|
|
9959
10238
|
register(cEntity);
|
|
9960
10239
|
}
|
|
10240
|
+
if (toForceUpdate.length) {
|
|
10241
|
+
this.visualsManager.ForceUpdate({
|
|
10242
|
+
entityIds: toForceUpdate,
|
|
10243
|
+
refreshColors: true,
|
|
10244
|
+
requestRender: false
|
|
10245
|
+
});
|
|
10246
|
+
}
|
|
9961
10247
|
this.viewer.scene.requestRender();
|
|
9962
10248
|
return [2 /*return*/];
|
|
9963
10249
|
}
|
|
@@ -21100,7 +21386,7 @@
|
|
|
21100
21386
|
CesiumViewMonitor.Monitor = Monitor;
|
|
21101
21387
|
})(exports.CesiumViewMonitor || (exports.CesiumViewMonitor = {}));
|
|
21102
21388
|
|
|
21103
|
-
var VERSION$1 = "3.4.
|
|
21389
|
+
var VERSION$1 = "3.4.3";
|
|
21104
21390
|
|
|
21105
21391
|
exports.VERSION = VERSION$1;
|
|
21106
21392
|
exports.CesiumParabola = CesiumParabola;
|