bruce-cesium 6.1.5 → 6.1.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.
@@ -7154,7 +7154,7 @@
7154
7154
  * @returns
7155
7155
  */
7156
7156
  function Render(params) {
7157
- var _a, _b, _c, _d, _e, _f;
7157
+ var _a, _b, _c, _d;
7158
7158
  const entity = params.entity;
7159
7159
  if (!params.entityHistoric) {
7160
7160
  params.entityHistoric = [];
@@ -7346,6 +7346,8 @@
7346
7346
  cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
7347
7347
  cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
7348
7348
  cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(exports.EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
7349
+ const 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;
7350
+ const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7349
7351
  if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
7350
7352
  animatePosition = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"];
7351
7353
  const animateSeries = animatePosition;
@@ -7353,8 +7355,6 @@
7353
7355
  if (series.length) {
7354
7356
  animateSeries.SupplementSeries(series);
7355
7357
  }
7356
- const 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;
7357
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7358
7358
  if (dateTime) {
7359
7359
  animateSeries.UpdatePositionForDateTime(pos3d, dateTime, !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading);
7360
7360
  }
@@ -7377,8 +7377,6 @@
7377
7377
  cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
7378
7378
  }
7379
7379
  else {
7380
- const dateTimeStr = (_d = (_c = entity.Bruce.Outline) === null || _c === void 0 ? void 0 : _c.find(x => !!x.DateTime)) === null || _d === void 0 ? void 0 : _d.DateTime;
7381
- const dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
7382
7380
  const posChanged = !prevPos3d || !Cesium.Cartesian3.equals(prevPos3d, pos3d);
7383
7381
  if (posChanged) {
7384
7382
  let posses = [];
@@ -7408,7 +7406,7 @@
7408
7406
  }
7409
7407
  }
7410
7408
  // If we're animating position then we can animate orientation too based on the interpolated position.
7411
- if (animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7409
+ if (dateTime && animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
7412
7410
  cEntity.orientation = new Cesium.CallbackProperty(() => {
7413
7411
  return animatePosition.GetOrient();
7414
7412
  }, false);
@@ -7553,7 +7551,7 @@
7553
7551
  // Generate a polyline 'track' for the historic data.
7554
7552
  // We do this for historic data that exists and is moving.
7555
7553
  if (shouldShowTrack && animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
7556
- const lStyle = (_f = (_e = params.fullStyle) === null || _e === void 0 ? void 0 : _e.polylineStyle) !== null && _f !== void 0 ? _f : {};
7554
+ const lStyle = (_d = (_c = params.fullStyle) === null || _c === void 0 ? void 0 : _c.polylineStyle) !== null && _d !== void 0 ? _d : {};
7557
7555
  const bColor = lStyle.lineColor ? BModels.Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
7558
7556
  const cColor = bColor ? ColorToCColor(bColor) : Cesium.Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
7559
7557
  let width = lStyle.lineWidth ? EnsureNumber(BModels.Calculator.GetNumber(lStyle.lineWidth, entity, params.tags)) : 2;
@@ -16837,11 +16835,12 @@
16837
16835
  }
16838
16836
  TilesetRenderEngine.OnTilesetReady = OnTilesetReady;
16839
16837
  function ApplyPosition(params) {
16840
- var _a;
16838
+ var _a, _b;
16841
16839
  const cTileset = params.cTileset;
16842
16840
  const root = cTileset.root;
16843
16841
  const position = params.position;
16844
- let location = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.location) ? position.ucs.location : position.location;
16842
+ const ucsTransform = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.transform) || {};
16843
+ let location = ((_b = position.ucs) === null || _b === void 0 ? void 0 : _b.location) ? position.ucs.location : position.location;
16845
16844
  let transform = position.transform;
16846
16845
  transform = {
16847
16846
  heading: 0,
@@ -16854,24 +16853,33 @@
16854
16853
  ...transform
16855
16854
  };
16856
16855
  transform.scale = EnsureNumber(transform.scale);
16857
- if (transform.scale <= 0) {
16858
- transform.scale = 0.000001;
16859
- }
16860
- // If we're in model-space we'll just go at 0,0 lat/lon and no h/p/r from the coords.
16856
+ // In model-space we focus on the UCS.
16857
+ // There's no location as we center the view around it.
16858
+ // TODO: although we should render the model relative to the UCS.
16861
16859
  if (params.modelSpace) {
16862
16860
  location = null;
16863
16861
  transform = {
16864
- heading: 0,
16865
- pitch: 0,
16866
- roll: 0,
16867
- scale: EnsureNumber(transform.scale, 1),
16868
- x: 0,
16869
- y: 0,
16870
- z: 0
16862
+ heading: EnsureNumber(ucsTransform.heading, 0),
16863
+ pitch: EnsureNumber(ucsTransform.pitch, 0),
16864
+ roll: EnsureNumber(ucsTransform.roll, 0),
16865
+ scale: EnsureNumber(ucsTransform.scale, 1),
16866
+ x: EnsureNumber(ucsTransform.x, 0),
16867
+ y: EnsureNumber(ucsTransform.y, 0),
16868
+ z: EnsureNumber(ucsTransform.z, 0)
16871
16869
  };
16872
- if (transform.scale <= 0) {
16873
- transform.scale = 0.000001;
16874
- }
16870
+ }
16871
+ // If not in model-space then scale/add UCS transform to the entity transform.
16872
+ else {
16873
+ transform.scale *= EnsureNumber(ucsTransform.scale, 1);
16874
+ transform.heading += EnsureNumber(ucsTransform.heading, 0);
16875
+ transform.pitch += EnsureNumber(ucsTransform.pitch, 0);
16876
+ transform.roll += EnsureNumber(ucsTransform.roll, 0);
16877
+ transform.x += EnsureNumber(ucsTransform.x, 0);
16878
+ transform.y += EnsureNumber(ucsTransform.y, 0);
16879
+ transform.z += EnsureNumber(ucsTransform.z, 0);
16880
+ }
16881
+ if (transform.scale <= 0) {
16882
+ transform.scale = 0.000001;
16875
16883
  }
16876
16884
  /**
16877
16885
  * Very cursed.
@@ -33654,7 +33662,7 @@
33654
33662
  }
33655
33663
  }
33656
33664
 
33657
- const VERSION = "6.1.5";
33665
+ const VERSION = "6.1.7";
33658
33666
 
33659
33667
  exports.VERSION = VERSION;
33660
33668
  exports.isOutlineChanged = isOutlineChanged;