bruce-cesium 6.2.1 → 6.2.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.
@@ -11511,41 +11511,172 @@
11511
11511
  return newStates;
11512
11512
  }
11513
11513
  /**
11514
- * Applies a set of new states to override the existing ones.
11515
- * This can be a costly operation as it will update all visuals.
11514
+ * Calculates the difference between current states and new states.
11515
+ * Returns what needs to be added, removed, and updated.
11516
+ */
11517
+ calculateStateDifference(newStates) {
11518
+ const toAdd = [];
11519
+ const toRemove = [];
11520
+ const toUpdate = [];
11521
+ const affectedEntityIds = new Set();
11522
+ // State map for quick lookups.
11523
+ const newStatesMap = new Map();
11524
+ for (const state of newStates) {
11525
+ if (!state.entityId || isBlankState(state)) {
11526
+ continue;
11527
+ }
11528
+ const key = `${state.entityId}::${state.menuItemId || NO_MENU_ITEM_KEY}`;
11529
+ newStatesMap.set(key, state);
11530
+ }
11531
+ // Track existing states.
11532
+ const existingKeys = new Set();
11533
+ // Check existing states to see if they need removal or updating.
11534
+ this.ForEachState((existingState) => {
11535
+ const key = `${existingState.entityId}::${existingState.menuItemId || NO_MENU_ITEM_KEY}`;
11536
+ existingKeys.add(key);
11537
+ const newState = newStatesMap.get(key);
11538
+ // State exists in current but not in new.
11539
+ if (!newState) {
11540
+ toRemove.push({ ...existingState });
11541
+ affectedEntityIds.add(existingState.entityId);
11542
+ }
11543
+ // State exists in both.
11544
+ // See if changed.
11545
+ else {
11546
+ if (this.isStateDifferent(existingState, newState)) {
11547
+ toUpdate.push({ ...newState });
11548
+ affectedEntityIds.add(existingState.entityId);
11549
+ }
11550
+ }
11551
+ });
11552
+ // Check for new states that don't exist currently.
11553
+ for (const [key, newState] of newStatesMap) {
11554
+ if (!existingKeys.has(key)) {
11555
+ toAdd.push({ ...newState });
11556
+ affectedEntityIds.add(newState.entityId);
11557
+ }
11558
+ }
11559
+ return { toAdd, toRemove, toUpdate, affectedEntityIds };
11560
+ }
11561
+ /**
11562
+ * Compares two states to determine if they're different.
11563
+ * Only compares meaningful properties (not entityId/menuItemId).
11564
+ */
11565
+ isStateDifferent(state1, state2) {
11566
+ const keys1 = Object.keys(state1).filter(k => k !== "entityId" && k !== "menuItemId");
11567
+ const keys2 = Object.keys(state2).filter(k => k !== "entityId" && k !== "menuItemId");
11568
+ // Different number of properties.
11569
+ if (keys1.length !== keys2.length) {
11570
+ return true;
11571
+ }
11572
+ // Check if any property values differ.
11573
+ for (const key of keys1) {
11574
+ if (state1[key] !== state2[key]) {
11575
+ return true;
11576
+ }
11577
+ }
11578
+ return false;
11579
+ }
11580
+ /**
11581
+ * Applies a set of new states to override the existing ones using differential updates.
11582
+ * This is more efficient than clearing and re-applying all states.
11516
11583
  * @param states
11517
11584
  */
11518
11585
  OverrideStates(states) {
11519
- // Clear current states.
11520
- this.ClearOpacity();
11521
- this.ClearLabelled();
11522
- this.ClearSelected();
11523
- this.ClearHighlighted();
11524
- this.ClearIsolated();
11525
- this.ClearHidden();
11526
- this.states = {};
11527
- let newStates = {};
11528
- for (let i = 0; i < states.length; i++) {
11529
- const state = states[i];
11530
- if (!state.menuItemId && state.hasOwnProperty("menuItemId")) {
11531
- delete state.menuItemId;
11586
+ // Calculate what needs to change.
11587
+ const diff = this.calculateStateDifference(states);
11588
+ // If nothing changed, exit early.
11589
+ if (diff.toAdd.length === 0 && diff.toRemove.length === 0 && diff.toUpdate.length === 0) {
11590
+ return;
11591
+ }
11592
+ // Track which visual properties need refreshing per entity.
11593
+ const refreshMap = new Map();
11594
+ const updateRefreshForEntity = (entityId, props) => {
11595
+ const existing = refreshMap.get(entityId) || {};
11596
+ refreshMap.set(entityId, {
11597
+ highlighted: existing.highlighted || props.highlighted || false,
11598
+ selected: existing.selected || props.selected || false,
11599
+ opacity: existing.opacity || props.opacity || false
11600
+ });
11601
+ };
11602
+ // Process removals.
11603
+ for (const state of diff.toRemove) {
11604
+ // Create a state with inverted/cleared values.
11605
+ const clearState = {
11606
+ entityId: state.entityId,
11607
+ menuItemId: state.menuItemId
11608
+ };
11609
+ // For each property that exists, set it to null to clear it.
11610
+ // This will cause setStateValues to delete the property.
11611
+ if (state.highlighted != null) {
11612
+ clearState.highlighted = null;
11613
+ updateRefreshForEntity(state.entityId, {
11614
+ highlighted: true
11615
+ });
11532
11616
  }
11533
- if (!state.entityId) {
11534
- continue;
11617
+ if (state.selected != null) {
11618
+ clearState.selected = null;
11619
+ updateRefreshForEntity(state.entityId, {
11620
+ selected: true
11621
+ });
11535
11622
  }
11536
- if (isBlankState(state)) {
11537
- continue;
11623
+ if (state.opacity != null) {
11624
+ clearState.opacity = null;
11625
+ updateRefreshForEntity(state.entityId, {
11626
+ opacity: true
11627
+ });
11538
11628
  }
11539
- if (!newStates[state.entityId]) {
11540
- newStates[state.entityId] = {};
11629
+ if (state.labelled != null) {
11630
+ clearState.labelled = null;
11631
+ updateRefreshForEntity(state.entityId, {});
11541
11632
  }
11542
- newStates[state.entityId][state.menuItemId ? state.menuItemId : NO_MENU_ITEM_KEY] = {
11543
- ...state
11544
- };
11633
+ if (state.hidden != null) {
11634
+ clearState.hidden = null;
11635
+ updateRefreshForEntity(state.entityId, {});
11636
+ }
11637
+ if (state.isolated != null) {
11638
+ clearState.isolated = null;
11639
+ updateRefreshForEntity(state.entityId, {});
11640
+ }
11641
+ this.setStateValues(clearState);
11642
+ }
11643
+ // Process additions and updates.
11644
+ const statesToSet = [...diff.toAdd, ...diff.toUpdate];
11645
+ for (const state of statesToSet) {
11646
+ // Determine what needs visual refresh based on what's changing.
11647
+ if (state.hasOwnProperty("highlighted")) {
11648
+ updateRefreshForEntity(state.entityId, {
11649
+ highlighted: true
11650
+ });
11651
+ }
11652
+ if (state.hasOwnProperty("selected")) {
11653
+ updateRefreshForEntity(state.entityId, {
11654
+ selected: true
11655
+ });
11656
+ }
11657
+ if (state.hasOwnProperty("opacity")) {
11658
+ updateRefreshForEntity(state.entityId, {
11659
+ opacity: true
11660
+ });
11661
+ }
11662
+ if (state.hasOwnProperty("labelled")) {
11663
+ updateRefreshForEntity(state.entityId, {});
11664
+ }
11665
+ if (state.hasOwnProperty("hidden") || state.hasOwnProperty("isolated")) {
11666
+ updateRefreshForEntity(state.entityId, {});
11667
+ }
11668
+ this.setStateValues(state);
11545
11669
  }
11546
- this.states = newStates;
11547
- // Reflect the rest of the changes.
11548
- this.updateAllEntities();
11670
+ // Queue updates for all affected entities.
11671
+ // TODO: if a massive list we should async batch this.
11672
+ for (const entityId of diff.affectedEntityIds) {
11673
+ const refresh = refreshMap.get(entityId);
11674
+ this.queueUpdate({
11675
+ entityId: entityId,
11676
+ refresh: refresh || true
11677
+ });
11678
+ }
11679
+ this.viewer.scene.requestRender();
11549
11680
  }
11550
11681
  /**
11551
11682
  * Returns all states with the first detected Menu Item ID settings included.
@@ -11993,7 +12124,7 @@
11993
12124
  }
11994
12125
  SetIsolated(params) {
11995
12126
  var _a;
11996
- const { entityIds, isolated: isolate, requestRender, menuItemId, source } = params;
12127
+ const { entityIds, isolated: isolate, requestRender, menuItemId, source, doUpdate } = params;
11997
12128
  for (let i = 0; i < entityIds.length; i++) {
11998
12129
  const entityId = entityIds[i];
11999
12130
  this.setStateValues({
@@ -12014,12 +12145,14 @@
12014
12145
  (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(update);
12015
12146
  }
12016
12147
  }
12017
- this.updateAllEntities({
12018
- requestRender: false,
12019
- refresh: isolate
12020
- });
12021
- if (requestRender != false) {
12022
- this.viewer.scene.requestRender();
12148
+ if (doUpdate !== false) {
12149
+ this.updateAllEntities({
12150
+ requestRender: false,
12151
+ refresh: isolate
12152
+ });
12153
+ if (requestRender != false) {
12154
+ this.viewer.scene.requestRender();
12155
+ }
12023
12156
  }
12024
12157
  }
12025
12158
  GetIsIsolated(params) {
@@ -12055,7 +12188,7 @@
12055
12188
  }
12056
12189
  delete state.isolated;
12057
12190
  });
12058
- if (changed) {
12191
+ if (changed && params.doUpdate !== false) {
12059
12192
  this.updateAllEntities({
12060
12193
  requestRender: params === null || params === void 0 ? void 0 : params.requestRender,
12061
12194
  refresh: true
@@ -12109,7 +12242,7 @@
12109
12242
  }
12110
12243
  delete state.hidden;
12111
12244
  });
12112
- if (changed) {
12245
+ if (changed && params.doUpdate !== false) {
12113
12246
  this.updateAllEntities({
12114
12247
  requestRender: params === null || params === void 0 ? void 0 : params.requestRender,
12115
12248
  refresh: true
@@ -12503,16 +12636,27 @@
12503
12636
  }
12504
12637
  }
12505
12638
  }
12506
- updateAllEntities(params) {
12507
- for (const entityId in this.rego) {
12508
- const regos = this.rego[entityId];
12509
- if (regos && regos.length) {
12510
- this.queueUpdate({
12511
- entityId: entityId,
12512
- refresh: (params === null || params === void 0 ? void 0 : params.refresh) == null ? true : params.refresh
12513
- });
12639
+ async updateAllEntities(params) {
12640
+ const ids = Object.keys(this.rego);
12641
+ const interval = setInterval(() => {
12642
+ const batch = ids.splice(0, 3000);
12643
+ if (!batch.length || (params.isCancelled && params.isCancelled())) {
12644
+ clearInterval(interval);
12645
+ return;
12514
12646
  }
12515
- }
12647
+ for (const entityId of batch) {
12648
+ const regos = this.rego[entityId];
12649
+ if (regos && regos.length) {
12650
+ this.queueUpdate({
12651
+ entityId: entityId,
12652
+ refresh: (params === null || params === void 0 ? void 0 : params.refresh) == null ? true : params.refresh
12653
+ });
12654
+ }
12655
+ }
12656
+ if ((params === null || params === void 0 ? void 0 : params.requestRender) !== false) {
12657
+ this.viewer.scene.requestRender();
12658
+ }
12659
+ }, 10);
12516
12660
  }
12517
12661
  /**
12518
12662
  * Sets opacity for given set of entities.
@@ -20761,6 +20905,71 @@
20761
20905
  DataSourceStaticKmlManager.Manager = Manager;
20762
20906
  })(exports.DataSourceStaticKmlManager || (exports.DataSourceStaticKmlManager = {}));
20763
20907
 
20908
+ (function (XGridsRenderEngine) {
20909
+ function Render(params) {
20910
+ var _a, _b, _c;
20911
+ const { api, viewer, tileset } = params;
20912
+ if (!LCCRender) {
20913
+ console.warn("[XGridsRenderEngine] Render() LCCRender library not available.");
20914
+ return null;
20915
+ }
20916
+ const settings = tileset.settings;
20917
+ let position = settings === null || settings === void 0 ? void 0 : settings.origin;
20918
+ if (settings.dontTransform) {
20919
+ position = null;
20920
+ }
20921
+ let m1 = undefined;
20922
+ // Location matrix.
20923
+ if ((position === null || position === void 0 ? void 0 : position.latitude) || (position === null || position === void 0 ? void 0 : position.longitude) || (position === null || position === void 0 ? void 0 : position.altitude)) {
20924
+ m1 = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(EnsureNumber(position.longitude, 0), EnsureNumber(position.latitude, 0), EnsureNumber(position.altitude, 0)));
20925
+ }
20926
+ else {
20927
+ m1 = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(0, 0, 0));
20928
+ }
20929
+ // Apply HPR + scale.
20930
+ if (!settings.dontRotate && !settings.dontTransform) {
20931
+ const translationMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, 0), new Cesium.Matrix4());
20932
+ const hpr = Cesium.HeadingPitchRoll.fromDegrees(EnsureNumber((_a = settings.rotation) === null || _a === void 0 ? void 0 : _a.z), EnsureNumber((_b = settings.rotation) === null || _b === void 0 ? void 0 : _b.x), EnsureNumber((_c = settings.rotation) === null || _c === void 0 ? void 0 : _c.y), new Cesium.HeadingPitchRoll());
20933
+ const hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
20934
+ const scaleMatrix = Cesium.Matrix4.fromUniformScale(EnsureNumber((position === null || position === void 0 ? void 0 : position.scale) || 1, 1), new Cesium.Matrix4());
20935
+ let combinedMatrix = Cesium.Matrix4.multiply(m1, translationMatrix, new Cesium.Matrix4());
20936
+ combinedMatrix = Cesium.Matrix4.multiply(combinedMatrix, Cesium.Matrix4.fromRotation(hprRotation), new Cesium.Matrix4());
20937
+ combinedMatrix = Cesium.Matrix4.multiply(combinedMatrix, scaleMatrix, new Cesium.Matrix4());
20938
+ m1 = combinedMatrix;
20939
+ }
20940
+ const loadUrl = BModels.Tileset.GetFileUrl({
20941
+ file: tileset.rootFileName || "meta.lcc",
20942
+ tilesetId: tileset.id,
20943
+ viaCdn: true,
20944
+ legacy: true,
20945
+ cacheToken: tileset.generateVersion,
20946
+ api: api
20947
+ });
20948
+ return window.LCCRender.load({
20949
+ camera: viewer.camera,
20950
+ scene: viewer.scene,
20951
+ dataPath: loadUrl,
20952
+ renderLib: Cesium,
20953
+ canvas: viewer.canvas,
20954
+ useEnv: false,
20955
+ modelMatrix: m1,
20956
+ useIndexDB: false,
20957
+ appKey: null
20958
+ });
20959
+ }
20960
+ XGridsRenderEngine.Render = Render;
20961
+ function Remove(viewer, renderObject) {
20962
+ if (!renderObject) {
20963
+ return;
20964
+ }
20965
+ if (!LCCRender) {
20966
+ console.warn("[XGridsRenderEngine] Remove() LCCRender library not available.");
20967
+ return;
20968
+ }
20969
+ }
20970
+ XGridsRenderEngine.Remove = Remove;
20971
+ })(exports.XGridsRenderEngine || (exports.XGridsRenderEngine = {}));
20972
+
20764
20973
  async function getLegacyTileset(params) {
20765
20974
  const { apiGetter, menuItem, tileset } = params;
20766
20975
  try {
@@ -20794,6 +21003,12 @@
20794
21003
  }
20795
21004
  }
20796
21005
  (function (TilesetArbRenderManager) {
21006
+ let ERenderType;
21007
+ (function (ERenderType) {
21008
+ ERenderType["CesiumTileset"] = "CesiumTileset";
21009
+ ERenderType["XGridsLCC"] = "XGridsLCC";
21010
+ ERenderType["Unknown"] = "Unknown";
21011
+ })(ERenderType = TilesetArbRenderManager.ERenderType || (TilesetArbRenderManager.ERenderType = {}));
20797
21012
  class Manager {
20798
21013
  get Disposed() {
20799
21014
  return this.disposed;
@@ -20804,6 +21019,12 @@
20804
21019
  get Styler() {
20805
21020
  return this.styler;
20806
21021
  }
21022
+ get RenderType() {
21023
+ return this.renderType;
21024
+ }
21025
+ get RenderTypeChanged() {
21026
+ return this.renderTypeChanged;
21027
+ }
20807
21028
  constructor(params) {
20808
21029
  this.disposed = false;
20809
21030
  this.cTileset = null;
@@ -20827,6 +21048,11 @@
20827
21048
  // Saves having to do a case-insensitive lookup every time.
20828
21049
  this.featurePropCache = new Map();
20829
21050
  this.featurePropsChecked = 0;
21051
+ // How we're rendering the data.
21052
+ this.renderType = ERenderType.Unknown;
21053
+ this.renderTypeChanged = new BModels.BruceEvent();
21054
+ // LCC object if we're using XGrids to render LCC data.
21055
+ this.lccObject = null;
20830
21056
  this.viewer = params.viewer;
20831
21057
  this.getters = params.getters;
20832
21058
  this.visualsManager = params.register;
@@ -20872,7 +21098,7 @@
20872
21098
  }
20873
21099
  const tilesetId = (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID;
20874
21100
  (async () => {
20875
- var _a, _b, _c, _d, _e, _f, _g;
21101
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
20876
21102
  if (tilesetId) {
20877
21103
  let canAccess = false;
20878
21104
  try {
@@ -20911,113 +21137,137 @@
20911
21137
  if (tileset && loadUrlOverride) {
20912
21138
  tileset.loadUrl = loadUrlOverride;
20913
21139
  }
20914
- const LEGACY_TYPES = [
20915
- BModels.Tileset.EType.LegacyEntitiesSet,
20916
- BModels.Tileset.EType.LegacyExternal,
20917
- BModels.Tileset.EType.LegacyStatic
20918
- ];
20919
- if (!type || LEGACY_TYPES.includes(type)) {
20920
- // Legacy type. We re-request using ui.tileset endpoint.
20921
- const legacyTileset = tileset ? await getLegacyTileset({
20922
- apiGetter: this.getters.GetBruceGetter(),
20923
- menuItem: this.item,
20924
- tileset
20925
- }) : null;
20926
- if (this.disposed) {
20927
- return;
20928
- }
20929
- let accountId = (_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID;
20930
- if (!accountId) {
20931
- accountId = this.getters.GetAccountId();
20932
- }
20933
- this.cTileset = await exports.TilesetRenderEngine.RenderLegacy({
20934
- apiGetter: this.getters.GetBruceGetter(),
20935
- tileset: legacyTileset,
20936
- viewer: this.viewer,
20937
- ionId: (_d = this.item.IonResource) === null || _d === void 0 ? void 0 : _d.AssetID,
20938
- ionAccessToken: (_e = this.item.IonResource) === null || _e === void 0 ? void 0 : _e.AccessToken,
20939
- loadUrl: loadUrlOverride,
20940
- accountId: accountId,
20941
- viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled),
20942
- noMemoryLimit: this.item.noMaximumMemory,
20943
- backFaceCulling: this.item.backFaceCulling
21140
+ // LCC Tileset to load through XGrids libs if they're available.
21141
+ if (tileset.type === BModels.Tileset.EType.LegacyStatic && tileset.rootFileName && (tileset.rootFileName.toLowerCase()).endsWith(".lcc")) {
21142
+ this.renderType = ERenderType.XGridsLCC;
21143
+ this.renderTypeChanged.Trigger(this.renderType);
21144
+ const api = this.getters.GetBruceApi({
21145
+ accountId: ((_c = (_b = this.item) === null || _b === void 0 ? void 0 : _b.tileset) === null || _c === void 0 ? void 0 : _c.ClientAccountID) || this.getters.GetAccountId()
20944
21146
  });
20945
- }
20946
- else if (tileset) {
20947
- this.cTileset = await exports.TilesetRenderEngine.Render({
20948
- apiGetter: this.getters.GetBruceGetter(),
20949
- tileset: tileset,
21147
+ this.lccObject = exports.XGridsRenderEngine.Render({
21148
+ api: api,
20950
21149
  viewer: this.viewer,
20951
- coords: null,
20952
- accountId: (_g = (_f = this.item.tileset) === null || _f === void 0 ? void 0 : _f.ClientAccountID) !== null && _g !== void 0 ? _g : this.getters.GetAccountId(),
20953
- viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled)
21150
+ tileset: tileset
20954
21151
  });
20955
- }
20956
- if (this.disposed) {
20957
- this.doDispose();
20958
- return;
20959
- }
20960
- this.viewer.scene.requestRender();
20961
- exports.TilesetRenderEngine.OnTilesetReady(this.cTileset).then(() => {
20962
- if (this.disposed || this.viewer.isDestroyed()) {
21152
+ // Disposed while it was loading so we'll remove it now.
21153
+ if (this.Disposed && this.lccObject) {
21154
+ exports.XGridsRenderEngine.Remove(this.viewer, this.lccObject);
21155
+ this.lccObject = null;
20963
21156
  return;
20964
21157
  }
20965
- // Colour mask to apply to the Tileset as a whole.
20966
- // Individual Entities can override this.
20967
- // This is typically used for Tilesets without Entities to allow some sort of basic styling per-bookmark.
20968
- try {
20969
- const colorCss = this.item.colorMask;
20970
- if (colorCss) {
20971
- this.cTileset.style = new Cesium.Cesium3DTileStyle({
20972
- color: {
20973
- conditions: [
20974
- ["true", `color("${colorCss}")`]
20975
- ]
20976
- }
20977
- });
21158
+ }
21159
+ // Typical Cesium Tileset.
21160
+ else {
21161
+ this.renderType = ERenderType.CesiumTileset;
21162
+ this.renderTypeChanged.Trigger(this.renderType);
21163
+ const LEGACY_TYPES = [
21164
+ BModels.Tileset.EType.LegacyEntitiesSet,
21165
+ BModels.Tileset.EType.LegacyExternal,
21166
+ BModels.Tileset.EType.LegacyStatic
21167
+ ];
21168
+ if (!type || LEGACY_TYPES.includes(type)) {
21169
+ // Legacy type. We re-request using ui.tileset endpoint.
21170
+ const legacyTileset = tileset ? await getLegacyTileset({
21171
+ apiGetter: this.getters.GetBruceGetter(),
21172
+ menuItem: this.item,
21173
+ tileset
21174
+ }) : null;
21175
+ if (this.disposed) {
21176
+ return;
20978
21177
  }
20979
- }
20980
- catch (e) {
20981
- console.error(e);
20982
- }
20983
- try {
20984
- if (this.item.ApplyStyles ||
20985
- this.item.Type == BModels.MenuItem.EType.IonTileset) {
20986
- const api = this.getters.GetBruceApi();
20987
- this.styler.Init({
20988
- viewer: this.viewer,
20989
- api: api,
20990
- cTileset: this.cTileset,
20991
- fallbackStyleId: this.item.styleId,
20992
- styleMapping: this.item.StyleMapping,
20993
- expandSources: false,
20994
- menuItemId: this.item.id,
20995
- register: this.visualsManager,
20996
- });
21178
+ let accountId = (_e = (_d = this.item) === null || _d === void 0 ? void 0 : _d.tileset) === null || _e === void 0 ? void 0 : _e.ClientAccountID;
21179
+ if (!accountId) {
21180
+ accountId = this.getters.GetAccountId();
20997
21181
  }
20998
- this.onCTilesetLoad();
20999
- this.viewer.scene.requestRender();
21000
- }
21001
- catch (e) {
21002
- console.error(e);
21003
- }
21004
- });
21005
- this.cTileset.tileLoad.addEventListener((tile) => {
21006
- try {
21007
- this.queueTile(tile, true);
21008
- }
21009
- catch (e) {
21010
- console.error(e);
21182
+ this.cTileset = await exports.TilesetRenderEngine.RenderLegacy({
21183
+ apiGetter: this.getters.GetBruceGetter(),
21184
+ tileset: legacyTileset,
21185
+ viewer: this.viewer,
21186
+ ionId: (_f = this.item.IonResource) === null || _f === void 0 ? void 0 : _f.AssetID,
21187
+ ionAccessToken: (_g = this.item.IonResource) === null || _g === void 0 ? void 0 : _g.AccessToken,
21188
+ loadUrl: loadUrlOverride,
21189
+ accountId: accountId,
21190
+ viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled),
21191
+ noMemoryLimit: this.item.noMaximumMemory,
21192
+ backFaceCulling: this.item.backFaceCulling
21193
+ });
21011
21194
  }
21012
- });
21013
- this.cTileset.tileUnload.addEventListener((tile) => {
21014
- try {
21015
- this.queueTile(tile, false);
21195
+ else if (tileset) {
21196
+ this.cTileset = await exports.TilesetRenderEngine.Render({
21197
+ apiGetter: this.getters.GetBruceGetter(),
21198
+ tileset: tileset,
21199
+ viewer: this.viewer,
21200
+ coords: null,
21201
+ accountId: (_j = (_h = this.item.tileset) === null || _h === void 0 ? void 0 : _h.ClientAccountID) !== null && _j !== void 0 ? _j : this.getters.GetAccountId(),
21202
+ viaCdn: this.item.cdnEnabled == null ? true : Boolean(this.item.cdnEnabled)
21203
+ });
21016
21204
  }
21017
- catch (e) {
21018
- console.error(e);
21205
+ if (this.disposed) {
21206
+ this.doDispose();
21207
+ return;
21019
21208
  }
21020
- });
21209
+ this.viewer.scene.requestRender();
21210
+ exports.TilesetRenderEngine.OnTilesetReady(this.cTileset).then(() => {
21211
+ if (this.disposed || this.viewer.isDestroyed()) {
21212
+ return;
21213
+ }
21214
+ // Colour mask to apply to the Tileset as a whole.
21215
+ // Individual Entities can override this.
21216
+ // This is typically used for Tilesets without Entities to allow some sort of basic styling per-bookmark.
21217
+ try {
21218
+ const colorCss = this.item.colorMask;
21219
+ if (colorCss) {
21220
+ this.cTileset.style = new Cesium.Cesium3DTileStyle({
21221
+ color: {
21222
+ conditions: [
21223
+ ["true", `color("${colorCss}")`]
21224
+ ]
21225
+ }
21226
+ });
21227
+ }
21228
+ }
21229
+ catch (e) {
21230
+ console.error(e);
21231
+ }
21232
+ try {
21233
+ if (this.item.ApplyStyles ||
21234
+ this.item.Type == BModels.MenuItem.EType.IonTileset) {
21235
+ const api = this.getters.GetBruceApi();
21236
+ this.styler.Init({
21237
+ viewer: this.viewer,
21238
+ api: api,
21239
+ cTileset: this.cTileset,
21240
+ fallbackStyleId: this.item.styleId,
21241
+ styleMapping: this.item.StyleMapping,
21242
+ expandSources: false,
21243
+ menuItemId: this.item.id,
21244
+ register: this.visualsManager,
21245
+ });
21246
+ }
21247
+ this.onCTilesetLoad();
21248
+ this.viewer.scene.requestRender();
21249
+ }
21250
+ catch (e) {
21251
+ console.error(e);
21252
+ }
21253
+ });
21254
+ this.cTileset.tileLoad.addEventListener((tile) => {
21255
+ try {
21256
+ this.queueTile(tile, true);
21257
+ }
21258
+ catch (e) {
21259
+ console.error(e);
21260
+ }
21261
+ });
21262
+ this.cTileset.tileUnload.addEventListener((tile) => {
21263
+ try {
21264
+ this.queueTile(tile, false);
21265
+ }
21266
+ catch (e) {
21267
+ console.error(e);
21268
+ }
21269
+ });
21270
+ }
21021
21271
  })();
21022
21272
  }
21023
21273
  /**
@@ -21161,6 +21411,10 @@
21161
21411
  }
21162
21412
  this.cTileset = null;
21163
21413
  }
21414
+ if (this.lccObject) {
21415
+ exports.XGridsRenderEngine.Remove(this.viewer, this.lccObject);
21416
+ this.lccObject = null;
21417
+ }
21164
21418
  (_b = this.styler) === null || _b === void 0 ? void 0 : _b.Dispose();
21165
21419
  this.visualsManager.RemoveRegos({
21166
21420
  menuItemId: this.item.id
@@ -34217,7 +34471,7 @@
34217
34471
  }
34218
34472
  }
34219
34473
 
34220
- const VERSION = "6.2.1";
34474
+ const VERSION = "6.2.3";
34221
34475
 
34222
34476
  exports.VERSION = VERSION;
34223
34477
  exports.isOutlineChanged = isOutlineChanged;