bruce-cesium 6.4.9 → 6.5.1

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
- 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';
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, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils } 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, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, JulianDate, Quaternion, Matrix4, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileset, IonResource, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, BoundingSphere, GeometryInstance, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -8582,7 +8582,7 @@ var EntitiesRenderManager;
8582
8582
  this.sources = [];
8583
8583
  }
8584
8584
  async ReRender(params) {
8585
- var _a, _b, _c, _d;
8585
+ var _a, _b, _c, _d, _e;
8586
8586
  let { entityIds, force, entities, maintain } = params;
8587
8587
  if (entities && !entityIds) {
8588
8588
  entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
@@ -8635,9 +8635,10 @@ var EntitiesRenderManager;
8635
8635
  const data = await Entity$1.GetListByIds({
8636
8636
  api: this.apiGetter.getApi(),
8637
8637
  entityIds: apiIds,
8638
- historicKey: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historicAttrKey,
8638
+ entityTypeId: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
8639
+ historicKey: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.historicAttrKey,
8639
8640
  historicPoint: this.viewer.clock.currentTime.toString(),
8640
- schemaId: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.schemaId,
8641
+ schemaId: (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.schemaId,
8641
8642
  expandSources: true,
8642
8643
  scenario: this.scenario,
8643
8644
  migrated: true,
@@ -8731,7 +8732,7 @@ var EntitiesRenderManager;
8731
8732
  return !maintainedLookup[id] && !this.reRenderState.shouldSkipInRun(id, runId);
8732
8733
  });
8733
8734
  const checkBatch = async () => {
8734
- var _a, _b;
8735
+ var _a, _b, _c;
8735
8736
  apiIds = this.reRenderState.filterNonSkippedIds(apiIds, runId);
8736
8737
  const entityIds = apiIds.splice(0, CHECK_BATCH_SIZE);
8737
8738
  if (!entityIds.length) {
@@ -8741,9 +8742,10 @@ var EntitiesRenderManager;
8741
8742
  const { entities } = await Entity$1.GetListByIds({
8742
8743
  api,
8743
8744
  entityIds,
8744
- historicKey: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey,
8745
+ entityTypeId: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"],
8746
+ historicKey: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historicAttrKey,
8745
8747
  historicPoint: this.viewer.clock.currentTime.toString(),
8746
- schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId,
8748
+ schemaId: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.schemaId,
8747
8749
  scenario: this.scenario,
8748
8750
  expandSources: true,
8749
8751
  migrated: true,
@@ -12282,7 +12284,7 @@ var TilesetRenderEngine;
12282
12284
  const api = apiGetter.getApi(accountId);
12283
12285
  await api.Loading;
12284
12286
  loadUrl = Tileset.GetFileUrl({
12285
- file: "tileset.json",
12287
+ 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
12288
  tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
12287
12289
  viaCdn: false,
12288
12290
  legacy: true,
@@ -12294,15 +12296,8 @@ var TilesetRenderEngine;
12294
12296
  const api = apiGetter.getApi(accountId);
12295
12297
  await api.Loading;
12296
12298
  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
12299
  loadUrl = Tileset.GetFileUrl({
12305
- file: "tileset.json",
12300
+ 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
12301
  tilesetId: (tileset === null || tileset === void 0 ? void 0 : tileset.ID) ? tileset.ID : params.tileset.id,
12307
12302
  viaCdn: true,
12308
12303
  legacy: true,
@@ -16278,7 +16273,8 @@ var XGridsRenderEngine;
16278
16273
  // When true it makes the new pieces fade-in.
16279
16274
  // The look is similar to sectioning in cesium. Might be a nice setting.
16280
16275
  useLoadingEffect: false
16281
- }, () => {
16276
+ }, async () => {
16277
+ var _a, _b;
16282
16278
  // Array index is the LOD level, ie: index 0 = LOD 0.
16283
16279
  const lods = obj.getLodInfos();
16284
16280
  //console.log("xgrids-getLodInfos()", lods);
@@ -16289,6 +16285,25 @@ var XGridsRenderEngine;
16289
16285
  if (maxSplats >= HARD_MAX) {
16290
16286
  console.warn("Reduced splat quality due to the number of splats being too large. Was: \"" + maxSplats + "\", now is: \"" + HARD_MAX + "\".");
16291
16287
  }
16288
+ // Auto fly to.
16289
+ if (params.flyTo) {
16290
+ 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;
16291
+ if (pos3d && Cartes.ValidateCartes3(pos3d)) {
16292
+ const altered = await DrawingUtils.RaisePos3d(viewer, pos3d, 300);
16293
+ if (altered && Cartes.ValidateCartes3(altered)) {
16294
+ viewer.scene.camera.flyTo({
16295
+ destination: altered,
16296
+ orientation: {
16297
+ heading: Math$1.toRadians(0.0),
16298
+ pitch: Math$1.toRadians(-90.0),
16299
+ roll: Math$1.toRadians(0.0)
16300
+ },
16301
+ duration: 0
16302
+ });
16303
+ return;
16304
+ }
16305
+ }
16306
+ }
16292
16307
  });
16293
16308
  // Highest LOD.
16294
16309
  obj.setStartLod(0);
@@ -16492,7 +16507,8 @@ var TilesetArbRenderManager;
16492
16507
  this.lccObject = XGridsRenderEngine.Render({
16493
16508
  api: api,
16494
16509
  viewer: this.viewer,
16495
- tileset: tileset
16510
+ tileset: tileset,
16511
+ flyTo: this.item.FlyTo
16496
16512
  });
16497
16513
  // Disposed while it was loading so we'll remove it now.
16498
16514
  if (this.Disposed && this.lccObject) {
@@ -16728,7 +16744,7 @@ var TilesetArbRenderManager;
16728
16744
  }
16729
16745
  }
16730
16746
  onCTilesetLoad() {
16731
- if (this.item.FlyTo) {
16747
+ if (this.item.FlyTo && this.cTileset) {
16732
16748
  this.viewer.zoomTo(this.cTileset, new HeadingPitchRange(0.0, -0.5, this.cTileset.boundingSphere.radius / 4.0));
16733
16749
  }
16734
16750
  }
@@ -35281,7 +35297,7 @@ class WidgetViewBar extends Widget.AWidget {
35281
35297
  }
35282
35298
  }
35283
35299
 
35284
- const VERSION = "6.4.9";
35300
+ const VERSION = "6.5.1";
35285
35301
  /**
35286
35302
  * Updates the environment instance used by bruce-cesium to one specified.
35287
35303
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.