bruce-cesium 6.5.4 → 6.5.6

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.
Files changed (25) hide show
  1. package/dist/bruce-cesium.es5.js +103 -152
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +101 -150
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/entity-render-engine-model3d.js +17 -4
  7. package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
  8. package/dist/lib/rendering/getters/entity-filter-getter.js +4 -0
  9. package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
  10. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +1 -0
  11. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
  12. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +1 -0
  13. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  14. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +2 -0
  15. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  16. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +9 -85
  17. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -1
  18. package/dist/lib/utils/entity-utils.js +42 -50
  19. package/dist/lib/utils/entity-utils.js.map +1 -1
  20. package/dist/lib/viewer/view-ground-area.js +22 -9
  21. package/dist/lib/viewer/view-ground-area.js.map +1 -1
  22. package/dist/types/bruce-cesium.d.ts +1 -1
  23. package/dist/types/utils/entity-utils.d.ts +5 -0
  24. package/dist/types/viewer/view-ground-area.d.ts +1 -0
  25. package/package.json +2 -2
@@ -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, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, ColorMaterialProperty, Color, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, Entity, DistanceDisplayCondition, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, PolygonHierarchy, ConstantPositionProperty, PolylineGraphics, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, Rectangle, 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, 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, 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';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -8640,6 +8640,7 @@ var EntitiesRenderManager;
8640
8640
  historicPoint: this.viewer.clock.currentTime.toString(),
8641
8641
  schemaId: (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.schemaId,
8642
8642
  expandSources: true,
8643
+ expandLocation: true,
8643
8644
  scenario: this.scenario,
8644
8645
  migrated: true,
8645
8646
  maxSearchTimeSec: 60 * 2
@@ -8748,6 +8749,7 @@ var EntitiesRenderManager;
8748
8749
  schemaId: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.schemaId,
8749
8750
  scenario: this.scenario,
8750
8751
  expandSources: true,
8752
+ expandLocation: true,
8751
8753
  migrated: true,
8752
8754
  maxSearchTimeSec: 60 * 2
8753
8755
  });
@@ -9680,6 +9682,7 @@ var EntitiesLoadedRenderManager;
9680
9682
  api,
9681
9683
  entityIds,
9682
9684
  expandSources: true,
9685
+ expandLocation: true,
9683
9686
  migrated: true,
9684
9687
  maxSearchTimeSec: 60 * 2
9685
9688
  });
@@ -10342,6 +10345,7 @@ var EntitiesIdsRenderManager;
10342
10345
  historicPoint: newDateTime,
10343
10346
  historicKey: this.item.BruceEntity.historicAttrKey,
10344
10347
  expandSources: true,
10348
+ expandLocation: true,
10345
10349
  migrated: true,
10346
10350
  // If we're taking 5+ minutes to make a query, it's a dud.
10347
10351
  // This is a timeout imposed on our DB and not external sources.
@@ -13064,6 +13068,8 @@ var EntityFilterGetter;
13064
13068
  scenario: this.scenario,
13065
13069
  historicKey: this.historicAttrKey,
13066
13070
  historicPoint: (this.historicAttrKey || this.historic) ? this.historicAttrDateTime : null,
13071
+ expandSources: true,
13072
+ expandLocation: true,
13067
13073
  schemaId: this.schemaId,
13068
13074
  filter: {
13069
13075
  pageSize: PAGE_SIZE,
@@ -13233,6 +13239,8 @@ var EntityFilterGetter;
13233
13239
  scenario: this.scenario,
13234
13240
  historicKey: this.historicAttrKey,
13235
13241
  historicPoint: historicAttrDateTime,
13242
+ expandSources: true,
13243
+ expandLocation: true,
13236
13244
  schemaId: this.schemaId,
13237
13245
  filter: {
13238
13246
  pageSize: batch.length,
@@ -14952,6 +14960,27 @@ var ViewGroundArea;
14952
14960
  return `${bounds.west},${bounds.south} ${bounds.west},${bounds.north} ${bounds.east},${bounds.north} ${bounds.east},${bounds.south}`;
14953
14961
  }
14954
14962
  ViewGroundArea.ToBboxPolygon = ToBboxPolygon;
14963
+ function NormalizeBounds(bounds, altitude) {
14964
+ if (!bounds ||
14965
+ !isDefined(bounds.east) ||
14966
+ !isDefined(bounds.west) ||
14967
+ !isDefined(bounds.north) ||
14968
+ !isDefined(bounds.south)) {
14969
+ return null;
14970
+ }
14971
+ const viewRect = { ...bounds };
14972
+ const centerLong = (viewRect.east + viewRect.west) / 2;
14973
+ const centerLat = (viewRect.north + viewRect.south) / 2;
14974
+ viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
14975
+ viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
14976
+ viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
14977
+ viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
14978
+ if (isDefined(altitude)) {
14979
+ viewRect.alt = altitude;
14980
+ }
14981
+ return viewRect;
14982
+ }
14983
+ ViewGroundArea.NormalizeBounds = NormalizeBounds;
14955
14984
  async function GetViewArea(viewer) {
14956
14985
  var _a, _b;
14957
14986
  if (!viewer || viewer.isDestroyed()) {
@@ -15017,15 +15046,7 @@ var ViewGroundArea;
15017
15046
  }
15018
15047
  }
15019
15048
  }
15020
- if (viewRect) {
15021
- const centerLong = (viewRect.east + viewRect.west) / 2;
15022
- const centerLat = (viewRect.north + viewRect.south) / 2;
15023
- viewRect.east = Math.max(viewRect.east, centerLong + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15024
- viewRect.west = Math.min(viewRect.west, centerLong - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15025
- viewRect.south = Math.min(viewRect.south, centerLat - (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15026
- viewRect.north = Math.max(viewRect.north, centerLat + (MINIMUM_VIEW_AREA_SIZE_DEGREES / 2));
15027
- viewRect.alt = (_b = viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height;
15028
- }
15049
+ viewRect = NormalizeBounds(viewRect, (_b = viewer.scene.camera.positionCartographic) === null || _b === void 0 ? void 0 : _b.height);
15029
15050
  if (center && viewRect) {
15030
15051
  return {
15031
15052
  bounds: viewRect,
@@ -18936,8 +18957,14 @@ var AssemblyRenderManager;
18936
18957
  // Won't bother with vector data for this experiment.
18937
18958
  continue;
18938
18959
  }
18939
- const pos3d = calcEntityLocation(entity, this.modelSpace);
18940
- const orient = calcEntityOrientation(entity, pos3d, this.modelSpace);
18960
+ const pos3d = EntityUtils.GetPos({
18961
+ viewer: this.viewer,
18962
+ entity,
18963
+ recordHeightRef: HeightReference.NONE,
18964
+ returnHeightRef: HeightReference.NONE,
18965
+ allowRendered: false
18966
+ });
18967
+ const orient = EntityUtils.GetAssemblyOrientation(entity, pos3d);
18941
18968
  if (!pos3d || !orient) {
18942
18969
  continue;
18943
18970
  }
@@ -19207,87 +19234,6 @@ var AssemblyRenderManager;
19207
19234
  }
19208
19235
  AssemblyRenderManager.Manager = Manager;
19209
19236
  })(AssemblyRenderManager || (AssemblyRenderManager = {}));
19210
- const axis_shift = new Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
19211
- function calcEntityLocation(entity, modelSpace) {
19212
- let aRootLocation = entity.Bruce.AssemblyRootLocation;
19213
- // If we're in model-space we cull location.
19214
- // This puts it at 0,0 lat/lon which we treat as 0,0,0 for model-space viewing.
19215
- if (modelSpace) {
19216
- aRootLocation = null;
19217
- }
19218
- const worldPosition = entity.Bruce.AssemblyWorldPosition;
19219
- if (!worldPosition) {
19220
- return null;
19221
- }
19222
- let offset = new Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
19223
- let heading = 0;
19224
- let pitch = 0;
19225
- let roll = 0;
19226
- if (!modelSpace) {
19227
- const eTransform = entity.Bruce.Transform;
19228
- if (eTransform) {
19229
- if (eTransform.heading) {
19230
- heading = eTransform.heading;
19231
- }
19232
- if (eTransform.pitch) {
19233
- pitch = eTransform.pitch;
19234
- }
19235
- if (eTransform.roll) {
19236
- roll = eTransform.roll;
19237
- }
19238
- }
19239
- }
19240
- let pos3d = Cartesian3.fromDegrees(EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.latitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.altitude));
19241
- const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
19242
- const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new HeadingPitchRoll());
19243
- const transform = Matrix3.fromHeadingPitchRoll(hpr);
19244
- const transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
19245
- pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
19246
- return pos3d;
19247
- }
19248
- function calcEntityOrientation(entity, pos3d, modelSpace) {
19249
- if (!entity.Bruce || !pos3d) {
19250
- return null;
19251
- }
19252
- // 0 or 90 for these?
19253
- let heading = 90;
19254
- let pitch = 0;
19255
- let roll = 0;
19256
- if (!modelSpace) {
19257
- const eTransform = entity.Bruce.Transform;
19258
- if (eTransform) {
19259
- if (eTransform.heading) {
19260
- heading = eTransform.heading;
19261
- }
19262
- if (eTransform.pitch) {
19263
- pitch = eTransform.pitch;
19264
- }
19265
- if (eTransform.roll) {
19266
- roll = eTransform.roll;
19267
- }
19268
- }
19269
- }
19270
- let hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll));
19271
- let orientation = Transforms.headingPitchRollQuaternion(pos3d, hpr);
19272
- if (entity.Bruce.AssemblyWorldPosition) {
19273
- // extract rot, scale
19274
- const awp = entity.Bruce.AssemblyWorldPosition;
19275
- const mawp = new Matrix4(+awp[0][0], +awp[0][1], +awp[0][2], +awp[0][3], +awp[1][0], +awp[1][1], +awp[1][2], +awp[1][3], +awp[2][0], +awp[2][1], +awp[2][2], +awp[2][3], +awp[3][0], +awp[3][1], +awp[3][2], +awp[3][3]);
19276
- let rotmat = new Matrix3();
19277
- rotmat = Matrix4.getRotation(mawp, rotmat);
19278
- // chuck on a heading rotation of +90
19279
- // according to docs, that is around -z
19280
- // https://cesium.com/learn/ion-sdk/ref-doc/HeadingPitchRoll.html
19281
- // see axis_shift quat defined above (could possibly be -ve z value)
19282
- const q = Quaternion.fromRotationMatrix(rotmat);
19283
- hpr = HeadingPitchRoll.fromQuaternion(q);
19284
- orientation = Transforms.headingPitchRollQuaternion(pos3d, hpr);
19285
- // add another h +90, quats multiply to concat rotations - but are not
19286
- // subject to order of rotation like HPR
19287
- orientation = Quaternion.multiply(orientation, axis_shift, new Quaternion());
19288
- }
19289
- return orientation;
19290
- }
19291
19237
 
19292
19238
  /**
19293
19239
  * Utility to keep track of enabled menu items within a Cesium viewer.
@@ -28867,63 +28813,35 @@ const getLocationFromFeature = (feature) => {
28867
28813
  }
28868
28814
  return result;
28869
28815
  };
28870
- function calcEntityLocation$1(entity, modelSpace) {
28871
- let aRootLocation = entity.Bruce.AssemblyRootLocation;
28872
- // If we're in model-space we cull location.
28873
- // This puts it at 0,0 lat/lon which we treat as 0,0,0 for model-space viewing.
28874
- if (modelSpace) {
28875
- aRootLocation = null;
28876
- }
28877
- const worldPosition = entity.Bruce.AssemblyWorldPosition;
28816
+ function calcEntityLocation(entity, modelSpace) {
28817
+ var _a, _b;
28818
+ const worldPosition = (_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition;
28878
28819
  if (!worldPosition) {
28879
28820
  return null;
28880
28821
  }
28881
- let offset;
28882
- {
28883
- // Check if we have rotation/scale components (non-identity 3x3 upper-left matrix).
28884
- const hasRotationOrScale = Math.abs(+worldPosition[0][0] - 1) > 1e-6 || Math.abs(+worldPosition[0][1]) > 1e-6 || Math.abs(+worldPosition[0][2]) > 1e-6 ||
28885
- Math.abs(+worldPosition[1][0]) > 1e-6 || Math.abs(+worldPosition[1][1] - 1) > 1e-6 || Math.abs(+worldPosition[1][2]) > 1e-6 ||
28886
- Math.abs(+worldPosition[2][0]) > 1e-6 || Math.abs(+worldPosition[2][1]) > 1e-6 || Math.abs(+worldPosition[2][2] - 1) > 1e-6;
28887
- if (hasRotationOrScale) {
28888
- // Extract translation first.
28889
- const translation = new Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
28890
- // Extract rotation matrix.
28891
- const mawp = new Matrix4(+worldPosition[0][0], +worldPosition[0][1], +worldPosition[0][2], +worldPosition[0][3], +worldPosition[1][0], +worldPosition[1][1], +worldPosition[1][2], +worldPosition[1][3], +worldPosition[2][0], +worldPosition[2][1], +worldPosition[2][2], +worldPosition[2][3], +worldPosition[3][0], +worldPosition[3][1], +worldPosition[3][2], +worldPosition[3][3]);
28892
- let rotmat = new Matrix3();
28893
- rotmat = Matrix4.getRotation(mawp, rotmat);
28894
- const inverseRotmat = Matrix3.transpose(rotmat, new Matrix3());
28895
- offset = Matrix3.multiplyByVector(inverseRotmat, translation, new Cartesian3());
28896
- }
28897
- // For translation-only matrices, extract translation directly.
28898
- else {
28899
- offset = new Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
28900
- }
28822
+ // The translation column of AssemblyWorldPosition is in ENU space:
28823
+ // [0][3] = East offset (m)
28824
+ // [1][3] = North offset (m)
28825
+ // [2][3] = Up/altitude offset (m)
28826
+ // All relative to the Assembly root's world location.
28827
+ // "Bruce.Location" stores the geometry-pivot centre instead of the Entity origin.
28828
+ // So we compute directly from the matrix translation to get the model origin position.
28829
+ const tx = +worldPosition[0][3];
28830
+ const ty = +worldPosition[1][3];
28831
+ const tz = +worldPosition[2][3];
28832
+ let rootPos;
28833
+ if (modelSpace) {
28834
+ rootPos = Cartesian3.fromDegrees(0, 0, 0);
28901
28835
  }
28902
- let heading = 0;
28903
- let pitch = 0;
28904
- let roll = 0;
28905
- if (!modelSpace) {
28906
- const eTransform = entity.Bruce.Transform;
28907
- if (eTransform) {
28908
- if (eTransform.heading) {
28909
- heading = eTransform.heading;
28910
- }
28911
- if (eTransform.pitch) {
28912
- pitch = eTransform.pitch;
28913
- }
28914
- if (eTransform.roll) {
28915
- roll = eTransform.roll;
28916
- }
28917
- }
28836
+ else {
28837
+ const rootLoc = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootLocation;
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));
28918
28839
  }
28919
- let pos3d = Cartesian3.fromDegrees(EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.latitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.altitude));
28920
- const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
28921
- const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new HeadingPitchRoll());
28922
- const transform = Matrix3.fromHeadingPitchRoll(hpr);
28923
- const transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
28924
- pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
28925
- return pos3d;
28840
+ const m1 = Transforms.eastNorthUpToFixedFrame(rootPos);
28841
+ return Matrix4.multiplyByPoint(m1, new Cartesian3(tx, ty, tz), new Cartesian3());
28926
28842
  }
28843
+ // +90° rotation around Z: aligns GLTF Y-up forward with Cesium ENU North.
28844
+ const _assemblyAxisShift = new Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
28927
28845
  var EntityUtils;
28928
28846
  (function (EntityUtils) {
28929
28847
  /**
@@ -29389,7 +29307,7 @@ var EntityUtils;
29389
29307
  }
29390
29308
  let pos3d = null;
29391
29309
  if (modelSpace) {
29392
- pos3d = calcEntityLocation$1(entity, modelSpace);
29310
+ pos3d = calcEntityLocation(entity, modelSpace);
29393
29311
  }
29394
29312
  else {
29395
29313
  const eLocation = Entity$1.GetValue({
@@ -29687,7 +29605,7 @@ var EntityUtils;
29687
29605
  }
29688
29606
  function evaluateRecord() {
29689
29607
  if (isAssemblyEntity) {
29690
- return calcEntityLocation$1(entity, isModelSpace);
29608
+ return calcEntityLocation(entity, isModelSpace);
29691
29609
  }
29692
29610
  const location = Entity$1.GetValue({
29693
29611
  entity: entity,
@@ -29780,6 +29698,26 @@ var EntityUtils;
29780
29698
  });
29781
29699
  }
29782
29700
  EntityUtils.GetPos = GetPos;
29701
+ /**
29702
+ * Returns the orientation quaternion for an assembly entity using its world position matrix.
29703
+ * Uses the rotation component of AssemblyWorldPosition to match the tileset rendering.
29704
+ */
29705
+ function GetAssemblyOrientation(entity, pos3d) {
29706
+ var _a;
29707
+ const awp = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition;
29708
+ if (!awp || !pos3d) {
29709
+ return null;
29710
+ }
29711
+ const mawp = new Matrix4(+awp[0][0], +awp[0][1], +awp[0][2], +awp[0][3], +awp[1][0], +awp[1][1], +awp[1][2], +awp[1][3], +awp[2][0], +awp[2][1], +awp[2][2], +awp[2][3], +awp[3][0], +awp[3][1], +awp[3][2], +awp[3][3]);
29712
+ let rotmat = new Matrix3();
29713
+ rotmat = Matrix4.getRotation(mawp, rotmat);
29714
+ const q = Quaternion.fromRotationMatrix(rotmat);
29715
+ const hpr = HeadingPitchRoll.fromQuaternion(q);
29716
+ const orientation = Transforms.headingPitchRollQuaternion(pos3d, hpr);
29717
+ // Correct for GLTF Y-up vs Cesium ENU Z-up axis convention (+90° around Z).
29718
+ return Quaternion.multiply(orientation, _assemblyAxisShift, new Quaternion());
29719
+ }
29720
+ EntityUtils.GetAssemblyOrientation = GetAssemblyOrientation;
29783
29721
  /**
29784
29722
  * Returns the position of the entity.
29785
29723
  * This is an async variant that checks for related assemblies.
@@ -31606,11 +31544,12 @@ var EntityRenderEngineModel3d;
31606
31544
  * @returns
31607
31545
  */
31608
31546
  function Render(params) {
31609
- var _a, _b, _c, _d;
31547
+ var _a, _b, _c, _d, _e;
31610
31548
  const entity = params.entity;
31611
31549
  if (!params.entityHistoric) {
31612
31550
  params.entityHistoric = [];
31613
31551
  }
31552
+ const hasAssemblyMatrix = !!((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyWorldPosition);
31614
31553
  const transform = Entity$1.GetValue({
31615
31554
  entity: entity,
31616
31555
  path: ["Bruce", "Transform"]
@@ -31751,6 +31690,12 @@ var EntityRenderEngineModel3d;
31751
31690
  return animatePosition.GetOrient();
31752
31691
  }, false);
31753
31692
  }
31693
+ else if (hasAssemblyMatrix) {
31694
+ getOrient = new CallbackProperty(() => {
31695
+ const currentPos = position ? GetCValue(params.viewer, position) : pos3d;
31696
+ return EntityUtils.GetAssemblyOrientation(entity, currentPos || pos3d);
31697
+ }, false);
31698
+ }
31754
31699
  else {
31755
31700
  const hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31756
31701
  getOrient = new CallbackProperty(() => {
@@ -31802,7 +31747,7 @@ var EntityRenderEngineModel3d;
31802
31747
  cEntity.model.colorBlendAmount = new ConstantProperty(blendAmount);
31803
31748
  cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
31804
31749
  cEntity.model.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
31805
- let dateTimeStr = (_b = (_a = entity.Bruce.Outline) === null || _a === void 0 ? void 0 : _a.find(x => !!x.DateTime)) === null || _b === void 0 ? void 0 : _b.DateTime;
31750
+ let dateTimeStr = (_c = (_b = entity.Bruce.Outline) === null || _b === void 0 ? void 0 : _b.find(x => !!x.DateTime)) === null || _c === void 0 ? void 0 : _c.DateTime;
31806
31751
  const isHistoric = Boolean(dateTimeStr);
31807
31752
  let dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
31808
31753
  // Initial animation check to see if we're continuing an animation.
@@ -31915,7 +31860,13 @@ var EntityRenderEngineModel3d;
31915
31860
  const hasExplicitTransformHeading = (transform === null || transform === void 0 ? void 0 : transform.heading) != null && !isNaN(EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading));
31916
31861
  const isDirectRealtimeUpdate = !isHistoric && !(params.entityHistoric && params.entityHistoric.length > 0);
31917
31862
  const preferTransformHeadingForRealtime = isDirectRealtimeUpdate && hasExplicitTransformHeading;
31918
- if (preferTransformHeadingForRealtime) {
31863
+ if (hasAssemblyMatrix) {
31864
+ cEntity.orientation = new CallbackProperty(() => {
31865
+ const currentPos = GetCValue(params.viewer, cEntity.position);
31866
+ return EntityUtils.GetAssemblyOrientation(entity, currentPos || pos3d);
31867
+ }, false);
31868
+ }
31869
+ else if (preferTransformHeadingForRealtime) {
31919
31870
  const hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31920
31871
  cEntity.orientation = new CallbackProperty(() => {
31921
31872
  const currentPos = GetCValue(params.viewer, cEntity.position);
@@ -32073,7 +32024,7 @@ var EntityRenderEngineModel3d;
32073
32024
  // Generate a polyline 'track' for the historic data.
32074
32025
  // We do this for historic data that exists and is moving.
32075
32026
  if (shouldShowTrack && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
32076
- const lStyle = (_d = (_c = params.fullStyle) === null || _c === void 0 ? void 0 : _c.polylineStyle) !== null && _d !== void 0 ? _d : {};
32027
+ const lStyle = (_e = (_d = params.fullStyle) === null || _d === void 0 ? void 0 : _d.polylineStyle) !== null && _e !== void 0 ? _e : {};
32077
32028
  const bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
32078
32029
  const cColor = bColor ? ColorToCColor(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
32079
32030
  let width = lStyle.lineWidth ? EnsureNumber(Calculator.GetNumber(lStyle.lineWidth, entity, params.tags)) : 2;
@@ -35313,7 +35264,7 @@ class WidgetViewBar extends Widget.AWidget {
35313
35264
  }
35314
35265
  }
35315
35266
 
35316
- const VERSION = "6.5.4";
35267
+ const VERSION = "6.5.6";
35317
35268
  /**
35318
35269
  * Updates the environment instance used by bruce-cesium to one specified.
35319
35270
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.