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.
@@ -10736,7 +10736,10 @@
10736
10736
  if (!cTileset) {
10737
10737
  return false;
10738
10738
  }
10739
- if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
10739
+ else if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
10740
+ return false;
10741
+ }
10742
+ else if (visual.primitive && visual.primitive.isDestroyed()) {
10740
10743
  return false;
10741
10744
  }
10742
10745
  return true;
@@ -10831,11 +10834,15 @@
10831
10834
  }
10832
10835
  function updateEntity(viewer, entityId, register, refresh, cache = {}) {
10833
10836
  var _a;
10837
+ if (!entityId) {
10838
+ // What are we doing?
10839
+ return;
10840
+ }
10834
10841
  // Unavailable for unoptimized single-Entity updates.
10835
10842
  if (!cache) {
10836
10843
  cache = {};
10837
10844
  }
10838
- let regos = register.GetRegos({
10845
+ const regos = register.GetRegos({
10839
10846
  entityId
10840
10847
  });
10841
10848
  regos.sort((a, b) => {
@@ -11116,7 +11123,7 @@
11116
11123
  for (let i = 0; i < batch.length; i++) {
11117
11124
  const entityId = batch[i];
11118
11125
  // Check if still registered.
11119
- if (!this.rego[entityId] || !this.rego[entityId].length) {
11126
+ if (entityId && (!this.rego[entityId] || !this.rego[entityId].length)) {
11120
11127
  continue;
11121
11128
  }
11122
11129
  updateEntity(this.viewer, entityId, this, this.updateQueueSettings[entityId] == null ? false : this.updateQueueSettings[entityId], cache);
@@ -12157,6 +12164,7 @@
12157
12164
  }
12158
12165
  return visuals;
12159
12166
  }
12167
+ return [];
12160
12168
  }
12161
12169
  /**
12162
12170
  * Removes regos matching given criteria.
@@ -12294,6 +12302,77 @@
12294
12302
  }
12295
12303
  }
12296
12304
  }
12305
+ /**
12306
+ * Removes regos matching given visuals.
12307
+ * This is used when we cannot unpack properties from the visual any longer to determine its ID.
12308
+ * Usually for Tileset features.
12309
+ * @param params
12310
+ */
12311
+ RemoveRegosByVisuals(params) {
12312
+ var _a, _b, _c;
12313
+ const { doRemove = true, requestRender = true, source, doUpdate, menuItemId } = params;
12314
+ const entityIds = Object.keys(this.rego);
12315
+ const removedEntityIds = [];
12316
+ for (const entityId of entityIds) {
12317
+ const regos = this.rego[entityId];
12318
+ if (regos && regos.length) {
12319
+ for (const rego of regos) {
12320
+ if (params.visuals.includes(rego.visual)) {
12321
+ exports.EntityLabel.Detatch({
12322
+ rego
12323
+ });
12324
+ if (doRemove != false) {
12325
+ removeEntity(this.viewer, rego.visual);
12326
+ }
12327
+ rego.visual = null;
12328
+ this.rego[entityId] = regos.filter(r => r.visual !== rego.visual);
12329
+ const update = {
12330
+ type: EVisualUpdateType.Remove,
12331
+ entityId: rego.entityId,
12332
+ rego: rego
12333
+ };
12334
+ if (source) {
12335
+ update.source = source;
12336
+ }
12337
+ if (source !== EUpdateSource.TREE_CASCADE) {
12338
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(update);
12339
+ }
12340
+ if (doUpdate && menuItemId) {
12341
+ this.queueUpdate({
12342
+ entityId: entityId,
12343
+ refresh: false
12344
+ });
12345
+ }
12346
+ if (!removedEntityIds.includes(rego.entityId)) {
12347
+ removedEntityIds.push(rego.entityId);
12348
+ }
12349
+ }
12350
+ // Check siblings.
12351
+ else if ((_b = rego.visual) === null || _b === void 0 ? void 0 : _b["_siblingGraphics"]) {
12352
+ let siblings = rego.visual["_siblingGraphics"];
12353
+ if (doRemove != false) {
12354
+ for (const sibling of siblings) {
12355
+ if (params.visuals.includes(sibling)) {
12356
+ removeEntity(this.viewer, sibling);
12357
+ }
12358
+ }
12359
+ }
12360
+ siblings = siblings.filter(s => !params.visuals.includes(s));
12361
+ rego.visual["_siblingGraphics"] = siblings;
12362
+ }
12363
+ }
12364
+ }
12365
+ if (!((_c = this.rego[entityId]) === null || _c === void 0 ? void 0 : _c.length)) {
12366
+ delete this.rego[entityId];
12367
+ }
12368
+ }
12369
+ if (requestRender) {
12370
+ this.viewer.scene.requestRender();
12371
+ }
12372
+ return {
12373
+ removedEntityIds
12374
+ };
12375
+ }
12297
12376
  /**
12298
12377
  * Returns an array of drilled visuals associated with this register.
12299
12378
  * The top array item is the first found.
@@ -18291,6 +18370,17 @@
18291
18370
  this.historicPossesInitialLoaded = false;
18292
18371
  this.historicAnimation = null;
18293
18372
  this.historicPossesLoadingProm = null;
18373
+ // Queue of loaded in features that we haven't processed yet.
18374
+ this.featureQueue = [];
18375
+ // State is true for 'add' or 'false' for 'remove'.
18376
+ this.featureQueueStates = new Map();
18377
+ this.featureQueueInterval = null;
18378
+ // Cache of feature properties we wanted to find vs what we found.
18379
+ // Eg: "entityId" -> "entityId" | "bruceId" | "id" | null.
18380
+ // Eg: "geomId" -> null | "geomId";
18381
+ // Saves having to do a case-insensitive lookup every time.
18382
+ this.featurePropCache = new Map();
18383
+ this.featurePropsChecked = 0;
18294
18384
  const { viewer, register: visualsManager, getters, item, modelSpace } = params;
18295
18385
  this.viewer = viewer;
18296
18386
  this.getters = getters;
@@ -18325,7 +18415,7 @@
18325
18415
  // Single shared getter to avoid multiple assemblies fighting to render.
18326
18416
  // This lets one complete, then the next start.
18327
18417
  await exports.SharedGetters.Queue.Run("Rendering assembly.", async () => {
18328
- var _a, _b, _c;
18418
+ var _a, _b;
18329
18419
  if (this.disposed) {
18330
18420
  return;
18331
18421
  }
@@ -18383,30 +18473,39 @@
18383
18473
  viaCdn: false
18384
18474
  });
18385
18475
  }
18386
- // ModelTree is needed to map incoming graphics to Entities.
18387
- // So we load it first, then start rendering.
18388
- try {
18389
- // In >v1 the model-tree sits in its own file.
18390
- if (((_a = tileset.settings) === null || _a === void 0 ? void 0 : _a["tilesetVersion"]) > 1) {
18391
- const modelTreeUrl = BModels.Tileset.GetFileUrl({
18392
- api: api,
18393
- file: "model_tree.json",
18394
- tilesetId: tileset.id,
18395
- cacheToken: tileset.generateVersion,
18396
- viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
18397
- });
18398
- this.modelTree = await api.get(modelTreeUrl);
18399
- this.modelTreeUpdate.Trigger(this.modelTree);
18400
- }
18401
- // In v1 the model-tree is inside the tileset.json.
18402
- else {
18403
- const tilesetJson = await api.get(tileset.loadUrl);
18404
- this.modelTree = ((_b = tilesetJson === null || tilesetJson === void 0 ? void 0 : tilesetJson.extensions) === null || _b === void 0 ? void 0 : _b.modelTree) || null;
18476
+ // TODO: we shouldn't just assume we'll need it, huge assemblies are 100+ MB.
18477
+ // TODO: this is a problem as we need to know what nodes are collapsed...
18478
+ // In >v1 the model-tree sits in its own file.
18479
+ if (((_a = tileset.settings) === null || _a === void 0 ? void 0 : _a["tilesetVersion"]) > 1) {
18480
+ const modelTreeUrl = BModels.Tileset.GetFileUrl({
18481
+ api: api,
18482
+ file: "model_tree.json",
18483
+ tilesetId: tileset.id,
18484
+ cacheToken: tileset.generateVersion,
18485
+ viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
18486
+ });
18487
+ api.get(modelTreeUrl).then((blob) => {
18488
+ if (this.disposed) {
18489
+ return;
18490
+ }
18491
+ this.modelTree = blob || null;
18405
18492
  this.modelTreeUpdate.Trigger(this.modelTree);
18406
- }
18493
+ }).catch((err) => {
18494
+ this.modelTreeError = err.message || "Unknown error";
18495
+ });
18407
18496
  }
18408
- catch (e) {
18409
- console.error(e);
18497
+ // In v1 the model-tree is inside the tileset.json.
18498
+ else {
18499
+ api.get(tileset.loadUrl).then((blob) => {
18500
+ var _a;
18501
+ if (this.disposed) {
18502
+ return;
18503
+ }
18504
+ this.modelTree = ((_a = blob === null || blob === void 0 ? void 0 : blob.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
18505
+ this.modelTreeUpdate.Trigger(this.modelTree);
18506
+ }).catch((err) => {
18507
+ this.modelTreeError = err.message || "Unknown error";
18508
+ });
18410
18509
  }
18411
18510
  if (this.disposed) {
18412
18511
  return;
@@ -18415,7 +18514,7 @@
18415
18514
  const rootId = settings.rootEntityId;
18416
18515
  this.rootId = rootId;
18417
18516
  // If historic, we'll see if the root Entity has a historic position to use.
18418
- if (((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic) && rootId) {
18517
+ if (((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historic) && rootId) {
18419
18518
  try {
18420
18519
  const { entity: root } = await BModels.Entity.Get({
18421
18520
  entityId: rootId,
@@ -18503,7 +18602,7 @@
18503
18602
  });
18504
18603
  cTileset.tileLoad.addEventListener((tile) => {
18505
18604
  try {
18506
- this.mapCTile(tile, true);
18605
+ this.queueTile(tile, true);
18507
18606
  }
18508
18607
  catch (e) {
18509
18608
  console.error(e);
@@ -18511,7 +18610,7 @@
18511
18610
  });
18512
18611
  cTileset.tileUnload.addEventListener((tile) => {
18513
18612
  try {
18514
- this.mapCTile(tile, false);
18613
+ this.queueTile(tile, false);
18515
18614
  }
18516
18615
  catch (e) {
18517
18616
  console.error(e);
@@ -18534,34 +18633,133 @@
18534
18633
  * @param load indicates if we are loading or unloading the tile.
18535
18634
  * @returns
18536
18635
  */
18537
- mapCTile(tile, load) {
18636
+ queueTile(tile, load) {
18538
18637
  const content = tile === null || tile === void 0 ? void 0 : tile.content;
18539
18638
  if (!content) {
18540
18639
  return;
18541
18640
  }
18542
- const regosToQueue = new Map();
18543
18641
  for (let i = 0; i < content.featuresLength; i++) {
18544
18642
  const feature = content.getFeature(i);
18545
- let rego = this.mapTilesetFeature(feature, load);
18546
- if (!(rego === null || rego === void 0 ? void 0 : rego.entityId)) {
18643
+ if (!this.featureQueue.includes(feature)) {
18644
+ this.featureQueue.push(feature);
18645
+ }
18646
+ this.featureQueueStates.set(feature, load);
18647
+ }
18648
+ this.pingFeatureQueue();
18649
+ }
18650
+ /**
18651
+ * Pings the feature queue to process any queued features.
18652
+ * Does nothing if we're already processing.
18653
+ * @returns
18654
+ */
18655
+ pingFeatureQueue() {
18656
+ if (!this.featureQueue.length || this.featureQueueInterval || this.disposed) {
18657
+ return;
18658
+ }
18659
+ this.featureQueueInterval = setInterval(() => {
18660
+ if (this.disposed) {
18661
+ clearInterval(this.featureQueueInterval);
18662
+ this.featureQueueInterval = null;
18663
+ return;
18664
+ }
18665
+ this.processFeatureQueueBatch();
18666
+ if (!this.featureQueue) {
18667
+ clearInterval(this.featureQueueInterval);
18668
+ this.featureQueueInterval = null;
18669
+ }
18670
+ }, 10);
18671
+ }
18672
+ /**
18673
+ * Process a batch of features from the feature queue.
18674
+ */
18675
+ processFeatureQueueBatch() {
18676
+ if (!this.featureQueue.length) {
18677
+ return;
18678
+ }
18679
+ // If features require geomId (don't have bruceId props) then the model tree must be loaded.
18680
+ // If it's not loaded, we simply return and keep waiting.
18681
+ if (!this.modelTree) {
18682
+ /*
18683
+ if (!this.featureQueue[0].getProperty("bruceId")) {
18684
+ return;
18685
+ }
18686
+ */
18687
+ // TODO: For now always requiring it when it's available.
18688
+ // This is because we need to think of a strategy or collapsed items first.
18689
+ if (!this.modelTreeError) {
18690
+ return;
18691
+ }
18692
+ }
18693
+ const BATCH_SIZE = 5000;
18694
+ const batch = this.featureQueue.splice(0, BATCH_SIZE);
18695
+ const regosToStyle = new Map();
18696
+ const featuresToRemove = [];
18697
+ for (const feature of batch) {
18698
+ const load = this.featureQueueStates.get(feature);
18699
+ this.featureQueueStates.delete(feature);
18700
+ if (!load) {
18701
+ featuresToRemove.push(feature);
18702
+ continue;
18703
+ }
18704
+ const result = this.mapTilesetFeature(feature);
18705
+ if (result === null) {
18547
18706
  // Override the default hide state set by the style.
18548
18707
  feature.show = true;
18549
18708
  continue;
18550
18709
  }
18551
- regosToQueue.set(rego.entityId, rego);
18710
+ else if (result) {
18711
+ regosToStyle.set(result.entityId, result);
18712
+ }
18552
18713
  }
18553
- if (this.styler && regosToQueue.size) {
18554
- this.styler.QueueEntities(Array.from(regosToQueue.values()));
18714
+ if (featuresToRemove.length) {
18715
+ const { removedEntityIds } = this.visualsManager.RemoveRegosByVisuals({
18716
+ visuals: featuresToRemove,
18717
+ requestRender: false,
18718
+ menuItemId: this.item.id,
18719
+ doRemove: false
18720
+ });
18721
+ for (const entityId of removedEntityIds) {
18722
+ delete this.loadedCesiumEntities[entityId];
18723
+ }
18724
+ }
18725
+ if (this.styler && regosToStyle.size) {
18726
+ this.styler.QueueEntities(Array.from(regosToStyle.values()));
18727
+ }
18728
+ }
18729
+ evaluateFeatureProps(feature) {
18730
+ var _a;
18731
+ // If we've checked 10 features then we should have a good handle on what props are available.
18732
+ if (this.featurePropsChecked >= 10) {
18733
+ return;
18734
+ }
18735
+ this.featurePropsChecked++;
18736
+ const featureAny = feature;
18737
+ const props = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_a = featureAny.getPropertyIds) === null || _a === void 0 ? void 0 : _a.call(featureAny);
18738
+ if (!props) {
18739
+ return;
18740
+ }
18741
+ for (const prop of props) {
18742
+ if (!prop) {
18743
+ continue;
18744
+ }
18745
+ const lowered = prop.toLowerCase();
18746
+ if (lowered === "bruceid" || lowered === "id" || lowered === "entityid") {
18747
+ this.featurePropCache.set("entityId", prop);
18748
+ }
18749
+ else if (lowered === "geomid") {
18750
+ this.featurePropCache.set("geomId", prop);
18751
+ }
18752
+ else if (lowered === "brucepath") {
18753
+ this.featurePropCache.set("brucePath", prop);
18754
+ }
18555
18755
  }
18556
- this.viewer.scene.requestRender();
18557
18756
  }
18558
18757
  /**
18559
18758
  * @param feature
18560
- * @param add indicates if we are adding or removing the feature.
18561
18759
  * @returns
18562
18760
  */
18563
- mapTilesetFeature(feature, add) {
18564
- var _a, _b, _c, _d, _e, _f;
18761
+ mapTilesetFeature(feature) {
18762
+ var _a, _b, _c, _d, _e;
18565
18763
  const accountId = (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
18566
18764
  const canEdit = accountId === this.getters.GetAccountId() && !((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic);
18567
18765
  let rego = {
@@ -18577,17 +18775,15 @@
18577
18775
  tilesetType: BModels.Tileset.EType.Cad,
18578
18776
  rootId: this.rootId
18579
18777
  };
18580
- const featureAny = feature;
18581
- const propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_e = featureAny.getPropertyIds) === null || _e === void 0 ? void 0 : _e.call(featureAny);
18582
- if (!propertyNames) {
18583
- return null;
18584
- }
18585
- const setByGeomId = () => {
18586
- const geomIdProp = propertyNames.find(x => String(x).toLowerCase() == "geomid");
18778
+ this.evaluateFeatureProps(feature);
18779
+ // Becoming legacy.
18780
+ // Need to handle collapsed items somehow in newer path first.
18781
+ if (!rego.entityId) {
18782
+ const geomIdProp = this.featurePropCache.get("geomId");
18587
18783
  if (geomIdProp) {
18588
18784
  const geomId = +feature.getProperty(geomIdProp);
18589
18785
  if (geomId != null && (!!geomId || geomId == 0)) {
18590
- const meta = this.getMetaByGeomId(geomId, feature.tileset);
18786
+ const meta = this.getMetaByGeomId(geomId);
18591
18787
  if (meta) {
18592
18788
  rego.entityId = meta.entityId;
18593
18789
  rego.entityTypeId = meta.typeId;
@@ -18596,15 +18792,17 @@
18596
18792
  }
18597
18793
  }
18598
18794
  }
18599
- };
18600
- const setByEntityId = () => {
18601
- const bruceIdProp = propertyNames.find(x => (String(x).toLowerCase() == "bruceid"));
18602
- if (bruceIdProp) {
18603
- rego.entityId = feature.getProperty(bruceIdProp);
18795
+ }
18796
+ // Latest path.
18797
+ if (!rego.entityId) {
18798
+ const entityIdProp = this.featurePropCache.get("entityId");
18799
+ if (entityIdProp) {
18800
+ rego.entityId = feature.getProperty(entityIdProp);
18604
18801
  }
18605
- };
18606
- const setByPath = () => {
18607
- const brucePathProp = propertyNames.find(x => String(x).toLowerCase() == "brucepath");
18802
+ }
18803
+ // Super legacy.
18804
+ if (!rego.entityId) {
18805
+ const brucePathProp = this.featurePropCache.get("brucePath");
18608
18806
  if (brucePathProp) {
18609
18807
  const pathStr = feature.getProperty(brucePathProp);
18610
18808
  if (pathStr) {
@@ -18614,20 +18812,13 @@
18614
18812
  rego.entityId = path[path.length - 1];
18615
18813
  }
18616
18814
  }
18617
- };
18618
- setByGeomId();
18619
- if (!rego.entityId) {
18620
- setByEntityId();
18621
- }
18622
- if (!rego.entityId) {
18623
- setByPath();
18624
18815
  }
18625
18816
  if (!rego.entityId) {
18626
18817
  return null;
18627
18818
  }
18628
18819
  // Optional menu item restriction.
18629
18820
  // Allows only showing certain entities from a tileset.
18630
- const onlyIds = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.EntityIds;
18821
+ const onlyIds = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.EntityIds;
18631
18822
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
18632
18823
  if (this.item.BruceEntity.Ghosts) {
18633
18824
  feature.color = Cesium.Color.WHITE.clone().withAlpha(0.5);
@@ -18635,74 +18826,60 @@
18635
18826
  else {
18636
18827
  feature.show = false;
18637
18828
  }
18638
- return null;
18829
+ return false;
18639
18830
  }
18640
- if (add) {
18641
- // Get the initial hide/show state.
18642
- const state = this.visualsManager.GetState({
18643
- entityId: rego.entityId,
18644
- menuItemId: this.item.id,
18645
- });
18646
- if (this.somethingIsolated == null ||
18647
- // 5s cache.
18648
- (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
18649
- this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
18650
- this.somethingIsolatedDateTime = new Date();
18831
+ // Get the initial hide/show state.
18832
+ const state = this.visualsManager.GetState({
18833
+ entityId: rego.entityId,
18834
+ menuItemId: this.item.id,
18835
+ });
18836
+ if (this.somethingIsolated == null ||
18837
+ // 5s cache.
18838
+ (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
18839
+ this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
18840
+ this.somethingIsolatedDateTime = new Date();
18841
+ }
18842
+ // Override the default hide state set by the style.
18843
+ let hide = false;
18844
+ if (state) {
18845
+ if (state.hidden) {
18846
+ hide = true;
18651
18847
  }
18652
- // Override the default hide state set by the style.
18653
- let hide = false;
18654
- if (state) {
18655
- if (state.hidden) {
18656
- hide = true;
18657
- }
18658
- else if (state.opacity === 0) {
18659
- hide = true;
18660
- }
18661
- else if (!state.isolated && this.somethingIsolated) {
18662
- hide = true;
18663
- }
18848
+ else if (state.opacity === 0) {
18849
+ hide = true;
18664
18850
  }
18665
- feature.show = !hide;
18666
- // Already exists, so we add this graphic as a sibling.
18667
- if (this.loadedCesiumEntities[rego.entityId]) {
18668
- rego = this.loadedCesiumEntities[rego.entityId];
18669
- if (!rego.visual) {
18670
- // No parent graphic.
18671
- rego.visual = feature;
18851
+ else if (!state.isolated && this.somethingIsolated) {
18852
+ hide = true;
18853
+ }
18854
+ }
18855
+ feature.show = !hide;
18856
+ // Already exists, so we add this graphic as a sibling.
18857
+ if (this.loadedCesiumEntities[rego.entityId]) {
18858
+ rego = this.loadedCesiumEntities[rego.entityId];
18859
+ if (!rego.visual) {
18860
+ // No parent graphic.
18861
+ rego.visual = feature;
18862
+ }
18863
+ else if (rego.visual == feature) ;
18864
+ else {
18865
+ const visual = rego.visual;
18866
+ // Sibling graphic.
18867
+ if (!visual._siblingGraphics) {
18868
+ visual._siblingGraphics = [];
18672
18869
  }
18673
- else if (rego.visual == feature) ;
18674
- else {
18675
- const visual = rego.visual;
18676
- // Sibling graphic.
18677
- if (!visual._siblingGraphics) {
18678
- visual._siblingGraphics = [];
18679
- }
18680
- if (visual._siblingGraphics.indexOf(feature) < 0) {
18681
- visual._siblingGraphics.push(feature);
18682
- }
18870
+ if (visual._siblingGraphics.indexOf(feature) < 0) {
18871
+ visual._siblingGraphics.push(feature);
18683
18872
  }
18684
18873
  }
18685
- this.loadedCesiumEntities[rego.entityId] = rego;
18686
- this.visualsManager.AddRego({
18687
- rego,
18688
- requestRender: false
18689
- });
18690
- return rego;
18691
- }
18692
- else {
18693
- this.visualsManager.RemoveRegos({
18694
- entityId: rego.entityId,
18695
- requestRender: false,
18696
- menuItemId: this.item.id,
18697
- doRemove: false,
18698
- source: exports.VisualsRegister.EUpdateSource.TILESET_DISPOSE
18699
- });
18700
- // Might have to do something smarter since siblings could still be OK.
18701
- this.loadedCesiumEntities[rego.entityId] = null;
18702
- delete this.loadedCesiumEntities[rego.entityId];
18703
18874
  }
18875
+ this.loadedCesiumEntities[rego.entityId] = rego;
18876
+ this.visualsManager.AddRego({
18877
+ rego,
18878
+ requestRender: false
18879
+ });
18880
+ return rego;
18704
18881
  }
18705
- getMetaByGeomId(geomId, tileset) {
18882
+ getMetaByGeomId(geomId) {
18706
18883
  if (this.treeNodeByGeomId == null) {
18707
18884
  if (!this.modelTree) {
18708
18885
  return null;
@@ -18742,8 +18919,8 @@
18742
18919
  newFirstFoundCollapsedBranch = cache;
18743
18920
  }
18744
18921
  }
18745
- // Always process children regardless of collapse state
18746
- // This ensures all nodes are mapped, even those under collapsed branches
18922
+ // Always process children regardless of collapse state.
18923
+ // This ensures all nodes are mapped, even those under collapsed branches.
18747
18924
  if (node.children) {
18748
18925
  for (let i = node.children.length - 1; i >= 0; i--) {
18749
18926
  stack.push({
@@ -18768,8 +18945,8 @@
18768
18945
  }
18769
18946
  /**
18770
18947
  * Gets the parent node of a given entity.
18771
- * @param entityId The entity ID to find the parent for
18772
- * @returns The parent node or null if no parent exists
18948
+ * @param entityId The entity ID to find the parent for.
18949
+ * @returns The parent node or null if no parent exists.
18773
18950
  */
18774
18951
  getParentNode(entityId) {
18775
18952
  if (this.treeNodeByEntityId == null) {
@@ -18786,8 +18963,8 @@
18786
18963
  }
18787
18964
  /**
18788
18965
  * Gets all child nodes of a given entity.
18789
- * @param entityId The entity ID to find children for
18790
- * @returns Array of child nodes
18966
+ * @param entityId The entity ID to find children for.
18967
+ * @returns Array of child nodes.
18791
18968
  */
18792
18969
  getChildNodes(entityId) {
18793
18970
  if (this.treeNodeByEntityId == null) {
@@ -18836,7 +19013,7 @@
18836
19013
  }
18837
19014
  /**
18838
19015
  * Gets the root node of the model tree.
18839
- * @returns The root node or null if no tree exists
19016
+ * @returns The root node or null if no tree exists.
18840
19017
  */
18841
19018
  getRootNode() {
18842
19019
  if (this.treeNodeByEntityId == null) {
@@ -18845,7 +19022,7 @@
18845
19022
  }
18846
19023
  this.buildModelTreeNodes(this.modelTree);
18847
19024
  }
18848
- // Find the node with no parent (root node)
19025
+ // Find the node with no parent (root node).
18849
19026
  for (const nodeId in this.treeNodeByEntityId) {
18850
19027
  const node = this.treeNodeByEntityId[nodeId];
18851
19028
  if (!node.parentId) {
@@ -18856,8 +19033,8 @@
18856
19033
  }
18857
19034
  /**
18858
19035
  * Gets the path from root to a given entity.
18859
- * @param entityId The entity ID to find the path for
18860
- * @returns Array of node IDs representing the path from root to the entity
19036
+ * @param entityId The entity ID to find the path for.
19037
+ * @returns Array of node IDs representing the path from root to the entity.
18861
19038
  */
18862
19039
  getNodePath(entityId) {
18863
19040
  if (this.treeNodeByEntityId == null) {
@@ -18880,8 +19057,8 @@
18880
19057
  }
18881
19058
  /**
18882
19059
  * Batch operation to get multiple node paths efficiently.
18883
- * @param entityIds Array of entity IDs to get paths for
18884
- * @returns Map of entityId to path array
19060
+ * @param entityIds Array of entity IDs to get paths for.
19061
+ * @returns Map of entityId to path array.
18885
19062
  */
18886
19063
  getNodePathsBatch(entityIds) {
18887
19064
  if (this.treeNodeByEntityId == null) {
@@ -18908,8 +19085,8 @@
18908
19085
  }
18909
19086
  /**
18910
19087
  * Batch operation to get multiple parent nodes efficiently.
18911
- * @param entityIds Array of entity IDs to get parents for
18912
- * @returns Map of entityId to parent node
19088
+ * @param entityIds Array of entity IDs to get parents for.
19089
+ * @returns Map of entityId to parent node.
18913
19090
  */
18914
19091
  getParentNodesBatch(entityIds) {
18915
19092
  if (this.treeNodeByEntityId == null) {
@@ -18932,8 +19109,8 @@
18932
19109
  }
18933
19110
  /**
18934
19111
  * Batch operation to get multiple child nodes efficiently.
18935
- * @param entityIds Array of entity IDs to get children for
18936
- * @returns Map of entityId to array of child nodes
19112
+ * @param entityIds Array of entity IDs to get children for.
19113
+ * @returns Map of entityId to array of child nodes.
18937
19114
  */
18938
19115
  getChildNodesBatch(entityIds) {
18939
19116
  if (this.treeNodeByEntityId == null) {
@@ -18943,11 +19120,11 @@
18943
19120
  this.buildModelTreeNodes(this.modelTree);
18944
19121
  }
18945
19122
  const children = new Map();
18946
- // Initialize all entityIds with empty arrays
19123
+ // Initialize all entityIds with empty arrays.
18947
19124
  for (const entityId of entityIds) {
18948
19125
  children.set(entityId, []);
18949
19126
  }
18950
- // Build a reverse lookup for efficiency
19127
+ // Build a reverse lookup for efficiency.
18951
19128
  for (const nodeId in this.treeNodeByEntityId) {
18952
19129
  const node = this.treeNodeByEntityId[nodeId];
18953
19130
  if (node.parentId && children.has(node.parentId)) {
@@ -18965,6 +19142,11 @@
18965
19142
  }
18966
19143
  doDispose() {
18967
19144
  var _a, _b;
19145
+ if (this.featureQueueInterval) {
19146
+ clearInterval(this.featureQueueInterval);
19147
+ this.featureQueueInterval = null;
19148
+ this.featureQueue = [];
19149
+ }
18968
19150
  if (this.cTileset) {
18969
19151
  const viewer = this.viewer;
18970
19152
  if (!(viewer === null || viewer === void 0 ? void 0 : viewer.isDestroyed()) && this.viewer.scene.primitives.contains(this.cTileset)) {
@@ -33214,7 +33396,7 @@
33214
33396
  }
33215
33397
  }
33216
33398
 
33217
- const VERSION = "6.0.3";
33399
+ const VERSION = "6.0.5";
33218
33400
 
33219
33401
  exports.VERSION = VERSION;
33220
33402
  exports.isOutlineChanged = isOutlineChanged;