bruce-cesium 5.8.2 → 5.8.4

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.
@@ -3440,6 +3440,9 @@
3440
3440
  latestDate = historicDetails.DateTime;
3441
3441
  }
3442
3442
  }
3443
+ // Hacky lookup for Entity ID -> related Tileset coords that are currently active.
3444
+ // This helps find ones that are modified due to being historic/moving and apply an Entity's local movement against them.
3445
+ const entityIdTilesetCoords = new Map();
3443
3446
  const data = {
3444
3447
  pos3d: null,
3445
3448
  rectangle: null,
@@ -3523,7 +3526,7 @@
3523
3526
  * Returns an array of positions from the entity's currently rendered graphics.
3524
3527
  */
3525
3528
  const evaluateRendered = async () => {
3526
- var _a, _b, _c;
3529
+ var _a, _b;
3527
3530
  const rego = visualRegister ? visualRegister.GetRego({
3528
3531
  entityId: sample.entityId,
3529
3532
  menuItemId: sample.menuItemId
@@ -3546,19 +3549,26 @@
3546
3549
  // Get the Tileset.
3547
3550
  const tileset = rego.visual.tileset;
3548
3551
  if (tileset === null || tileset === void 0 ? void 0 : tileset._bruceCoords) {
3552
+ // Record so we can use it during record evaluation instead of rendered evaluation.
3553
+ entityIdTilesetCoords.set(entityId, tileset._bruceCoords);
3554
+ return [];
3549
3555
  // The render logic currently swaps out the UCS location when the assembly is moving.
3550
- const location = (_c = tileset._bruceCoords.ucs) === null || _c === void 0 ? void 0 : _c.location;
3551
- if (location) {
3552
- const latitude = EnsureNumber(location.latitude);
3553
- const longitude = EnsureNumber(location.longitude);
3554
- // Disallowing 0.
3555
- if (latitude && longitude) {
3556
- const pos3d = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3557
- const toAdjust = [pos3d];
3558
- await ensureHeightRefs(toAdjust, sample);
3559
- return toAdjust;
3560
- }
3561
- }
3556
+ // const location = tileset._bruceCoords.ucs?.location;
3557
+ // if (location) {
3558
+ // const latitude = EnsureNumber(location.latitude);
3559
+ // const longitude = EnsureNumber(location.longitude);
3560
+ // // Disallowing 0.
3561
+ // if (latitude && longitude) {
3562
+ // const pos3d = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3563
+ // console.log("using tileset pos3d for historic entity", {
3564
+ // pos3d: pos3d,
3565
+ // entity:
3566
+ // })
3567
+ // const toAdjust = [pos3d];
3568
+ // await ensureHeightRefs(toAdjust, sample);
3569
+ // return toAdjust;
3570
+ // }
3571
+ // }
3562
3572
  }
3563
3573
  }
3564
3574
  let posses = [];
@@ -3710,7 +3720,7 @@
3710
3720
  * @param sample
3711
3721
  */
3712
3722
  const getRecordEntityPositions = async (sample) => {
3713
- var _a, _b, _c;
3723
+ var _a, _b, _c, _d;
3714
3724
  let { entityId, entity, disallowRendered } = sample;
3715
3725
  const isAssemblyEntity = ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyRootLocation) != null;
3716
3726
  /**
@@ -3790,6 +3800,74 @@
3790
3800
  return posses;
3791
3801
  };
3792
3802
  if (isAssemblyEntity) {
3803
+ // See if we have tileset coords to use.
3804
+ // This means we have to hack fly-to for a historic/moving assembly.
3805
+ {
3806
+ const tCoords = entityIdTilesetCoords.get(entityId);
3807
+ const location = (_b = tCoords === null || tCoords === void 0 ? void 0 : tCoords.ucs) === null || _b === void 0 ? void 0 : _b.location;
3808
+ if (tCoords && location) {
3809
+ const latitude = EnsureNumber(location.latitude);
3810
+ const longitude = EnsureNumber(location.longitude);
3811
+ if (latitude && longitude) {
3812
+ const worldPosition = entity.Bruce.AssemblyWorldPosition;
3813
+ if (worldPosition) {
3814
+ const offset = new Cesium.Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
3815
+ const transform = tCoords.transform;
3816
+ let heading = 0;
3817
+ if (+transform.heading) {
3818
+ heading = +transform.heading;
3819
+ }
3820
+ let pitch = 0;
3821
+ if (+transform.pitch) {
3822
+ pitch = +transform.pitch;
3823
+ }
3824
+ let roll = 0;
3825
+ if (+transform.roll) {
3826
+ roll = +transform.roll;
3827
+ }
3828
+ let pos3d = Cesium.Cartesian3.fromDegrees(EnsureNumber(longitude), EnsureNumber(latitude), EnsureNumber(location.altitude));
3829
+ const m1 = Cesium.Transforms.eastNorthUpToFixedFrame(pos3d);
3830
+ const hpr = Cesium.HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new Cesium.HeadingPitchRoll());
3831
+ const transformHpr = Cesium.Matrix3.fromHeadingPitchRoll(hpr);
3832
+ const transformedOffset = Cesium.Matrix3.multiplyByVector(transformHpr, offset, new Cesium.Cartesian3());
3833
+ pos3d = Cesium.Matrix4.multiplyByPoint(m1, transformedOffset, new Cesium.Cartesian3());
3834
+ pos3d = await processPosHeight(pos3d, Cesium.HeightReference.NONE);
3835
+ const geometryRadius = BModels.Entity.GetValue({
3836
+ entity: entity,
3837
+ path: ["Bruce", "GeometryRadius"]
3838
+ });
3839
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3840
+ const sphere = Cesium.BoundingSphere.fromPoints([pos3d]);
3841
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3842
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3843
+ sphere.radius = geometryRadius;
3844
+ spheres.push(sphere);
3845
+ }
3846
+ }
3847
+ return [pos3d];
3848
+ }
3849
+ else {
3850
+ if (location) {
3851
+ let pos3d = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3852
+ pos3d = await processPosHeight(pos3d, Cesium.HeightReference.NONE);
3853
+ const geometryRadius = BModels.Entity.GetValue({
3854
+ entity: entity,
3855
+ path: ["Bruce", "GeometryRadius"]
3856
+ });
3857
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3858
+ const sphere = Cesium.BoundingSphere.fromPoints([pos3d]);
3859
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3860
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3861
+ sphere.radius = geometryRadius;
3862
+ spheres.push(sphere);
3863
+ }
3864
+ }
3865
+ return [pos3d];
3866
+ }
3867
+ }
3868
+ }
3869
+ }
3870
+ }
3793
3871
  let pos3d = null;
3794
3872
  if (modelSpace) {
3795
3873
  pos3d = calcEntityLocation(entity, modelSpace);
@@ -3799,7 +3877,7 @@
3799
3877
  entity: entity,
3800
3878
  path: ["Bruce", "Location"]
3801
3879
  });
3802
- if (eLocation != null && ((_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootLocation) != null) {
3880
+ if (eLocation != null && ((_c = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyRootLocation) != null) {
3803
3881
  pos3d = Cesium.Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3804
3882
  }
3805
3883
  }
@@ -3830,7 +3908,7 @@
3830
3908
  entity: entity,
3831
3909
  path: ["Bruce", "Location"]
3832
3910
  });
3833
- if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_c = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyRootLocation) != null) {
3911
+ if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_d = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _d === void 0 ? void 0 : _d.AssemblyRootLocation) != null) {
3834
3912
  pos3d = Cesium.Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3835
3913
  if (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x) {
3836
3914
  pos3d = await processPosHeight(pos3d, Cesium.HeightReference.NONE);
@@ -11756,7 +11834,8 @@
11756
11834
  entityId: rego.entityId,
11757
11835
  menuItemId: rego.menuItemId,
11758
11836
  doUpdate: false,
11759
- requestRender: false
11837
+ requestRender: false,
11838
+ source: "add-rego-replace"
11760
11839
  });
11761
11840
  }
11762
11841
  const entityId = rego.entityId;
@@ -13119,13 +13198,15 @@
13119
13198
  if (shouldRender) {
13120
13199
  this.visualsManager.RemoveRegos({
13121
13200
  menuItemId: this.item.id,
13122
- retainTagIds: tagsToRender
13201
+ retainTagIds: tagsToRender,
13202
+ source: "entities-tag-filter"
13123
13203
  });
13124
13204
  (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
13125
13205
  }
13126
13206
  else {
13127
13207
  this.visualsManager.RemoveRegos({
13128
- menuItemId: this.item.id
13208
+ menuItemId: this.item.id,
13209
+ source: "entities-disabled"
13129
13210
  });
13130
13211
  (_k = this.clustering) === null || _k === void 0 ? void 0 : _k.Dispose();
13131
13212
  return;
@@ -13266,7 +13347,8 @@
13266
13347
  this.unsetGetter();
13267
13348
  this.disposed = true;
13268
13349
  this.visualsManager.RemoveRegos({
13269
- menuItemId: this.item.id
13350
+ menuItemId: this.item.id,
13351
+ source: "entities-dispose"
13270
13352
  });
13271
13353
  (_a = this.entityCheckRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
13272
13354
  (_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
@@ -14144,7 +14226,8 @@
14144
14226
  }
14145
14227
  this.visualsManager.RemoveRegos({
14146
14228
  entityId: x,
14147
- menuItemId: this.item.id
14229
+ menuItemId: this.item.id,
14230
+ source: "entities-loaded-remove"
14148
14231
  });
14149
14232
  this.renderedEntities[x] = false;
14150
14233
  });
@@ -14160,7 +14243,8 @@
14160
14243
  }
14161
14244
  this.item.BruceEntity.Entities = [];
14162
14245
  this.visualsManager.RemoveRegos({
14163
- menuItemId: this.item.id
14246
+ menuItemId: this.item.id,
14247
+ source: "entities-loaded-clear"
14164
14248
  });
14165
14249
  this.renderedEntities = {};
14166
14250
  this.recreateGetter();
@@ -14224,7 +14308,8 @@
14224
14308
  this.getterSub = null;
14225
14309
  this.disposed = true;
14226
14310
  this.visualsManager.RemoveRegos({
14227
- menuItemId: this.item.id
14311
+ menuItemId: this.item.id,
14312
+ source: "entities-loaded-dispose"
14228
14313
  });
14229
14314
  for (let i = 0; i < this.sources.length; i++) {
14230
14315
  const source = this.sources[i];
@@ -18325,7 +18410,8 @@
18325
18410
  entityId: rego.entityId,
18326
18411
  requestRender: false,
18327
18412
  menuItemId: this.item.id,
18328
- doRemove: false
18413
+ doRemove: false,
18414
+ source: "tileset-dispose"
18329
18415
  });
18330
18416
  // Might have to do something smarter since siblings could still be OK.
18331
18417
  this.loadedCesiumEntities[rego.entityId] = null;
@@ -18419,7 +18505,8 @@
18419
18505
  (_b = this.styler) === null || _b === void 0 ? void 0 : _b.Dispose();
18420
18506
  this.visualsManager.RemoveRegos({
18421
18507
  menuItemId: this.item.id,
18422
- doRemove: false
18508
+ doRemove: false,
18509
+ source: "tileset-dispose"
18423
18510
  });
18424
18511
  this.viewerDateTimeDispose();
18425
18512
  }
@@ -18910,7 +18997,8 @@
18910
18997
  this.cTileset = null;
18911
18998
  }
18912
18999
  this.visualsManager.RemoveRegos({
18913
- menuItemId: this.item.id
19000
+ menuItemId: this.item.id,
19001
+ source: "osm-tileset-dispose"
18914
19002
  });
18915
19003
  this.featureQueue = [];
18916
19004
  }
@@ -20088,7 +20176,8 @@
20088
20176
  relation: rego.relation,
20089
20177
  entityId: rego.entityId,
20090
20178
  menuItemId: this.item.id,
20091
- requestRender: false
20179
+ requestRender: false,
20180
+ source: "relations-filter"
20092
20181
  });
20093
20182
  }
20094
20183
  }
@@ -20135,7 +20224,8 @@
20135
20224
  }
20136
20225
  this.disposed = true;
20137
20226
  this.register.RemoveRegos({
20138
- menuItemId: this.item.id
20227
+ menuItemId: this.item.id,
20228
+ source: "relations-dispose"
20139
20229
  });
20140
20230
  }
20141
20231
  /**
@@ -20396,7 +20486,7 @@
20396
20486
  menuItemId: this.item.id,
20397
20487
  relation: relation,
20398
20488
  requestRender: false,
20399
- doUpdate: true
20489
+ source: "relations-filter"
20400
20490
  });
20401
20491
  }
20402
20492
  const key = RelationRenderEngine.GetRenderGroupId(relation);
@@ -32218,7 +32308,7 @@
32218
32308
  }
32219
32309
  }
32220
32310
 
32221
- const VERSION = "5.8.2";
32311
+ const VERSION = "5.8.4";
32222
32312
 
32223
32313
  exports.VERSION = VERSION;
32224
32314
  exports.isOutlineChanged = isOutlineChanged;