bruce-cesium 6.5.6 → 6.5.7

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, 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, 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, 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, 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,15 @@ 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 root hpr before we apply the local offset.
28842
+ const rootTransform = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyRootTransform;
28843
+ if (rootTransform) {
28844
+ const rootHpr = new HeadingPitchRoll(Math$1.toRadians(EnsureNumber(rootTransform.heading)), Math$1.toRadians(EnsureNumber(rootTransform.pitch)), Math$1.toRadians(EnsureNumber(rootTransform.roll)));
28845
+ const hprMat4 = Matrix4.fromRotationTranslation(Matrix3.fromHeadingPitchRoll(rootHpr), Cartesian3.ZERO, new Matrix4());
28846
+ Matrix4.multiply(enuFrame, hprMat4, enuFrame);
28847
+ }
28848
+ return Matrix4.multiplyByPoint(enuFrame, new Cartesian3(tx, ty, tz), new Cartesian3());
28842
28849
  }
28843
28850
  // +90° rotation around Z: aligns GLTF Y-up forward with Cesium ENU North.
28844
28851
  const _assemblyAxisShift = new Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
@@ -29703,7 +29710,7 @@ var EntityUtils;
29703
29710
  * Uses the rotation component of AssemblyWorldPosition to match the tileset rendering.
29704
29711
  */
29705
29712
  function GetAssemblyOrientation(entity, pos3d) {
29706
- var _a;
29713
+ var _a, _b;
29707
29714
  const awp = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition;
29708
29715
  if (!awp || !pos3d) {
29709
29716
  return null;
@@ -29712,10 +29719,14 @@ var EntityUtils;
29712
29719
  let rotmat = new Matrix3();
29713
29720
  rotmat = Matrix4.getRotation(mawp, rotmat);
29714
29721
  const q = Quaternion.fromRotationMatrix(rotmat);
29715
- const hpr = HeadingPitchRoll.fromQuaternion(q);
29716
- const orientation = Transforms.headingPitchRollQuaternion(pos3d, hpr);
29722
+ // Build root-HPR orientation in ECEF at the entity's position, then compose the
29723
+ // entity's local rotation on top — matching how tilesets apply the root transform.
29724
+ const rootTransform = (_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootTransform;
29725
+ 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)));
29726
+ const rootOrientation = Transforms.headingPitchRollQuaternion(pos3d, rootHpr);
29727
+ const combined = Quaternion.multiply(rootOrientation, q, new Quaternion());
29717
29728
  // Correct for GLTF Y-up vs Cesium ENU Z-up axis convention (+90° around Z).
29718
- return Quaternion.multiply(orientation, _assemblyAxisShift, new Quaternion());
29729
+ return Quaternion.multiply(combined, _assemblyAxisShift, new Quaternion());
29719
29730
  }
29720
29731
  EntityUtils.GetAssemblyOrientation = GetAssemblyOrientation;
29721
29732
  /**
@@ -35264,7 +35275,7 @@ class WidgetViewBar extends Widget.AWidget {
35264
35275
  }
35265
35276
  }
35266
35277
 
35267
- const VERSION = "6.5.6";
35278
+ const VERSION = "6.5.7";
35268
35279
  /**
35269
35280
  * Updates the environment instance used by bruce-cesium to one specified.
35270
35281
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.