bruce-cesium 6.4.8 → 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
- 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, Carto, ProjectView, ProjectViewBookmark, Bounds, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils } 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, 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, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, Cartesian3, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Model, JulianDate, Quaternion, Matrix4, Cartesian2, PolygonHierarchy, PolylineGraphics, SceneTransforms, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, 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, 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
  }
@@ -32834,12 +32848,7 @@ var EntityRenderEnginePolygon;
32834
32848
  cFillColor.alpha <= 0) {
32835
32849
  return null;
32836
32850
  }
32837
- const forcePerPositionHeight = Boolean(entity === null || entity === void 0 ? void 0 : entity.__bruceSyntheticMultiGeometryChild);
32838
32851
  let heightRef = getHeightRef$3(style);
32839
- if (forcePerPositionHeight && heightRef == HeightReference.CLAMP_TO_GROUND) {
32840
- // Synthetic multi-geometry children render more reliably as absolute polygons.
32841
- heightRef = HeightReference.NONE;
32842
- }
32843
32852
  const outerRing = pRings.find(x => x.Facing == Geometry.EPolygonRingType.Boundaries);
32844
32853
  const points = Geometry.ParsePoints(outerRing === null || outerRing === void 0 ? void 0 : outerRing.LinearRing);
32845
32854
  let posses = points.map(x => Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)));
@@ -32860,19 +32869,10 @@ var EntityRenderEnginePolygon;
32860
32869
  }).filter(x => x.length >= 4);
32861
32870
  const zIndex = getZIndex$1(style, entity, params.tags);
32862
32871
  const size = getSizeOfPolygonEntity(entity);
32863
- const polygonDistanceDisplayCondition = forcePerPositionHeight ? undefined :
32864
- EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true);
32865
- const lineDistanceDisplayCondition = forcePerPositionHeight ? undefined :
32866
- EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance);
32867
- const corridorDistanceDisplayCondition = forcePerPositionHeight ? undefined :
32868
- EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width);
32869
32872
  let classification = ClassificationType.TERRAIN;
32870
32873
  if (style.drapeOver == "ALL") {
32871
32874
  classification = ClassificationType.BOTH;
32872
32875
  }
32873
- if (forcePerPositionHeight) {
32874
- classification = undefined;
32875
- }
32876
32876
  const prepareExistingGraphic = (cEntity, siblings = 0) => {
32877
32877
  // Gather entity in case previous version had sibling graphics we no longer need.
32878
32878
  const parts = EntityUtils.GatherEntity({
@@ -32905,10 +32905,10 @@ var EntityRenderEnginePolygon;
32905
32905
  extrudedHeightReference: extrusion.exHeightRef,
32906
32906
  shadows: ShadowMode.ENABLED,
32907
32907
  heightReference: heightRef,
32908
- classificationType: classification != null ? classification : undefined,
32909
- perPositionHeight: forcePerPositionHeight || heightRef != HeightReference.CLAMP_TO_GROUND,
32908
+ classificationType: classification,
32909
+ perPositionHeight: heightRef == HeightReference.CLAMP_TO_GROUND ? false : true,
32910
32910
  zIndex: zIndex,
32911
- distanceDisplayCondition: polygonDistanceDisplayCondition
32911
+ distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
32912
32912
  },
32913
32913
  position: EntityUtils.GetPos({
32914
32914
  viewer: params.viewer,
@@ -32944,9 +32944,8 @@ var EntityRenderEnginePolygon;
32944
32944
  cEntity.polygon.heightReference = new ConstantProperty(heightRef);
32945
32945
  }
32946
32946
  const oldPerPosHeight = GetCValue(params.viewer, cEntity.polygon.perPositionHeight);
32947
- const newPerPosHeight = forcePerPositionHeight || heightRef != HeightReference.CLAMP_TO_GROUND;
32948
- if (oldPerPosHeight != newPerPosHeight) {
32949
- cEntity.polygon.perPositionHeight = new ConstantProperty(newPerPosHeight);
32947
+ if (oldPerPosHeight != (heightRef == HeightReference.CLAMP_TO_GROUND ? false : true)) {
32948
+ cEntity.polygon.perPositionHeight = new ConstantProperty(heightRef == HeightReference.CLAMP_TO_GROUND ? false : true);
32950
32949
  }
32951
32950
  const oldPosition = GetCValue(params.viewer, cEntity.position);
32952
32951
  const newPosition = EntityUtils.GetPos({
@@ -32963,9 +32962,9 @@ var EntityRenderEnginePolygon;
32963
32962
  if (oldZIndex != zIndex) {
32964
32963
  cEntity.polygon.zIndex = new ConstantProperty(zIndex);
32965
32964
  }
32966
- cEntity.polygon.distanceDisplayCondition = polygonDistanceDisplayCondition != null ? new ConstantProperty(polygonDistanceDisplayCondition) : undefined;
32965
+ cEntity.polygon.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
32967
32966
  cEntity.polygon.shadows = new ConstantProperty(ShadowMode.ENABLED);
32968
- cEntity.polygon.classificationType = classification != null ? new ConstantProperty(classification) : undefined;
32967
+ cEntity.polygon.classificationType = new ConstantProperty(classification);
32969
32968
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
32970
32969
  // WARNING: polygon does not support animation (yet?).
32971
32970
  CesiumEntityStyler.SetDefaultColor({
@@ -33003,7 +33002,7 @@ var EntityRenderEnginePolygon;
33003
33002
  classificationType: ClassificationType.TERRAIN,
33004
33003
  arcType: ArcType.GEODESIC,
33005
33004
  zIndex: zIndex,
33006
- distanceDisplayCondition: lineDistanceDisplayCondition
33005
+ distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
33007
33006
  }) : null,
33008
33007
  corridor: units == "m" ? {
33009
33008
  positions: borderPosses,
@@ -33015,7 +33014,7 @@ var EntityRenderEnginePolygon;
33015
33014
  zIndex: zIndex + 1,
33016
33015
  cornerType: CornerType.MITERED,
33017
33016
  classificationType: classification,
33018
- distanceDisplayCondition: corridorDistanceDisplayCondition,
33017
+ distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width),
33019
33018
  shadows: ShadowMode.ENABLED
33020
33019
  } : null,
33021
33020
  show: true
@@ -33046,7 +33045,7 @@ var EntityRenderEnginePolygon;
33046
33045
  cEntityBorder.polyline.material = newMaterial;
33047
33046
  }
33048
33047
  cEntityBorder.polyline.classificationType = new ConstantProperty(ClassificationType.TERRAIN);
33049
- cEntityBorder.polyline.distanceDisplayCondition = lineDistanceDisplayCondition != null ? new ConstantProperty(lineDistanceDisplayCondition) : undefined;
33048
+ cEntityBorder.polyline.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
33050
33049
  cEntityBorder.corridor = undefined;
33051
33050
  }
33052
33051
  else {
@@ -33076,7 +33075,7 @@ var EntityRenderEnginePolygon;
33076
33075
  cEntityBorder.corridor.material = newMaterial;
33077
33076
  }
33078
33077
  cEntityBorder.corridor.fill = new ConstantProperty(true);
33079
- cEntityBorder.corridor.distanceDisplayCondition = corridorDistanceDisplayCondition != null ? new ConstantProperty(corridorDistanceDisplayCondition) : undefined;
33078
+ cEntityBorder.corridor.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width));
33080
33079
  cEntityBorder.polyline = undefined;
33081
33080
  }
33082
33081
  cEntityBorder.show = true;
@@ -33096,7 +33095,7 @@ var EntityRenderEnginePolygon;
33096
33095
  classificationType: ClassificationType.TERRAIN,
33097
33096
  arcType: ArcType.GEODESIC,
33098
33097
  zIndex: zIndex,
33099
- distanceDisplayCondition: lineDistanceDisplayCondition
33098
+ distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance)
33100
33099
  }) : null,
33101
33100
  corridor: units == "m" ? {
33102
33101
  positions: borderPosses,
@@ -33108,7 +33107,7 @@ var EntityRenderEnginePolygon;
33108
33107
  zIndex: zIndex + 1,
33109
33108
  cornerType: CornerType.MITERED,
33110
33109
  classificationType: classification,
33111
- distanceDisplayCondition: corridorDistanceDisplayCondition,
33110
+ distanceDisplayCondition: EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance, width),
33112
33111
  shadows: ShadowMode.ENABLED,
33113
33112
  } : null,
33114
33113
  show: true
@@ -33553,7 +33552,7 @@ var EntityRenderEngine;
33553
33552
  }
33554
33553
  EntityRenderEngine.GetRenderGroupId = GetRenderGroupId;
33555
33554
  async function Render(params) {
33556
- var _a, _b, _c, _d, _e;
33555
+ var _a, _b, _c, _d;
33557
33556
  const groupRenderParams = {
33558
33557
  apiGetter: params.apiGetter,
33559
33558
  viewer: params.viewer,
@@ -33715,21 +33714,14 @@ var EntityRenderEngine;
33715
33714
  };
33716
33715
  pParams.entitiesHistoric = params.entitiesHistoric;
33717
33716
  const zoomItem = pParams.zoomItems[entity.Bruce.ID];
33718
- // Preserve the full feature extent so tiny child polygons don't get over-culled.
33719
- const multiGeometryBounds = Bounds.FromEntity(entity);
33720
33717
  for (let j = 0; j < geometry.MultiGeometry.length; j++) {
33721
33718
  const subEntity = {
33722
33719
  ...entity,
33723
- __bruceSyntheticMultiGeometryChild: true,
33724
33720
  geometry: null,
33725
33721
  Bruce: {
33726
33722
  ...entity.Bruce,
33727
33723
  ID: ObjectUtils.UId(),
33728
- Location: null,
33729
- VectorGeometry: geometry.MultiGeometry[j],
33730
- Boundaries: multiGeometryBounds ? {
33731
- ...multiGeometryBounds
33732
- } : (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.Boundaries
33724
+ VectorGeometry: geometry.MultiGeometry[j]
33733
33725
  }
33734
33726
  };
33735
33727
  pParams.zoomItems[subEntity.Bruce.ID] = zoomItem;
@@ -35303,7 +35295,7 @@ class WidgetViewBar extends Widget.AWidget {
35303
35295
  }
35304
35296
  }
35305
35297
 
35306
- const VERSION = "6.4.8";
35298
+ const VERSION = "6.5.0";
35307
35299
  /**
35308
35300
  * Updates the environment instance used by bruce-cesium to one specified.
35309
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.