bruce-cesium 5.2.7 → 5.2.9

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.
@@ -16843,6 +16843,10 @@
16843
16843
  // It's pretty expensive so we save it for a few seconds inbetween checks.
16844
16844
  this.somethingIsolated = null;
16845
16845
  this.somethingIsolatedDateTime = null;
16846
+ // Entity ID -> rego.
16847
+ // We retain this information as a quick look-up on what has been registered.
16848
+ // This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
16849
+ this.loadedCesiumEntities = {};
16846
16850
  const { viewer, register: visualsManager, getters, item } = params;
16847
16851
  this.viewer = viewer;
16848
16852
  this.getters = getters;
@@ -16850,24 +16854,29 @@
16850
16854
  this.visualsManager = visualsManager;
16851
16855
  }
16852
16856
  Init() {
16853
- var _a;
16857
+ var _a, _b;
16854
16858
  const tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
16855
16859
  if (!tilesetId) {
16856
16860
  return;
16857
16861
  }
16862
+ let accountId = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID;
16863
+ if (!accountId) {
16864
+ accountId = this.getters.GetAccountId();
16865
+ }
16858
16866
  this.renderPriority = this.item.renderPriority;
16859
16867
  if (this.renderPriority == null) {
16860
16868
  this.renderPriority = 0;
16861
16869
  }
16862
16870
  (async () => {
16863
- var _a, _b, _c;
16864
- let api = this.getters.GetBruceApi();
16871
+ var _a;
16872
+ const api = this.getters.GetBruceApi({
16873
+ accountId: accountId
16874
+ });
16865
16875
  let coords = null;
16866
16876
  let tileset = null;
16867
16877
  // Single shared getter to avoid multiple assemblies fighting to render.
16868
16878
  // This lets one complete, then the next start.
16869
16879
  await exports.SharedGetters.Queue.Run("Rendering assembly.", async () => {
16870
- var _a, _b;
16871
16880
  if (this.disposed) {
16872
16881
  return;
16873
16882
  }
@@ -16875,7 +16884,7 @@
16875
16884
  let canAccess = false;
16876
16885
  try {
16877
16886
  canAccess = await BModels.Tileset.Publish.IsAccessAllowed({
16878
- sourceAccountId: (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID,
16887
+ sourceAccountId: accountId,
16879
16888
  tilesetId: tilesetId,
16880
16889
  forAccountId: this.getters.GetAccountId(),
16881
16890
  getters: this.getters
@@ -16888,14 +16897,13 @@
16888
16897
  console.error(e);
16889
16898
  }
16890
16899
  if (!canAccess) {
16891
- console.warn(`Cannot access tileset: ${tilesetId}, from account: ${(_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID}.`);
16900
+ console.warn(`Cannot access tileset: ${tilesetId}, from account: ${accountId}.`);
16892
16901
  return;
16893
16902
  }
16894
16903
  }
16895
16904
  else {
16896
16905
  console.warn("No tileset id found. Skipping access check.");
16897
16906
  }
16898
- api = this.getters.GetBruceApi();
16899
16907
  tileset = (await BModels.Tileset.Get({
16900
16908
  api,
16901
16909
  tilesetId
@@ -16943,7 +16951,7 @@
16943
16951
  tileset: tileset,
16944
16952
  viewer: this.viewer,
16945
16953
  coords: coords,
16946
- accountId: (_c = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID) !== null && _c !== void 0 ? _c : this.getters.GetAccountId(),
16954
+ accountId: accountId,
16947
16955
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled),
16948
16956
  noMemoryLimit: this.item["noMaximumMemory"]
16949
16957
  });
@@ -16967,7 +16975,9 @@
16967
16975
  this.onCTilesetLoad();
16968
16976
  this.styler.Init({
16969
16977
  viewer: this.viewer,
16970
- api,
16978
+ // Default API instead of the account one.
16979
+ // Records are driven by the account loading it instead of the source account.
16980
+ api: this.getters.GetBruceApi(),
16971
16981
  cTileset: this.cTileset,
16972
16982
  fallbackStyleId: this.item.styleId,
16973
16983
  styleMapping: this.item.StyleMapping,
@@ -17049,7 +17059,7 @@
17049
17059
  menuItemType: this.item.Type,
17050
17060
  priority: this.renderPriority,
17051
17061
  visual: feature,
17052
- accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17062
+ accountId: (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17053
17063
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
17054
17064
  tilesetType: BModels.Tileset.EType.Cad,
17055
17065
  rootId: this.rootId,
@@ -17140,6 +17150,26 @@
17140
17150
  }
17141
17151
  }
17142
17152
  feature.show = !hide;
17153
+ // Already exists, so we add this graphic as a sibling.
17154
+ if (this.loadedCesiumEntities[rego.entityId]) {
17155
+ rego = this.loadedCesiumEntities[rego.entityId];
17156
+ if (!rego.visual) {
17157
+ // No parent graphic.
17158
+ rego.visual = feature;
17159
+ }
17160
+ else if (rego.visual == feature) ;
17161
+ else {
17162
+ const visual = rego.visual;
17163
+ // Sibling graphic.
17164
+ if (!visual._siblingGraphics) {
17165
+ visual._siblingGraphics = [];
17166
+ }
17167
+ if (visual._siblingGraphics.indexOf(feature) < 0) {
17168
+ visual._siblingGraphics.push(feature);
17169
+ }
17170
+ }
17171
+ }
17172
+ this.loadedCesiumEntities[rego.entityId] = rego;
17143
17173
  this.visualsManager.AddRego({
17144
17174
  rego,
17145
17175
  requestRender: false
@@ -17153,6 +17183,9 @@
17153
17183
  menuItemId: this.item.id,
17154
17184
  doRemove: false
17155
17185
  });
17186
+ // Might have to do something smarter since siblings could still be OK.
17187
+ this.loadedCesiumEntities[rego.entityId] = null;
17188
+ delete this.loadedCesiumEntities[rego.entityId];
17156
17189
  }
17157
17190
  }
17158
17191
  getMetaByGeomId(geomId, tileset) {
@@ -17165,9 +17198,9 @@
17165
17198
  if (!modelTree) {
17166
17199
  return null;
17167
17200
  }
17168
- return this.digMetaByGeomId(geomId, modelTree, [], 0);
17201
+ return this.digMetaByGeomId(geomId, modelTree, [], 0, null);
17169
17202
  }
17170
- digMetaByGeomId(geomId, branch, path, depth) {
17203
+ digMetaByGeomId(geomId, branch, path, depth, firstFoundCollapsedBranch) {
17171
17204
  if (this.hasHitDepthLimit || depth > 10) {
17172
17205
  if (!this.hasHitDepthLimit) {
17173
17206
  console.error("digMetaByGeomId: depth > 10. Disabling further attempts.");
@@ -17177,12 +17210,19 @@
17177
17210
  }
17178
17211
  path = [].concat(path);
17179
17212
  path.push(branch.id);
17213
+ if (!firstFoundCollapsedBranch && branch.collapsed) {
17214
+ firstFoundCollapsedBranch = branch;
17215
+ }
17180
17216
  if (branch.geomId == geomId) {
17181
- return { id: path[path.length - 1], typeId: branch.typeId, name: branch.name };
17217
+ // If we collapsed on a higher branch then we return it instead.
17218
+ if (firstFoundCollapsedBranch) {
17219
+ branch = firstFoundCollapsedBranch;
17220
+ }
17221
+ return { id: branch.id, typeId: branch.typeId, name: branch.name };
17182
17222
  }
17183
17223
  else if (branch.children) {
17184
17224
  for (let i = 0; i < branch.children.length; i++) {
17185
- let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1);
17225
+ let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1, firstFoundCollapsedBranch);
17186
17226
  if (meta) {
17187
17227
  return meta;
17188
17228
  }
@@ -29876,7 +29916,7 @@
29876
29916
  }
29877
29917
  }
29878
29918
 
29879
- const VERSION = "5.2.7";
29919
+ const VERSION = "5.2.9";
29880
29920
 
29881
29921
  exports.VERSION = VERSION;
29882
29922
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;