bruce-cesium 6.4.9 → 6.5.0

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,6 +1,6 @@
1
1
  import { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, EntityCoords, DataLab, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Bounds, Carto, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- 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';
3
+ 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, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -12282,7 +12282,7 @@ var TilesetRenderEngine;
12282
12282
  const api = apiGetter.getApi(accountId);
12283
12283
  await api.Loading;
12284
12284
  loadUrl = Tileset.GetFileUrl({
12285
- file: "tileset.json",
12285
+ file: (tileset === null || tileset === void 0 ? void 0 : tileset.rootFileName) ? tileset === null || tileset === void 0 ? void 0 : tileset.rootFileName : (tileset === null || tileset === void 0 ? void 0 : tileset.RootFileName) ? tileset === null || tileset === void 0 ? void 0 : tileset.RootFileName : "tileset.json",
12286
12286
  tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
12287
12287
  viaCdn: false,
12288
12288
  legacy: true,
@@ -12294,15 +12294,8 @@ var TilesetRenderEngine;
12294
12294
  const api = apiGetter.getApi(accountId);
12295
12295
  await api.Loading;
12296
12296
  if (api.GetCdnBaseUrl()) {
12297
- /*
12298
- const rootFile = tileset.RootFileName ? tileset.RootFileName : "tileset.json";
12299
- loadUrl = api.LegacyTilesetCdnUrl
12300
- .replace("<TILESETID>", tileset.ID)
12301
- .replace("<FILEPATH>", rootFile)
12302
- .replace("<ACCOUNT>", accountId);
12303
- */
12304
12297
  loadUrl = Tileset.GetFileUrl({
12305
- file: "tileset.json",
12298
+ file: (tileset === null || tileset === void 0 ? void 0 : tileset.rootFileName) ? tileset === null || tileset === void 0 ? void 0 : tileset.rootFileName : (tileset === null || tileset === void 0 ? void 0 : tileset.RootFileName) ? tileset === null || tileset === void 0 ? void 0 : tileset.RootFileName : "tileset.json",
12306
12299
  tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
12307
12300
  viaCdn: true,
12308
12301
  legacy: true,
@@ -16278,7 +16271,8 @@ var XGridsRenderEngine;
16278
16271
  // When true it makes the new pieces fade-in.
16279
16272
  // The look is similar to sectioning in cesium. Might be a nice setting.
16280
16273
  useLoadingEffect: false
16281
- }, () => {
16274
+ }, async () => {
16275
+ var _a, _b;
16282
16276
  // Array index is the LOD level, ie: index 0 = LOD 0.
16283
16277
  const lods = obj.getLodInfos();
16284
16278
  //console.log("xgrids-getLodInfos()", lods);
@@ -16289,6 +16283,25 @@ var XGridsRenderEngine;
16289
16283
  if (maxSplats >= HARD_MAX) {
16290
16284
  console.warn("Reduced splat quality due to the number of splats being too large. Was: \"" + maxSplats + "\", now is: \"" + HARD_MAX + "\".");
16291
16285
  }
16286
+ // Auto fly to.
16287
+ if (params.flyTo) {
16288
+ const pos3d = (_b = (_a = obj === null || obj === void 0 ? void 0 : obj.getBounds) === null || _a === void 0 ? void 0 : _a.call(obj)) === null || _b === void 0 ? void 0 : _b.origin;
16289
+ if (pos3d && Cartes.ValidateCartes3(pos3d)) {
16290
+ const altered = await DrawingUtils.RaisePos3d(viewer, pos3d, 300);
16291
+ if (altered && Cartes.ValidateCartes3(altered)) {
16292
+ viewer.scene.camera.flyTo({
16293
+ destination: altered,
16294
+ orientation: {
16295
+ heading: Math$1.toRadians(0.0),
16296
+ pitch: Math$1.toRadians(-90.0),
16297
+ roll: Math$1.toRadians(0.0)
16298
+ },
16299
+ duration: 0
16300
+ });
16301
+ return;
16302
+ }
16303
+ }
16304
+ }
16292
16305
  });
16293
16306
  // Highest LOD.
16294
16307
  obj.setStartLod(0);
@@ -16492,7 +16505,8 @@ var TilesetArbRenderManager;
16492
16505
  this.lccObject = XGridsRenderEngine.Render({
16493
16506
  api: api,
16494
16507
  viewer: this.viewer,
16495
- tileset: tileset
16508
+ tileset: tileset,
16509
+ flyTo: this.item.FlyTo
16496
16510
  });
16497
16511
  // Disposed while it was loading so we'll remove it now.
16498
16512
  if (this.Disposed && this.lccObject) {
@@ -16728,7 +16742,7 @@ var TilesetArbRenderManager;
16728
16742
  }
16729
16743
  }
16730
16744
  onCTilesetLoad() {
16731
- if (this.item.FlyTo) {
16745
+ if (this.item.FlyTo && this.cTileset) {
16732
16746
  this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
16733
16747
  }
16734
16748
  }
@@ -35281,7 +35295,7 @@ class WidgetViewBar extends Widget.AWidget {
35281
35295
  }
35282
35296
  }
35283
35297
 
35284
- const VERSION = "6.4.9";
35298
+ const VERSION = "6.5.0";
35285
35299
  /**
35286
35300
  * Updates the environment instance used by bruce-cesium to one specified.
35287
35301
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.