bruce-cesium 6.5.7 → 6.5.9

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, Carto, Bounds, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, 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, 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';
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, ArcType, CornerType, PolygonHierarchy, PolylineGraphics, Cartesian2, SceneTransforms, NearFarScalar, JulianDate, Quaternion, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileset, Matrix4, 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.
@@ -16364,6 +16364,36 @@ var XGridsRenderEngine;
16364
16364
  LCCRender.unload(renderObject);
16365
16365
  }
16366
16366
  XGridsRenderEngine.Remove = Remove;
16367
+ /**
16368
+ * Applies position, rotation, and scale to a live XGrids render object.
16369
+ */
16370
+ function ApplyPosition(params) {
16371
+ const { renderObject, origin, rotation, dontRotate, dontTransform } = params;
16372
+ if (!renderObject) {
16373
+ return;
16374
+ }
16375
+ const lat = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.latitude, 0);
16376
+ const lon = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.longitude, 0);
16377
+ const alt = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.altitude, 0);
16378
+ const scale = EnsureNumber((origin === null || origin === void 0 ? void 0 : origin.scale) || 1, 1);
16379
+ if (!dontTransform) {
16380
+ const pos = Cartesian3.fromDegrees(lon, lat, alt);
16381
+ if (typeof renderObject.setTranslation === 'function') {
16382
+ renderObject.setTranslation(pos);
16383
+ }
16384
+ }
16385
+ if (!dontRotate && !dontTransform) {
16386
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.z), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.x), EnsureNumber(rotation === null || rotation === void 0 ? void 0 : rotation.y), new HeadingPitchRoll());
16387
+ const rotMatrix = Matrix3.fromHeadingPitchRoll(hpr);
16388
+ if (typeof renderObject.setRotation === 'function') {
16389
+ renderObject.setRotation(rotMatrix);
16390
+ }
16391
+ if (typeof renderObject.setScale === 'function') {
16392
+ renderObject.setScale(new Cartesian3(scale, scale, scale));
16393
+ }
16394
+ }
16395
+ }
16396
+ XGridsRenderEngine.ApplyPosition = ApplyPosition;
16367
16397
  })(XGridsRenderEngine || (XGridsRenderEngine = {}));
16368
16398
 
16369
16399
  async function getLegacyTileset(params) {
@@ -16422,6 +16452,9 @@ var TilesetArbRenderManager;
16422
16452
  get RenderTypeChanged() {
16423
16453
  return this.renderTypeChanged;
16424
16454
  }
16455
+ get LccObject() {
16456
+ return this.lccObject;
16457
+ }
16425
16458
  constructor(params) {
16426
16459
  this.disposed = false;
16427
16460
  this.cTileset = null;
@@ -16547,6 +16580,57 @@ var TilesetArbRenderManager;
16547
16580
  tileset: tileset,
16548
16581
  flyTo: this.item.FlyTo
16549
16582
  });
16583
+ if (this.lccObject) {
16584
+ const lccSettings = tileset.settings;
16585
+ const origin = lccSettings === null || lccSettings === void 0 ? void 0 : lccSettings.origin;
16586
+ const rotation = lccSettings === null || lccSettings === void 0 ? void 0 : lccSettings.rotation;
16587
+ this.lccObject._isXGridsLCC = true;
16588
+ this.lccObject._bruceCoords = {
16589
+ location: {
16590
+ latitude: +(origin === null || origin === void 0 ? void 0 : origin.latitude) || 0,
16591
+ longitude: +(origin === null || origin === void 0 ? void 0 : origin.longitude) || 0,
16592
+ altitude: +(origin === null || origin === void 0 ? void 0 : origin.altitude) || 0
16593
+ },
16594
+ transform: {
16595
+ heading: +(rotation === null || rotation === void 0 ? void 0 : rotation.z) || 0,
16596
+ pitch: +(rotation === null || rotation === void 0 ? void 0 : rotation.x) || 0,
16597
+ roll: +(rotation === null || rotation === void 0 ? void 0 : rotation.y) || 0,
16598
+ scale: +(origin === null || origin === void 0 ? void 0 : origin.scale) || 1
16599
+ },
16600
+ isLegacy: true,
16601
+ legacyProps: {
16602
+ rotate: !(lccSettings === null || lccSettings === void 0 ? void 0 : lccSettings.dontRotate),
16603
+ transform: !(lccSettings === null || lccSettings === void 0 ? void 0 : lccSettings.dontTransform),
16604
+ usingBoundingBox: true
16605
+ }
16606
+ };
16607
+ // Attach a position-update callback so app-editors can update easier.
16608
+ const capturedSettings = lccSettings;
16609
+ const capturedObj = this.lccObject;
16610
+ this.lccObject._applyPosition = (coords) => {
16611
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16612
+ if (!capturedObj) {
16613
+ return;
16614
+ }
16615
+ const loc = (_b = (_a = coords === null || coords === void 0 ? void 0 : coords.ucs) === null || _a === void 0 ? void 0 : _a.location) !== null && _b !== void 0 ? _b : coords === null || coords === void 0 ? void 0 : coords.location;
16616
+ XGridsRenderEngine.ApplyPosition({
16617
+ renderObject: capturedObj,
16618
+ origin: {
16619
+ latitude: loc === null || loc === void 0 ? void 0 : loc.latitude,
16620
+ longitude: loc === null || loc === void 0 ? void 0 : loc.longitude,
16621
+ altitude: loc === null || loc === void 0 ? void 0 : loc.altitude,
16622
+ scale: (_d = (_c = coords === null || coords === void 0 ? void 0 : coords.transform) === null || _c === void 0 ? void 0 : _c.scale) !== null && _d !== void 0 ? _d : 1
16623
+ },
16624
+ rotation: {
16625
+ z: (_f = (_e = coords === null || coords === void 0 ? void 0 : coords.transform) === null || _e === void 0 ? void 0 : _e.heading) !== null && _f !== void 0 ? _f : 0,
16626
+ x: (_h = (_g = coords === null || coords === void 0 ? void 0 : coords.transform) === null || _g === void 0 ? void 0 : _g.pitch) !== null && _h !== void 0 ? _h : 0,
16627
+ y: (_k = (_j = coords === null || coords === void 0 ? void 0 : coords.transform) === null || _j === void 0 ? void 0 : _j.roll) !== null && _k !== void 0 ? _k : 0
16628
+ },
16629
+ dontRotate: capturedSettings === null || capturedSettings === void 0 ? void 0 : capturedSettings.dontRotate,
16630
+ dontTransform: capturedSettings === null || capturedSettings === void 0 ? void 0 : capturedSettings.dontTransform
16631
+ });
16632
+ };
16633
+ }
16550
16634
  // Disposed while it was loading so we'll remove it now.
16551
16635
  if (this.Disposed && this.lccObject) {
16552
16636
  XGridsRenderEngine.Remove(this.viewer, this.lccObject);
@@ -28838,8 +28922,9 @@ function calcEntityLocation(entity, modelSpace) {
28838
28922
  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
28923
  }
28840
28924
  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;
28925
+ // Rotate using the assembly's accumulated world h/p/r before applying the local offset,
28926
+ // matching how tilesets apply the root transform.
28927
+ const rootTransform = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyWorldTransform;
28843
28928
  if (rootTransform) {
28844
28929
  const rootHpr = new HeadingPitchRoll(Math$1.toRadians(EnsureNumber(rootTransform.heading)), Math$1.toRadians(EnsureNumber(rootTransform.pitch)), Math$1.toRadians(EnsureNumber(rootTransform.roll)));
28845
28930
  const hprMat4 = Matrix4.fromRotationTranslation(Matrix3.fromHeadingPitchRoll(rootHpr), Cartesian3.ZERO, new Matrix4());
@@ -29719,9 +29804,9 @@ var EntityUtils;
29719
29804
  let rotmat = new Matrix3();
29720
29805
  rotmat = Matrix4.getRotation(mawp, rotmat);
29721
29806
  const q = Quaternion.fromRotationMatrix(rotmat);
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;
29807
+ // Apply world transform prior to axis.
29808
+ // This accounts for UCS/root being rotated.
29809
+ const rootTransform = (_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyWorldTransform;
29725
29810
  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
29811
  const rootOrientation = Transforms.headingPitchRollQuaternion(pos3d, rootHpr);
29727
29812
  const combined = Quaternion.multiply(rootOrientation, q, new Quaternion());
@@ -35275,7 +35360,7 @@ class WidgetViewBar extends Widget.AWidget {
35275
35360
  }
35276
35361
  }
35277
35362
 
35278
- const VERSION = "6.5.7";
35363
+ const VERSION = "6.5.9";
35279
35364
  /**
35280
35365
  * Updates the environment instance used by bruce-cesium to one specified.
35281
35366
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.