bruce-cesium 4.7.6 → 4.7.8

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.
Files changed (27) hide show
  1. package/dist/bruce-cesium.es5.js +189 -93
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +187 -91
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/getters/entity-filter-getter.js +8 -1
  7. package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
  8. package/dist/lib/rendering/render-managers/common/shared-getters.js +3 -1
  9. package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
  10. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +50 -34
  11. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  12. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js +17 -2
  13. package/dist/lib/rendering/render-managers/tilesets/tileset-arb-render-manager.js.map +1 -1
  14. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +20 -7
  15. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
  16. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js +11 -2
  17. package/dist/lib/rendering/render-managers/tilesets/tileset-entities-render-manager.js.map +1 -1
  18. package/dist/lib/rendering/tileset-render-engine.js +77 -43
  19. package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
  20. package/dist/lib/rendering/visuals-register.js.map +1 -1
  21. package/dist/types/bruce-cesium.d.ts +1 -1
  22. package/dist/types/rendering/getters/entity-filter-getter.d.ts +2 -0
  23. package/dist/types/rendering/render-managers/common/shared-getters.d.ts +1 -0
  24. package/dist/types/rendering/render-managers/entities/entities-render-manager.d.ts +3 -0
  25. package/dist/types/rendering/tileset-render-engine.d.ts +15 -1
  26. package/dist/types/rendering/visuals-register.d.ts +1 -0
  27. package/package.json +2 -2
@@ -1,6 +1,6 @@
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, EntityAttribute, EntityAttachment, EntityAttachmentType, Session } from 'bruce-models';
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, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, Session } 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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, PolygonPipeline, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, 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, 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, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -11968,6 +11968,10 @@ var EntitiesRenderManager;
11968
11968
  // Highly experimental flag to try improve rendering large sets of polygons and polylines.
11969
11969
  // Many things are not supported when this is enabled.
11970
11970
  this.useGeojson = false;
11971
+ // Zoom control to reference.
11972
+ this.zoomControl = [];
11973
+ // Scenario for retrieving Entities.
11974
+ this.scenario = null;
11971
11975
  var viewer = params.viewer, apiGetter = params.apiGetter, monitor = params.monitor, item = params.item, visualsManager = params.register, sharedGetters = params.sharedGetters;
11972
11976
  this.viewer = viewer;
11973
11977
  this.sharedGetters = sharedGetters;
@@ -11989,15 +11993,16 @@ var EntitiesRenderManager;
11989
11993
  });
11990
11994
  Manager.prototype.Init = function (params) {
11991
11995
  var _this = this;
11992
- var _a, _b, _c, _d, _e, _f;
11996
+ var _a, _b, _c, _d, _e, _f, _g;
11993
11997
  if (this.disposed) {
11994
11998
  throw (new Error("This item is disposed."));
11995
11999
  }
11996
12000
  if (params === null || params === void 0 ? void 0 : params.item) {
11997
12001
  this.item = params.item;
11998
12002
  }
11999
- if (!((_a = this.item.CameraZoomSettings) === null || _a === void 0 ? void 0 : _a.length)) {
12000
- this.item.CameraZoomSettings = [
12003
+ this.zoomControl = this.item.CameraZoomSettings;
12004
+ if (!((_a = this.zoomControl) === null || _a === void 0 ? void 0 : _a.length)) {
12005
+ this.zoomControl = [
12001
12006
  {
12002
12007
  MinZoom: 0,
12003
12008
  MaxZoom: 200000,
@@ -12008,10 +12013,11 @@ var EntitiesRenderManager;
12008
12013
  }
12009
12014
  ];
12010
12015
  }
12011
- if (this.useGeojson && this.item.CameraZoomSettings.length > 1) {
12016
+ if (this.useGeojson && this.zoomControl.length > 1) {
12012
12017
  console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12013
- this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
12018
+ this.zoomControl = [this.zoomControl[0]];
12014
12019
  }
12020
+ this.scenario = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["Scenario.ID"];
12015
12021
  var isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
12016
12022
  var tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
12017
12023
  if (!tagsToRender) {
@@ -12020,9 +12026,9 @@ var EntitiesRenderManager;
12020
12026
  tagsToRender = [].concat(tagsToRender);
12021
12027
  var shouldRender = !isTagItem || tagsToRender.length > 0;
12022
12028
  this.unsetGetter();
12023
- (_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
12029
+ (_c = this.viewMonitorRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
12024
12030
  this.viewMonitorRemoval = null;
12025
- (_c = this.entityCheckQueue) === null || _c === void 0 ? void 0 : _c.Dispose();
12031
+ (_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Dispose();
12026
12032
  this.entityCheckQueue = null;
12027
12033
  clearInterval(this.renderQueueInterval);
12028
12034
  this.renderQueueInterval = null;
@@ -12034,27 +12040,26 @@ var EntitiesRenderManager;
12034
12040
  menuItemId: this.item.id,
12035
12041
  retainTagIds: tagsToRender
12036
12042
  });
12037
- (_d = this.clustering) === null || _d === void 0 ? void 0 : _d.Dispose();
12043
+ (_e = this.clustering) === null || _e === void 0 ? void 0 : _e.Dispose();
12038
12044
  }
12039
12045
  else {
12040
12046
  this.visualsManager.RemoveRegos({
12041
12047
  menuItemId: this.item.id
12042
12048
  });
12043
- (_e = this.clustering) === null || _e === void 0 ? void 0 : _e.Dispose();
12049
+ (_f = this.clustering) === null || _f === void 0 ? void 0 : _f.Dispose();
12044
12050
  return;
12045
12051
  }
12046
12052
  if (this.item.enableClustering) {
12047
- this.clustering = new PointClustering(this.visualsManager, this.item.id, (_f = this.item) === null || _f === void 0 ? void 0 : _f.clustering);
12053
+ this.clustering = new PointClustering(this.visualsManager, this.item.id, (_g = this.item) === null || _g === void 0 ? void 0 : _g.clustering);
12048
12054
  }
12049
12055
  this.setGetter();
12050
12056
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(function () {
12051
12057
  _this.entityCheckQueue.Call();
12052
12058
  });
12053
12059
  this.entityCheckQueue = new DelayQueue(function () {
12054
- var _a;
12055
12060
  // Don't bother checking for zoom control changes if we only have 1 item.
12056
12061
  // We'll let Cesium handle hide/show at max zoom range.
12057
- var shouldCheck = ((_a = _this.item) === null || _a === void 0 ? void 0 : _a.CameraZoomSettings) && _this.item.CameraZoomSettings.length > 1;
12062
+ var shouldCheck = _this.zoomControl && _this.zoomControl.length > 1;
12058
12063
  if (shouldCheck) {
12059
12064
  _this.doEntityCheck(Object.keys(_this.renderedEntities));
12060
12065
  }
@@ -12084,10 +12089,11 @@ var EntitiesRenderManager;
12084
12089
  cdn: this.item.cdnEnabled,
12085
12090
  historicAttrKey: this.item.BruceEntity.historicAttrKey,
12086
12091
  historicInterpolation: this.item.historicInterpolation,
12087
- schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId
12092
+ schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId,
12093
+ scenario: this.scenario
12088
12094
  });
12089
12095
  var minMax = RenderManager.GetZoomMinMax({
12090
- zoomControl: this.item.CameraZoomSettings
12096
+ zoomControl: this.zoomControl
12091
12097
  });
12092
12098
  this.getter.IncludeMenuItem(this.item.id, (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [], minMax[0], minMax[1]);
12093
12099
  this.getterSub = this.getter.OnUpdate.Subscribe(function (entities) {
@@ -12197,16 +12203,24 @@ var EntitiesRenderManager;
12197
12203
  });
12198
12204
  };
12199
12205
  Manager.prototype.UpdateSettings = function (params) {
12200
- var CameraZoomSettings = params.zoomControl, queueRerender = params.queueRerender;
12206
+ var CameraZoomSettings = params.zoomControl, queueRerender = params.queueRerender, scenario = params.scenario;
12201
12207
  if (this.disposed) {
12202
12208
  return;
12203
12209
  }
12210
+ var changed = false;
12204
12211
  if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
12205
- this.item.CameraZoomSettings = CameraZoomSettings;
12206
- if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
12212
+ this.zoomControl = CameraZoomSettings;
12213
+ if (this.renderAsGeojson && this.zoomControl.length > 1) {
12207
12214
  console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12208
- this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
12215
+ this.zoomControl = [this.zoomControl[0]];
12209
12216
  }
12217
+ changed = true;
12218
+ }
12219
+ if (scenario != null) {
12220
+ this.scenario = scenario;
12221
+ changed = true;
12222
+ }
12223
+ if (changed) {
12210
12224
  this.setGetter();
12211
12225
  }
12212
12226
  if (queueRerender != false) {
@@ -12319,7 +12333,7 @@ var EntitiesRenderManager;
12319
12333
  entities = entities.filter(function (x) { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId_1; });
12320
12334
  }
12321
12335
  if (!this.useGeojson) return [3 /*break*/, 5];
12322
- zoomItem = this.item.CameraZoomSettings[0];
12336
+ zoomItem = this.zoomControl[0];
12323
12337
  if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Point)) return [3 /*break*/, 2];
12324
12338
  // We'll just render these as individuals since we don't support point geojson.
12325
12339
  return [4 /*yield*/, this.renderAsIndividuals(entities, force)];
@@ -12369,7 +12383,7 @@ var EntitiesRenderManager;
12369
12383
  var _a;
12370
12384
  _this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
12371
12385
  });
12372
- zoomItem = this.item.CameraZoomSettings[0];
12386
+ zoomItem = this.zoomControl[0];
12373
12387
  if (!(zoomItem.DisplayType == ZoomControl.EDisplayType.Model3D && entities.length)) return [3 /*break*/, 2];
12374
12388
  return [4 /*yield*/, EntityLod.GetLods({
12375
12389
  api: this.apiGetter.getApi(),
@@ -12707,12 +12721,12 @@ var EntitiesRenderManager;
12707
12721
  * @returns
12708
12722
  */
12709
12723
  Manager.prototype.renderAsIndividuals = function (entities, force) {
12710
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
12724
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
12711
12725
  if (force === void 0) { force = false; }
12712
12726
  return __awaiter(this, void 0, void 0, function () {
12713
- var entitiesHistoric, startTmp, stopTmp, startStr, stopStr, historicData, toRemoveIds_1, i, removeId, toRemoveIds_2, i, removeId, _o, updated, cEntities, i, entity, id, cEntity, rego, visual, wasClustered, tagIds, rego_1;
12714
- return __generator(this, function (_p) {
12715
- switch (_p.label) {
12727
+ var entitiesHistoric, startTmp, stopTmp, startStr, stopStr, historicData, toRemoveIds_1, i, removeId, toRemoveIds_2, i, removeId, _q, updated, cEntities, i, entity, id, cEntity, rego, visual, wasClustered, tagIds, rego_1;
12728
+ return __generator(this, function (_r) {
12729
+ switch (_r.label) {
12716
12730
  case 0:
12717
12731
  entitiesHistoric = {};
12718
12732
  if (!(((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey) && entities.length)) return [3 /*break*/, 3];
@@ -12729,7 +12743,7 @@ var EntitiesRenderManager;
12729
12743
  api: this.apiGetter.getApi()
12730
12744
  })];
12731
12745
  case 1:
12732
- historicData = _p.sent();
12746
+ historicData = _r.sent();
12733
12747
  entitiesHistoric = historicData.recordsByIds;
12734
12748
  toRemoveIds_1 = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey) && !entitiesHistoric[x.Bruce.ID]; }).map(function (x) { return x.Bruce.ID; });
12735
12749
  for (i = 0; i < toRemoveIds_1.length; i++) {
@@ -12755,7 +12769,7 @@ var EntitiesRenderManager;
12755
12769
  (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(removeId, false);
12756
12770
  }
12757
12771
  entities = entities.filter(function (x) { return !toRemoveIds_2.includes(x.Bruce.ID); });
12758
- _p.label = 3;
12772
+ _r.label = 3;
12759
12773
  case 3:
12760
12774
  if (this.disposed) {
12761
12775
  this.doDispose();
@@ -12767,7 +12781,7 @@ var EntitiesRenderManager;
12767
12781
  entities: entities,
12768
12782
  menuItemId: this.item.id,
12769
12783
  visualRegister: this.visualsManager,
12770
- zoomControl: this.item.CameraZoomSettings,
12784
+ zoomControl: this.zoomControl,
12771
12785
  entitiesHistoric: entitiesHistoric,
12772
12786
  entityHistoricDrawTrack: this.item.historicDrawTrack,
12773
12787
  force: force,
@@ -12776,7 +12790,7 @@ var EntitiesRenderManager;
12776
12790
  optimizeTolerance: this.item.optimizeTolerance,
12777
12791
  })];
12778
12792
  case 4:
12779
- _o = _p.sent(), updated = _o.updated, cEntities = _o.entities;
12793
+ _q = _r.sent(), updated = _q.updated, cEntities = _q.entities;
12780
12794
  if (this.disposed) {
12781
12795
  this.doDispose();
12782
12796
  return [2 /*return*/];
@@ -12809,7 +12823,8 @@ var EntitiesRenderManager;
12809
12823
  name: cEntity.name,
12810
12824
  cdn: this.item.cdnEnabled,
12811
12825
  historicDateTime: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricDateTime,
12812
- historicAttrKey: (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricAttrKey
12826
+ historicAttrKey: (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricAttrKey,
12827
+ scenario: (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h["Scenario.ID"]
12813
12828
  };
12814
12829
  this.visualsManager.AddRego({
12815
12830
  rego: rego_1,
@@ -12820,11 +12835,12 @@ var EntitiesRenderManager;
12820
12835
  rego.name = cEntity.name;
12821
12836
  rego.visual = cEntity;
12822
12837
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
12823
- rego.tagIds = ((_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12824
- rego.historicDateTime = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.HistoricDateTime;
12825
- rego.historicAttrKey = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.HistoricAttrKey;
12838
+ rego.tagIds = ((_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12839
+ rego.historicDateTime = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.HistoricDateTime;
12840
+ rego.historicAttrKey = (_l = entity.Bruce) === null || _l === void 0 ? void 0 : _l.HistoricAttrKey;
12826
12841
  rego.cdn = this.item.cdnEnabled;
12827
- rego.schemaId = (_l = entity.Bruce) === null || _l === void 0 ? void 0 : _l.SchemaID;
12842
+ rego.schemaId = (_m = entity.Bruce) === null || _m === void 0 ? void 0 : _m.SchemaID;
12843
+ rego.scenario = (_o = entity.Bruce) === null || _o === void 0 ? void 0 : _o["Scenario.ID"];
12828
12844
  // Marked as stale meaning some change was performed that requires a refresh.
12829
12845
  // This usually means a new sibling was added that we need to update.
12830
12846
  if (rego.stale) {
@@ -12854,7 +12870,7 @@ var EntitiesRenderManager;
12854
12870
  menuItemId: this.item.id,
12855
12871
  requestRender: false
12856
12872
  });
12857
- (_m = this.clustering) === null || _m === void 0 ? void 0 : _m.RemoveEntity(id, false);
12873
+ (_p = this.clustering) === null || _p === void 0 ? void 0 : _p.RemoveEntity(id, false);
12858
12874
  }
12859
12875
  }
12860
12876
  this.viewer.scene.requestRender();
@@ -15085,9 +15101,10 @@ var TilesetRenderEngine;
15085
15101
  }
15086
15102
  TilesetRenderEngine.RenderLegacy = RenderLegacy;
15087
15103
  var Styler = /** @class */ (function () {
15088
- function Styler(viewer, api, cTileset, fallbackStyleId, styleMapping, expandSources, menuItemId, register) {
15089
- var _a;
15104
+ function Styler() {
15090
15105
  this.disposed = false;
15106
+ // Indicates if the styler has been loaded/initialized and is ready to style.
15107
+ this.loaded = false;
15091
15108
  this.styleMappingLoaded = false;
15092
15109
  this.styleMappingsLoaded = {};
15093
15110
  this.fallbackStyle = null;
@@ -15096,6 +15113,7 @@ var TilesetRenderEngine;
15096
15113
  // Dictionary of Entity ID -> boolean to indicate which Entities have been styled.
15097
15114
  // This is used to determine if the Style colour needs to be overriden or not.
15098
15115
  this.styledEntityIds = {};
15116
+ this.scenario = 0;
15099
15117
  this.runningQueues = 0;
15100
15118
  this.recordLoadQueue = [];
15101
15119
  this.recordCheckQueue = [];
@@ -15104,30 +15122,6 @@ var TilesetRenderEngine;
15104
15122
  this._styleProgress = 0;
15105
15123
  // Event for when the style progress changes.
15106
15124
  this.OnStyleProgress = new BruceEvent();
15107
- this.viewer = viewer;
15108
- this.api = api;
15109
- this.cTileset = cTileset;
15110
- this.expandSources = expandSources;
15111
- this.fallbackStyleId = fallbackStyleId;
15112
- this.styleMapping = styleMapping;
15113
- if (styleMapping) {
15114
- // Dereference.
15115
- styleMapping = JSON.parse(JSON.stringify(styleMapping));
15116
- }
15117
- // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
15118
- // We have some evil hard-coded style mappings that need to be fixed.
15119
- // These exist within legacy project views.
15120
- // Update: This now also lets people have a style mapping without a real style record.
15121
- if ((_a = this.styleMapping) === null || _a === void 0 ? void 0 : _a.length) {
15122
- for (var i = 0; i < this.styleMapping.length; i++) {
15123
- var mapItem = this.styleMapping[i];
15124
- var mapStyle = mapItem.style ? mapItem.style : mapItem.Style;
15125
- this.styleMapping[i].style = correctStyle(mapStyle);
15126
- }
15127
- }
15128
- this.register = register;
15129
- this.menuItemId = menuItemId;
15130
- this.loadStyles();
15131
15125
  }
15132
15126
  Object.defineProperty(Styler.prototype, "Disposed", {
15133
15127
  get: function () {
@@ -15136,6 +15130,13 @@ var TilesetRenderEngine;
15136
15130
  enumerable: false,
15137
15131
  configurable: true
15138
15132
  });
15133
+ Object.defineProperty(Styler.prototype, "Loaded", {
15134
+ get: function () {
15135
+ return this.loaded;
15136
+ },
15137
+ enumerable: false,
15138
+ configurable: true
15139
+ });
15139
15140
  Object.defineProperty(Styler.prototype, "StyleProgress", {
15140
15141
  get: function () {
15141
15142
  return this._styleProgress;
@@ -15143,6 +15144,44 @@ var TilesetRenderEngine;
15143
15144
  enumerable: false,
15144
15145
  configurable: true
15145
15146
  });
15147
+ Styler.prototype.Init = function (params) {
15148
+ var _a;
15149
+ var viewer = params.viewer, api = params.api, cTileset = params.cTileset, fallbackStyleId = params.fallbackStyleId, styleMapping = params.styleMapping, expandSources = params.expandSources, menuItemId = params.menuItemId, register = params.register, scenario = params.scenario;
15150
+ this.viewer = viewer;
15151
+ this.api = api;
15152
+ this.cTileset = cTileset;
15153
+ this.register = register;
15154
+ this.menuItemId = menuItemId;
15155
+ if (expandSources != null) {
15156
+ this.expandSources = expandSources;
15157
+ }
15158
+ if (fallbackStyleId != null) {
15159
+ this.fallbackStyleId = fallbackStyleId;
15160
+ }
15161
+ if (this.styleMapping) {
15162
+ this.styleMapping = styleMapping;
15163
+ if (this.styleMapping) {
15164
+ // Dereference.
15165
+ this.styleMapping = JSON.parse(JSON.stringify(this.styleMapping));
15166
+ }
15167
+ // ND-1641. BOOKMARKS - (DEMO) View does not match bookmark.
15168
+ // We have some evil hard-coded style mappings that need to be fixed.
15169
+ // These exist within legacy project views.
15170
+ // Update: This now also lets people have a style mapping without a real style record.
15171
+ if ((_a = this.styleMapping) === null || _a === void 0 ? void 0 : _a.length) {
15172
+ for (var i = 0; i < this.styleMapping.length; i++) {
15173
+ var mapItem = this.styleMapping[i];
15174
+ var mapStyle = mapItem.style ? mapItem.style : mapItem.Style;
15175
+ this.styleMapping[i].style = correctStyle(mapStyle);
15176
+ }
15177
+ }
15178
+ }
15179
+ if (scenario != null) {
15180
+ this.scenario = scenario;
15181
+ }
15182
+ this.loadStyles();
15183
+ this.loaded = true;
15184
+ };
15146
15185
  /**
15147
15186
  * Updates style mapping and fallback style.
15148
15187
  * This will trigger a re-style of all entities, and will stop existing style loads.
@@ -15178,22 +15217,30 @@ var TilesetRenderEngine;
15178
15217
  if (params.expandSources != null) {
15179
15218
  this.expandSources = params.expandSources;
15180
15219
  }
15181
- // Empty queues.
15182
- // Requeue all.
15183
- this.recordLoadQueue = [];
15184
- this.recordCheckQueue = [];
15185
- var regos = this.register.GetRegos({
15186
- menuItemId: this.menuItemId
15187
- });
15188
- // Reset progress.
15189
- this.updateStyleProgress();
15190
- this.styleMappingLoaded = false;
15191
- this.styleMappingsLoaded = {};
15192
- this.QueueEntities(regos);
15193
- this.loadStyles();
15220
+ if (params.scenario != null) {
15221
+ this.scenario = params.scenario;
15222
+ }
15223
+ if (this.loaded) {
15224
+ // Empty queues.
15225
+ // Requeue all.
15226
+ this.recordLoadQueue = [];
15227
+ this.recordCheckQueue = [];
15228
+ var regos = this.register.GetRegos({
15229
+ menuItemId: this.menuItemId
15230
+ });
15231
+ // Reset progress.
15232
+ this.updateStyleProgress();
15233
+ this.styleMappingLoaded = false;
15234
+ this.styleMappingsLoaded = {};
15235
+ this.QueueEntities(regos);
15236
+ this.loadStyles();
15237
+ }
15194
15238
  };
15195
15239
  Styler.prototype.QueueEntities = function (entities, highPriority) {
15196
15240
  if (highPriority === void 0) { highPriority = false; }
15241
+ if (!this.loaded) {
15242
+ return;
15243
+ }
15197
15244
  // We set a default colour right away to avoid race conditions at later times.
15198
15245
  for (var i = 0; i < entities.length; i++) {
15199
15246
  var entity = entities[i];
@@ -15240,7 +15287,8 @@ var TilesetRenderEngine;
15240
15287
  api: this.api,
15241
15288
  entityIds: batch,
15242
15289
  migrated: true,
15243
- expandSources: this.expandSources
15290
+ expandSources: this.expandSources,
15291
+ scenario: this.scenario
15244
15292
  })];
15245
15293
  case 2:
15246
15294
  entities = (_c.sent()).entities;
@@ -15489,8 +15537,10 @@ var TilesetRenderEngine;
15489
15537
  _c.label = 19;
15490
15538
  case 19:
15491
15539
  this.styleMappingsLoaded[styleMap.EntityTypeID] = true;
15492
- this.processTilesetFeatureCheckQueue();
15493
- this.processQueue();
15540
+ if (this.loaded) {
15541
+ this.processTilesetFeatureCheckQueue();
15542
+ this.processQueue();
15543
+ }
15494
15544
  _c.label = 20;
15495
15545
  case 20:
15496
15546
  i++;
@@ -15500,7 +15550,7 @@ var TilesetRenderEngine;
15500
15550
  return [2 /*return*/];
15501
15551
  }
15502
15552
  this.styleMappingLoaded = true;
15503
- if (!!this.disposed) return [3 /*break*/, 23];
15553
+ if (!(!this.disposed && this.loaded)) return [3 /*break*/, 23];
15504
15554
  return [4 /*yield*/, this.processTilesetFeatureCheckQueue()];
15505
15555
  case 22:
15506
15556
  _c.sent();
@@ -15778,7 +15828,7 @@ var TilesetCadRenderManager;
15778
15828
  function Manager(params) {
15779
15829
  this.disposed = false;
15780
15830
  this.cTileset = null;
15781
- this.styler = null;
15831
+ this.styler = new TilesetRenderEngine.Styler();
15782
15832
  // Indicates the hierarchy depth limit has been hit.
15783
15833
  // This likely means poor data so we have to disable drilling otherwise lag would be too bad.
15784
15834
  // The result is no entity type IDs are known so most styles fail.
@@ -15864,13 +15914,23 @@ var TilesetCadRenderManager;
15864
15914
  }
15865
15915
  this.viewer.scene.requestRender();
15866
15916
  TilesetRenderEngine.OnTilesetReady(this.cTileset).then(function () {
15867
- var _a;
15917
+ var _a, _b;
15868
15918
  try {
15869
15919
  if (_this.disposed || cTileset.isDestroyed()) {
15870
15920
  return;
15871
15921
  }
15872
15922
  _this.onCTilesetLoad();
15873
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandSources, _this.item.id, _this.visualsManager);
15923
+ _this.styler.Init({
15924
+ viewer: _this.viewer,
15925
+ api: api,
15926
+ cTileset: _this.cTileset,
15927
+ fallbackStyleId: _this.item.styleId,
15928
+ styleMapping: _this.item.StyleMapping,
15929
+ expandSources: (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandSources,
15930
+ menuItemId: _this.item.id,
15931
+ register: _this.visualsManager,
15932
+ scenario: (_b = _this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["Scenario.ID"]
15933
+ });
15874
15934
  _this.viewer.scene.requestRender();
15875
15935
  }
15876
15936
  catch (e) {
@@ -15934,7 +15994,7 @@ var TilesetCadRenderManager;
15934
15994
  */
15935
15995
  Manager.prototype.mapTilesetFeature = function (feature, add) {
15936
15996
  var _this = this;
15937
- var _a, _b, _c, _d, _e;
15997
+ var _a, _b, _c, _d, _e, _f;
15938
15998
  var rego = {
15939
15999
  entityId: null,
15940
16000
  entityTypeId: null,
@@ -15945,10 +16005,13 @@ var TilesetCadRenderManager;
15945
16005
  accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
15946
16006
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
15947
16007
  tilesetType: Tileset.EType.Cad,
15948
- rootId: this.rootId
16008
+ rootId: this.rootId,
16009
+ // TODO: Scenario is tied to the record, not to the Tileset.
16010
+ // So we need a way to update it when we load the record from styling.
16011
+ scenario: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d["Scenario.ID"]
15949
16012
  };
15950
16013
  var featureAny = feature;
15951
- var propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_d = featureAny.getPropertyIds) === null || _d === void 0 ? void 0 : _d.call(featureAny);
16014
+ var propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_e = featureAny.getPropertyIds) === null || _e === void 0 ? void 0 : _e.call(featureAny);
15952
16015
  if (!propertyNames) {
15953
16016
  return null;
15954
16017
  }
@@ -15996,7 +16059,7 @@ var TilesetCadRenderManager;
15996
16059
  }
15997
16060
  // Optional menu item restriction.
15998
16061
  // Allows only showing certain entities from a tileset.
15999
- var onlyIds = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.EntityIds;
16062
+ var onlyIds = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.EntityIds;
16000
16063
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
16001
16064
  if (this.item.BruceEntity.Ghosts) {
16002
16065
  feature.color = Color.WHITE.clone().withAlpha(0.5);
@@ -16532,12 +16595,13 @@ var EntityFilterGetter;
16532
16595
  this.maxHeight = 100000;
16533
16596
  this.viewRect = null;
16534
16597
  this.viewCenter = null;
16598
+ this.scenario = 0;
16535
16599
  this.historicRefreshAbortController = null;
16536
16600
  // Entity IDs found for the latest integrity.
16537
16601
  // We use this for refreshing historic data without having to repeat geographic queries.
16538
16602
  this.gatheredIntegrity = null;
16539
16603
  this.gatheredEntityIds = [];
16540
- var api = params.api, viewer = params.viewer, viewPort = params.viewPort, typeId = params.typeId, schemaId = params.schemaId, batchSize = params.batchSize, attrFilter = params.attrFilter, historicAttrKey = params.historicAttrKey, historicInterpolation = params.historicInterpolation, viaCdn = params.viaCdn;
16604
+ var api = params.api, viewer = params.viewer, viewPort = params.viewPort, typeId = params.typeId, schemaId = params.schemaId, batchSize = params.batchSize, attrFilter = params.attrFilter, historicAttrKey = params.historicAttrKey, historicInterpolation = params.historicInterpolation, viaCdn = params.viaCdn, scenario = params.scenario;
16541
16605
  this.api = api;
16542
16606
  this.typeId = typeId;
16543
16607
  this.schemaId = schemaId;
@@ -16548,6 +16612,7 @@ var EntityFilterGetter;
16548
16612
  this.viewPort = viewPort;
16549
16613
  this.attrFilter = attrFilter;
16550
16614
  this.viewer = viewer;
16615
+ this.scenario = scenario ? scenario : 0;
16551
16616
  this.updateBounds();
16552
16617
  }
16553
16618
  Object.defineProperty(Getter.prototype, "OnUpdate", {
@@ -16590,6 +16655,9 @@ var EntityFilterGetter;
16590
16655
  if (this.historicAttrKey) {
16591
16656
  integrity += this.historicAttrKey;
16592
16657
  }
16658
+ if (this.scenario) {
16659
+ integrity += this.scenario;
16660
+ }
16593
16661
  return integrity;
16594
16662
  };
16595
16663
  Getter.prototype.viewAreaSub = function () {
@@ -16868,6 +16936,7 @@ var EntityFilterGetter;
16868
16936
  }
16869
16937
  return [4 /*yield*/, Entity$1.GetList({
16870
16938
  api: this.api,
16939
+ scenario: this.scenario,
16871
16940
  historicKey: this.historicAttrKey,
16872
16941
  historicPoint: this.historicAttrDateTime,
16873
16942
  schemaId: this.schemaId,
@@ -17052,6 +17121,7 @@ var EntityFilterGetter;
17052
17121
  }
17053
17122
  return [4 /*yield*/, Entity$1.GetList({
17054
17123
  api: this.api,
17124
+ scenario: this.scenario,
17055
17125
  historicKey: this.historicAttrKey,
17056
17126
  historicPoint: historicAttrDateTime,
17057
17127
  schemaId: this.schemaId,
@@ -17149,6 +17219,7 @@ function createFilterGetterCacheKey(params) {
17149
17219
  cacheKey += params.schemaId ? params.schemaId : "";
17150
17220
  cacheKey += JSON.stringify(params.tagIds ? params.tagIds : []);
17151
17221
  cacheKey += params.historicAttrKey ? params.historicAttrKey : "";
17222
+ cacheKey += params.scenario ? params.scenario : 0;
17152
17223
  if (params.historicAttrKey) {
17153
17224
  cacheKey += params.historicInterpolation ? "true" : "false";
17154
17225
  }
@@ -17177,7 +17248,8 @@ var SharedGetters;
17177
17248
  attrFilter: params.attrFilter,
17178
17249
  historicAttrKey: params.historicAttrKey,
17179
17250
  historicInterpolation: params.historicInterpolation,
17180
- viaCdn: params.cdn
17251
+ viaCdn: params.cdn,
17252
+ scenario: params.scenario,
17181
17253
  });
17182
17254
  this.data[cacheKey] = getter;
17183
17255
  /**
@@ -17777,7 +17849,7 @@ var TilesetEntitiesRenderManager;
17777
17849
  this.initCounter = 0;
17778
17850
  this.disposed = false;
17779
17851
  this.cTileset = null;
17780
- this.styler = null;
17852
+ this.styler = new TilesetRenderEngine.Styler();
17781
17853
  var viewer = params.viewer, visualsManager = params.register, apiGetter = params.getters, item = params.item;
17782
17854
  this.viewer = viewer;
17783
17855
  this.getters = apiGetter;
@@ -17906,7 +17978,16 @@ var TilesetEntitiesRenderManager;
17906
17978
  }
17907
17979
  if (_this.item.ApplyStyles) {
17908
17980
  var api_1 = _this.getters.GetBruceApi();
17909
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api_1, _this.cTileset, +_this.item.styleId, [], false, _this.item.id, _this.visualsManager);
17981
+ _this.styler.Init({
17982
+ viewer: _this.viewer,
17983
+ api: api_1,
17984
+ cTileset: _this.cTileset,
17985
+ fallbackStyleId: +_this.item.styleId,
17986
+ styleMapping: [],
17987
+ expandSources: false,
17988
+ menuItemId: _this.item.id,
17989
+ register: _this.visualsManager
17990
+ });
17910
17991
  }
17911
17992
  _this.onCTilesetLoad();
17912
17993
  _this.viewer.scene.requestRender();
@@ -18370,7 +18451,7 @@ var TilesetArbRenderManager;
18370
18451
  function Manager(params) {
18371
18452
  this.disposed = false;
18372
18453
  this.cTileset = null;
18373
- this.styler = null;
18454
+ this.styler = new TilesetRenderEngine.Styler();
18374
18455
  this.tilesetType = null;
18375
18456
  this.viewer = params.viewer;
18376
18457
  this.getters = params.getters;
@@ -18553,6 +18634,9 @@ var TilesetArbRenderManager;
18553
18634
  }
18554
18635
  this.viewer.scene.requestRender();
18555
18636
  TilesetRenderEngine.OnTilesetReady(this.cTileset).then(function () {
18637
+ if (_this.disposed || _this.viewer.isDestroyed()) {
18638
+ return;
18639
+ }
18556
18640
  // Colour mask to apply to the Tileset as a whole.
18557
18641
  // Individual Entities can override this.
18558
18642
  // This is typically used for Tilesets without Entities to allow some sort of basic styling per-bookmark.
@@ -18575,7 +18659,16 @@ var TilesetArbRenderManager;
18575
18659
  if (_this.item.ApplyStyles ||
18576
18660
  _this.item.Type == MenuItem.EType.IonTileset) {
18577
18661
  var api = _this.getters.GetBruceApi();
18578
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, false, _this.item.id, _this.visualsManager);
18662
+ _this.styler.Init({
18663
+ viewer: _this.viewer,
18664
+ api: api,
18665
+ cTileset: _this.cTileset,
18666
+ fallbackStyleId: _this.item.styleId,
18667
+ styleMapping: _this.item.StyleMapping,
18668
+ expandSources: false,
18669
+ menuItemId: _this.item.id,
18670
+ register: _this.visualsManager
18671
+ });
18579
18672
  }
18580
18673
  _this.onCTilesetLoad();
18581
18674
  _this.viewer.scene.requestRender();
@@ -18585,6 +18678,9 @@ var TilesetArbRenderManager;
18585
18678
  }
18586
18679
  });
18587
18680
  this.cTileset.tileLoad.addEventListener(function (tile) {
18681
+ if (_this.disposed || _this.viewer.isDestroyed()) {
18682
+ return;
18683
+ }
18588
18684
  try {
18589
18685
  _this.mapCTile(tile);
18590
18686
  }
@@ -28536,7 +28632,7 @@ var WidgetViewBar = /** @class */ (function (_super) {
28536
28632
  return WidgetViewBar;
28537
28633
  }(Widget.AWidget));
28538
28634
 
28539
- var VERSION = "4.7.6";
28635
+ var VERSION = "4.7.8";
28540
28636
 
28541
28637
  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 };
28542
28638
  //# sourceMappingURL=bruce-cesium.es5.js.map