bruce-cesium 6.7.6 → 6.7.7

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.
@@ -19115,7 +19115,7 @@
19115
19115
  this.item = params.item;
19116
19116
  }
19117
19117
  (async () => {
19118
- var _a;
19118
+ var _a, _b, _c;
19119
19119
  // If the tileset already exists then we just need to update the style.
19120
19120
  if (this.cTileset) {
19121
19121
  const colorCss = this.item.colorMask;
@@ -19142,16 +19142,44 @@
19142
19142
  console.warn("Cesium version does not support 'createGooglePhotorealistic3DTileset' so Google Photos tileset will not be rendered.");
19143
19143
  return;
19144
19144
  }
19145
+ // Proxy path: key injected server-side.
19145
19146
  if (api.IsVersionAtLeast(BModels.BruceApi.VERSION_WITH_PROXIES)) {
19146
- // Proxy path: key injected server-side.
19147
- const proxyRootUrl = api.GetBaseUrl() + "proxy/google-tiles/v1/3dtiles/root.json";
19147
+ // If we have a Google token we'll proxy through that.
19148
+ // Otherwise use Cesium Ion to load as a resource.
19149
+ const { programKeys } = await BModels.ProgramKey.GetList({
19150
+ api: this.getters.GetBruceApi()
19151
+ });
19152
+ const hasGoogleToken = Boolean((_a = programKeys.find(x => x.ProgramId === BModels.ProgramKey.EProgramId.GooglePhotogrammetry)) === null || _a === void 0 ? void 0 : _a.Available);
19153
+ // Must have own iot token, this ensures we don't use our template one for loading customer photogrammetry.
19154
+ const hasIonToken = Boolean((_b = programKeys.find(x => x.ProgramId === BModels.ProgramKey.EProgramId.CesiumIon)) === null || _b === void 0 ? void 0 : _b.Available);
19148
19155
  if (this.disposed) {
19149
19156
  this.doDispose();
19150
19157
  return;
19151
19158
  }
19152
- this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
19153
- showCreditsOnScreen: true
19154
- });
19159
+ // WARNING: we are routing through ion first right now as it is faster.
19160
+ // Should be a user-decision and we should improve our google proxying.
19161
+ if (hasIonToken && Cesium.Ion.defaultServer) {
19162
+ const loadUrl = await Cesium.IonResource.fromAssetId(2275207, undefined);
19163
+ if (this.disposed) {
19164
+ this.doDispose();
19165
+ return;
19166
+ }
19167
+ this.cTileset = await createTileset(loadUrl, {}, true);
19168
+ }
19169
+ else if (hasGoogleToken) {
19170
+ const proxyRootUrl = api.GetBaseUrl() + "proxy/google-tiles/v1/3dtiles/root.json";
19171
+ if (this.disposed) {
19172
+ this.doDispose();
19173
+ return;
19174
+ }
19175
+ this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
19176
+ showCreditsOnScreen: true
19177
+ });
19178
+ }
19179
+ else {
19180
+ console.warn("No Google or Cesium Ion token available, so Google Photos tileset will not be rendered.");
19181
+ return;
19182
+ }
19155
19183
  }
19156
19184
  // Legacy path: fetch real Google key and use createGooglePhotorealistic3DTileset().
19157
19185
  // Kill of whenever all API instances are migrated.
@@ -19179,7 +19207,7 @@
19179
19207
  this.doDispose();
19180
19208
  return;
19181
19209
  }
19182
- this.cTileset = await ((_a = CESIUM.createGooglePhotorealistic3DTileset) === null || _a === void 0 ? void 0 : _a.call(CESIUM));
19210
+ this.cTileset = await ((_c = CESIUM.createGooglePhotorealistic3DTileset) === null || _c === void 0 ? void 0 : _c.call(CESIUM));
19183
19211
  }
19184
19212
  if (this.disposed) {
19185
19213
  this.doDispose();
@@ -36354,7 +36382,7 @@
36354
36382
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
36355
36383
  })(exports.StyleUtils || (exports.StyleUtils = {}));
36356
36384
 
36357
- const VERSION = "6.7.6";
36385
+ const VERSION = "6.7.7";
36358
36386
  /**
36359
36387
  * Updates the environment instance used by bruce-cesium to one specified.
36360
36388
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -36376,6 +36404,7 @@
36376
36404
  exports.getENVIRONMENT = getENVIRONMENT;
36377
36405
  exports.isOutlineChanged = isOutlineChanged$1;
36378
36406
  exports.CesiumParabola = CesiumParabola;
36407
+ exports.createTileset = createTileset;
36379
36408
  exports.CESIUM_INSPECTOR_KEY = CESIUM_INSPECTOR_KEY;
36380
36409
  exports.CESIUM_TIMELINE_KEY = CESIUM_TIMELINE_KEY;
36381
36410
  exports.CESIUM_TIMELINE_LIVE_KEY = CESIUM_TIMELINE_LIVE_KEY;