bruce-cesium 7.7.0 → 7.7.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, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ColorBlendMode, ShadowMode, ClassificationType, Model, 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, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, NearFarScalar, Matrix3, KmlDataSource, FeatureDetection, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Api, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, ProjectView, ProjectViewBookmark, ZoomControl, Assembly, EntityCoords, BruceApi, EntityRelation, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, EntityAttachment, EntityAttribute, MathUtils, ProjectViewBookmarkGroup } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, HeightReference, ColorBlendMode, HeadingPitchRoll, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, DistanceDisplayCondition, JulianDate, Quaternion, ArcType, CornerType, SceneMode, IntersectionTests, Ray, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, Matrix3, NearFarScalar, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, Intersect, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CustomDataSource, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, Carto, ProjectViewTile, EntityHistoricData, BruceEvent, DelayQueue, Entity as Entity$1, EntityTag, ClientFile, ENVIRONMENT, EntityAttachmentType, EntityRelationType, EntityType, Tileset, Calculator, DataLab, Style, ObjectUtils, MenuItem, AccountConcept, RecordChangeFeed, EntityLod, UrlUtils, Api, Geometry as Geometry$1, ClientFileValueMap, Color as Color$1, ProjectView, ProjectViewBookmark, ZoomControl, Bounds, Assembly, EntityCoords, BruceApi, EntityRelation, 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.
@@ -12307,6 +12307,15 @@ var VisualsRegister;
12307
12307
  }
12308
12308
  return this.onUpdate;
12309
12309
  }
12310
+ /**
12311
+ * Fires after one or more regos changed their resolved style through SetRegoStyle.
12312
+ */
12313
+ get OnStyleChange() {
12314
+ if (!this.onStyleChange) {
12315
+ this.onStyleChange = new BruceEvent();
12316
+ }
12317
+ return this.onStyleChange;
12318
+ }
12310
12319
  get OnLabelGroupsChanged() { return this.labelGroupsChanged; }
12311
12320
  constructor(params) {
12312
12321
  var _a, _b;
@@ -12333,6 +12342,14 @@ var VisualsRegister;
12333
12342
  this.lazyOverrideInterval = null;
12334
12343
  this.activeChunkedIntervals = new Set();
12335
12344
  this.onUpdate = null;
12345
+ // A scene restyle touches every rego, so restyles are reported once per window rather than per Entity.
12346
+ this.styleChangeQueue = new DelayQueue(() => {
12347
+ var _a;
12348
+ if (!this.disposed) {
12349
+ (_a = this.onStyleChange) === null || _a === void 0 ? void 0 : _a.Trigger();
12350
+ }
12351
+ }, 250);
12352
+ this.onStyleChange = null;
12336
12353
  // Entity ID -> Menu Item ID -> State.
12337
12354
  // When no Menu Item ID is set, then the second key is a blank string.
12338
12355
  // If an Entity ID state is set without a Menu Item ID, then it acts as a default for all Menu Items.
@@ -13346,6 +13363,7 @@ var VisualsRegister;
13346
13363
  clearInterval(interval);
13347
13364
  }
13348
13365
  this.activeChunkedIntervals.clear();
13366
+ this.styleChangeQueue.Dispose();
13349
13367
  this.disposed = true;
13350
13368
  for (const record of Array.from(this.menuItemSources.values())) {
13351
13369
  try {
@@ -14716,6 +14734,19 @@ var VisualsRegister;
14716
14734
  }
14717
14735
  }
14718
14736
  }
14737
+ /**
14738
+ * Records the style a rego resolved to, and queues OnStyleChange when that moved.
14739
+ * Assigned outright, so a restyle that traces nothing clears the old key.
14740
+ */
14741
+ SetRegoStyle(params) {
14742
+ const { rego, styleId, styleEffective } = params;
14743
+ if (rego.styleId === styleId && rego.styleEffective === styleEffective) {
14744
+ return;
14745
+ }
14746
+ rego.styleId = styleId;
14747
+ rego.styleEffective = styleEffective;
14748
+ this.styleChangeQueue.Call();
14749
+ }
14719
14750
  async updateAllEntities(params) {
14720
14751
  this.syncDimming();
14721
14752
  const ids = Object.keys(this.rego);
@@ -16104,11 +16135,13 @@ class TilesetStyler {
16104
16135
  override: override
16105
16136
  });
16106
16137
  this.overrideFeatureColor.set(rego.entityId, true);
16107
- // Assigned outright, so a restyle that traces nothing clears the old key.
16108
- rego.styleId = resolvedStyleId !== null && resolvedStyleId !== void 0 ? resolvedStyleId : undefined;
16109
- rego.styleEffective = (_b = StyleEffective.Combine([
16110
- { key: "color", effective: fillColorTrace.effective }
16111
- ])) !== null && _b !== void 0 ? _b : undefined;
16138
+ this.register.SetRegoStyle({
16139
+ rego,
16140
+ styleId: resolvedStyleId !== null && resolvedStyleId !== void 0 ? resolvedStyleId : undefined,
16141
+ styleEffective: (_b = StyleEffective.Combine([
16142
+ { key: "color", effective: fillColorTrace.effective }
16143
+ ])) !== null && _b !== void 0 ? _b : undefined
16144
+ });
16112
16145
  }
16113
16146
  if (((_c = data === null || data === void 0 ? void 0 : data.Bruce) === null || _c === void 0 ? void 0 : _c.InternalID) != null) {
16114
16147
  rego.internalId = data.Bruce.InternalID;
@@ -20625,9 +20658,11 @@ var EntitiesRenderManager;
20625
20658
  rego.schema = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.Schema;
20626
20659
  rego.canEdit = canEdit;
20627
20660
  rego.internalId = (_k = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.InternalID) !== null && _k !== void 0 ? _k : rego.internalId;
20628
- // Assigned outright, so a restyle that traces nothing clears the old key.
20629
- rego.styleId = cEntity.styleId;
20630
- rego.styleEffective = cEntity.styleEffective;
20661
+ this.visualsManager.SetRegoStyle({
20662
+ rego,
20663
+ styleId: cEntity.styleId,
20664
+ styleEffective: cEntity.styleEffective
20665
+ });
20631
20666
  // Marked as stale meaning some change was performed that requires a refresh.
20632
20667
  // This usually means a new sibling was added that we need to update.
20633
20668
  if (rego.stale) {
@@ -21643,8 +21678,11 @@ var EntitiesLoadedRenderManager;
21643
21678
  else if (updated.get(id) && rego) {
21644
21679
  rego.visual = cEntity;
21645
21680
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
21646
- rego.styleId = cEntity.styleId;
21647
- rego.styleEffective = cEntity.styleEffective;
21681
+ this.visualsManager.SetRegoStyle({
21682
+ rego,
21683
+ styleId: cEntity.styleId,
21684
+ styleEffective: cEntity.styleEffective
21685
+ });
21648
21686
  rego.name = cEntity.name;
21649
21687
  // We manually trigger an update event since the graphic was updated but not recreated.
21650
21688
  this.visualsManager.OnUpdate.Trigger({
@@ -22106,8 +22144,11 @@ var EntitiesIdsRenderManager;
22106
22144
  else if (updated.get(id) && rego) {
22107
22145
  rego.visual = cEntity;
22108
22146
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
22109
- rego.styleId = cEntity.styleId;
22110
- rego.styleEffective = cEntity.styleEffective;
22147
+ this.visualsManager.SetRegoStyle({
22148
+ rego,
22149
+ styleId: cEntity.styleId,
22150
+ styleEffective: cEntity.styleEffective
22151
+ });
22111
22152
  rego.name = cEntity.name;
22112
22153
  // We manually trigger an update event since the graphic was updated but not recreated.
22113
22154
  this.visualsManager.OnUpdate.Trigger({
@@ -22391,8 +22432,11 @@ var EntityRenderManager;
22391
22432
  else if (updated.get(id) && rego) {
22392
22433
  rego.visual = cEntity;
22393
22434
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
22394
- rego.styleId = cEntity.styleId;
22395
- rego.styleEffective = cEntity.styleEffective;
22435
+ this.visualsManager.SetRegoStyle({
22436
+ rego,
22437
+ styleId: cEntity.styleId,
22438
+ styleEffective: cEntity.styleEffective
22439
+ });
22396
22440
  rego.name = cEntity.name;
22397
22441
  // We manually trigger an update event since the graphic was updated but not recreated.
22398
22442
  this.visualsManager.OnUpdate.Trigger({
@@ -25786,8 +25830,11 @@ var DataLabRenderManager;
25786
25830
  rego.name = cEntity.name;
25787
25831
  rego.visual = cEntity;
25788
25832
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
25789
- rego.styleId = cEntity.styleId;
25790
- rego.styleEffective = cEntity.styleEffective;
25833
+ this.visualsManager.SetRegoStyle({
25834
+ rego,
25835
+ styleId: cEntity.styleId,
25836
+ styleEffective: cEntity.styleEffective
25837
+ });
25791
25838
  rego.tagIds = entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [];
25792
25839
  rego.outline = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.Outline;
25793
25840
  rego.cdn = this.item.cdnEnabled;
@@ -57120,7 +57167,7 @@ var StyleUtils;
57120
57167
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
57121
57168
  })(StyleUtils || (StyleUtils = {}));
57122
57169
 
57123
- const VERSION = "7.7.0";
57170
+ const VERSION = "7.7.1";
57124
57171
  /**
57125
57172
  * Updates the environment instance used by bruce-cesium to one specified.
57126
57173
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.