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.
@@ -1,6 +1,6 @@
1
1
  import { Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, EntityRelationType, ENVIRONMENT, BruceEvent, EntityCoords, Api, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, SceneMode, GeoJsonDataSource, ColorMaterialProperty, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, SceneTransforms, PolygonPipeline, EllipsoidTerrainProvider, CesiumInspector, defined, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, NearFarScalar, Model, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, GeoJsonDataSource, ColorMaterialProperty, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, PolygonPipeline, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, Intersect } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -742,6 +742,52 @@ var CesiumEntityStyler;
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 = 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 Cesium3DTileFeature) {
759
+ var opacity = getAppliedOpacity(part);
760
+ refreshColor(viewer, part, opacity);
761
+ }
762
+ else if (part instanceof 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.
@@ -6479,16 +6525,40 @@ var VisualsRegister;
6479
6525
  };
6480
6526
  Register.prototype.ForceUpdate = function (params) {
6481
6527
  var _a;
6482
- var entityIds = params.entityIds;
6528
+ var entityIds = params.entityIds, requestRender = params.requestRender, refreshColors = params.refreshColors;
6529
+ var selectedIds = this.selectedIds;
6530
+ var highlightedIds = this.highlightedIds;
6483
6531
  for (var i = 0; i < entityIds.length; i++) {
6484
6532
  var entityId = entityIds[i];
6485
6533
  updateEntity(this.viewer, entityId, this);
6534
+ if (refreshColors) {
6535
+ if (selectedIds.includes(entityId)) {
6536
+ CesiumEntityStyler.Select({
6537
+ entity: this.GetRego({
6538
+ entityId: entityId
6539
+ }).visual,
6540
+ viewer: this.viewer,
6541
+ requestRender: false
6542
+ });
6543
+ }
6544
+ else if (highlightedIds.includes(entityId)) {
6545
+ CesiumEntityStyler.Highlight({
6546
+ entity: this.GetRego({
6547
+ entityId: entityId
6548
+ }).visual,
6549
+ viewer: this.viewer,
6550
+ requestRender: false
6551
+ });
6552
+ }
6553
+ }
6486
6554
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
6487
6555
  type: EVisualUpdateType.Update,
6488
6556
  entityId: entityId
6489
6557
  });
6490
6558
  }
6491
- this.viewer.scene.requestRender();
6559
+ if (requestRender != false) {
6560
+ this.viewer.scene.requestRender();
6561
+ }
6492
6562
  };
6493
6563
  /**
6494
6564
  * Marks given entityIds as either labelled or not labelled.
@@ -8164,6 +8234,10 @@ var EntitiesRenderManager;
8164
8234
  }
8165
8235
  ];
8166
8236
  }
8237
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
8238
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
8239
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
8240
+ }
8167
8241
  var isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
8168
8242
  var tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
8169
8243
  if (!tagsToRender) {
@@ -8347,6 +8421,10 @@ var EntitiesRenderManager;
8347
8421
  }
8348
8422
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
8349
8423
  this.item.CameraZoomSettings = CameraZoomSettings;
8424
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
8425
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
8426
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
8427
+ }
8350
8428
  this.setGetter();
8351
8429
  }
8352
8430
  if (queueRerender != false) {
@@ -8441,11 +8519,11 @@ var EntitiesRenderManager;
8441
8519
  var _a;
8442
8520
  if (force === void 0) { force = false; }
8443
8521
  return __awaiter(this, void 0, void 0, function () {
8444
- var typeId_1, e_3;
8522
+ var typeId_1, zoomItem, e_3;
8445
8523
  return __generator(this, function (_b) {
8446
8524
  switch (_b.label) {
8447
8525
  case 0:
8448
- _b.trys.push([0, 5, , 6]);
8526
+ _b.trys.push([0, 8, , 9]);
8449
8527
  if (this.disposed || this.viewer.isDestroyed()) {
8450
8528
  return [2 /*return*/];
8451
8529
  }
@@ -8453,21 +8531,30 @@ var EntitiesRenderManager;
8453
8531
  if (typeId_1) {
8454
8532
  entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
8455
8533
  }
8456
- if (!this.useGeojson) return [3 /*break*/, 2];
8457
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
8534
+ if (!this.useGeojson) return [3 /*break*/, 5];
8535
+ zoomItem = this.item.CameraZoomSettings[0];
8536
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
8537
+ // We'll just render these as individuals since we don't support point geojson.
8538
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8458
8539
  case 1:
8540
+ // We'll just render these as individuals since we don't support point geojson.
8459
8541
  _b.sent();
8460
8542
  return [3 /*break*/, 4];
8461
- case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8543
+ case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
8462
8544
  case 3:
8463
8545
  _b.sent();
8464
8546
  _b.label = 4;
8465
- case 4: return [3 /*break*/, 6];
8466
- case 5:
8547
+ case 4: return [3 /*break*/, 7];
8548
+ case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
8549
+ case 6:
8550
+ _b.sent();
8551
+ _b.label = 7;
8552
+ case 7: return [3 /*break*/, 9];
8553
+ case 8:
8467
8554
  e_3 = _b.sent();
8468
8555
  console.error(e_3);
8469
- return [3 /*break*/, 6];
8470
- case 6: return [2 /*return*/];
8556
+ return [3 /*break*/, 9];
8557
+ case 9: return [2 /*return*/];
8471
8558
  }
8472
8559
  });
8473
8560
  });
@@ -8479,12 +8566,12 @@ var EntitiesRenderManager;
8479
8566
  * @param force TODO: This should re-render entities that are already rendered.
8480
8567
  */
8481
8568
  Manager.prototype.renderAsGeojson = function (entities, force) {
8482
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
8569
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
8483
8570
  return __awaiter(this, void 0, void 0, function () {
8484
- 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;
8571
+ 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;
8485
8572
  var _this = this;
8486
- return __generator(this, function (_m) {
8487
- switch (_m.label) {
8573
+ return __generator(this, function (_o) {
8574
+ switch (_o.label) {
8488
8575
  case 0:
8489
8576
  entities = entities.filter(function (entity) {
8490
8577
  var _a;
@@ -8496,52 +8583,93 @@ var EntitiesRenderManager;
8496
8583
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
8497
8584
  });
8498
8585
  zoomItem = this.item.CameraZoomSettings[0];
8499
- style = null;
8500
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
8501
- _m.label = 1;
8586
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
8587
+ return [4 /*yield*/, EntityLod.GetLods({
8588
+ api: this.apiGetter.getApi(),
8589
+ filter: {
8590
+ externalSources: false,
8591
+ Items: entities.map(function (x) {
8592
+ var _a, _b;
8593
+ return {
8594
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
8595
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
8596
+ group: "DEFAULT",
8597
+ level: Number(zoomItem.LODLevel)
8598
+ };
8599
+ }),
8600
+ strict: false
8601
+ }
8602
+ })];
8502
8603
  case 1:
8503
- _m.trys.push([1, 3, , 4]);
8604
+ lods = (_o.sent()).lods;
8605
+ if (this.disposed) {
8606
+ this.doDispose();
8607
+ return [2 /*return*/];
8608
+ }
8609
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
8610
+ individuals = entities.filter(function (entity) {
8611
+ var _a;
8612
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
8613
+ });
8614
+ if (individuals.length) {
8615
+ this.renderAsIndividuals(individuals, force);
8616
+ }
8617
+ // Now we proceed with what is left.
8618
+ entities = entities.filter(function (entity) {
8619
+ var _a;
8620
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
8621
+ });
8622
+ _o.label = 2;
8623
+ case 2:
8624
+ if (!entities.length) {
8625
+ return [2 /*return*/];
8626
+ }
8627
+ style = null;
8628
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
8629
+ _o.label = 3;
8630
+ case 3:
8631
+ _o.trys.push([3, 5, , 6]);
8504
8632
  return [4 /*yield*/, Style.Get({
8505
8633
  api: this.apiGetter.getApi(),
8506
8634
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
8507
8635
  })];
8508
- case 2:
8509
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
8510
- return [3 /*break*/, 4];
8511
- case 3:
8512
- e_4 = _m.sent();
8513
- console.error(e_4);
8514
- return [3 /*break*/, 4];
8515
8636
  case 4:
8637
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
8638
+ return [3 /*break*/, 6];
8639
+ case 5:
8640
+ e_4 = _o.sent();
8641
+ console.error(e_4);
8642
+ return [3 /*break*/, 6];
8643
+ case 6:
8516
8644
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
8517
8645
  if (!entityTypeId) {
8518
8646
  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"];
8519
8647
  }
8520
- if (!entityTypeId) return [3 /*break*/, 10];
8521
- _m.label = 5;
8522
- case 5:
8523
- _m.trys.push([5, 9, , 10]);
8648
+ if (!entityTypeId) return [3 /*break*/, 12];
8649
+ _o.label = 7;
8650
+ case 7:
8651
+ _o.trys.push([7, 11, , 12]);
8524
8652
  return [4 /*yield*/, EntityType.Get({
8525
8653
  entityTypeId: entityTypeId,
8526
8654
  api: this.apiGetter.getApi()
8527
8655
  })];
8528
- case 6:
8529
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
8530
- if (!(!style && entityType)) return [3 /*break*/, 8];
8531
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
8656
+ case 8:
8657
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
8658
+ if (!(!style && entityType)) return [3 /*break*/, 10];
8659
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
8532
8660
  return [4 /*yield*/, Style.Get({
8533
8661
  api: this.apiGetter.getApi(),
8534
8662
  styleId: entityType["DisplaySetting.ID"]
8535
8663
  })];
8536
- case 7:
8537
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
8538
- _m.label = 8;
8539
- case 8: return [3 /*break*/, 10];
8540
8664
  case 9:
8541
- e_5 = _m.sent();
8665
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
8666
+ _o.label = 10;
8667
+ case 10: return [3 /*break*/, 12];
8668
+ case 11:
8669
+ e_5 = _o.sent();
8542
8670
  console.error(e_5);
8543
- return [3 /*break*/, 10];
8544
- case 10:
8671
+ return [3 /*break*/, 12];
8672
+ case 12:
8545
8673
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
8546
8674
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
8547
8675
  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;
@@ -8566,7 +8694,16 @@ var EntitiesRenderManager;
8566
8694
  // No points.
8567
8695
  allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
8568
8696
  });
8569
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
8697
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
8698
+ return !geojson.features.some(function (feature) {
8699
+ var _a, _b, _c;
8700
+ 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);
8701
+ });
8702
+ });
8703
+ if (notRendered.length) {
8704
+ this.renderAsIndividuals(notRendered, force);
8705
+ }
8706
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
8570
8707
  return [2 /*return*/];
8571
8708
  }
8572
8709
  return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
@@ -8575,8 +8712,8 @@ var EntitiesRenderManager;
8575
8712
  strokeWidth: lineWidthPx,
8576
8713
  clampToGround: lineWidthPx <= 0 && polygonsClamped
8577
8714
  })];
8578
- case 11:
8579
- source = _m.sent();
8715
+ case 13:
8716
+ source = _o.sent();
8580
8717
  this.viewer.dataSources.add(source);
8581
8718
  this.sources.push(source);
8582
8719
  if (this.disposed) {
@@ -8640,6 +8777,7 @@ var EntitiesRenderManager;
8640
8777
  thing.polyline.width = width;
8641
8778
  }
8642
8779
  };
8780
+ toForceUpdate = [];
8643
8781
  register = function (thing) {
8644
8782
  var _a, _b, _c, _d;
8645
8783
  // See if the cesium entity already exists in a group.
@@ -8652,7 +8790,6 @@ var EntitiesRenderManager;
8652
8790
  if (!entityId) {
8653
8791
  return;
8654
8792
  }
8655
- var needsUpdate = false;
8656
8793
  // Find group for the nextspace entity ID.
8657
8794
  group = groups.find(function (x) { return x.entityId == entityId; });
8658
8795
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -8667,6 +8804,7 @@ var EntitiesRenderManager;
8667
8804
  rego: null
8668
8805
  };
8669
8806
  groups.push(group);
8807
+ applyStyle(thing, entityId, group.data);
8670
8808
  var rego = {
8671
8809
  entityId: entityId,
8672
8810
  menuItemId: _this.item.id,
@@ -8691,6 +8829,7 @@ var EntitiesRenderManager;
8691
8829
  }
8692
8830
  // Found a group. We flag this as a sibling entity of the primary.
8693
8831
  else {
8832
+ applyStyle(thing, entityId, group.data);
8694
8833
  group.siblings.push(thing);
8695
8834
  group.visual._siblingGraphics = group.siblings;
8696
8835
  thing._parentEntity = group.visual;
@@ -8698,21 +8837,24 @@ var EntitiesRenderManager;
8698
8837
  _this.visualsManager.RefreshMark({
8699
8838
  rego: group.rego
8700
8839
  });
8701
- needsUpdate = true;
8840
+ if (!toForceUpdate.includes(entityId)) {
8841
+ toForceUpdate.push(entityId);
8842
+ }
8702
8843
  }
8703
8844
  }
8704
- applyStyle(thing, entityId, group.data);
8705
- if (needsUpdate) {
8706
- _this.visualsManager.ForceUpdate({
8707
- entityIds: [entityId],
8708
- });
8709
- }
8710
8845
  };
8711
8846
  sEntities = source.entities.values;
8712
8847
  for (i = 0; i < sEntities.length; i++) {
8713
8848
  cEntity = sEntities[i];
8714
8849
  register(cEntity);
8715
8850
  }
8851
+ if (toForceUpdate.length) {
8852
+ this.visualsManager.ForceUpdate({
8853
+ entityIds: toForceUpdate,
8854
+ refreshColors: true,
8855
+ requestRender: false
8856
+ });
8857
+ }
8716
8858
  this.viewer.scene.requestRender();
8717
8859
  return [2 /*return*/];
8718
8860
  }
@@ -9022,6 +9164,10 @@ var EntitiesLoadedRenderManager;
9022
9164
  }
9023
9165
  ];
9024
9166
  }
9167
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9168
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9169
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9170
+ }
9025
9171
  this.recreateGetter();
9026
9172
  };
9027
9173
  /**
@@ -9109,6 +9255,10 @@ var EntitiesLoadedRenderManager;
9109
9255
  }
9110
9256
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
9111
9257
  this.item.CameraZoomSettings = CameraZoomSettings;
9258
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9259
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9260
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9261
+ }
9112
9262
  }
9113
9263
  if (queueRerender != false) {
9114
9264
  var entityIds = Object.keys(this.renderedEntities);
@@ -9175,12 +9325,12 @@ var EntitiesLoadedRenderManager;
9175
9325
  Manager.prototype.onGetterUpdate = function (entities, force) {
9176
9326
  if (force === void 0) { force = false; }
9177
9327
  return __awaiter(this, void 0, void 0, function () {
9178
- var isEntityInItem_1, e_2;
9328
+ var isEntityInItem_1, zoomItem, e_2;
9179
9329
  var _this = this;
9180
9330
  return __generator(this, function (_a) {
9181
9331
  switch (_a.label) {
9182
9332
  case 0:
9183
- _a.trys.push([0, 5, , 6]);
9333
+ _a.trys.push([0, 8, , 9]);
9184
9334
  if (this.disposed || this.viewer.isDestroyed()) {
9185
9335
  return [2 /*return*/];
9186
9336
  }
@@ -9194,21 +9344,30 @@ var EntitiesLoadedRenderManager;
9194
9344
  var _a;
9195
9345
  return isEntityInItem_1((_a = x === null || x === void 0 ? void 0 : x.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9196
9346
  });
9197
- if (!this.useGeojson) return [3 /*break*/, 2];
9198
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9347
+ if (!this.useGeojson) return [3 /*break*/, 5];
9348
+ zoomItem = this.item.CameraZoomSettings[0];
9349
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
9350
+ // We'll just render these as individuals since we don't support point geojson.
9351
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9199
9352
  case 1:
9353
+ // We'll just render these as individuals since we don't support point geojson.
9200
9354
  _a.sent();
9201
9355
  return [3 /*break*/, 4];
9202
- case 2: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9356
+ case 2: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9203
9357
  case 3:
9204
9358
  _a.sent();
9205
9359
  _a.label = 4;
9206
- case 4: return [3 /*break*/, 6];
9207
- case 5:
9360
+ case 4: return [3 /*break*/, 7];
9361
+ case 5: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9362
+ case 6:
9363
+ _a.sent();
9364
+ _a.label = 7;
9365
+ case 7: return [3 /*break*/, 9];
9366
+ case 8:
9208
9367
  e_2 = _a.sent();
9209
9368
  console.error(e_2);
9210
- return [3 /*break*/, 6];
9211
- case 6: return [2 /*return*/];
9369
+ return [3 /*break*/, 9];
9370
+ case 9: return [2 /*return*/];
9212
9371
  }
9213
9372
  });
9214
9373
  });
@@ -9220,12 +9379,12 @@ var EntitiesLoadedRenderManager;
9220
9379
  * @param force TODO: This should re-render entities that are already rendered.
9221
9380
  */
9222
9381
  Manager.prototype.renderAsGeojson = function (entities, force) {
9223
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9382
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9224
9383
  return __awaiter(this, void 0, void 0, function () {
9225
- 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;
9384
+ 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;
9226
9385
  var _this = this;
9227
- return __generator(this, function (_m) {
9228
- switch (_m.label) {
9386
+ return __generator(this, function (_o) {
9387
+ switch (_o.label) {
9229
9388
  case 0:
9230
9389
  entities = entities.filter(function (entity) {
9231
9390
  var _a;
@@ -9237,52 +9396,93 @@ var EntitiesLoadedRenderManager;
9237
9396
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
9238
9397
  });
9239
9398
  zoomItem = this.item.CameraZoomSettings[0];
9240
- style = null;
9241
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
9242
- _m.label = 1;
9399
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
9400
+ return [4 /*yield*/, EntityLod.GetLods({
9401
+ api: this.apiGetter.getApi(),
9402
+ filter: {
9403
+ externalSources: false,
9404
+ Items: entities.map(function (x) {
9405
+ var _a, _b;
9406
+ return {
9407
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
9408
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
9409
+ group: "DEFAULT",
9410
+ level: Number(zoomItem.LODLevel)
9411
+ };
9412
+ }),
9413
+ strict: false
9414
+ }
9415
+ })];
9243
9416
  case 1:
9244
- _m.trys.push([1, 3, , 4]);
9417
+ lods = (_o.sent()).lods;
9418
+ if (this.disposed) {
9419
+ this.doDispose();
9420
+ return [2 /*return*/];
9421
+ }
9422
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
9423
+ individuals = entities.filter(function (entity) {
9424
+ var _a;
9425
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9426
+ });
9427
+ if (individuals.length) {
9428
+ this.renderAsIndividuals(individuals, force);
9429
+ }
9430
+ // Now we proceed with what is left.
9431
+ entities = entities.filter(function (entity) {
9432
+ var _a;
9433
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
9434
+ });
9435
+ _o.label = 2;
9436
+ case 2:
9437
+ if (!entities.length) {
9438
+ return [2 /*return*/];
9439
+ }
9440
+ style = null;
9441
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
9442
+ _o.label = 3;
9443
+ case 3:
9444
+ _o.trys.push([3, 5, , 6]);
9245
9445
  return [4 /*yield*/, Style.Get({
9246
9446
  api: this.apiGetter.getApi(),
9247
9447
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
9248
9448
  })];
9249
- case 2:
9250
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9251
- return [3 /*break*/, 4];
9252
- case 3:
9253
- e_3 = _m.sent();
9254
- console.error(e_3);
9255
- return [3 /*break*/, 4];
9256
9449
  case 4:
9450
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9451
+ return [3 /*break*/, 6];
9452
+ case 5:
9453
+ e_3 = _o.sent();
9454
+ console.error(e_3);
9455
+ return [3 /*break*/, 6];
9456
+ case 6:
9257
9457
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
9258
9458
  if (!entityTypeId) {
9259
9459
  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"];
9260
9460
  }
9261
- if (!entityTypeId) return [3 /*break*/, 10];
9262
- _m.label = 5;
9263
- case 5:
9264
- _m.trys.push([5, 9, , 10]);
9461
+ if (!entityTypeId) return [3 /*break*/, 12];
9462
+ _o.label = 7;
9463
+ case 7:
9464
+ _o.trys.push([7, 11, , 12]);
9265
9465
  return [4 /*yield*/, EntityType.Get({
9266
9466
  entityTypeId: entityTypeId,
9267
9467
  api: this.apiGetter.getApi()
9268
9468
  })];
9269
- case 6:
9270
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9271
- if (!(!style && entityType)) return [3 /*break*/, 8];
9272
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
9469
+ case 8:
9470
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9471
+ if (!(!style && entityType)) return [3 /*break*/, 10];
9472
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
9273
9473
  return [4 /*yield*/, Style.Get({
9274
9474
  api: this.apiGetter.getApi(),
9275
9475
  styleId: entityType["DisplaySetting.ID"]
9276
9476
  })];
9277
- case 7:
9278
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9279
- _m.label = 8;
9280
- case 8: return [3 /*break*/, 10];
9281
9477
  case 9:
9282
- e_4 = _m.sent();
9478
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9479
+ _o.label = 10;
9480
+ case 10: return [3 /*break*/, 12];
9481
+ case 11:
9482
+ e_4 = _o.sent();
9283
9483
  console.error(e_4);
9284
- return [3 /*break*/, 10];
9285
- case 10:
9484
+ return [3 /*break*/, 12];
9485
+ case 12:
9286
9486
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
9287
9487
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
9288
9488
  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;
@@ -9307,7 +9507,16 @@ var EntitiesLoadedRenderManager;
9307
9507
  // No points.
9308
9508
  allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
9309
9509
  });
9310
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
9510
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
9511
+ return !geojson.features.some(function (feature) {
9512
+ var _a, _b, _c;
9513
+ 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);
9514
+ });
9515
+ });
9516
+ if (notRendered.length) {
9517
+ this.renderAsIndividuals(notRendered, force);
9518
+ }
9519
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
9311
9520
  return [2 /*return*/];
9312
9521
  }
9313
9522
  return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
@@ -9316,8 +9525,8 @@ var EntitiesLoadedRenderManager;
9316
9525
  strokeWidth: lineWidthPx,
9317
9526
  clampToGround: lineWidthPx <= 0 && polygonsClamped
9318
9527
  })];
9319
- case 11:
9320
- source = _m.sent();
9528
+ case 13:
9529
+ source = _o.sent();
9321
9530
  this.viewer.dataSources.add(source);
9322
9531
  this.sources.push(source);
9323
9532
  if (this.disposed) {
@@ -9381,6 +9590,7 @@ var EntitiesLoadedRenderManager;
9381
9590
  thing.polyline.width = width;
9382
9591
  }
9383
9592
  };
9593
+ toForceUpdate = [];
9384
9594
  register = function (thing) {
9385
9595
  var _a, _b, _c, _d;
9386
9596
  // See if the cesium entity already exists in a group.
@@ -9393,7 +9603,6 @@ var EntitiesLoadedRenderManager;
9393
9603
  if (!entityId) {
9394
9604
  return;
9395
9605
  }
9396
- var needsUpdate = false;
9397
9606
  // Find group for the nextspace entity ID.
9398
9607
  group = groups.find(function (x) { return x.entityId == entityId; });
9399
9608
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -9408,6 +9617,7 @@ var EntitiesLoadedRenderManager;
9408
9617
  rego: null
9409
9618
  };
9410
9619
  groups.push(group);
9620
+ applyStyle(thing, entityId, group.data);
9411
9621
  var rego = {
9412
9622
  entityId: entityId,
9413
9623
  menuItemId: _this.item.id,
@@ -9432,6 +9642,7 @@ var EntitiesLoadedRenderManager;
9432
9642
  }
9433
9643
  // Found a group. We flag this as a sibling entity of the primary.
9434
9644
  else {
9645
+ applyStyle(thing, entityId, group.data);
9435
9646
  group.siblings.push(thing);
9436
9647
  group.visual._siblingGraphics = group.siblings;
9437
9648
  thing._parentEntity = group.visual;
@@ -9439,21 +9650,24 @@ var EntitiesLoadedRenderManager;
9439
9650
  _this.visualsManager.RefreshMark({
9440
9651
  rego: group.rego
9441
9652
  });
9442
- needsUpdate = true;
9653
+ if (!toForceUpdate.includes(entityId)) {
9654
+ toForceUpdate.push(entityId);
9655
+ }
9443
9656
  }
9444
9657
  }
9445
- applyStyle(thing, entityId, group.data);
9446
- if (needsUpdate) {
9447
- _this.visualsManager.ForceUpdate({
9448
- entityIds: [entityId],
9449
- });
9450
- }
9451
9658
  };
9452
9659
  sEntities = source.entities.values;
9453
9660
  for (i = 0; i < sEntities.length; i++) {
9454
9661
  cEntity = sEntities[i];
9455
9662
  register(cEntity);
9456
9663
  }
9664
+ if (toForceUpdate.length) {
9665
+ this.visualsManager.ForceUpdate({
9666
+ entityIds: toForceUpdate,
9667
+ refreshColors: true,
9668
+ requestRender: false
9669
+ });
9670
+ }
9457
9671
  this.viewer.scene.requestRender();
9458
9672
  return [2 /*return*/];
9459
9673
  }
@@ -9603,6 +9817,10 @@ var EntitiesIdsRenderManager;
9603
9817
  }
9604
9818
  ];
9605
9819
  }
9820
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9821
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9822
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9823
+ }
9606
9824
  this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
9607
9825
  this.getterSub = this.getter.OnUpdate.Subscribe(function (ids) {
9608
9826
  _this.onGetterUpdate(ids);
@@ -9671,6 +9889,10 @@ var EntitiesIdsRenderManager;
9671
9889
  }
9672
9890
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
9673
9891
  this.item.CameraZoomSettings = CameraZoomSettings;
9892
+ if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
9893
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
9894
+ this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
9895
+ }
9674
9896
  }
9675
9897
  if (queueRerender != false) {
9676
9898
  var entityIds = Object.keys(this.renderedEntities);
@@ -9717,7 +9939,7 @@ var EntitiesIdsRenderManager;
9717
9939
  Manager.prototype.renderEntities = function (entities, force) {
9718
9940
  if (force === void 0) { force = false; }
9719
9941
  return __awaiter(this, void 0, void 0, function () {
9720
- var e_2;
9942
+ var zoomItem, e_2;
9721
9943
  return __generator(this, function (_a) {
9722
9944
  switch (_a.label) {
9723
9945
  case 0:
@@ -9726,22 +9948,31 @@ var EntitiesIdsRenderManager;
9726
9948
  }
9727
9949
  _a.label = 1;
9728
9950
  case 1:
9729
- _a.trys.push([1, 6, , 7]);
9730
- if (!this.useGeojson) return [3 /*break*/, 3];
9731
- return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9951
+ _a.trys.push([1, 9, , 10]);
9952
+ if (!this.useGeojson) return [3 /*break*/, 6];
9953
+ zoomItem = this.item.CameraZoomSettings[0];
9954
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Point)) return [3 /*break*/, 3];
9955
+ // We'll just render these as individuals since we don't support point geojson.
9956
+ return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9732
9957
  case 2:
9958
+ // We'll just render these as individuals since we don't support point geojson.
9733
9959
  _a.sent();
9734
9960
  return [3 /*break*/, 5];
9735
- case 3: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9961
+ case 3: return [4 /*yield*/, this.renderAsGeojson(entities, force)];
9736
9962
  case 4:
9737
9963
  _a.sent();
9738
9964
  _a.label = 5;
9739
- case 5: return [3 /*break*/, 7];
9740
- case 6:
9965
+ case 5: return [3 /*break*/, 8];
9966
+ case 6: return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
9967
+ case 7:
9968
+ _a.sent();
9969
+ _a.label = 8;
9970
+ case 8: return [3 /*break*/, 10];
9971
+ case 9:
9741
9972
  e_2 = _a.sent();
9742
9973
  console.error(e_2);
9743
- return [3 /*break*/, 7];
9744
- case 7: return [2 /*return*/];
9974
+ return [3 /*break*/, 10];
9975
+ case 10: return [2 /*return*/];
9745
9976
  }
9746
9977
  });
9747
9978
  });
@@ -9753,12 +9984,12 @@ var EntitiesIdsRenderManager;
9753
9984
  * @param force TODO: This should re-render entities that are already rendered.
9754
9985
  */
9755
9986
  Manager.prototype.renderAsGeojson = function (entities, force) {
9756
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
9987
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9757
9988
  return __awaiter(this, void 0, void 0, function () {
9758
- 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;
9989
+ 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;
9759
9990
  var _this = this;
9760
- return __generator(this, function (_m) {
9761
- switch (_m.label) {
9991
+ return __generator(this, function (_o) {
9992
+ switch (_o.label) {
9762
9993
  case 0:
9763
9994
  entities = entities.filter(function (entity) {
9764
9995
  var _a;
@@ -9770,52 +10001,93 @@ var EntitiesIdsRenderManager;
9770
10001
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
9771
10002
  });
9772
10003
  zoomItem = this.item.CameraZoomSettings[0];
9773
- style = null;
9774
- if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 4];
9775
- _m.label = 1;
10004
+ if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
10005
+ return [4 /*yield*/, EntityLod.GetLods({
10006
+ api: this.apiGetter.getApi(),
10007
+ filter: {
10008
+ externalSources: false,
10009
+ Items: entities.map(function (x) {
10010
+ var _a, _b;
10011
+ return {
10012
+ entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
10013
+ categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
10014
+ group: "DEFAULT",
10015
+ level: Number(zoomItem.LODLevel)
10016
+ };
10017
+ }),
10018
+ strict: false
10019
+ }
10020
+ })];
9776
10021
  case 1:
9777
- _m.trys.push([1, 3, , 4]);
10022
+ lods = (_o.sent()).lods;
10023
+ if (this.disposed) {
10024
+ this.doDispose();
10025
+ return [2 /*return*/];
10026
+ }
10027
+ withLods_1 = lods.filter(function (x) { return x.entityId && !!x.clientFileId; }).map(function (x) { return x.entityId; });
10028
+ individuals = entities.filter(function (entity) {
10029
+ var _a;
10030
+ return withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
10031
+ });
10032
+ if (individuals.length) {
10033
+ this.renderAsIndividuals(individuals, force);
10034
+ }
10035
+ // Now we proceed with what is left.
10036
+ entities = entities.filter(function (entity) {
10037
+ var _a;
10038
+ return !withLods_1.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
10039
+ });
10040
+ _o.label = 2;
10041
+ case 2:
10042
+ if (!entities.length) {
10043
+ return [2 /*return*/];
10044
+ }
10045
+ style = null;
10046
+ if (!((zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) && (zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID) > -1)) return [3 /*break*/, 6];
10047
+ _o.label = 3;
10048
+ case 3:
10049
+ _o.trys.push([3, 5, , 6]);
9778
10050
  return [4 /*yield*/, Style.Get({
9779
10051
  api: this.apiGetter.getApi(),
9780
10052
  styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
9781
10053
  })];
9782
- case 2:
9783
- style = (_a = (_m.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
9784
- return [3 /*break*/, 4];
9785
- case 3:
9786
- e_3 = _m.sent();
9787
- console.error(e_3);
9788
- return [3 /*break*/, 4];
9789
10054
  case 4:
10055
+ style = (_a = (_o.sent()).style) === null || _a === void 0 ? void 0 : _a.Settings;
10056
+ return [3 /*break*/, 6];
10057
+ case 5:
10058
+ e_3 = _o.sent();
10059
+ console.error(e_3);
10060
+ return [3 /*break*/, 6];
10061
+ case 6:
9790
10062
  entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
9791
10063
  if (!entityTypeId) {
9792
10064
  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"];
9793
10065
  }
9794
- if (!entityTypeId) return [3 /*break*/, 10];
9795
- _m.label = 5;
9796
- case 5:
9797
- _m.trys.push([5, 9, , 10]);
10066
+ if (!entityTypeId) return [3 /*break*/, 12];
10067
+ _o.label = 7;
10068
+ case 7:
10069
+ _o.trys.push([7, 11, , 12]);
9798
10070
  return [4 /*yield*/, EntityType.Get({
9799
10071
  entityTypeId: entityTypeId,
9800
10072
  api: this.apiGetter.getApi()
9801
10073
  })];
9802
- case 6:
9803
- entityType = (_e = (_m.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
9804
- if (!(!style && entityType)) return [3 /*break*/, 8];
9805
- if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 8];
10074
+ case 8:
10075
+ entityType = (_e = (_o.sent())) === null || _e === void 0 ? void 0 : _e.entityType;
10076
+ if (!(!style && entityType)) return [3 /*break*/, 10];
10077
+ if (!(entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0)) return [3 /*break*/, 10];
9806
10078
  return [4 /*yield*/, Style.Get({
9807
10079
  api: this.apiGetter.getApi(),
9808
10080
  styleId: entityType["DisplaySetting.ID"]
9809
10081
  })];
9810
- case 7:
9811
- style = (_f = (_m.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
9812
- _m.label = 8;
9813
- case 8: return [3 /*break*/, 10];
9814
10082
  case 9:
9815
- e_4 = _m.sent();
10083
+ style = (_f = (_o.sent()).style) === null || _f === void 0 ? void 0 : _f.Settings;
10084
+ _o.label = 10;
10085
+ case 10: return [3 /*break*/, 12];
10086
+ case 11:
10087
+ e_4 = _o.sent();
9816
10088
  console.error(e_4);
9817
- return [3 /*break*/, 10];
9818
- case 10:
10089
+ return [3 /*break*/, 12];
10090
+ case 12:
9819
10091
  pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
9820
10092
  lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
9821
10093
  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;
@@ -9840,7 +10112,16 @@ var EntitiesIdsRenderManager;
9840
10112
  // No points.
9841
10113
  allowedDisplayTypes: [ZoomControl.EDisplayType.Geometry]
9842
10114
  });
9843
- if (!((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length)) {
10115
+ notRendered = !((_l = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _l === void 0 ? void 0 : _l.length) ? entities : entities.filter(function (entity) {
10116
+ return !geojson.features.some(function (feature) {
10117
+ var _a, _b, _c;
10118
+ 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);
10119
+ });
10120
+ });
10121
+ if (notRendered.length) {
10122
+ this.renderAsIndividuals(notRendered, force);
10123
+ }
10124
+ if (!((_m = geojson === null || geojson === void 0 ? void 0 : geojson.features) === null || _m === void 0 ? void 0 : _m.length)) {
9844
10125
  return [2 /*return*/];
9845
10126
  }
9846
10127
  return [4 /*yield*/, GeoJsonDataSource.load(geojson, {
@@ -9849,8 +10130,8 @@ var EntitiesIdsRenderManager;
9849
10130
  strokeWidth: lineWidthPx,
9850
10131
  clampToGround: lineWidthPx <= 0 && polygonsClamped
9851
10132
  })];
9852
- case 11:
9853
- source = _m.sent();
10133
+ case 13:
10134
+ source = _o.sent();
9854
10135
  this.viewer.dataSources.add(source);
9855
10136
  this.sources.push(source);
9856
10137
  if (this.disposed) {
@@ -9914,6 +10195,7 @@ var EntitiesIdsRenderManager;
9914
10195
  thing.polyline.width = width;
9915
10196
  }
9916
10197
  };
10198
+ toForceUpdate = [];
9917
10199
  register = function (thing) {
9918
10200
  var _a, _b, _c, _d;
9919
10201
  // See if the cesium entity already exists in a group.
@@ -9926,7 +10208,6 @@ var EntitiesIdsRenderManager;
9926
10208
  if (!entityId) {
9927
10209
  return;
9928
10210
  }
9929
- var needsUpdate = false;
9930
10211
  // Find group for the nextspace entity ID.
9931
10212
  group = groups.find(function (x) { return x.entityId == entityId; });
9932
10213
  // No group yet. We can designate this as the primary entity and create a new group for it.
@@ -9941,6 +10222,7 @@ var EntitiesIdsRenderManager;
9941
10222
  rego: null
9942
10223
  };
9943
10224
  groups.push(group);
10225
+ applyStyle(thing, entityId, group.data);
9944
10226
  var rego = {
9945
10227
  entityId: entityId,
9946
10228
  menuItemId: _this.item.id,
@@ -9965,6 +10247,7 @@ var EntitiesIdsRenderManager;
9965
10247
  }
9966
10248
  // Found a group. We flag this as a sibling entity of the primary.
9967
10249
  else {
10250
+ applyStyle(thing, entityId, group.data);
9968
10251
  group.siblings.push(thing);
9969
10252
  group.visual._siblingGraphics = group.siblings;
9970
10253
  thing._parentEntity = group.visual;
@@ -9972,21 +10255,24 @@ var EntitiesIdsRenderManager;
9972
10255
  _this.visualsManager.RefreshMark({
9973
10256
  rego: group.rego
9974
10257
  });
9975
- needsUpdate = true;
10258
+ if (!toForceUpdate.includes(entityId)) {
10259
+ toForceUpdate.push(entityId);
10260
+ }
9976
10261
  }
9977
10262
  }
9978
- applyStyle(thing, entityId, group.data);
9979
- if (needsUpdate) {
9980
- _this.visualsManager.ForceUpdate({
9981
- entityIds: [entityId],
9982
- });
9983
- }
9984
10263
  };
9985
10264
  sEntities = source.entities.values;
9986
10265
  for (i = 0; i < sEntities.length; i++) {
9987
10266
  cEntity = sEntities[i];
9988
10267
  register(cEntity);
9989
10268
  }
10269
+ if (toForceUpdate.length) {
10270
+ this.visualsManager.ForceUpdate({
10271
+ entityIds: toForceUpdate,
10272
+ refreshColors: true,
10273
+ requestRender: false
10274
+ });
10275
+ }
9990
10276
  this.viewer.scene.requestRender();
9991
10277
  return [2 /*return*/];
9992
10278
  }
@@ -21159,7 +21445,7 @@ var CesiumViewMonitor;
21159
21445
  CesiumViewMonitor$$1.Monitor = Monitor;
21160
21446
  })(CesiumViewMonitor || (CesiumViewMonitor = {}));
21161
21447
 
21162
- var VERSION$1 = "3.4.1";
21448
+ var VERSION$1 = "3.4.3";
21163
21449
 
21164
21450
  export { VERSION$1 as VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, Draw3dPolygon, Draw3dPolyline };
21165
21451
  //# sourceMappingURL=bruce-cesium.es5.js.map