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.
@@ -1,6 +1,6 @@
1
1
  import * as Cesium from 'cesium';
2
- 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, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, BoundingSphere, Intersect, CustomDataSource, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Bounds, Color as Color$1, Geometry, Carto, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, Entity, DistanceDisplayCondition, HeightReference, ColorBlendMode, Color, CallbackProperty, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, ConstantProperty, Cartesian3, ClassificationType, Model, ArcType, CornerType, ConstantPositionProperty, ColorMaterialProperty, Primitive, Cesium3DTileFeature, JulianDate, Quaternion, Matrix4, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, HorizontalOrigin, VerticalOrigin, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileset, Cesium3DTileColorBlendMode, BoundingSphere, Intersect, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, CustomDataSource, CesiumInspector, ClockRange, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry, Bounds, Color as Color$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Api, BruceEvent, EntityCoords, DataLab, DelayQueue, EntityHistoricData, BruceApi, EntityRelation, AccountConcept, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewTile, ProjectViewLegacyTile, Camera, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -6470,6 +6470,8 @@ function runCullChecker(register) {
6470
6470
  }
6471
6471
  const toRemove = [];
6472
6472
  const toAdd = [];
6473
+ // Entities the register has to re-evaluate, because the culler cannot restore a `show` it did not set.
6474
+ const toRefresh = new Set();
6473
6475
  const isIsolatedAny = register.GetIsIsolatedAny();
6474
6476
  const slice = entityIds.splice(0, CHECK_BATCH);
6475
6477
  for (let i = 0; i < slice.length; i++) {
@@ -6518,6 +6520,12 @@ function runCullChecker(register) {
6518
6520
  (!isIsolatedAny || state.isolated)) {
6519
6521
  toAdd.push(part);
6520
6522
  }
6523
+ else if (part.show === false &&
6524
+ rego.overrideShow != false &&
6525
+ !state.hidden &&
6526
+ (!isIsolatedAny || state.isolated)) {
6527
+ toRefresh.add(entityId);
6528
+ }
6521
6529
  }
6522
6530
  }
6523
6531
  }
@@ -6528,6 +6536,11 @@ function runCullChecker(register) {
6528
6536
  if (toAdd.length > 0) {
6529
6537
  addEntities(viewer, toAdd);
6530
6538
  }
6539
+ if (toRefresh.size > 0) {
6540
+ register.ForceUpdate({
6541
+ entityIds: Array.from(toRefresh)
6542
+ });
6543
+ }
6531
6544
  if (entityIds.length <= 0) {
6532
6545
  clearInterval(checkInterval);
6533
6546
  checkInterval = null;
@@ -6750,7 +6763,11 @@ var VisualRegisterCuller;
6750
6763
  return false;
6751
6764
  }
6752
6765
  if (visual instanceof Entity) {
6753
- return visual[VisualRegisterCuller.VISUAL_CULL_KEY] == true;
6766
+ if (visual[VisualRegisterCuller.VISUAL_CULL_KEY] != true) {
6767
+ return false;
6768
+ }
6769
+ // Invalidated, so the decision above was measured from geometry that no longer describes this.
6770
+ return boundingSphereCache.Get(visual.id) != null;
6754
6771
  }
6755
6772
  return false;
6756
6773
  }
@@ -34795,6 +34812,54 @@ var EntityUtils;
34795
34812
  });
34796
34813
  }
34797
34814
  EntityUtils.GetPosAsync = GetPosAsync;
34815
+ // Graphics that take a heightReference, and so get a cached terrain offset from Cesium.
34816
+ const GROUND_REFERENCED_GRAPHICS = ["ellipse", "polygon", "corridor", "rectangle", "box", "cylinder", "ellipsoid"];
34817
+ const HEIGHT_REFERENCE_KEYS = ["heightReference", "extrudedHeightReference"];
34818
+ /**
34819
+ * Makes a moved graphic sample the ground again at where it now is.
34820
+ *
34821
+ * Reassigning the height references touches an observed property, so the updater discards the stale offset
34822
+ * and builds a new one against the current position.
34823
+ * @returns whether anything was refreshed.
34824
+ */
34825
+ function RefreshGroundClamping(params) {
34826
+ var _a, _b;
34827
+ const { viewer, visual } = params;
34828
+ if (!viewer || ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer)) || !(visual instanceof Entity)) {
34829
+ return false;
34830
+ }
34831
+ const parts = GatherEntity({ entity: visual });
34832
+ let refreshed = false;
34833
+ for (let i = 0; i < parts.length; i++) {
34834
+ const part = parts[i];
34835
+ if (!(part instanceof Entity)) {
34836
+ continue;
34837
+ }
34838
+ for (let j = 0; j < GROUND_REFERENCED_GRAPHICS.length; j++) {
34839
+ const graphic = part[GROUND_REFERENCED_GRAPHICS[j]];
34840
+ if (!graphic) {
34841
+ continue;
34842
+ }
34843
+ for (let k = 0; k < HEIGHT_REFERENCE_KEYS.length; k++) {
34844
+ const key = HEIGHT_REFERENCE_KEYS[k];
34845
+ const current = GetValue$1(viewer, graphic[key]);
34846
+ // Nothing to resample for a graphic that does not follow the ground.
34847
+ if (current == null || current === HeightReference.NONE) {
34848
+ continue;
34849
+ }
34850
+ // A new property instance rather than the same value written back, since an equal value would
34851
+ // be dropped as a no-op and the updater would never hear about it.
34852
+ graphic[key] = new ConstantProperty(current);
34853
+ refreshed = true;
34854
+ }
34855
+ }
34856
+ }
34857
+ if (refreshed) {
34858
+ (_b = viewer.scene) === null || _b === void 0 ? void 0 : _b.requestRender();
34859
+ }
34860
+ return refreshed;
34861
+ }
34862
+ EntityUtils.RefreshGroundClamping = RefreshGroundClamping;
34798
34863
  /**
34799
34864
  * Returns entity and any associated parent/sibling entities as a flat array.
34800
34865
  * @param entity
@@ -34985,7 +35050,9 @@ var EntityUtils;
34985
35050
  viewer: params.viewer,
34986
35051
  createIfMissing: true
34987
35052
  });
34988
- const location = await EntityUtils.GetLocation({
35053
+ // A tileset-only fly-to has no entities to sample from, so there's nothing to resolve here.
35054
+ // The tileset's own bounding sphere is used further down instead.
35055
+ const location = (entityIds === null || entityIds === void 0 ? void 0 : entityIds.length) ? await EntityUtils.GetLocation({
34989
35056
  samples: entityIds.map((id) => ({
34990
35057
  entityId: id,
34991
35058
  entity: entityLookup.get(id),
@@ -34996,7 +35063,7 @@ var EntityUtils;
34996
35063
  visualRegister: manager.VisualsRegister,
34997
35064
  minimumAlt: params.minimumAlt,
34998
35065
  api: manager.Getters.GetBruceApi()
34999
- });
35066
+ }) : null;
35000
35067
  if (params.isCancelled && params.isCancelled()) {
35001
35068
  return;
35002
35069
  }
@@ -40502,7 +40569,7 @@ var StyleUtils;
40502
40569
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
40503
40570
  })(StyleUtils || (StyleUtils = {}));
40504
40571
 
40505
- const VERSION = "7.0.9";
40572
+ const VERSION = "7.1.0";
40506
40573
  /**
40507
40574
  * Updates the environment instance used by bruce-cesium to one specified.
40508
40575
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.