bruce-cesium 4.8.1 → 4.8.2

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 { BruceEvent, Cartes, Entity as Entity$1, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttribute, EntityAttachment, EntityAttachmentType } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, Matrix4, Matrix3, IonResource, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, Quaternion, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15160,6 +15160,10 @@ var TilesetRenderEngine;
15160
15160
  // This is used to determine if the Style colour needs to be overriden or not.
15161
15161
  this.styledEntityIds = {};
15162
15162
  this.scenario = 0;
15163
+ // More expensive process.
15164
+ // When an Entity is styled, the rego is reviewed and updated if needed.
15165
+ // This is currently used for scenarios, and off by default to keep other processes faster.
15166
+ this.shouldUpdateRegoStates = false;
15163
15167
  this.runningQueues = 0;
15164
15168
  this.recordLoadQueue = [];
15165
15169
  this.recordCheckQueue = [];
@@ -15225,6 +15229,9 @@ var TilesetRenderEngine;
15225
15229
  if (scenario != null) {
15226
15230
  this.scenario = scenario;
15227
15231
  }
15232
+ if (!!scenario) {
15233
+ this.shouldUpdateRegoStates = true;
15234
+ }
15228
15235
  this.loadStyles();
15229
15236
  this.loaded = true;
15230
15237
  };
@@ -15265,6 +15272,9 @@ var TilesetRenderEngine;
15265
15272
  }
15266
15273
  if (params.scenario != null) {
15267
15274
  this.scenario = params.scenario;
15275
+ if (!this.shouldUpdateRegoStates && !!this.scenario) {
15276
+ this.shouldUpdateRegoStates = true;
15277
+ }
15268
15278
  }
15269
15279
  if (this.loaded) {
15270
15280
  // Empty queues.
@@ -15724,7 +15734,7 @@ var TilesetRenderEngine;
15724
15734
  this.styleTilesetFeatureFullData(entity, null, []);
15725
15735
  };
15726
15736
  Styler.prototype.styleTilesetFeatureFullData = function (entity, data, tags) {
15727
- var _a;
15737
+ var _a, _b, _c, _d;
15728
15738
  var visual = entity.visual;
15729
15739
  if (!visual || !(visual instanceof Cesium3DTileFeature)) {
15730
15740
  return;
@@ -15738,14 +15748,38 @@ var TilesetRenderEngine;
15738
15748
  else {
15739
15749
  cColor = colorToCColor$4(bColor);
15740
15750
  }
15751
+ var override = this.styledEntityIds[entity.entityId] == true;
15741
15752
  CesiumEntityStyler.SetDefaultColor({
15742
15753
  color: cColor,
15743
15754
  entity: visual,
15744
15755
  viewer: this.viewer,
15745
- override: this.styledEntityIds[entity.entityId] == true
15756
+ override: override
15746
15757
  });
15747
15758
  this.styledEntityIds[entity.entityId] = true;
15748
15759
  this.updateStyleProgress();
15760
+ // Since we only need to update it for scenarios right now.
15761
+ // We'll avoid doing it if not needed, eg: first render and no scenario (same state as default).
15762
+ if (this.shouldUpdateRegoStates && (override || ((_b = data === null || data === void 0 ? void 0 : data.Bruce) === null || _b === void 0 ? void 0 : _b.Scenario))) {
15763
+ // Update the Entity's rego state.
15764
+ var rego = this.getEntityRego(entity.entityId);
15765
+ if (rego) {
15766
+ var changed = false;
15767
+ // Changed scenario.
15768
+ if (rego.scenario != ((_c = data === null || data === void 0 ? void 0 : data.Bruce) === null || _c === void 0 ? void 0 : _c.Scenario)) {
15769
+ rego.scenario = (_d = data === null || data === void 0 ? void 0 : data.Bruce) === null || _d === void 0 ? void 0 : _d.Scenario;
15770
+ changed = true;
15771
+ }
15772
+ // Something changed, trigger a rego update.
15773
+ // This lets UI know when the rego has changed.
15774
+ if (changed) {
15775
+ this.register.OnUpdate.Trigger({
15776
+ type: VisualsRegister.EVisualUpdateType.Update,
15777
+ entityId: entity.entityId,
15778
+ rego: rego
15779
+ });
15780
+ }
15781
+ }
15782
+ }
15749
15783
  };
15750
15784
  Styler.prototype.getTilesetFeatureStyle = function (entityId, entityTypeId) {
15751
15785
  var _a, _b, _c, _d;
@@ -16040,7 +16074,7 @@ var TilesetCadRenderManager;
16040
16074
  */
16041
16075
  Manager.prototype.mapTilesetFeature = function (feature, add) {
16042
16076
  var _this = this;
16043
- var _a, _b, _c, _d, _e, _f;
16077
+ var _a, _b, _c, _d, _e;
16044
16078
  var rego = {
16045
16079
  entityId: null,
16046
16080
  entityTypeId: null,
@@ -16052,12 +16086,10 @@ var TilesetCadRenderManager;
16052
16086
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
16053
16087
  tilesetType: Tileset.EType.Cad,
16054
16088
  rootId: this.rootId,
16055
- // TODO: Scenario is tied to the record, not to the Tileset.
16056
- // So we need a way to update it when we load the record from styling.
16057
- scenario: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.Scenario
16089
+ scenario: null
16058
16090
  };
16059
16091
  var featureAny = feature;
16060
- var propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_e = featureAny.getPropertyIds) === null || _e === void 0 ? void 0 : _e.call(featureAny);
16092
+ var propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_d = featureAny.getPropertyIds) === null || _d === void 0 ? void 0 : _d.call(featureAny);
16061
16093
  if (!propertyNames) {
16062
16094
  return null;
16063
16095
  }
@@ -16105,7 +16137,7 @@ var TilesetCadRenderManager;
16105
16137
  }
16106
16138
  // Optional menu item restriction.
16107
16139
  // Allows only showing certain entities from a tileset.
16108
- var onlyIds = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.EntityIds;
16140
+ var onlyIds = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.EntityIds;
16109
16141
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
16110
16142
  if (this.item.BruceEntity.Ghosts) {
16111
16143
  feature.color = Color.WHITE.clone().withAlpha(0.5);
@@ -28681,7 +28713,7 @@ var WidgetViewBar = /** @class */ (function (_super) {
28681
28713
  return WidgetViewBar;
28682
28714
  }(Widget.AWidget));
28683
28715
 
28684
- var VERSION = "4.8.1";
28716
+ var VERSION = "4.8.2";
28685
28717
 
28686
28718
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
28687
28719
  //# sourceMappingURL=bruce-cesium.es5.js.map