bruce-cesium 7.7.5 → 7.7.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.
@@ -28584,26 +28584,38 @@
28584
28584
  */
28585
28585
  function ApplyPosition(params) {
28586
28586
  const { renderObject, origin, rotation, dontRotate, dontTransform } = params;
28587
- if (!renderObject) {
28587
+ if (!renderObject || dontTransform) {
28588
28588
  return;
28589
28589
  }
28590
28590
  const lat = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.latitude, 0);
28591
28591
  const lon = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.longitude, 0);
28592
28592
  const alt = EnsureNumber(origin === null || origin === void 0 ? void 0 : origin.altitude, 0);
28593
28593
  const scale = EnsureNumber((origin === null || origin === void 0 ? void 0 : origin.scale) || 1, 1);
28594
+ // A complete matrix avoids SDK setters whose translation, rotation and scale contracts differ.
28595
+ if (typeof renderObject.setModelMatrix === "function") {
28596
+ const matrix = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(lon, lat, alt));
28597
+ if (!dontRotate) {
28598
+ const hpr = Cesium.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));
28599
+ const local = Cesium.Matrix4.fromRotation(Cesium.Matrix3.fromHeadingPitchRoll(hpr));
28600
+ Cesium.Matrix4.multiply(matrix, local, matrix);
28601
+ Cesium.Matrix4.multiplyByUniformScale(matrix, scale, matrix);
28602
+ }
28603
+ renderObject.setModelMatrix(matrix);
28604
+ return;
28605
+ }
28594
28606
  if (!dontTransform) {
28595
28607
  const pos = Cesium.Cartesian3.fromDegrees(lon, lat, alt);
28596
- if (typeof renderObject.setTranslation === 'function') {
28608
+ if (typeof renderObject.setTranslation === "function") {
28597
28609
  renderObject.setTranslation(pos);
28598
28610
  }
28599
28611
  }
28600
28612
  if (!dontRotate && !dontTransform) {
28601
28613
  const hpr = Cesium.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 Cesium.HeadingPitchRoll());
28602
28614
  const rotMatrix = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
28603
- if (typeof renderObject.setRotation === 'function') {
28615
+ if (typeof renderObject.setRotation === "function") {
28604
28616
  renderObject.setRotation(rotMatrix);
28605
28617
  }
28606
- if (typeof renderObject.setScale === 'function') {
28618
+ if (typeof renderObject.setScale === "function") {
28607
28619
  renderObject.setScale(new Cesium.Cartesian3(scale, scale, scale));
28608
28620
  }
28609
28621
  }
@@ -54858,6 +54870,12 @@ void main() {
54858
54870
  ? BModels.Geometry.ParsePoints(ring.LinearRing).map((point) => point.altitude)
54859
54871
  : [])
54860
54872
  });
54873
+ const drapesOnGround = (heightRef === Cesium.HeightReference.CLAMP_TO_GROUND &&
54874
+ extrusion.value == undefined &&
54875
+ !drawsDisplacedSurface);
54876
+ if (drapesOnGround) {
54877
+ posses = groundPosses(posses);
54878
+ }
54861
54879
  posses = CullDuplicateCPosses(posses);
54862
54880
  if (posses.length < 4) {
54863
54881
  return null;
@@ -54866,6 +54884,9 @@ void main() {
54866
54884
  const holePosses = holeRings.map((x) => {
54867
54885
  const points = BModels.Geometry.ParsePoints(x.LinearRing);
54868
54886
  let holePosses = points.map(x => Cesium.Cartesian3.fromDegrees(EnsureNumber(x.longitude), EnsureNumber(x.latitude), EnsureNumber(x.altitude)));
54887
+ if (drapesOnGround) {
54888
+ holePosses = groundPosses(holePosses);
54889
+ }
54869
54890
  holePosses = CullDuplicateCPosses(holePosses);
54870
54891
  BModels.Cartes.CloseRing3(holePosses);
54871
54892
  return holePosses;
@@ -55652,6 +55673,18 @@ void main() {
55652
55673
  /*
55653
55674
  * The lon/lat bounding rectangle of a ring, which is the frame Cesium drapes an image material in.
55654
55675
  */
55676
+ /*
55677
+ * Moves a ring onto the ellipsoid, as Cesium fills only a strip of a ground polygon with high vertices.
55678
+ */
55679
+ function groundPosses(posses) {
55680
+ return posses.map((pos) => {
55681
+ const carto = Cesium.Cartographic.fromCartesian(pos);
55682
+ if (!carto) {
55683
+ return pos;
55684
+ }
55685
+ return Cesium.Cartesian3.fromRadians(carto.longitude, carto.latitude, 0);
55686
+ });
55687
+ }
55655
55688
  function polygonBbox(posses) {
55656
55689
  if (!posses || posses.length === 0) {
55657
55690
  return undefined;
@@ -57563,7 +57596,7 @@ void main() {
57563
57596
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
57564
57597
  })(exports.StyleUtils || (exports.StyleUtils = {}));
57565
57598
 
57566
- const VERSION = "7.7.5";
57599
+ const VERSION = "7.7.7";
57567
57600
  /**
57568
57601
  * Updates the environment instance used by bruce-cesium to one specified.
57569
57602
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.