bruce-cesium 6.5.6 → 6.5.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,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, Camera, ProjectViewLegacyTile, 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, ClassificationType, PolygonHierarchy, ShadowMode, ConstantPositionProperty, PolylineGraphics, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, ColorBlendMode, Model, Cartesian2, 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, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, 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, JulianDate, Quaternion, Matrix4, PolygonHierarchy, ConstantPositionProperty, PolylineGraphics, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, 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, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -28814,7 +28814,7 @@ const getLocationFromFeature = (feature) => {
28814
28814
  return result;
28815
28815
  };
28816
28816
  function calcEntityLocation(entity, modelSpace) {
28817
- var _a, _b;
28817
+ var _a, _b, _c;
28818
28818
  const worldPosition = (_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition;
28819
28819
  if (!worldPosition) {
28820
28820
  return null;
@@ -28837,8 +28837,16 @@ function calcEntityLocation(entity, modelSpace) {
28837
28837
  const rootLoc = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootLocation;
28838
28838
  rootPos = Cartesian3.fromDegrees(EnsureNumber(rootLoc === null || rootLoc === void 0 ? void 0 : rootLoc.longitude), EnsureNumber(rootLoc === null || rootLoc === void 0 ? void 0 : rootLoc.latitude), EnsureNumber(rootLoc === null || rootLoc === void 0 ? void 0 : rootLoc.altitude));
28839
28839
  }
28840
- const m1 = Transforms.eastNorthUpToFixedFrame(rootPos);
28841
- return Matrix4.multiplyByPoint(m1, new Cartesian3(tx, ty, tz), new Cartesian3());
28840
+ const enuFrame = Transforms.eastNorthUpToFixedFrame(rootPos);
28841
+ // Rotate using the assembly's accumulated world h/p/r before applying the local offset,
28842
+ // matching how tilesets apply the root transform.
28843
+ const rootTransform = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyWorldTransform;
28844
+ if (rootTransform) {
28845
+ const rootHpr = new HeadingPitchRoll(Math$1.toRadians(EnsureNumber(rootTransform.heading)), Math$1.toRadians(EnsureNumber(rootTransform.pitch)), Math$1.toRadians(EnsureNumber(rootTransform.roll)));
28846
+ const hprMat4 = Matrix4.fromRotationTranslation(Matrix3.fromHeadingPitchRoll(rootHpr), Cartesian3.ZERO, new Matrix4());
28847
+ Matrix4.multiply(enuFrame, hprMat4, enuFrame);
28848
+ }
28849
+ return Matrix4.multiplyByPoint(enuFrame, new Cartesian3(tx, ty, tz), new Cartesian3());
28842
28850
  }
28843
28851
  // +90° rotation around Z: aligns GLTF Y-up forward with Cesium ENU North.
28844
28852
  const _assemblyAxisShift = new Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
@@ -29703,7 +29711,7 @@ var EntityUtils;
29703
29711
  * Uses the rotation component of AssemblyWorldPosition to match the tileset rendering.
29704
29712
  */
29705
29713
  function GetAssemblyOrientation(entity, pos3d) {
29706
- var _a;
29714
+ var _a, _b;
29707
29715
  const awp = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition;
29708
29716
  if (!awp || !pos3d) {
29709
29717
  return null;
@@ -29712,10 +29720,14 @@ var EntityUtils;
29712
29720
  let rotmat = new Matrix3();
29713
29721
  rotmat = Matrix4.getRotation(mawp, rotmat);
29714
29722
  const q = Quaternion.fromRotationMatrix(rotmat);
29715
- const hpr = HeadingPitchRoll.fromQuaternion(q);
29716
- const orientation = Transforms.headingPitchRollQuaternion(pos3d, hpr);
29723
+ // Apply world transform prior to axis.
29724
+ // This accounts for UCS/root being rotated.
29725
+ const rootTransform = (_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyWorldTransform;
29726
+ const rootHpr = new HeadingPitchRoll(Math$1.toRadians(EnsureNumber(rootTransform === null || rootTransform === void 0 ? void 0 : rootTransform.heading)), Math$1.toRadians(EnsureNumber(rootTransform === null || rootTransform === void 0 ? void 0 : rootTransform.pitch)), Math$1.toRadians(EnsureNumber(rootTransform === null || rootTransform === void 0 ? void 0 : rootTransform.roll)));
29727
+ const rootOrientation = Transforms.headingPitchRollQuaternion(pos3d, rootHpr);
29728
+ const combined = Quaternion.multiply(rootOrientation, q, new Quaternion());
29717
29729
  // Correct for GLTF Y-up vs Cesium ENU Z-up axis convention (+90° around Z).
29718
- return Quaternion.multiply(orientation, _assemblyAxisShift, new Quaternion());
29730
+ return Quaternion.multiply(combined, _assemblyAxisShift, new Quaternion());
29719
29731
  }
29720
29732
  EntityUtils.GetAssemblyOrientation = GetAssemblyOrientation;
29721
29733
  /**
@@ -35264,7 +35276,7 @@ class WidgetViewBar extends Widget.AWidget {
35264
35276
  }
35265
35277
  }
35266
35278
 
35267
- const VERSION = "6.5.6";
35279
+ const VERSION = "6.5.8";
35268
35280
  /**
35269
35281
  * Updates the environment instance used by bruce-cesium to one specified.
35270
35282
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.