bruce-cesium 6.7.6 → 6.7.8

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,5 +1,5 @@
1
1
  import * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
3
3
  import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Bounds, Geometry, Carto, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
@@ -13981,11 +13981,16 @@ var TilesetCadRenderManager;
13981
13981
  cacheToken: tileset.generateVersion,
13982
13982
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
13983
13983
  });
13984
- api.get(modelTreeUrl).then((blob) => {
13984
+ api.get(modelTreeUrl).then(async (result) => {
13985
13985
  if (this.disposed) {
13986
13986
  return;
13987
13987
  }
13988
- this.modelTree = blob || null;
13988
+ // S3 signed URLs may return application/octet-stream instead of application/json,
13989
+ // causing the API to return a Blob rather than a parsed object.
13990
+ if (result instanceof Blob) {
13991
+ result = JSON.parse(await result.text());
13992
+ }
13993
+ this.modelTree = result || null;
13989
13994
  this.modelTreeUpdate.Trigger(this.modelTree);
13990
13995
  }).catch((err) => {
13991
13996
  this.modelTreeError = err.message || "Unknown error";
@@ -13993,12 +13998,15 @@ var TilesetCadRenderManager;
13993
13998
  }
13994
13999
  // In v1 the model-tree is inside the tileset.json.
13995
14000
  else {
13996
- api.get(tileset.loadUrl).then((blob) => {
14001
+ api.get(tileset.loadUrl).then(async (result) => {
13997
14002
  var _a;
13998
14003
  if (this.disposed) {
13999
14004
  return;
14000
14005
  }
14001
- this.modelTree = ((_a = blob === null || blob === void 0 ? void 0 : blob.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
14006
+ if (result instanceof Blob) {
14007
+ result = JSON.parse(await result.text());
14008
+ }
14009
+ this.modelTree = ((_a = result === null || result === void 0 ? void 0 : result.extensions) === null || _a === void 0 ? void 0 : _a.modelTree) || null;
14002
14010
  this.modelTreeUpdate.Trigger(this.modelTree);
14003
14011
  }).catch((err) => {
14004
14012
  this.modelTreeError = err.message || "Unknown error";
@@ -15827,10 +15835,14 @@ var EntityFilterGetter;
15827
15835
  }
15828
15836
  // API gave us a URL to use.
15829
15837
  else if (curCell.FetchURL) {
15830
- const tmpResponse = await this.api.get(curCell.FetchURL, {
15838
+ let tmpResponse = await this.api.get(curCell.FetchURL, {
15831
15839
  abortSignal: abortController.signal,
15832
15840
  noCache: true
15833
15841
  });
15842
+ // S3 signed URLs may return application/octet-stream, causing a Blob result.
15843
+ if (tmpResponse instanceof Blob) {
15844
+ tmpResponse = JSON.parse(await tmpResponse.text());
15845
+ }
15834
15846
  // Same mapping as bruce-models doing Entity.GetList.
15835
15847
  response = {
15836
15848
  entities: tmpResponse.Items ? tmpResponse.Items : [],
@@ -19134,7 +19146,7 @@ var RelationsRenderManager;
19134
19146
  })(RelationsRenderManager || (RelationsRenderManager = {}));
19135
19147
 
19136
19148
  var TilesetGooglePhotosRenderManager;
19137
- (function (TilesetGooglePhotosRenderManager) {
19149
+ (function (TilesetGooglePhotosRenderManager$$1) {
19138
19150
  class Manager {
19139
19151
  get Disposed() {
19140
19152
  return this.disposed;
@@ -19176,7 +19188,7 @@ var TilesetGooglePhotosRenderManager;
19176
19188
  this.item = params.item;
19177
19189
  }
19178
19190
  (async () => {
19179
- var _a;
19191
+ var _a, _b, _c;
19180
19192
  // If the tileset already exists then we just need to update the style.
19181
19193
  if (this.cTileset) {
19182
19194
  const colorCss = this.item.colorMask;
@@ -19203,16 +19215,44 @@ var TilesetGooglePhotosRenderManager;
19203
19215
  console.warn("Cesium version does not support 'createGooglePhotorealistic3DTileset' so Google Photos tileset will not be rendered.");
19204
19216
  return;
19205
19217
  }
19218
+ // Proxy path: key injected server-side.
19206
19219
  if (api.IsVersionAtLeast(BruceApi.VERSION_WITH_PROXIES)) {
19207
- // Proxy path: key injected server-side.
19208
- const proxyRootUrl = api.GetBaseUrl() + "proxy/google-tiles/v1/3dtiles/root.json";
19220
+ // If we have a Google token we'll proxy through that.
19221
+ // Otherwise use Cesium Ion to load as a resource.
19222
+ const { programKeys } = await ProgramKey.GetList({
19223
+ api: this.getters.GetBruceApi()
19224
+ });
19225
+ const hasGoogleToken = Boolean((_a = programKeys.find(x => x.ProgramId === ProgramKey.EProgramId.GooglePhotogrammetry)) === null || _a === void 0 ? void 0 : _a.Available);
19226
+ // Must have own iot token, this ensures we don't use our template one for loading customer photogrammetry.
19227
+ const hasIonToken = Boolean((_b = programKeys.find(x => x.ProgramId === ProgramKey.EProgramId.CesiumIon)) === null || _b === void 0 ? void 0 : _b.Available);
19209
19228
  if (this.disposed) {
19210
19229
  this.doDispose();
19211
19230
  return;
19212
19231
  }
19213
- this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
19214
- showCreditsOnScreen: true
19215
- });
19232
+ // WARNING: we are routing through ion first right now as it is faster.
19233
+ // Should be a user-decision and we should improve our google proxying.
19234
+ if (hasIonToken && Ion.defaultServer) {
19235
+ const loadUrl = await IonResource.fromAssetId(2275207, undefined);
19236
+ if (this.disposed) {
19237
+ this.doDispose();
19238
+ return;
19239
+ }
19240
+ this.cTileset = await createTileset(loadUrl, {}, true);
19241
+ }
19242
+ else if (hasGoogleToken) {
19243
+ const proxyRootUrl = api.GetBaseUrl() + "proxy/google-tiles/v1/3dtiles/root.json";
19244
+ if (this.disposed) {
19245
+ this.doDispose();
19246
+ return;
19247
+ }
19248
+ this.cTileset = await CESIUM.Cesium3DTileset.fromUrl(proxyRootUrl, {
19249
+ showCreditsOnScreen: true
19250
+ });
19251
+ }
19252
+ else {
19253
+ console.warn("No Google or Cesium Ion token available, so Google Photos tileset will not be rendered.");
19254
+ return;
19255
+ }
19216
19256
  }
19217
19257
  // Legacy path: fetch real Google key and use createGooglePhotorealistic3DTileset().
19218
19258
  // Kill of whenever all API instances are migrated.
@@ -19240,7 +19280,7 @@ var TilesetGooglePhotosRenderManager;
19240
19280
  this.doDispose();
19241
19281
  return;
19242
19282
  }
19243
- this.cTileset = await ((_a = CESIUM.createGooglePhotorealistic3DTileset) === null || _a === void 0 ? void 0 : _a.call(CESIUM));
19283
+ this.cTileset = await ((_c = CESIUM.createGooglePhotorealistic3DTileset) === null || _c === void 0 ? void 0 : _c.call(CESIUM));
19244
19284
  }
19245
19285
  if (this.disposed) {
19246
19286
  this.doDispose();
@@ -19268,7 +19308,7 @@ var TilesetGooglePhotosRenderManager;
19268
19308
  async ReRender(params) {
19269
19309
  }
19270
19310
  }
19271
- TilesetGooglePhotosRenderManager.Manager = Manager;
19311
+ TilesetGooglePhotosRenderManager$$1.Manager = Manager;
19272
19312
  })(TilesetGooglePhotosRenderManager || (TilesetGooglePhotosRenderManager = {}));
19273
19313
 
19274
19314
  /**
@@ -36476,7 +36516,7 @@ var StyleUtils;
36476
36516
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
36477
36517
  })(StyleUtils || (StyleUtils = {}));
36478
36518
 
36479
- const VERSION = "6.7.6";
36519
+ const VERSION = "6.7.8";
36480
36520
  /**
36481
36521
  * Updates the environment instance used by bruce-cesium to one specified.
36482
36522
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.
@@ -36493,5 +36533,5 @@ const getENVIRONMENT = () => {
36493
36533
  return ENVIRONMENT;
36494
36534
  };
36495
36535
 
36496
- export { VERSION, setENVIRONMENT, getENVIRONMENT, CesiumAnimatedInOut, CesiumAnimatedProperty, isOutlineChanged$1 as isOutlineChanged, StyleEffective, EntityRenderEngine, EntityRenderEngineModel3d, EntityRenderEnginePoint, EntityRenderEnginePolygon, EntityRenderEnginePolyline, MenuItemCreator, MenuItemManager, CesiumParabola, EntityLabel, LiveCursor, SharedGetters, DataSourceStaticKmlManager, DataLabRenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, AssemblyRenderManager, GoogleSearchRenderManager, RelationsRenderManager, RenderManager, TilesetArbRenderManager, TilesetCadRenderManager, TilesetEntitiesRenderManager, TilesetGooglePhotosRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TileRenderEngine, TilesetRenderEngine, ViewRenderEngine, VisualsRegister, XGridsRenderEngine, CesiumEntityStyler, DrawingUtils, EntityUtils, MeasureUtils, StyleUtils, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, CesiumViewMonitor, ViewGroundArea, ViewerEventTracker, ViewerUtils, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, WidgetControlViewBar, WidgetControlViewBarSearch, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar };
36536
+ export { VERSION, setENVIRONMENT, getENVIRONMENT, CesiumAnimatedInOut, CesiumAnimatedProperty, isOutlineChanged$1 as isOutlineChanged, StyleEffective, EntityRenderEngine, EntityRenderEngineModel3d, EntityRenderEnginePoint, EntityRenderEnginePolygon, EntityRenderEnginePolyline, MenuItemCreator, MenuItemManager, CesiumParabola, EntityLabel, LiveCursor, SharedGetters, DataSourceStaticKmlManager, DataLabRenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, AssemblyRenderManager, GoogleSearchRenderManager, RelationsRenderManager, RenderManager, TilesetArbRenderManager, TilesetCadRenderManager, TilesetEntitiesRenderManager, TilesetGooglePhotosRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TileRenderEngine, createTileset, TilesetRenderEngine, ViewRenderEngine, VisualsRegister, XGridsRenderEngine, CesiumEntityStyler, DrawingUtils, EntityUtils, MeasureUtils, StyleUtils, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, CESIUM_MODEL_SPACE_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, CesiumViewMonitor, ViewGroundArea, ViewerEventTracker, ViewerUtils, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, WidgetControlViewBar, WidgetControlViewBarSearch, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar };
36497
36537
  //# sourceMappingURL=bruce-cesium.es5.js.map