bruce-cesium 6.0.3 → 6.0.5

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 { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, SceneTransforms, Quaternion, Matrix3, Matrix4, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -10765,7 +10765,10 @@ function isAlive$1(viewer, visual) {
10765
10765
  if (!cTileset) {
10766
10766
  return false;
10767
10767
  }
10768
- if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
10768
+ else if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
10769
+ return false;
10770
+ }
10771
+ else if (visual.primitive && visual.primitive.isDestroyed()) {
10769
10772
  return false;
10770
10773
  }
10771
10774
  return true;
@@ -10860,11 +10863,15 @@ function updateEntityShow(viewer, rego, show) {
10860
10863
  }
10861
10864
  function updateEntity(viewer, entityId, register, refresh, cache = {}) {
10862
10865
  var _a;
10866
+ if (!entityId) {
10867
+ // What are we doing?
10868
+ return;
10869
+ }
10863
10870
  // Unavailable for unoptimized single-Entity updates.
10864
10871
  if (!cache) {
10865
10872
  cache = {};
10866
10873
  }
10867
- let regos = register.GetRegos({
10874
+ const regos = register.GetRegos({
10868
10875
  entityId
10869
10876
  });
10870
10877
  regos.sort((a, b) => {
@@ -11149,7 +11156,7 @@ var VisualsRegister;
11149
11156
  for (let i = 0; i < batch.length; i++) {
11150
11157
  const entityId = batch[i];
11151
11158
  // Check if still registered.
11152
- if (!this.rego[entityId] || !this.rego[entityId].length) {
11159
+ if (entityId && (!this.rego[entityId] || !this.rego[entityId].length)) {
11153
11160
  continue;
11154
11161
  }
11155
11162
  updateEntity(this.viewer, entityId, this, this.updateQueueSettings[entityId] == null ? false : this.updateQueueSettings[entityId], cache);
@@ -12190,6 +12197,7 @@ var VisualsRegister;
12190
12197
  }
12191
12198
  return visuals;
12192
12199
  }
12200
+ return [];
12193
12201
  }
12194
12202
  /**
12195
12203
  * Removes regos matching given criteria.
@@ -12327,6 +12335,77 @@ var VisualsRegister;
12327
12335
  }
12328
12336
  }
12329
12337
  }
12338
+ /**
12339
+ * Removes regos matching given visuals.
12340
+ * This is used when we cannot unpack properties from the visual any longer to determine its ID.
12341
+ * Usually for Tileset features.
12342
+ * @param params
12343
+ */
12344
+ RemoveRegosByVisuals(params) {
12345
+ var _a, _b, _c;
12346
+ const { doRemove = true, requestRender = true, source, doUpdate, menuItemId } = params;
12347
+ const entityIds = Object.keys(this.rego);
12348
+ const removedEntityIds = [];
12349
+ for (const entityId of entityIds) {
12350
+ const regos = this.rego[entityId];
12351
+ if (regos && regos.length) {
12352
+ for (const rego of regos) {
12353
+ if (params.visuals.includes(rego.visual)) {
12354
+ EntityLabel.Detatch({
12355
+ rego
12356
+ });
12357
+ if (doRemove != false) {
12358
+ removeEntity(this.viewer, rego.visual);
12359
+ }
12360
+ rego.visual = null;
12361
+ this.rego[entityId] = regos.filter(r => r.visual !== rego.visual);
12362
+ const update = {
12363
+ type: EVisualUpdateType.Remove,
12364
+ entityId: rego.entityId,
12365
+ rego: rego
12366
+ };
12367
+ if (source) {
12368
+ update.source = source;
12369
+ }
12370
+ if (source !== EUpdateSource.TREE_CASCADE) {
12371
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(update);
12372
+ }
12373
+ if (doUpdate && menuItemId) {
12374
+ this.queueUpdate({
12375
+ entityId: entityId,
12376
+ refresh: false
12377
+ });
12378
+ }
12379
+ if (!removedEntityIds.includes(rego.entityId)) {
12380
+ removedEntityIds.push(rego.entityId);
12381
+ }
12382
+ }
12383
+ // Check siblings.
12384
+ else if ((_b = rego.visual) === null || _b === void 0 ? void 0 : _b["_siblingGraphics"]) {
12385
+ let siblings = rego.visual["_siblingGraphics"];
12386
+ if (doRemove != false) {
12387
+ for (const sibling of siblings) {
12388
+ if (params.visuals.includes(sibling)) {
12389
+ removeEntity(this.viewer, sibling);
12390
+ }
12391
+ }
12392
+ }
12393
+ siblings = siblings.filter(s => !params.visuals.includes(s));
12394
+ rego.visual["_siblingGraphics"] = siblings;
12395
+ }
12396
+ }
12397
+ }
12398
+ if (!((_c = this.rego[entityId]) === null || _c === void 0 ? void 0 : _c.length)) {
12399
+ delete this.rego[entityId];
12400
+ }
12401
+ }
12402
+ if (requestRender) {
12403
+ this.viewer.scene.requestRender();
12404
+ }
12405
+ return {
12406
+ removedEntityIds
12407
+ };
12408
+ }
12330
12409
  /**
12331
12410
  * Returns an array of drilled visuals associated with this register.
12332
12411
  * The top array item is the first found.
@@ -18351,6 +18430,17 @@ var TilesetCadRenderManager;
18351
18430
  this.historicPossesInitialLoaded = false;
18352
18431
  this.historicAnimation = null;
18353
18432
  this.historicPossesLoadingProm = null;
18433
+ // Queue of loaded in features that we haven't processed yet.
18434
+ this.featureQueue = [];
18435
+ // State is true for 'add' or 'false' for 'remove'.
18436
+ this.featureQueueStates = new Map();
18437
+ this.featureQueueInterval = null;
18438
+ // Cache of feature properties we wanted to find vs what we found.
18439
+ // Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
18440
+ // Eg: "geomId" -> null | "geomId";
18441
+ // Saves having to do a case-insensitive lookup every time.
18442
+ this.featurePropCache = new Map();
18443
+ this.featurePropsChecked = 0;
18354
18444
  const { viewer, register: visualsManager, getters, item, modelSpace } = params;
18355
18445
  this.viewer = viewer;
18356
18446
  this.getters = getters;
@@ -18385,7 +18475,7 @@ var TilesetCadRenderManager;
18385
18475
  // Single shared getter to avoid multiple assemblies fighting to render.
18386
18476
  // This lets one complete, then the next start.
18387
18477
  await SharedGetters.Queue.Run("Rendering assembly.", async () => {
18388
- var _a, _b, _c;
18478
+ var _a, _b;
18389
18479
  if (this.disposed) {
18390
18480
  return;
18391
18481
  }
@@ -18443,30 +18533,39 @@ var TilesetCadRenderManager;
18443
18533
  viaCdn: false
18444
18534
  });
18445
18535
  }
18446
- // ModelTree is needed to map incoming graphics to Entities.
18447
- // So we load it first, then start rendering.
18448
- try {
18449
- // In >v1 the model-tree sits in its own file.
18450
- if (((_a = tileset.settings) === null || _a === void 0 ? void 0 : _a["tilesetVersion"]) > 1) {
18451
- const modelTreeUrl = Tileset.GetFileUrl({
18452
- api: api,
18453
- file: "model_tree.json",
18454
- tilesetId: tileset.id,
18455
- cacheToken: tileset.generateVersion,
18456
- viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
18457
- });
18458
- this.modelTree = await api.get(modelTreeUrl);
18459
- this.modelTreeUpdate.Trigger(this.modelTree);
18460
- }
18461
- // In v1 the model-tree is inside the tileset.json.
18462
- else {
18463
- const tilesetJson = await api.get(tileset.loadUrl);
18464
- this.modelTree = ((_b = tilesetJson === null || tilesetJson === void 0 ? void 0 : tilesetJson.extensions) === null || _b === void 0 ? void 0 : _b.modelTree) || null;
18536
+ // TODO: we shouldn't just assume we'll need it, huge assemblies are 100+ MB.
18537
+ // TODO: this is a problem as we need to know what nodes are collapsed...
18538
+ // In >v1 the model-tree sits in its own file.
18539
+ if (((_a = tileset.settings) === null || _a === void 0 ? void 0 : _a["tilesetVersion"]) > 1) {
18540
+ const modelTreeUrl = Tileset.GetFileUrl({
18541
+ api: api,
18542
+ file: "model_tree.json",
18543
+ tilesetId: tileset.id,
18544
+ cacheToken: tileset.generateVersion,
18545
+ viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
18546
+ });
18547
+ api.get(modelTreeUrl).then((blob) => {
18548
+ if (this.disposed) {
18549
+ return;
18550
+ }
18551
+ this.modelTree = blob || null;
18465
18552
  this.modelTreeUpdate.Trigger(this.modelTree);
18466
- }
18553
+ }).catch((err) => {
18554
+ this.modelTreeError = err.message || "Unknown error";
18555
+ });
18467
18556
  }
18468
- catch (e) {
18469
- console.error(e);
18557
+ // In v1 the model-tree is inside the tileset.json.
18558
+ else {
18559
+ api.get(tileset.loadUrl).then((blob) => {
18560
+ var _a;
18561
+ if (this.disposed) {
18562
+ return;
18563
+ }
18564
+ this.modelTree = ((_a = blob === null || blob === void 0 ? void 0 : blob.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
18565
+ this.modelTreeUpdate.Trigger(this.modelTree);
18566
+ }).catch((err) => {
18567
+ this.modelTreeError = err.message || "Unknown error";
18568
+ });
18470
18569
  }
18471
18570
  if (this.disposed) {
18472
18571
  return;
@@ -18475,7 +18574,7 @@ var TilesetCadRenderManager;
18475
18574
  const rootId = settings.rootEntityId;
18476
18575
  this.rootId = rootId;
18477
18576
  // If historic, we'll see if the root Entity has a historic position to use.
18478
- if (((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic) && rootId) {
18577
+ if (((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historic) && rootId) {
18479
18578
  try {
18480
18579
  const { entity: root } = await Entity$1.Get({
18481
18580
  entityId: rootId,
@@ -18563,7 +18662,7 @@ var TilesetCadRenderManager;
18563
18662
  });
18564
18663
  cTileset.tileLoad.addEventListener((tile) => {
18565
18664
  try {
18566
- this.mapCTile(tile, true);
18665
+ this.queueTile(tile, true);
18567
18666
  }
18568
18667
  catch (e) {
18569
18668
  console.error(e);
@@ -18571,7 +18670,7 @@ var TilesetCadRenderManager;
18571
18670
  });
18572
18671
  cTileset.tileUnload.addEventListener((tile) => {
18573
18672
  try {
18574
- this.mapCTile(tile, false);
18673
+ this.queueTile(tile, false);
18575
18674
  }
18576
18675
  catch (e) {
18577
18676
  console.error(e);
@@ -18594,34 +18693,133 @@ var TilesetCadRenderManager;
18594
18693
  * @param load indicates if we are loading or unloading the tile.
18595
18694
  * @returns
18596
18695
  */
18597
- mapCTile(tile, load) {
18696
+ queueTile(tile, load) {
18598
18697
  const content = tile === null || tile === void 0 ? void 0 : tile.content;
18599
18698
  if (!content) {
18600
18699
  return;
18601
18700
  }
18602
- const regosToQueue = new Map();
18603
18701
  for (let i = 0; i < content.featuresLength; i++) {
18604
18702
  const feature = content.getFeature(i);
18605
- let rego = this.mapTilesetFeature(feature, load);
18606
- if (!(rego === null || rego === void 0 ? void 0 : rego.entityId)) {
18703
+ if (!this.featureQueue.includes(feature)) {
18704
+ this.featureQueue.push(feature);
18705
+ }
18706
+ this.featureQueueStates.set(feature, load);
18707
+ }
18708
+ this.pingFeatureQueue();
18709
+ }
18710
+ /**
18711
+ * Pings the feature queue to process any queued features.
18712
+ * Does nothing if we're already processing.
18713
+ * @returns
18714
+ */
18715
+ pingFeatureQueue() {
18716
+ if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
18717
+ return;
18718
+ }
18719
+ this.featureQueueInterval = setInterval(() => {
18720
+ if (this.disposed) {
18721
+ clearInterval(this.featureQueueInterval);
18722
+ this.featureQueueInterval = null;
18723
+ return;
18724
+ }
18725
+ this.processFeatureQueueBatch();
18726
+ if (!this.featureQueue) {
18727
+ clearInterval(this.featureQueueInterval);
18728
+ this.featureQueueInterval = null;
18729
+ }
18730
+ }, 10);
18731
+ }
18732
+ /**
18733
+ * Process a batch of features from the feature queue.
18734
+ */
18735
+ processFeatureQueueBatch() {
18736
+ if (!this.featureQueue.length) {
18737
+ return;
18738
+ }
18739
+ // If features require geomId (don't have bruceId props) then the model tree must be loaded.
18740
+ // If it's not loaded, we simply return and keep waiting.
18741
+ if (!this.modelTree) {
18742
+ /*
18743
+ if (!this.featureQueue[0].getProperty("bruceId")) {
18744
+ return;
18745
+ }
18746
+ */
18747
+ // TODO: For now always requiring it when it's available.
18748
+ // This is because we need to think of a strategy or collapsed items first.
18749
+ if (!this.modelTreeError) {
18750
+ return;
18751
+ }
18752
+ }
18753
+ const BATCH_SIZE = 5000;
18754
+ const batch = this.featureQueue.splice(0, BATCH_SIZE);
18755
+ const regosToStyle = new Map();
18756
+ const featuresToRemove = [];
18757
+ for (const feature of batch) {
18758
+ const load = this.featureQueueStates.get(feature);
18759
+ this.featureQueueStates.delete(feature);
18760
+ if (!load) {
18761
+ featuresToRemove.push(feature);
18762
+ continue;
18763
+ }
18764
+ const result = this.mapTilesetFeature(feature);
18765
+ if (result === null) {
18607
18766
  // Override the default hide state set by the style.
18608
18767
  feature.show = true;
18609
18768
  continue;
18610
18769
  }
18611
- regosToQueue.set(rego.entityId, rego);
18770
+ else if (result) {
18771
+ regosToStyle.set(result.entityId, result);
18772
+ }
18612
18773
  }
18613
- if (this.styler && regosToQueue.size) {
18614
- this.styler.QueueEntities(Array.from(regosToQueue.values()));
18774
+ if (featuresToRemove.length) {
18775
+ const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
18776
+ visuals: featuresToRemove,
18777
+ requestRender: false,
18778
+ menuItemId: this.item.id,
18779
+ doRemove: false
18780
+ });
18781
+ for (const entityId of removedEntityIds) {
18782
+ delete this.loadedCesiumEntities[entityId];
18783
+ }
18784
+ }
18785
+ if (this.styler && regosToStyle.size) {
18786
+ this.styler.QueueEntities(Array.from(regosToStyle.values()));
18787
+ }
18788
+ }
18789
+ evaluateFeatureProps(feature) {
18790
+ var _a;
18791
+ // If we've checked 10 features then we should have a good handle on what props are available.
18792
+ if (this.featurePropsChecked >= 10) {
18793
+ return;
18794
+ }
18795
+ this.featurePropsChecked++;
18796
+ const featureAny = feature;
18797
+ const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
18798
+ if (!props) {
18799
+ return;
18800
+ }
18801
+ for (const prop of props) {
18802
+ if (!prop) {
18803
+ continue;
18804
+ }
18805
+ const lowered = prop.toLowerCase();
18806
+ if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
18807
+ this.featurePropCache.set("entityId", prop);
18808
+ }
18809
+ else if (lowered === "geomid") {
18810
+ this.featurePropCache.set("geomId", prop);
18811
+ }
18812
+ else if (lowered === "brucepath") {
18813
+ this.featurePropCache.set("brucePath", prop);
18814
+ }
18615
18815
  }
18616
- this.viewer.scene.requestRender();
18617
18816
  }
18618
18817
  /**
18619
18818
  * @param feature
18620
- * @param add indicates if we are adding or removing the feature.
18621
18819
  * @returns
18622
18820
  */
18623
- mapTilesetFeature(feature, add) {
18624
- var _a, _b, _c, _d, _e, _f;
18821
+ mapTilesetFeature(feature) {
18822
+ var _a, _b, _c, _d, _e;
18625
18823
  const accountId = (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
18626
18824
  const canEdit = accountId === this.getters.GetAccountId() && !((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic);
18627
18825
  let rego = {
@@ -18637,17 +18835,15 @@ var TilesetCadRenderManager;
18637
18835
  tilesetType: Tileset.EType.Cad,
18638
18836
  rootId: this.rootId
18639
18837
  };
18640
- const featureAny = feature;
18641
- const propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_e = featureAny.getPropertyIds) === null || _e === void 0 ? void 0 : _e.call(featureAny);
18642
- if (!propertyNames) {
18643
- return null;
18644
- }
18645
- const setByGeomId = () => {
18646
- const geomIdProp = propertyNames.find(x => String(x).toLowerCase() == "geomid");
18838
+ this.evaluateFeatureProps(feature);
18839
+ // Becoming legacy.
18840
+ // Need to handle collapsed items somehow in newer path first.
18841
+ if (!rego.entityId) {
18842
+ const geomIdProp = this.featurePropCache.get("geomId");
18647
18843
  if (geomIdProp) {
18648
18844
  const geomId = +feature.getProperty(geomIdProp);
18649
18845
  if (geomId != null && (!!geomId || geomId == 0)) {
18650
- const meta = this.getMetaByGeomId(geomId, feature.tileset);
18846
+ const meta = this.getMetaByGeomId(geomId);
18651
18847
  if (meta) {
18652
18848
  rego.entityId = meta.entityId;
18653
18849
  rego.entityTypeId = meta.typeId;
@@ -18656,15 +18852,17 @@ var TilesetCadRenderManager;
18656
18852
  }
18657
18853
  }
18658
18854
  }
18659
- };
18660
- const setByEntityId = () => {
18661
- const bruceIdProp = propertyNames.find(x => (String(x).toLowerCase() == "bruceid"));
18662
- if (bruceIdProp) {
18663
- rego.entityId = feature.getProperty(bruceIdProp);
18855
+ }
18856
+ // Latest path.
18857
+ if (!rego.entityId) {
18858
+ const entityIdProp = this.featurePropCache.get("entityId");
18859
+ if (entityIdProp) {
18860
+ rego.entityId = feature.getProperty(entityIdProp);
18664
18861
  }
18665
- };
18666
- const setByPath = () => {
18667
- const brucePathProp = propertyNames.find(x => String(x).toLowerCase() == "brucepath");
18862
+ }
18863
+ // Super legacy.
18864
+ if (!rego.entityId) {
18865
+ const brucePathProp = this.featurePropCache.get("brucePath");
18668
18866
  if (brucePathProp) {
18669
18867
  const pathStr = feature.getProperty(brucePathProp);
18670
18868
  if (pathStr) {
@@ -18674,20 +18872,13 @@ var TilesetCadRenderManager;
18674
18872
  rego.entityId = path[path.length - 1];
18675
18873
  }
18676
18874
  }
18677
- };
18678
- setByGeomId();
18679
- if (!rego.entityId) {
18680
- setByEntityId();
18681
- }
18682
- if (!rego.entityId) {
18683
- setByPath();
18684
18875
  }
18685
18876
  if (!rego.entityId) {
18686
18877
  return null;
18687
18878
  }
18688
18879
  // Optional menu item restriction.
18689
18880
  // Allows only showing certain entities from a tileset.
18690
- const onlyIds = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.EntityIds;
18881
+ const onlyIds = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.EntityIds;
18691
18882
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
18692
18883
  if (this.item.BruceEntity.Ghosts) {
18693
18884
  feature.color = Color.WHITE.clone().withAlpha(0.5);
@@ -18695,74 +18886,60 @@ var TilesetCadRenderManager;
18695
18886
  else {
18696
18887
  feature.show = false;
18697
18888
  }
18698
- return null;
18889
+ return false;
18699
18890
  }
18700
- if (add) {
18701
- // Get the initial hide/show state.
18702
- const state = this.visualsManager.GetState({
18703
- entityId: rego.entityId,
18704
- menuItemId: this.item.id,
18705
- });
18706
- if (this.somethingIsolated == null ||
18707
- // 5s cache.
18708
- (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
18709
- this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
18710
- this.somethingIsolatedDateTime = new Date();
18891
+ // Get the initial hide/show state.
18892
+ const state = this.visualsManager.GetState({
18893
+ entityId: rego.entityId,
18894
+ menuItemId: this.item.id,
18895
+ });
18896
+ if (this.somethingIsolated == null ||
18897
+ // 5s cache.
18898
+ (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
18899
+ this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
18900
+ this.somethingIsolatedDateTime = new Date();
18901
+ }
18902
+ // Override the default hide state set by the style.
18903
+ let hide = false;
18904
+ if (state) {
18905
+ if (state.hidden) {
18906
+ hide = true;
18711
18907
  }
18712
- // Override the default hide state set by the style.
18713
- let hide = false;
18714
- if (state) {
18715
- if (state.hidden) {
18716
- hide = true;
18717
- }
18718
- else if (state.opacity === 0) {
18719
- hide = true;
18720
- }
18721
- else if (!state.isolated && this.somethingIsolated) {
18722
- hide = true;
18723
- }
18908
+ else if (state.opacity === 0) {
18909
+ hide = true;
18724
18910
  }
18725
- feature.show = !hide;
18726
- // Already exists, so we add this graphic as a sibling.
18727
- if (this.loadedCesiumEntities[rego.entityId]) {
18728
- rego = this.loadedCesiumEntities[rego.entityId];
18729
- if (!rego.visual) {
18730
- // No parent graphic.
18731
- rego.visual = feature;
18911
+ else if (!state.isolated && this.somethingIsolated) {
18912
+ hide = true;
18913
+ }
18914
+ }
18915
+ feature.show = !hide;
18916
+ // Already exists, so we add this graphic as a sibling.
18917
+ if (this.loadedCesiumEntities[rego.entityId]) {
18918
+ rego = this.loadedCesiumEntities[rego.entityId];
18919
+ if (!rego.visual) {
18920
+ // No parent graphic.
18921
+ rego.visual = feature;
18922
+ }
18923
+ else if (rego.visual == feature) ;
18924
+ else {
18925
+ const visual = rego.visual;
18926
+ // Sibling graphic.
18927
+ if (!visual._siblingGraphics) {
18928
+ visual._siblingGraphics = [];
18732
18929
  }
18733
- else if (rego.visual == feature) ;
18734
- else {
18735
- const visual = rego.visual;
18736
- // Sibling graphic.
18737
- if (!visual._siblingGraphics) {
18738
- visual._siblingGraphics = [];
18739
- }
18740
- if (visual._siblingGraphics.indexOf(feature) < 0) {
18741
- visual._siblingGraphics.push(feature);
18742
- }
18930
+ if (visual._siblingGraphics.indexOf(feature) < 0) {
18931
+ visual._siblingGraphics.push(feature);
18743
18932
  }
18744
18933
  }
18745
- this.loadedCesiumEntities[rego.entityId] = rego;
18746
- this.visualsManager.AddRego({
18747
- rego,
18748
- requestRender: false
18749
- });
18750
- return rego;
18751
- }
18752
- else {
18753
- this.visualsManager.RemoveRegos({
18754
- entityId: rego.entityId,
18755
- requestRender: false,
18756
- menuItemId: this.item.id,
18757
- doRemove: false,
18758
- source: VisualsRegister.EUpdateSource.TILESET_DISPOSE
18759
- });
18760
- // Might have to do something smarter since siblings could still be OK.
18761
- this.loadedCesiumEntities[rego.entityId] = null;
18762
- delete this.loadedCesiumEntities[rego.entityId];
18763
18934
  }
18935
+ this.loadedCesiumEntities[rego.entityId] = rego;
18936
+ this.visualsManager.AddRego({
18937
+ rego,
18938
+ requestRender: false
18939
+ });
18940
+ return rego;
18764
18941
  }
18765
- getMetaByGeomId(geomId, tileset) {
18942
+ getMetaByGeomId(geomId) {
18766
18943
  if (this.treeNodeByGeomId == null) {
18767
18944
  if (!this.modelTree) {
18768
18945
  return null;
@@ -18802,8 +18979,8 @@ var TilesetCadRenderManager;
18802
18979
  newFirstFoundCollapsedBranch = cache;
18803
18980
  }
18804
18981
  }
18805
- // Always process children regardless of collapse state
18806
- // This ensures all nodes are mapped, even those under collapsed branches
18982
+ // Always process children regardless of collapse state.
18983
+ // This ensures all nodes are mapped, even those under collapsed branches.
18807
18984
  if (node.children) {
18808
18985
  for (let i = node.children.length - 1; i >= 0; i--) {
18809
18986
  stack.push({
@@ -18828,8 +19005,8 @@ var TilesetCadRenderManager;
18828
19005
  }
18829
19006
  /**
18830
19007
  * Gets the parent node of a given entity.
18831
- * @param entityId The entity ID to find the parent for
18832
- * @returns The parent node or null if no parent exists
19008
+ * @param entityId The entity ID to find the parent for.
19009
+ * @returns The parent node or null if no parent exists.
18833
19010
  */
18834
19011
  getParentNode(entityId) {
18835
19012
  if (this.treeNodeByEntityId == null) {
@@ -18846,8 +19023,8 @@ var TilesetCadRenderManager;
18846
19023
  }
18847
19024
  /**
18848
19025
  * Gets all child nodes of a given entity.
18849
- * @param entityId The entity ID to find children for
18850
- * @returns Array of child nodes
19026
+ * @param entityId The entity ID to find children for.
19027
+ * @returns Array of child nodes.
18851
19028
  */
18852
19029
  getChildNodes(entityId) {
18853
19030
  if (this.treeNodeByEntityId == null) {
@@ -18896,7 +19073,7 @@ var TilesetCadRenderManager;
18896
19073
  }
18897
19074
  /**
18898
19075
  * Gets the root node of the model tree.
18899
- * @returns The root node or null if no tree exists
19076
+ * @returns The root node or null if no tree exists.
18900
19077
  */
18901
19078
  getRootNode() {
18902
19079
  if (this.treeNodeByEntityId == null) {
@@ -18905,7 +19082,7 @@ var TilesetCadRenderManager;
18905
19082
  }
18906
19083
  this.buildModelTreeNodes(this.modelTree);
18907
19084
  }
18908
- // Find the node with no parent (root node)
19085
+ // Find the node with no parent (root node).
18909
19086
  for (const nodeId in this.treeNodeByEntityId) {
18910
19087
  const node = this.treeNodeByEntityId[nodeId];
18911
19088
  if (!node.parentId) {
@@ -18916,8 +19093,8 @@ var TilesetCadRenderManager;
18916
19093
  }
18917
19094
  /**
18918
19095
  * Gets the path from root to a given entity.
18919
- * @param entityId The entity ID to find the path for
18920
- * @returns Array of node IDs representing the path from root to the entity
19096
+ * @param entityId The entity ID to find the path for.
19097
+ * @returns Array of node IDs representing the path from root to the entity.
18921
19098
  */
18922
19099
  getNodePath(entityId) {
18923
19100
  if (this.treeNodeByEntityId == null) {
@@ -18940,8 +19117,8 @@ var TilesetCadRenderManager;
18940
19117
  }
18941
19118
  /**
18942
19119
  * Batch operation to get multiple node paths efficiently.
18943
- * @param entityIds Array of entity IDs to get paths for
18944
- * @returns Map of entityId to path array
19120
+ * @param entityIds Array of entity IDs to get paths for.
19121
+ * @returns Map of entityId to path array.
18945
19122
  */
18946
19123
  getNodePathsBatch(entityIds) {
18947
19124
  if (this.treeNodeByEntityId == null) {
@@ -18968,8 +19145,8 @@ var TilesetCadRenderManager;
18968
19145
  }
18969
19146
  /**
18970
19147
  * Batch operation to get multiple parent nodes efficiently.
18971
- * @param entityIds Array of entity IDs to get parents for
18972
- * @returns Map of entityId to parent node
19148
+ * @param entityIds Array of entity IDs to get parents for.
19149
+ * @returns Map of entityId to parent node.
18973
19150
  */
18974
19151
  getParentNodesBatch(entityIds) {
18975
19152
  if (this.treeNodeByEntityId == null) {
@@ -18992,8 +19169,8 @@ var TilesetCadRenderManager;
18992
19169
  }
18993
19170
  /**
18994
19171
  * Batch operation to get multiple child nodes efficiently.
18995
- * @param entityIds Array of entity IDs to get children for
18996
- * @returns Map of entityId to array of child nodes
19172
+ * @param entityIds Array of entity IDs to get children for.
19173
+ * @returns Map of entityId to array of child nodes.
18997
19174
  */
18998
19175
  getChildNodesBatch(entityIds) {
18999
19176
  if (this.treeNodeByEntityId == null) {
@@ -19003,11 +19180,11 @@ var TilesetCadRenderManager;
19003
19180
  this.buildModelTreeNodes(this.modelTree);
19004
19181
  }
19005
19182
  const children = new Map();
19006
- // Initialize all entityIds with empty arrays
19183
+ // Initialize all entityIds with empty arrays.
19007
19184
  for (const entityId of entityIds) {
19008
19185
  children.set(entityId, []);
19009
19186
  }
19010
- // Build a reverse lookup for efficiency
19187
+ // Build a reverse lookup for efficiency.
19011
19188
  for (const nodeId in this.treeNodeByEntityId) {
19012
19189
  const node = this.treeNodeByEntityId[nodeId];
19013
19190
  if (node.parentId && children.has(node.parentId)) {
@@ -19025,6 +19202,11 @@ var TilesetCadRenderManager;
19025
19202
  }
19026
19203
  doDispose() {
19027
19204
  var _a, _b;
19205
+ if (this.featureQueueInterval) {
19206
+ clearInterval(this.featureQueueInterval);
19207
+ this.featureQueueInterval = null;
19208
+ this.featureQueue = [];
19209
+ }
19028
19210
  if (this.cTileset) {
19029
19211
  const viewer = this.viewer;
19030
19212
  if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
@@ -33318,7 +33500,7 @@ class WidgetViewBar extends Widget.AWidget {
33318
33500
  }
33319
33501
  }
33320
33502
 
33321
- const VERSION = "6.0.3";
33503
+ const VERSION = "6.0.5";
33322
33504
 
33323
33505
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
33324
33506
  //# sourceMappingURL=bruce-cesium.es5.js.map