bruce-cesium 7.8.9 → 7.9.1

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, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, Cartesian3, Model, ClassificationType, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ArcType, CornerType, JulianDate, Quaternion, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, FeatureDetection, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, WebGLConstants, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, ClockRange, ShadowMode, DynamicEnvironmentMapManager, GeometryInstance, PrimitiveCollection, PolylineCollection, LabelCollection, LabelStyle, Material, CustomDataSource, Event, CameraEventType, Plane, OrientedBoundingBox, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Geometry as Geometry$1, Api, Bounds, ClientFileValueMap, Color as Color$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, EntityRelation, BruceApi, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttribute, MathUtils } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, HeightReference, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ConstantPositionProperty, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ColorBlendMode, Model, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, HorizontalOrigin, VerticalOrigin, NearFarScalar, Matrix3, KmlDataSource, FeatureDetection, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, WebGLConstants, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PrimitiveCollection, ShadowMode, PolylineCollection, LabelCollection, LabelStyle, Material, CustomDataSource, GeometryInstance, Event, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, ScreenSpaceEventHandler, ScreenSpaceEventType, CameraEventType, Plane, OrientedBoundingBox, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, PathUtils, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, Geometry as Geometry$1, EntityLod, UrlUtils, Bounds, ClientFileValueMap, Color as Color$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, Api, EntityRelation, BruceApi, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -11116,7 +11116,7 @@ var EntityLabel;
11116
11116
  * If one exists then the action is ignored.
11117
11117
  */
11118
11118
  function Attach(params) {
11119
- var _a, _b, _c;
11119
+ var _a, _b, _c, _d;
11120
11120
  const { rego, viewer, pos3d, visualRegister, api, options, groupId } = params;
11121
11121
  if (!rego || !viewer) {
11122
11122
  return;
@@ -11127,8 +11127,8 @@ var EntityLabel;
11127
11127
  return Attach({
11128
11128
  ...params,
11129
11129
  pos3d: undefined,
11130
- options: (_a = group === null || group === void 0 ? void 0 : group.options) !== null && _a !== void 0 ? _a : options,
11131
- groupId: (_b = group === null || group === void 0 ? void 0 : group.groupId) !== null && _b !== void 0 ? _b : groupId,
11130
+ options: group ? group.options : (_b = (_a = visualRegister.GetLabelDefaults) === null || _a === void 0 ? void 0 : _a.call(visualRegister)) !== null && _b !== void 0 ? _b : options,
11131
+ groupId: (_c = group === null || group === void 0 ? void 0 : group.groupId) !== null && _c !== void 0 ? _c : groupId,
11132
11132
  persistent: true
11133
11133
  });
11134
11134
  }
@@ -11138,7 +11138,7 @@ var EntityLabel;
11138
11138
  if (rego[EntityLabel.ATTACH_KEY].Persistent && params.persistent !== true && !groupId) {
11139
11139
  return rego[EntityLabel.ATTACH_KEY];
11140
11140
  }
11141
- rego[EntityLabel.ATTACH_KEY].Persistent = (_c = params.persistent) !== null && _c !== void 0 ? _c : Boolean(groupId);
11141
+ rego[EntityLabel.ATTACH_KEY].Persistent = (_d = params.persistent) !== null && _d !== void 0 ? _d : Boolean(groupId);
11142
11142
  rego[EntityLabel.ATTACH_KEY].Configure(options, groupId);
11143
11143
  return rego[EntityLabel.ATTACH_KEY];
11144
11144
  }
@@ -13851,7 +13851,7 @@ function updateEntity(viewer, entityId, register, refresh, cache = {}) {
13851
13851
  viewer,
13852
13852
  api: (_b = register.ApiGetters) === null || _b === void 0 ? void 0 : _b.GetBruceApi(),
13853
13853
  visualRegister: register,
13854
- options: labelGroup === null || labelGroup === void 0 ? void 0 : labelGroup.options,
13854
+ options: labelGroup ? labelGroup.options : register.GetLabelDefaults(),
13855
13855
  groupId: labelGroup === null || labelGroup === void 0 ? void 0 : labelGroup.groupId,
13856
13856
  persistent: true
13857
13857
  });
@@ -14038,6 +14038,8 @@ var VisualsRegister;
14038
14038
  this.menuItemSources = new Map();
14039
14039
  // Set when the data source order no longer matches the zIndexes seen, so it is re-applied once.
14040
14040
  this.sourceOrderDirty = false;
14041
+ // The look of labelled Entities no label group holds.
14042
+ this.labelDefaults = null;
14041
14043
  // Stops following what is simulated, so labels can read it again when it changes.
14042
14044
  this.simulationRemoval = null;
14043
14045
  this.shadowsRemoval = null;
@@ -16892,6 +16894,25 @@ var VisualsRegister;
16892
16894
  var _a;
16893
16895
  return (_a = this.labelGroups) === null || _a === void 0 ? void 0 : _a.Resolve(entityId, menuItemId);
16894
16896
  }
16897
+ /*
16898
+ * How a labelled Entity in no label group is drawn, such as an account's default look; null draws plain text.
16899
+ */
16900
+ SetLabelDefaults(options) {
16901
+ if (this.disposed) {
16902
+ return;
16903
+ }
16904
+ const next = options ? { ...options } : null;
16905
+ if (JSON.stringify(next) === JSON.stringify(this.labelDefaults)) {
16906
+ return;
16907
+ }
16908
+ this.labelDefaults = next;
16909
+ for (const entityId of this.GetLabelled()) {
16910
+ this.queueUpdate({ entityId, refresh: false });
16911
+ }
16912
+ }
16913
+ GetLabelDefaults() {
16914
+ return this.labelDefaults ? { ...this.labelDefaults } : null;
16915
+ }
16895
16916
  /*
16896
16917
  * Called by a group label once it is on screen, so its entity's default image is read only when it can be seen.
16897
16918
  */
@@ -18658,11 +18679,20 @@ var TilesetRenderEngine;
18658
18679
  TilesetRenderEngine.ApplyPosition = ApplyPosition;
18659
18680
  // Eye dome lighting strength that keeps depth readable as soft grey edges, tuned on a coloured scan in November 2026.
18660
18681
  TilesetRenderEngine.POINT_OUTLINE_STRENGTH = 0.02;
18682
+ /*
18683
+ * Returns a positive maximum point size, since a stored 0 or null shrinks every point to nothing.
18684
+ */
18685
+ function GetMaximumAttenuation(value, fallback) {
18686
+ const size = value == null ? NaN : Number(value);
18687
+ return size > 0 ? size : fallback;
18688
+ }
18689
+ TilesetRenderEngine.GetMaximumAttenuation = GetMaximumAttenuation;
18661
18690
  function ApplySettings(params) {
18662
18691
  const { cTileset, settings } = params;
18663
18692
  cTileset.maximumScreenSpaceError = EnsureNumber(settings.maxScreenSpaceError, 5);
18664
18693
  cTileset.pointCloudShading.attenuation = Boolean(settings.attenuation);
18665
- cTileset.pointCloudShading.maximumAttenuation = EnsureNumber(settings.maximumAttenuation, 4);
18694
+ const maximumAttenuation = GetMaximumAttenuation(settings.maximumAttenuation, 4);
18695
+ cTileset.pointCloudShading.maximumAttenuation = maximumAttenuation;
18666
18696
  // Cesium's eye dome lighting is the point outline, at its default strength of 1 they render black.
18667
18697
  cTileset.pointCloudShading.eyeDomeLighting = settings.pointOutlines !== false;
18668
18698
  cTileset.pointCloudShading.eyeDomeLightingStrength = TilesetRenderEngine.POINT_OUTLINE_STRENGTH;
@@ -18673,7 +18703,8 @@ var TilesetRenderEngine;
18673
18703
  }
18674
18704
  const cTilesetExt = cTileset;
18675
18705
  cTilesetExt._bruceSettings = {
18676
- ...settings
18706
+ ...settings,
18707
+ maximumAttenuation
18677
18708
  };
18678
18709
  }
18679
18710
  TilesetRenderEngine.ApplySettings = ApplySettings;
@@ -29526,10 +29557,7 @@ var TilesetEntitiesRenderManager;
29526
29557
  if (!attenuation && attenuation != false) {
29527
29558
  attenuation = true;
29528
29559
  }
29529
- let attenuationMax = this.item.attenuationMax;
29530
- if (isNaN(attenuationMax)) {
29531
- attenuationMax = 20;
29532
- }
29560
+ const attenuationMax = TilesetRenderEngine.GetMaximumAttenuation(this.item.attenuationMax, 20);
29533
29561
  TilesetRenderEngine.OnTilesetReady(this.cTileset).then(() => {
29534
29562
  TilesetRenderEngine.ApplySettings({
29535
29563
  cTileset: this.cTileset,
@@ -29899,10 +29927,7 @@ var TilesetEntitiesRenderManager;
29899
29927
  if (!attenuation && attenuation != false) {
29900
29928
  attenuation = true;
29901
29929
  }
29902
- let attenuationMax = this.item.attenuationMax;
29903
- if (isNaN(attenuationMax)) {
29904
- attenuationMax = 20;
29905
- }
29930
+ const attenuationMax = TilesetRenderEngine.GetMaximumAttenuation(this.item.attenuationMax, 20);
29906
29931
  TilesetRenderEngine.ApplySettings({
29907
29932
  cTileset: this.cTileset,
29908
29933
  settings: {
@@ -61271,7 +61296,7 @@ var StyleUtils;
61271
61296
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
61272
61297
  })(StyleUtils || (StyleUtils = {}));
61273
61298
 
61274
- const VERSION = "7.8.9";
61299
+ const VERSION = "7.9.1";
61275
61300
  /**
61276
61301
  * Updates the environment instance used by bruce-cesium to one specified.
61277
61302
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.