bruce-cesium 7.0.9 → 7.1.0

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.
@@ -6454,6 +6454,8 @@
6454
6454
  }
6455
6455
  const toRemove = [];
6456
6456
  const toAdd = [];
6457
+ // Entities the register has to re-evaluate, because the culler cannot restore a `show` it did not set.
6458
+ const toRefresh = new Set();
6457
6459
  const isIsolatedAny = register.GetIsIsolatedAny();
6458
6460
  const slice = entityIds.splice(0, CHECK_BATCH);
6459
6461
  for (let i = 0; i < slice.length; i++) {
@@ -6502,6 +6504,12 @@
6502
6504
  (!isIsolatedAny || state.isolated)) {
6503
6505
  toAdd.push(part);
6504
6506
  }
6507
+ else if (part.show === false &&
6508
+ rego.overrideShow != false &&
6509
+ !state.hidden &&
6510
+ (!isIsolatedAny || state.isolated)) {
6511
+ toRefresh.add(entityId);
6512
+ }
6505
6513
  }
6506
6514
  }
6507
6515
  }
@@ -6512,6 +6520,11 @@
6512
6520
  if (toAdd.length > 0) {
6513
6521
  addEntities(viewer, toAdd);
6514
6522
  }
6523
+ if (toRefresh.size > 0) {
6524
+ register.ForceUpdate({
6525
+ entityIds: Array.from(toRefresh)
6526
+ });
6527
+ }
6515
6528
  if (entityIds.length <= 0) {
6516
6529
  clearInterval(checkInterval);
6517
6530
  checkInterval = null;
@@ -6733,7 +6746,11 @@
6733
6746
  return false;
6734
6747
  }
6735
6748
  if (visual instanceof Cesium.Entity) {
6736
- return visual[VisualRegisterCuller.VISUAL_CULL_KEY] == true;
6749
+ if (visual[VisualRegisterCuller.VISUAL_CULL_KEY] != true) {
6750
+ return false;
6751
+ }
6752
+ // Invalidated, so the decision above was measured from geometry that no longer describes this.
6753
+ return boundingSphereCache.Get(visual.id) != null;
6737
6754
  }
6738
6755
  return false;
6739
6756
  }
@@ -34701,6 +34718,54 @@
34701
34718
  });
34702
34719
  }
34703
34720
  EntityUtils.GetPosAsync = GetPosAsync;
34721
+ // Graphics that take a heightReference, and so get a cached terrain offset from Cesium.
34722
+ const GROUND_REFERENCED_GRAPHICS = ["ellipse", "polygon", "corridor", "rectangle", "box", "cylinder", "ellipsoid"];
34723
+ const HEIGHT_REFERENCE_KEYS = ["heightReference", "extrudedHeightReference"];
34724
+ /**
34725
+ * Makes a moved graphic sample the ground again at where it now is.
34726
+ *
34727
+ * Reassigning the height references touches an observed property, so the updater discards the stale offset
34728
+ * and builds a new one against the current position.
34729
+ * @returns whether anything was refreshed.
34730
+ */
34731
+ function RefreshGroundClamping(params) {
34732
+ var _a, _b;
34733
+ const { viewer, visual } = params;
34734
+ if (!viewer || ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer)) || !(visual instanceof Cesium.Entity)) {
34735
+ return false;
34736
+ }
34737
+ const parts = GatherEntity({ entity: visual });
34738
+ let refreshed = false;
34739
+ for (let i = 0; i < parts.length; i++) {
34740
+ const part = parts[i];
34741
+ if (!(part instanceof Cesium.Entity)) {
34742
+ continue;
34743
+ }
34744
+ for (let j = 0; j < GROUND_REFERENCED_GRAPHICS.length; j++) {
34745
+ const graphic = part[GROUND_REFERENCED_GRAPHICS[j]];
34746
+ if (!graphic) {
34747
+ continue;
34748
+ }
34749
+ for (let k = 0; k < HEIGHT_REFERENCE_KEYS.length; k++) {
34750
+ const key = HEIGHT_REFERENCE_KEYS[k];
34751
+ const current = GetValue$1(viewer, graphic[key]);
34752
+ // Nothing to resample for a graphic that does not follow the ground.
34753
+ if (current == null || current === Cesium.HeightReference.NONE) {
34754
+ continue;
34755
+ }
34756
+ // A new property instance rather than the same value written back, since an equal value would
34757
+ // be dropped as a no-op and the updater would never hear about it.
34758
+ graphic[key] = new Cesium.ConstantProperty(current);
34759
+ refreshed = true;
34760
+ }
34761
+ }
34762
+ }
34763
+ if (refreshed) {
34764
+ (_b = viewer.scene) === null || _b === void 0 ? void 0 : _b.requestRender();
34765
+ }
34766
+ return refreshed;
34767
+ }
34768
+ EntityUtils.RefreshGroundClamping = RefreshGroundClamping;
34704
34769
  /**
34705
34770
  * Returns entity and any associated parent/sibling entities as a flat array.
34706
34771
  * @param entity
@@ -34891,7 +34956,9 @@
34891
34956
  viewer: params.viewer,
34892
34957
  createIfMissing: true
34893
34958
  });
34894
- const location = await EntityUtils.GetLocation({
34959
+ // A tileset-only fly-to has no entities to sample from, so there's nothing to resolve here.
34960
+ // The tileset's own bounding sphere is used further down instead.
34961
+ const location = (entityIds === null || entityIds === void 0 ? void 0 : entityIds.length) ? await EntityUtils.GetLocation({
34895
34962
  samples: entityIds.map((id) => ({
34896
34963
  entityId: id,
34897
34964
  entity: entityLookup.get(id),
@@ -34902,7 +34969,7 @@
34902
34969
  visualRegister: manager.VisualsRegister,
34903
34970
  minimumAlt: params.minimumAlt,
34904
34971
  api: manager.Getters.GetBruceApi()
34905
- });
34972
+ }) : null;
34906
34973
  if (params.isCancelled && params.isCancelled()) {
34907
34974
  return;
34908
34975
  }
@@ -40379,7 +40446,7 @@
40379
40446
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
40380
40447
  })(exports.StyleUtils || (exports.StyleUtils = {}));
40381
40448
 
40382
- const VERSION = "7.0.9";
40449
+ const VERSION = "7.1.0";
40383
40450
  /**
40384
40451
  * Updates the environment instance used by bruce-cesium to one specified.
40385
40452
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.