bruce-cesium 4.6.1 → 4.6.3

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
- 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, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttribute, EntityAttachment, EntityAttachmentType } 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, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, Camera, 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, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, 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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, PolygonPipeline, 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.
@@ -11861,6 +11861,20 @@ function getValue$2(viewer, obj) {
11861
11861
  function colorToCColor$1(color) {
11862
11862
  return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
11863
11863
  }
11864
+ function getShowDebugBounds() {
11865
+ if (!window) {
11866
+ return false;
11867
+ }
11868
+ var showBounds = window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS;
11869
+ if (showBounds) {
11870
+ return true;
11871
+ }
11872
+ if (window.location.search) {
11873
+ var params = new URLSearchParams(window.location.search);
11874
+ showBounds = params.get("debugScanBounds");
11875
+ }
11876
+ return showBounds == "true" || showBounds == "1" || showBounds == "yes";
11877
+ }
11864
11878
  /**
11865
11879
  * Manager for rendering Bruce entities.
11866
11880
  * This will request entities based on setup menu item filter.
@@ -11996,9 +12010,10 @@ var EntitiesRenderManager;
11996
12010
  // Unfortunately this searches as an "AND" rather than "OR" which does not meet our needs here.
11997
12011
  // So for multiple tags we'll manually sort on UI end...
11998
12012
  tagIds: (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [],
11999
- debugShowBounds: Boolean(window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
12013
+ debugShowBounds: getShowDebugBounds(),
12000
12014
  cdn: this.item.cdnEnabled,
12001
12015
  historicAttrKey: this.item.BruceEntity.historicAttrKey,
12016
+ historicInterpolation: this.item.historicInterpolation,
12002
12017
  schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId
12003
12018
  });
12004
12019
  var minMax = RenderManager.GetZoomMinMax({
@@ -12226,7 +12241,7 @@ var EntitiesRenderManager;
12226
12241
  switch (_b.label) {
12227
12242
  case 0:
12228
12243
  _b.trys.push([0, 8, , 9]);
12229
- if (this.disposed || this.viewer.isDestroyed()) {
12244
+ if (this.disposed || this.viewer.isDestroyed() || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
12230
12245
  return [2 /*return*/];
12231
12246
  }
12232
12247
  typeId_1 = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"];
@@ -12622,28 +12637,16 @@ var EntitiesRenderManager;
12622
12637
  * @returns
12623
12638
  */
12624
12639
  Manager.prototype.renderAsIndividuals = function (entities, force) {
12625
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12640
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
12626
12641
  if (force === void 0) { force = false; }
12627
12642
  return __awaiter(this, void 0, void 0, function () {
12628
- var entitiesHistoric, toRemove, i, entity, startTmp, stopTmp, startStr, stopStr, historicData, _m, updated, cEntities, i, entity, id, cEntity, rego, visual, wasClustered, tagIds, rego_1;
12629
- return __generator(this, function (_o) {
12630
- switch (_o.label) {
12643
+ 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;
12644
+ return __generator(this, function (_p) {
12645
+ switch (_p.label) {
12631
12646
  case 0:
12632
12647
  entitiesHistoric = {};
12633
- if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey)) return [3 /*break*/, 2];
12634
- toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey); });
12635
- for (i = 0; i < toRemove.length; i++) {
12636
- entity = toRemove[i];
12637
- this.visualsManager.RemoveRegos({
12638
- entityId: entity.Bruce.ID,
12639
- menuItemId: this.item.id,
12640
- requestRender: false
12641
- });
12642
- (_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
12643
- }
12644
- entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey); });
12648
+ if (!(((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey) && entities.length)) return [3 /*break*/, 3];
12645
12649
  if (!this.item.historicInterpolation) return [3 /*break*/, 2];
12646
- if (!entities.length) return [3 /*break*/, 2];
12647
12650
  startTmp = JulianDate.toDate(this.viewer.clock.startTime);
12648
12651
  stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
12649
12652
  startStr = new Date(startTmp.getTime() - 1000).toISOString();
@@ -12656,29 +12659,54 @@ var EntitiesRenderManager;
12656
12659
  api: this.apiGetter.getApi()
12657
12660
  })];
12658
12661
  case 1:
12659
- historicData = _o.sent();
12662
+ historicData = _p.sent();
12663
+ entitiesHistoric = historicData.recordsByIds;
12664
+ 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; });
12665
+ for (i = 0; i < toRemoveIds_1.length; i++) {
12666
+ removeId = toRemoveIds_1[i];
12667
+ this.visualsManager.RemoveRegos({
12668
+ entityId: removeId,
12669
+ menuItemId: this.item.id,
12670
+ requestRender: false
12671
+ });
12672
+ (_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(removeId, false);
12673
+ }
12674
+ entities = entities.filter(function (x) { return !toRemoveIds_1.includes(x.Bruce.ID); });
12675
+ return [3 /*break*/, 3];
12676
+ case 2:
12677
+ toRemoveIds_2 = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey); }).map(function (x) { return x.Bruce.ID; });
12678
+ for (i = 0; i < toRemoveIds_2.length; i++) {
12679
+ removeId = toRemoveIds_2[i];
12680
+ this.visualsManager.RemoveRegos({
12681
+ entityId: removeId,
12682
+ menuItemId: this.item.id,
12683
+ requestRender: false
12684
+ });
12685
+ (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(removeId, false);
12686
+ }
12687
+ entities = entities.filter(function (x) { return !toRemoveIds_2.includes(x.Bruce.ID); });
12688
+ _p.label = 3;
12689
+ case 3:
12660
12690
  if (this.disposed) {
12661
12691
  this.doDispose();
12662
12692
  return [2 /*return*/];
12663
12693
  }
12664
- entitiesHistoric = historicData.recordsByIds;
12665
- _o.label = 2;
12666
- case 2: return [4 /*yield*/, EntityRenderEngine.Render({
12667
- viewer: this.viewer,
12668
- apiGetter: this.apiGetter,
12669
- entities: entities,
12670
- menuItemId: this.item.id,
12671
- visualRegister: this.visualsManager,
12672
- zoomControl: this.item.CameraZoomSettings,
12673
- entitiesHistoric: entitiesHistoric,
12674
- entityHistoricDrawTrack: this.item.historicDrawTrack,
12675
- force: force,
12676
- optimizeGeometry: this.item.optimizeGeometry,
12677
- optimizeMinPoints: this.item.optimizeMinPoints,
12678
- optimizeTolerance: this.item.optimizeTolerance,
12679
- })];
12680
- case 3:
12681
- _m = _o.sent(), updated = _m.updated, cEntities = _m.entities;
12694
+ return [4 /*yield*/, EntityRenderEngine.Render({
12695
+ viewer: this.viewer,
12696
+ apiGetter: this.apiGetter,
12697
+ entities: entities,
12698
+ menuItemId: this.item.id,
12699
+ visualRegister: this.visualsManager,
12700
+ zoomControl: this.item.CameraZoomSettings,
12701
+ entitiesHistoric: entitiesHistoric,
12702
+ entityHistoricDrawTrack: this.item.historicDrawTrack,
12703
+ force: force,
12704
+ optimizeGeometry: this.item.optimizeGeometry,
12705
+ optimizeMinPoints: this.item.optimizeMinPoints,
12706
+ optimizeTolerance: this.item.optimizeTolerance,
12707
+ })];
12708
+ case 4:
12709
+ _o = _p.sent(), updated = _o.updated, cEntities = _o.entities;
12682
12710
  if (this.disposed) {
12683
12711
  this.doDispose();
12684
12712
  return [2 /*return*/];
@@ -12696,10 +12724,10 @@ var EntitiesRenderManager;
12696
12724
  visual = rego === null || rego === void 0 ? void 0 : rego.visual;
12697
12725
  if (!visual || visual != cEntity) {
12698
12726
  wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
12699
- tagIds = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c["Layer.ID"];
12727
+ tagIds = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d["Layer.ID"];
12700
12728
  rego_1 = {
12701
12729
  entityId: id,
12702
- schemaId: (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.SchemaID,
12730
+ schemaId: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.SchemaID,
12703
12731
  menuItemId: this.item.id,
12704
12732
  menuItemType: this.item.Type,
12705
12733
  visual: cEntity,
@@ -12710,8 +12738,8 @@ var EntitiesRenderManager;
12710
12738
  overrideShow: wasClustered ? false : null,
12711
12739
  name: cEntity.name,
12712
12740
  cdn: this.item.cdnEnabled,
12713
- historicDateTime: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.HistoricDateTime,
12714
- historicAttrKey: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricAttrKey
12741
+ historicDateTime: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricDateTime,
12742
+ historicAttrKey: (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricAttrKey
12715
12743
  };
12716
12744
  this.visualsManager.AddRego({
12717
12745
  rego: rego_1,
@@ -12722,11 +12750,11 @@ var EntitiesRenderManager;
12722
12750
  rego.name = cEntity.name;
12723
12751
  rego.visual = cEntity;
12724
12752
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
12725
- rego.tagIds = ((_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12726
- rego.historicDateTime = (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.HistoricDateTime;
12727
- rego.historicAttrKey = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.HistoricAttrKey;
12753
+ rego.tagIds = ((_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12754
+ rego.historicDateTime = (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.HistoricDateTime;
12755
+ rego.historicAttrKey = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.HistoricAttrKey;
12728
12756
  rego.cdn = this.item.cdnEnabled;
12729
- rego.schemaId = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.SchemaID;
12757
+ rego.schemaId = (_l = entity.Bruce) === null || _l === void 0 ? void 0 : _l.SchemaID;
12730
12758
  // Marked as stale meaning some change was performed that requires a refresh.
12731
12759
  // This usually means a new sibling was added that we need to update.
12732
12760
  if (rego.stale) {
@@ -12756,7 +12784,7 @@ var EntitiesRenderManager;
12756
12784
  menuItemId: this.item.id,
12757
12785
  requestRender: false
12758
12786
  });
12759
- (_l = this.clustering) === null || _l === void 0 ? void 0 : _l.RemoveEntity(id, false);
12787
+ (_m = this.clustering) === null || _m === void 0 ? void 0 : _m.RemoveEntity(id, false);
12760
12788
  }
12761
12789
  }
12762
12790
  this.viewer.scene.requestRender();
@@ -16184,20 +16212,28 @@ var EntityFilterGetter;
16184
16212
  this.onStateUpdate = null;
16185
16213
  this.onScanUpdate = null;
16186
16214
  this.viewPortChangeRemoval = null;
16215
+ this.viewPortDelayQueue = null;
16187
16216
  this.viewerDateTimeChangeRemoval = null;
16188
16217
  this.cells = null;
16189
16218
  this.registeredItems = {};
16190
16219
  this.getterLoopId = 0;
16220
+ this.getterLoopAbortControllers = {};
16191
16221
  this.tagIds = null;
16192
16222
  this.minHeight = 0;
16193
16223
  this.maxHeight = 100000;
16194
16224
  this.viewRect = null;
16195
16225
  this.viewCenter = null;
16196
- 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, viaCdn = params.viaCdn;
16226
+ this.historicRefreshAbortController = null;
16227
+ // Entity IDs found for the latest integrity.
16228
+ // We use this for refreshing historic data without having to repeat geographic queries.
16229
+ this.gatheredIntegrity = null;
16230
+ this.gatheredEntityIds = [];
16231
+ 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;
16197
16232
  this.api = api;
16198
16233
  this.typeId = typeId;
16199
16234
  this.schemaId = schemaId;
16200
16235
  this.historicAttrKey = historicAttrKey;
16236
+ this.historicInterpolation = Boolean(historicInterpolation);
16201
16237
  this.viaCdn = Boolean(viaCdn);
16202
16238
  this.batchSize = isNaN(batchSize) ? 300 : batchSize;
16203
16239
  this.viewPort = viewPort;
@@ -16250,15 +16286,22 @@ var EntityFilterGetter;
16250
16286
  Getter.prototype.viewAreaSub = function () {
16251
16287
  var _this = this;
16252
16288
  this.viewAreaDispose();
16253
- this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(function () {
16289
+ // We'll avoid restarting the scanner too often.
16290
+ this.viewPortDelayQueue = new DelayQueue(function () {
16254
16291
  _this.updateBounds();
16255
16292
  _this.startGetterLoop();
16293
+ }, 2000);
16294
+ this.viewPortChangeRemoval = this.viewPort.Updated().Subscribe(function () {
16295
+ var _a;
16296
+ (_a = _this.viewPortDelayQueue) === null || _a === void 0 ? void 0 : _a.Call();
16256
16297
  });
16257
16298
  };
16258
16299
  Getter.prototype.viewAreaDispose = function () {
16259
- var _a;
16300
+ var _a, _b;
16260
16301
  (_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
16261
16302
  this.viewPortChangeRemoval = null;
16303
+ (_b = this.viewPortDelayQueue) === null || _b === void 0 ? void 0 : _b.Dispose();
16304
+ this.viewPortDelayQueue = null;
16262
16305
  };
16263
16306
  /**
16264
16307
  * Monitors the Cesium viewer and updates the historic data filter values.
@@ -16272,6 +16315,11 @@ var EntityFilterGetter;
16272
16315
  // This is multiplied by the speed of animation to figure
16273
16316
  // out how many animation "ticks" before we allow an update.
16274
16317
  var INTERVAL_WHILE_ANIMATING = 2.5 * 1000;
16318
+ var INTERVAL_WHILE_NOT_ANIMATING = 1000;
16319
+ if (this.historicInterpolation) {
16320
+ INTERVAL_WHILE_ANIMATING = 6 * 1000;
16321
+ INTERVAL_WHILE_NOT_ANIMATING = 3.5 * 1000;
16322
+ }
16275
16323
  var lastUpdateTime = null;
16276
16324
  var delayQueue = new DelayQueue(function () {
16277
16325
  try {
@@ -16281,17 +16329,16 @@ var EntityFilterGetter;
16281
16329
  return;
16282
16330
  }
16283
16331
  }
16284
- lastUpdateTime = new Date().getTime();
16285
16332
  var current = _this.historicAttrDateTime;
16286
16333
  _this.updateHistoricDateTime();
16287
16334
  if (current != _this.historicAttrDateTime) {
16288
- _this.updateState();
16335
+ _this.emitHistoricData();
16289
16336
  }
16290
16337
  }
16291
16338
  catch (e) {
16292
16339
  console.error(e);
16293
16340
  }
16294
- }, 250);
16341
+ }, INTERVAL_WHILE_NOT_ANIMATING);
16295
16342
  var postUpdateRemoval = this.viewer.scene.postUpdate.addEventListener(function () {
16296
16343
  if (delayQueue) {
16297
16344
  delayQueue.Call();
@@ -16410,8 +16457,20 @@ var EntityFilterGetter;
16410
16457
  this.getterLoopId += 1;
16411
16458
  var loopId = this.getterLoopId;
16412
16459
  var loopIntegrity = this.getIntegrityId();
16413
- new Promise(function () { return __awaiter(_this, void 0, void 0, function () {
16414
- var MIN_HEIGHT, MAX_HEIGHT, PAGE_SIZE, retryAttempts, retryDelay, prevFirstId, prevLastId, prevTicks, alt, cells, curCellIndex, postedScanning, postedLoading, total, curCell, entities, integrity, first, last, e_1;
16460
+ // Abort any existing loops that don't match the current loop.
16461
+ // We tried using integrity, however we want to interrupt when user moves camera quickly.
16462
+ // So it's better to use the loop ID.
16463
+ var abortId = String(loopId);
16464
+ {
16465
+ var newAbortControllers = {};
16466
+ for (var key in this.getterLoopAbortControllers) {
16467
+ this.getterLoopAbortControllers[key].abort();
16468
+ }
16469
+ this.getterLoopAbortControllers = newAbortControllers;
16470
+ }
16471
+ var abortController = this.getterLoopAbortControllers[abortId] = new AbortController();
16472
+ (function () { return __awaiter(_this, void 0, void 0, function () {
16473
+ var MIN_HEIGHT, MAX_HEIGHT, PAGE_SIZE, retryAttempts, retryDelay, prevFirstId, prevLastId, prevTicks, alt, cells, curCellIndex, postedScanning, postedLoading, total, curCell, entities, integrity, i, entity, first, last, e_1;
16415
16474
  var _a, _b, _c, _d, _e, _f, _g, _h;
16416
16475
  return __generator(this, function (_j) {
16417
16476
  switch (_j.label) {
@@ -16505,7 +16564,10 @@ var EntityFilterGetter;
16505
16564
  viaCdn: this.viaCdn,
16506
16565
  migrated: true,
16507
16566
  req: {
16508
- noCache: true
16567
+ // If we are passing in an abort, we MUST pass in noCache.
16568
+ // Otherwise we will cache an aborted request.
16569
+ noCache: true,
16570
+ abortSignal: abortController.signal
16509
16571
  }
16510
16572
  })];
16511
16573
  case 9:
@@ -16514,6 +16576,20 @@ var EntityFilterGetter;
16514
16576
  if (loopIntegrity == integrity && entities) {
16515
16577
  (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
16516
16578
  }
16579
+ if (this.gatheredIntegrity != integrity) {
16580
+ this.gatheredIntegrity = integrity;
16581
+ this.gatheredEntityIds = [];
16582
+ }
16583
+ // Add to the integrity list for any new IDs found.
16584
+ // This lets us keep track of all IDs we've found within the same integrity for historic data.
16585
+ if (this.historicAttrKey) {
16586
+ for (i = 0; i < entities.length; i++) {
16587
+ entity = entities[i];
16588
+ if (!this.gatheredEntityIds.includes(entity.Bruce.ID)) {
16589
+ this.gatheredEntityIds.push(entity.Bruce.ID);
16590
+ }
16591
+ }
16592
+ }
16517
16593
  if (this.getterLoopId != loopId) {
16518
16594
  return [3 /*break*/, 13];
16519
16595
  }
@@ -16556,7 +16632,14 @@ var EntityFilterGetter;
16556
16632
  return [3 /*break*/, 11];
16557
16633
  case 10:
16558
16634
  e_1 = _j.sent();
16635
+ // Ignore abort errors.
16636
+ if (e_1 && typeof e_1 === "object" && e_1.name == "AbortError") {
16637
+ return [3 /*break*/, 13];
16638
+ }
16559
16639
  console.error(e_1);
16640
+ if (this.getterLoopId != loopId) {
16641
+ return [3 /*break*/, 13];
16642
+ }
16560
16643
  // Request failed so let's add a delay and try again soon.
16561
16644
  retryDelay += RETRY_DELAY_INCREMENT;
16562
16645
  retryAttempts -= 1;
@@ -16575,7 +16658,104 @@ var EntityFilterGetter;
16575
16658
  return [2 /*return*/];
16576
16659
  }
16577
16660
  });
16578
- }); });
16661
+ }); })();
16662
+ };
16663
+ /**
16664
+ * Gets the historic state of found Entities for the current date times and emits them.
16665
+ * Since geometry searches are tied to the base Entity, we don't have to re-scan the viewport.
16666
+ */
16667
+ Getter.prototype.emitHistoricData = function () {
16668
+ var _this = this;
16669
+ var integrity = this.getIntegrityId();
16670
+ // Gathered ID does't match current one.
16671
+ if (this.gatheredIntegrity != integrity) {
16672
+ return;
16673
+ }
16674
+ var historicAttrDateTime = this.historicAttrDateTime;
16675
+ var SCAN_BATCH_SIZE = 1000;
16676
+ if (this.historicRefreshAbortController) {
16677
+ this.historicRefreshAbortController.abort();
16678
+ this.historicRefreshAbortController = null;
16679
+ }
16680
+ (function () { return __awaiter(_this, void 0, void 0, function () {
16681
+ var pageIndex, i, batch, controller, entities, e_2;
16682
+ var _a;
16683
+ return __generator(this, function (_b) {
16684
+ switch (_b.label) {
16685
+ case 0:
16686
+ pageIndex = 0;
16687
+ _b.label = 1;
16688
+ case 1:
16689
+ _b.trys.push([1, 6, , 7]);
16690
+ i = 0;
16691
+ _b.label = 2;
16692
+ case 2:
16693
+ if (!(i < this.gatheredEntityIds.length)) return [3 /*break*/, 5];
16694
+ batch = this.gatheredEntityIds.slice(i, i + SCAN_BATCH_SIZE);
16695
+ if (!batch.length) {
16696
+ return [3 /*break*/, 5];
16697
+ }
16698
+ controller = this.historicRefreshAbortController = new AbortController();
16699
+ return [4 /*yield*/, Entity$1.GetList({
16700
+ api: this.api,
16701
+ historicKey: this.historicAttrKey,
16702
+ historicPoint: historicAttrDateTime,
16703
+ schemaId: this.schemaId,
16704
+ filter: {
16705
+ pageSize: SCAN_BATCH_SIZE,
16706
+ pageIndex: pageIndex,
16707
+ entityTypeId: this.typeId,
16708
+ layerIds: this.tagIds,
16709
+ layerIdsOperator: "in",
16710
+ sortOrder: Api.ESortOrder.Asc,
16711
+ entityTypeConditions: {
16712
+ "ID": {
16713
+ "IN": batch
16714
+ }
16715
+ },
16716
+ },
16717
+ viaCdn: this.viaCdn,
16718
+ migrated: true,
16719
+ req: {
16720
+ // If we are passing in an abort, we MUST pass in noCache.
16721
+ // Otherwise we will cache an aborted request.
16722
+ noCache: true,
16723
+ abortSignal: controller.signal
16724
+ }
16725
+ })];
16726
+ case 3:
16727
+ entities = (_b.sent()).entities;
16728
+ // Date changed.
16729
+ if (this.historicAttrDateTime != historicAttrDateTime) {
16730
+ return [3 /*break*/, 5];
16731
+ }
16732
+ // Integrity changed.
16733
+ if (this.gatheredIntegrity != integrity) {
16734
+ return [3 /*break*/, 5];
16735
+ }
16736
+ // No Menu Items.
16737
+ if (!this.GetMenuItems().length) {
16738
+ return [3 /*break*/, 5];
16739
+ }
16740
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(entities);
16741
+ pageIndex += 1;
16742
+ _b.label = 4;
16743
+ case 4:
16744
+ i += SCAN_BATCH_SIZE;
16745
+ return [3 /*break*/, 2];
16746
+ case 5: return [3 /*break*/, 7];
16747
+ case 6:
16748
+ e_2 = _b.sent();
16749
+ // Ignore abort errors.
16750
+ if (e_2 && typeof e_2 === "object" && e_2.name == "AbortError") {
16751
+ return [2 /*return*/];
16752
+ }
16753
+ console.error(e_2);
16754
+ return [3 /*break*/, 7];
16755
+ case 7: return [2 /*return*/];
16756
+ }
16757
+ });
16758
+ }); })();
16579
16759
  };
16580
16760
  return Getter;
16581
16761
  }());
@@ -16591,6 +16771,9 @@ function createFilterGetterCacheKey(params) {
16591
16771
  cacheKey += params.schemaId ? params.schemaId : "";
16592
16772
  cacheKey += JSON.stringify(params.tagIds ? params.tagIds : []);
16593
16773
  cacheKey += params.historicAttrKey ? params.historicAttrKey : "";
16774
+ if (params.historicAttrKey) {
16775
+ cacheKey += params.historicInterpolation ? "true" : "false";
16776
+ }
16594
16777
  // This could potentially crash, but if it crashes here then it would crash during API request anyways.
16595
16778
  cacheKey += JSON.stringify(params.attrFilter ? params.attrFilter : {});
16596
16779
  return cacheKey;
@@ -16615,6 +16798,7 @@ var SharedGetters;
16615
16798
  batchSize: params.batchSize,
16616
16799
  attrFilter: params.attrFilter,
16617
16800
  historicAttrKey: params.historicAttrKey,
16801
+ historicInterpolation: params.historicInterpolation,
16618
16802
  viaCdn: params.cdn
16619
16803
  });
16620
16804
  this.data[cacheKey] = getter;
@@ -16625,6 +16809,7 @@ var SharedGetters;
16625
16809
  if (params.viewer && params.debugShowBounds) {
16626
16810
  // Cell id -> entity.
16627
16811
  var cellCache_1 = {};
16812
+ var cellPrefix_1 = ObjectUtils.UId(10) + "_";
16628
16813
  getter.OnScanUpdate.Subscribe(function (cells) {
16629
16814
  if (window.ON_SCAN_UPDATE_PAUSED == true) {
16630
16815
  return;
@@ -16635,7 +16820,7 @@ var SharedGetters;
16635
16820
  cells.forEach(function (cell) {
16636
16821
  var _a;
16637
16822
  var bounds = cell.GetBounds();
16638
- var id = bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
16823
+ var id = cellPrefix_1 + bounds.east + "_" + bounds.north + "_" + bounds.south + "_" + bounds.west;
16639
16824
  curCellIds.push(id);
16640
16825
  fetchedCells[id] = cell.IsFetched();
16641
16826
  fetchingCellId = cell.Fetching ? id : fetchingCellId;
@@ -16697,7 +16882,8 @@ var SharedGetters;
16697
16882
  })(SharedGetters || (SharedGetters = {}));
16698
16883
 
16699
16884
  var MAX_BATCHES = 2;
16700
- var BATCH_SIZE$3 = 30;
16885
+ var BATCH_SIZE_OLD_API = 30;
16886
+ var BATCH_SIZE_NEW_API = 1000;
16701
16887
  var BATCH_DELAY = 200;
16702
16888
  var MAX_RANGE = 3000;
16703
16889
  var TilesetOsmRenderManager;
@@ -16715,6 +16901,7 @@ var TilesetOsmRenderManager;
16715
16901
  this.queueCheckInterval = null;
16716
16902
  this.processingQueue = 0;
16717
16903
  this._osmIdToBruceId = {};
16904
+ this.batchSize = BATCH_SIZE_OLD_API;
16718
16905
  var viewer = params.viewer, visualsManager = params.register, apiGetter = params.getters, monitor = params.monitor, item = params.item;
16719
16906
  this.viewer = viewer;
16720
16907
  this.getters = apiGetter;
@@ -16773,7 +16960,7 @@ var TilesetOsmRenderManager;
16773
16960
  this.sourceId = EnsureNumber((_a = menuItem.BruceEntity) === null || _a === void 0 ? void 0 : _a.SourceId, 0);
16774
16961
  this.entityTypeId = (_b = menuItem.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
16775
16962
  (function () { return __awaiter(_this, void 0, void 0, function () {
16776
- var validToken, CESIUM, cTileset;
16963
+ var validToken, CESIUM, cTileset, api;
16777
16964
  var _this = this;
16778
16965
  return __generator(this, function (_a) {
16779
16966
  switch (_a.label) {
@@ -16800,6 +16987,13 @@ var TilesetOsmRenderManager;
16800
16987
  }
16801
16988
  _a.label = 4;
16802
16989
  case 4:
16990
+ api = this.getters.GetBruceApi();
16991
+ return [4 /*yield*/, api.Loading];
16992
+ case 5:
16993
+ _a.sent();
16994
+ if (api.IsVersionAtLeast("1.0.5244")) {
16995
+ this.batchSize = BATCH_SIZE_NEW_API;
16996
+ }
16803
16997
  if (this.disposed) {
16804
16998
  if (this.cTileset && !this.cTileset.isDestroyed()) {
16805
16999
  this.cTileset.destroy();
@@ -16936,7 +17130,7 @@ var TilesetOsmRenderManager;
16936
17130
  var isClose = this.getIsVisualWithinRange(feature, MAX_RANGE);
16937
17131
  if (isClose) {
16938
17132
  batch.push(feature);
16939
- if (batch.length >= BATCH_SIZE$3) {
17133
+ if (batch.length >= this.batchSize) {
16940
17134
  return batch;
16941
17135
  }
16942
17136
  }
@@ -17098,7 +17292,7 @@ var TilesetOsmRenderManager;
17098
17292
  delete this._loadedCesiumEntities[key];
17099
17293
  this.totalLoaded -= 1;
17100
17294
  removed += 1;
17101
- if (removed >= BATCH_SIZE$3) {
17295
+ if (removed >= this.batchSize) {
17102
17296
  return true;
17103
17297
  }
17104
17298
  }
@@ -24113,11 +24307,11 @@ function renderNavigator(iteration, params, bookmark, view, getters) {
24113
24307
  var ViewRenderEngine;
24114
24308
  (function (ViewRenderEngine) {
24115
24309
  function Render(params) {
24116
- var _a;
24310
+ var _a, _b;
24117
24311
  return __awaiter(this, void 0, void 0, function () {
24118
- var iteration, api, view, _b, bookmark, bookmarkId, _c, version, bWidget;
24119
- return __generator(this, function (_d) {
24120
- switch (_d.label) {
24312
+ var iteration, api, view, _c, bookmark, bookmarkId, _d, version, bWidget, lpWidget;
24313
+ return __generator(this, function (_e) {
24314
+ switch (_e.label) {
24121
24315
  case 0:
24122
24316
  if (!params.manager && params.viewer) {
24123
24317
  params.manager = ViewerUtils.GetManager({
@@ -24140,17 +24334,17 @@ var ViewRenderEngine;
24140
24334
  }
24141
24335
  api = params.getters.GetBruceApi();
24142
24336
  if (!params.view) return [3 /*break*/, 1];
24143
- _b = params.view;
24337
+ _c = params.view;
24144
24338
  return [3 /*break*/, 3];
24145
24339
  case 1: return [4 /*yield*/, ProjectView.Get({
24146
24340
  api: api,
24147
24341
  viewId: params.viewId
24148
24342
  })];
24149
24343
  case 2:
24150
- _b = (_d.sent()).view;
24151
- _d.label = 3;
24344
+ _c = (_e.sent()).view;
24345
+ _e.label = 3;
24152
24346
  case 3:
24153
- view = _b;
24347
+ view = _c;
24154
24348
  bookmark = params.bookmark;
24155
24349
  if (!!bookmark) return [3 /*break*/, 7];
24156
24350
  bookmarkId = params.bookmarkId;
@@ -24164,14 +24358,14 @@ var ViewRenderEngine;
24164
24358
  bookmarkId: bookmarkId
24165
24359
  })];
24166
24360
  case 4:
24167
- _c = (_d.sent()).bookmark;
24361
+ _d = (_e.sent()).bookmark;
24168
24362
  return [3 /*break*/, 6];
24169
24363
  case 5:
24170
- _c = null;
24171
- _d.label = 6;
24364
+ _d = null;
24365
+ _e.label = 6;
24172
24366
  case 6:
24173
- bookmark = _c;
24174
- _d.label = 7;
24367
+ bookmark = _d;
24368
+ _e.label = 7;
24175
24369
  case 7:
24176
24370
  if (!assertIteration$1(params.viewer, iteration)) {
24177
24371
  return [2 /*return*/];
@@ -24180,12 +24374,12 @@ var ViewRenderEngine;
24180
24374
  if (!(version == 1)) return [3 /*break*/, 9];
24181
24375
  return [4 /*yield*/, renderLegacyNavigator(iteration, params, bookmark, view)];
24182
24376
  case 8:
24183
- _d.sent();
24377
+ _e.sent();
24184
24378
  return [3 /*break*/, 11];
24185
24379
  case 9: return [4 /*yield*/, renderNavigator(iteration, params, bookmark, view, params.getters)];
24186
24380
  case 10:
24187
- _d.sent();
24188
- _d.label = 11;
24381
+ _e.sent();
24382
+ _e.label = 11;
24189
24383
  case 11:
24190
24384
  if (!assertIteration$1(params.viewer, iteration)) {
24191
24385
  return [2 /*return*/];
@@ -24195,6 +24389,11 @@ var ViewRenderEngine;
24195
24389
  bWidget.ViewId = params.viewId ? params.viewId : view === null || view === void 0 ? void 0 : view.ID;
24196
24390
  bWidget.LastEnabledBookmarkId = params.bookmarkId ? params.bookmarkId : bookmark === null || bookmark === void 0 ? void 0 : bookmark.ID;
24197
24391
  }
24392
+ lpWidget = (_b = params.viewer) === null || _b === void 0 ? void 0 : _b[VIEWER_LEFT_PANEL_WIDGET_KEY];
24393
+ if (lpWidget) {
24394
+ lpWidget.ViewId = params.viewId ? params.viewId : view === null || view === void 0 ? void 0 : view.ID;
24395
+ lpWidget.LastEnabledBookmarkId = params.bookmarkId ? params.bookmarkId : bookmark === null || bookmark === void 0 ? void 0 : bookmark.ID;
24396
+ }
24198
24397
  return [2 /*return*/];
24199
24398
  }
24200
24399
  });
@@ -24237,6 +24436,8 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
24237
24436
  var isChanged = this._viewId != value;
24238
24437
  if (isChanged) {
24239
24438
  this._viewId = value;
24439
+ this._updatePanelStyles();
24440
+ this._loading = this.loadBookmarks();
24240
24441
  }
24241
24442
  },
24242
24443
  enumerable: false,
@@ -24288,13 +24489,15 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
24288
24489
  };
24289
24490
  WidgetLeftPanel.prototype.loadBookmarks = function () {
24290
24491
  return __awaiter(this, void 0, void 0, function () {
24291
- var api, viewId, data, e_1;
24492
+ var viewId, api, data, e_1;
24292
24493
  return __generator(this, function (_a) {
24293
24494
  switch (_a.label) {
24294
24495
  case 0:
24295
- _a.trys.push([0, 2, , 3]);
24296
- api = this._apiGetters.GetBruceApi();
24297
24496
  viewId = this._viewId;
24497
+ _a.label = 1;
24498
+ case 1:
24499
+ _a.trys.push([1, 3, , 4]);
24500
+ api = this._apiGetters.GetBruceApi();
24298
24501
  if (!viewId) {
24299
24502
  this.bookmarks = [];
24300
24503
  return [2 /*return*/];
@@ -24303,16 +24506,22 @@ var WidgetLeftPanel = /** @class */ (function (_super) {
24303
24506
  viewId: viewId,
24304
24507
  api: api
24305
24508
  })];
24306
- case 1:
24509
+ case 2:
24307
24510
  data = _a.sent();
24511
+ if (this._viewId !== viewId) {
24512
+ return [2 /*return*/];
24513
+ }
24308
24514
  this.bookmarks = data.bookmarks;
24309
- return [3 /*break*/, 3];
24310
- case 2:
24515
+ return [3 /*break*/, 4];
24516
+ case 3:
24311
24517
  e_1 = _a.sent();
24312
24518
  console.error(e_1);
24519
+ if (this._viewId !== viewId) {
24520
+ return [2 /*return*/];
24521
+ }
24313
24522
  this.bookmarks = [];
24314
- return [3 /*break*/, 3];
24315
- case 3: return [2 /*return*/];
24523
+ return [3 /*break*/, 4];
24524
+ case 4: return [2 /*return*/];
24316
24525
  }
24317
24526
  });
24318
24527
  });
@@ -27862,7 +28071,7 @@ var WidgetViewBar = /** @class */ (function (_super) {
27862
28071
  return WidgetViewBar;
27863
28072
  }(Widget.AWidget));
27864
28073
 
27865
- var VERSION = "4.6.1";
28074
+ var VERSION = "4.6.3";
27866
28075
 
27867
28076
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, 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 };
27868
28077
  //# sourceMappingURL=bruce-cesium.es5.js.map