bruce-cesium 3.7.4 → 3.7.6

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.
@@ -1279,12 +1279,11 @@
1279
1279
  /**
1280
1280
  * Stores a copy of the color against a key within the graphic.
1281
1281
  * This lets us refer to it later if we need to change to it.
1282
- * @param viewer
1283
1282
  * @param key
1284
1283
  * @param color
1285
1284
  * @param graphic
1286
1285
  */
1287
- function storeColor(viewer, key, color, graphic) {
1286
+ function storeColor(key, color, graphic) {
1288
1287
  graphic[getStoreKey(key)] = (color === null || color === void 0 ? void 0 : color.clone) ? color.clone() : color;
1289
1288
  }
1290
1289
  /**
@@ -1304,7 +1303,7 @@
1304
1303
  // We'll only store the default color.
1305
1304
  // Rest can be retrieved every time to get the latest setting value.
1306
1305
  if (color) {
1307
- storeColor(viewer, key, color, graphic);
1306
+ storeColor(key, color, graphic);
1308
1307
  }
1309
1308
  }
1310
1309
  else if (key == "select") {
@@ -1551,36 +1550,36 @@
1551
1550
  }
1552
1551
  if (part instanceof Cesium.Cesium3DTileFeature) {
1553
1552
  var opacity = getAppliedOpacity(part);
1554
- storeColor(viewer, "default", calculateCurColor(viewer, part), part);
1553
+ storeColor("default", calculateCurColor(viewer, part), part);
1555
1554
  refreshColor(viewer, part, opacity);
1556
1555
  }
1557
1556
  else if (part instanceof Cesium.Entity) {
1558
1557
  if (part.billboard) {
1559
- storeColor(viewer, "default", calculateCurColor(viewer, part.billboard), part.billboard);
1558
+ storeColor("default", calculateCurColor(viewer, part.billboard), part.billboard);
1560
1559
  refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
1561
1560
  }
1562
1561
  if (part.model) {
1563
- storeColor(viewer, "default", calculateCurColor(viewer, part.model), part.model);
1562
+ storeColor("default", calculateCurColor(viewer, part.model), part.model);
1564
1563
  refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1565
1564
  }
1566
1565
  if (part.polyline) {
1567
- storeColor(viewer, "default", calculateCurColor(viewer, part.polyline), part.polyline);
1566
+ storeColor("default", calculateCurColor(viewer, part.polyline), part.polyline);
1568
1567
  refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1569
1568
  }
1570
1569
  if (part.polygon) {
1571
- storeColor(viewer, "default", calculateCurColor(viewer, part.polygon), part.polygon);
1570
+ storeColor("default", calculateCurColor(viewer, part.polygon), part.polygon);
1572
1571
  refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1573
1572
  }
1574
1573
  if (part.corridor) {
1575
- storeColor(viewer, "default", calculateCurColor(viewer, part.corridor), part.corridor);
1574
+ storeColor("default", calculateCurColor(viewer, part.corridor), part.corridor);
1576
1575
  refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1577
1576
  }
1578
1577
  if (part.point) {
1579
- storeColor(viewer, "default", calculateCurColor(viewer, part.point), part.point);
1578
+ storeColor("default", calculateCurColor(viewer, part.point), part.point);
1580
1579
  refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1581
1580
  }
1582
1581
  if (part.ellipse) {
1583
- storeColor(viewer, "default", calculateCurColor(viewer, part.ellipse), part.ellipse);
1582
+ storeColor("default", calculateCurColor(viewer, part.ellipse), part.ellipse);
1584
1583
  refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
1585
1584
  }
1586
1585
  }
@@ -1615,36 +1614,36 @@
1615
1614
  }
1616
1615
  if (part instanceof Cesium.Cesium3DTileFeature) {
1617
1616
  var opacity = getAppliedOpacity(part);
1618
- storeColor(viewer, "default", params.color, part);
1617
+ storeColor("default", params.color, part);
1619
1618
  refreshColor(viewer, part, opacity);
1620
1619
  }
1621
1620
  else if (part instanceof Cesium.Entity) {
1622
1621
  if (part.billboard) {
1623
- storeColor(viewer, "default", params.color, part.billboard);
1622
+ storeColor("default", params.color, part.billboard);
1624
1623
  refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
1625
1624
  }
1626
1625
  if (part.model) {
1627
- storeColor(viewer, "default", params.color, part.model);
1626
+ storeColor("default", params.color, part.model);
1628
1627
  refreshColor(viewer, part.model, getAppliedOpacity(part.model));
1629
1628
  }
1630
1629
  if (part.polyline) {
1631
- storeColor(viewer, "default", params.color, part.polyline);
1630
+ storeColor("default", params.color, part.polyline);
1632
1631
  refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
1633
1632
  }
1634
1633
  if (part.polygon) {
1635
- storeColor(viewer, "default", params.color, part.polygon);
1634
+ storeColor("default", params.color, part.polygon);
1636
1635
  refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
1637
1636
  }
1638
1637
  if (part.corridor) {
1639
- storeColor(viewer, "default", params.color, part.corridor);
1638
+ storeColor("default", params.color, part.corridor);
1640
1639
  refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
1641
1640
  }
1642
1641
  if (part.point) {
1643
- storeColor(viewer, "default", params.color, part.point);
1642
+ storeColor("default", params.color, part.point);
1644
1643
  refreshColor(viewer, part.point, getAppliedOpacity(part.point));
1645
1644
  }
1646
1645
  if (part.ellipse) {
1647
- storeColor(viewer, "default", params.color, part.ellipse);
1646
+ storeColor("default", params.color, part.ellipse);
1648
1647
  refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
1649
1648
  }
1650
1649
  }
@@ -4797,11 +4796,11 @@
4797
4796
  }
4798
4797
  (function (EntityRenderEngine) {
4799
4798
  function Render(params) {
4800
- var _a, _b, _c, _d, _e, _f, _g, _h;
4799
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4801
4800
  return __awaiter(this, void 0, void 0, function () {
4802
4801
  var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
4803
- return __generator(this, function (_j) {
4804
- switch (_j.label) {
4802
+ return __generator(this, function (_m) {
4803
+ switch (_m.label) {
4805
4804
  case 0:
4806
4805
  groupRenderParams = {
4807
4806
  apiGetter: params.apiGetter,
@@ -4849,7 +4848,11 @@
4849
4848
  });
4850
4849
  newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
4851
4850
  oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
4852
- if (!params.force && newRenderId == oldRenderId && !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale)) {
4851
+ if (!params.force &&
4852
+ newRenderId == oldRenderId &&
4853
+ !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
4854
+ // If historic metadata is different then it's also stale.
4855
+ ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.historicDateTime))) {
4853
4856
  // No sorting category needed. Already rendered the way we want.
4854
4857
  cEntities[id] = existingRego.visual;
4855
4858
  }
@@ -4859,12 +4862,16 @@
4859
4862
  cEntities[id] = existingRego.visual;
4860
4863
  // Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
4861
4864
  existingRego.stale = false;
4865
+ // Update metadata for the same reason.
4866
+ existingRego.historicDateTime = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime;
4867
+ existingRego.historicAttrKey = (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey;
4868
+ existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
4862
4869
  }
4863
4870
  if (displayType == bruceModels.ZoomControl.EDisplayType.Model3D) {
4864
4871
  models.push(entity);
4865
4872
  }
4866
4873
  else if (displayType == bruceModels.ZoomControl.EDisplayType.Geometry) {
4867
- if ((_e = (_d = entity.geometry) === null || _d === void 0 ? void 0 : _d.MultiGeometry) === null || _e === void 0 ? void 0 : _e.length) {
4874
+ if ((_h = (_g = entity.geometry) === null || _g === void 0 ? void 0 : _g.MultiGeometry) === null || _h === void 0 ? void 0 : _h.length) {
4868
4875
  multiGeometry.push(entity);
4869
4876
  }
4870
4877
  else {
@@ -4882,7 +4889,7 @@
4882
4889
  mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
4883
4890
  return [4 /*yield*/, Model3d.RenderGroup(mParams)];
4884
4891
  case 1:
4885
- mEntities = _j.sent();
4892
+ mEntities = _m.sent();
4886
4893
  for (i = 0; i < mParams.entities.length; i++) {
4887
4894
  entity = mParams.entities[i];
4888
4895
  id = entity.Bruce.ID;
@@ -4894,16 +4901,16 @@
4894
4901
  multiGeometry.push(entity);
4895
4902
  }
4896
4903
  }
4897
- _j.label = 2;
4904
+ _m.label = 2;
4898
4905
  case 2:
4899
4906
  if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
4900
4907
  _loop_1 = function (i) {
4901
4908
  var entity, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
4902
- return __generator(this, function (_k) {
4903
- switch (_k.label) {
4909
+ return __generator(this, function (_o) {
4910
+ switch (_o.label) {
4904
4911
  case 0:
4905
4912
  entity = multiGeometry[i];
4906
- if (!((_g = (_f = entity.geometry) === null || _f === void 0 ? void 0 : _f.MultiGeometry) === null || _g === void 0 ? void 0 : _g.length)) {
4913
+ if (!((_k = (_j = entity.geometry) === null || _j === void 0 ? void 0 : _j.MultiGeometry) === null || _k === void 0 ? void 0 : _k.length)) {
4907
4914
  polygons.push(entity);
4908
4915
  return [2 /*return*/, "continue"];
4909
4916
  }
@@ -4916,7 +4923,7 @@
4916
4923
  }
4917
4924
  return [4 /*yield*/, Polygon.RenderGroup(pParams)];
4918
4925
  case 1:
4919
- cPoly = _k.sent();
4926
+ cPoly = _o.sent();
4920
4927
  Object.keys(cPoly).forEach(function (key) {
4921
4928
  if (cPoly[key]) {
4922
4929
  pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
@@ -4925,7 +4932,7 @@
4925
4932
  rendered = Object.values(cPoly);
4926
4933
  return [4 /*yield*/, Polyline.RenderGroup(pParams)];
4927
4934
  case 2:
4928
- cLines = _k.sent();
4935
+ cLines = _o.sent();
4929
4936
  Object.keys(cLines).forEach(function (key) {
4930
4937
  if (cLines[key]) {
4931
4938
  pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
@@ -4935,9 +4942,9 @@
4935
4942
  if (!!rendered.length) return [3 /*break*/, 4];
4936
4943
  return [4 /*yield*/, Point.RenderGroup(pParams)];
4937
4944
  case 3:
4938
- cPoints = _k.sent();
4945
+ cPoints = _o.sent();
4939
4946
  rendered = rendered.concat(Object.values(cPoints));
4940
- _k.label = 4;
4947
+ _o.label = 4;
4941
4948
  case 4:
4942
4949
  rendered = rendered.filter(function (x) { return x != null; });
4943
4950
  if (rendered.length) {
@@ -4945,7 +4952,7 @@
4945
4952
  id: bruceModels.ObjectUtils.UId(10)
4946
4953
  });
4947
4954
  rootEntity_1._siblingGraphics = [];
4948
- rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_h = params.viewer) === null || _h === void 0 ? void 0 : _h.terrainProvider);
4955
+ rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_l = params.viewer) === null || _l === void 0 ? void 0 : _l.terrainProvider);
4949
4956
  rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
4950
4957
  cEntities[entity.Bruce.ID] = rootEntity_1;
4951
4958
  firstEntity = rendered[0];
@@ -4964,13 +4971,13 @@
4964
4971
  });
4965
4972
  };
4966
4973
  i = 0;
4967
- _j.label = 3;
4974
+ _m.label = 3;
4968
4975
  case 3:
4969
4976
  if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
4970
4977
  return [5 /*yield**/, _loop_1(i)];
4971
4978
  case 4:
4972
- _j.sent();
4973
- _j.label = 5;
4979
+ _m.sent();
4980
+ _m.label = 5;
4974
4981
  case 5:
4975
4982
  i++;
4976
4983
  return [3 /*break*/, 3];
@@ -4979,7 +4986,7 @@
4979
4986
  pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
4980
4987
  return [4 /*yield*/, Polygon.RenderGroup(pParams)];
4981
4988
  case 7:
4982
- pEntities = _j.sent();
4989
+ pEntities = _m.sent();
4983
4990
  for (i = 0; i < pParams.entities.length; i++) {
4984
4991
  entity = pParams.entities[i];
4985
4992
  cEntity = pEntities[entity.Bruce.ID];
@@ -4990,13 +4997,13 @@
4990
4997
  polylines.push(entity);
4991
4998
  }
4992
4999
  }
4993
- _j.label = 8;
5000
+ _m.label = 8;
4994
5001
  case 8:
4995
5002
  if (!(polylines.length > 0)) return [3 /*break*/, 10];
4996
5003
  pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
4997
5004
  return [4 /*yield*/, Polyline.RenderGroup(pParams)];
4998
5005
  case 9:
4999
- pEntities = _j.sent();
5006
+ pEntities = _m.sent();
5000
5007
  for (i = 0; i < pParams.entities.length; i++) {
5001
5008
  entity = pParams.entities[i];
5002
5009
  cEntity = pEntities[entity.Bruce.ID];
@@ -5007,13 +5014,13 @@
5007
5014
  points.push(entity);
5008
5015
  }
5009
5016
  }
5010
- _j.label = 10;
5017
+ _m.label = 10;
5011
5018
  case 10:
5012
5019
  if (!(points.length > 0)) return [3 /*break*/, 12];
5013
5020
  pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
5014
5021
  return [4 /*yield*/, Point.RenderGroup(pParams)];
5015
5022
  case 11:
5016
- pEntities = _j.sent();
5023
+ pEntities = _m.sent();
5017
5024
  for (i = 0; i < pParams.entities.length; i++) {
5018
5025
  entity = pParams.entities[i];
5019
5026
  cEntity = pEntities[entity.Bruce.ID];
@@ -5021,7 +5028,7 @@
5021
5028
  cEntities[entity.Bruce.ID] = cEntity;
5022
5029
  }
5023
5030
  }
5024
- _j.label = 12;
5031
+ _m.label = 12;
5025
5032
  case 12: return [2 /*return*/, cEntities];
5026
5033
  }
5027
5034
  });
@@ -5221,7 +5228,7 @@
5221
5228
  }));
5222
5229
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
5223
5230
  exports.CesiumEntityStyler.SetDefaultColor({
5224
- color: cColor_1,
5231
+ color: cColor_1 ? cColor_1 : new Cesium.Color(),
5225
5232
  entity: cEntity,
5226
5233
  viewer: params.viewer,
5227
5234
  override: true,
@@ -6151,6 +6158,11 @@
6151
6158
  position: pos,
6152
6159
  show: true
6153
6160
  });
6161
+ exports.CesiumEntityStyler.BakeDefaultColor({
6162
+ entity: cEntity,
6163
+ viewer: params.viewer,
6164
+ override: true
6165
+ });
6154
6166
  }
6155
6167
  else {
6156
6168
  // Gather entity in case previous version had sibling graphics we no longer need.
@@ -6199,7 +6211,7 @@
6199
6211
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
6200
6212
  // cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
6201
6213
  exports.CesiumEntityStyler.SetDefaultColor({
6202
- color: color,
6214
+ color: color ? color : new Cesium.Color(),
6203
6215
  entity: cEntity,
6204
6216
  viewer: params.viewer,
6205
6217
  override: true,
@@ -9730,7 +9742,8 @@
9730
9742
  // So for multiple tags we'll manually sort on UI end...
9731
9743
  tagIds: (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [],
9732
9744
  debugShowBounds: Boolean(window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
9733
- cdn: this.item.cdnEnabled
9745
+ cdn: this.item.cdnEnabled,
9746
+ historicAttrKey: this.item.BruceEntity.historicAttrKey
9734
9747
  });
9735
9748
  var minMax = exports.RenderManager.GetZoomMinMax({
9736
9749
  zoomControl: this.item.CameraZoomSettings
@@ -10292,23 +10305,37 @@
10292
10305
  * @returns
10293
10306
  */
10294
10307
  Manager.prototype.renderAsIndividuals = function (entities, force) {
10295
- var _a, _b, _c;
10308
+ var _a, _b, _c, _d, _e, _f, _g;
10296
10309
  if (force === void 0) { force = false; }
10297
10310
  return __awaiter(this, void 0, void 0, function () {
10298
- var cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
10299
- return __generator(this, function (_d) {
10300
- switch (_d.label) {
10301
- case 0: return [4 /*yield*/, exports.EntityRenderEngine.Render({
10302
- viewer: this.viewer,
10303
- apiGetter: this.apiGetter,
10304
- entities: entities,
10305
- menuItemId: this.item.id,
10306
- visualRegister: this.visualsManager,
10307
- zoomControl: this.item.CameraZoomSettings,
10308
- force: force
10309
- })];
10311
+ var toRemove, i, entity, cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
10312
+ return __generator(this, function (_h) {
10313
+ switch (_h.label) {
10314
+ case 0:
10315
+ if ((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey) {
10316
+ toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
10317
+ for (i = 0; i < toRemove.length; i++) {
10318
+ entity = toRemove[i];
10319
+ this.visualsManager.RemoveRegos({
10320
+ entityId: entity.Bruce.ID,
10321
+ menuItemId: this.item.id,
10322
+ requestRender: false
10323
+ });
10324
+ (_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
10325
+ }
10326
+ entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
10327
+ }
10328
+ return [4 /*yield*/, exports.EntityRenderEngine.Render({
10329
+ viewer: this.viewer,
10330
+ apiGetter: this.apiGetter,
10331
+ entities: entities,
10332
+ menuItemId: this.item.id,
10333
+ visualRegister: this.visualsManager,
10334
+ zoomControl: this.item.CameraZoomSettings,
10335
+ force: force
10336
+ })];
10310
10337
  case 1:
10311
- cEntities = _d.sent();
10338
+ cEntities = _h.sent();
10312
10339
  if (this.disposed) {
10313
10340
  this.doDispose();
10314
10341
  return [2 /*return*/];
@@ -10319,13 +10346,13 @@
10319
10346
  cEntity = cEntities[id];
10320
10347
  this.renderedEntities[id] = !!cEntity;
10321
10348
  if (cEntity) {
10322
- visual = (_a = this.visualsManager.GetRego({
10349
+ visual = (_c = this.visualsManager.GetRego({
10323
10350
  entityId: id,
10324
10351
  menuItemId: this.item.id
10325
- })) === null || _a === void 0 ? void 0 : _a.visual;
10352
+ })) === null || _c === void 0 ? void 0 : _c.visual;
10326
10353
  if (!visual || visual != cEntity) {
10327
10354
  wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
10328
- tagIds = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b["Layer.ID"];
10355
+ tagIds = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d["Layer.ID"];
10329
10356
  rego = {
10330
10357
  entityId: id,
10331
10358
  menuItemId: this.item.id,
@@ -10336,7 +10363,9 @@
10336
10363
  tagIds: tagIds ? [].concat(tagIds) : [],
10337
10364
  overrideShow: wasClustered ? false : null,
10338
10365
  name: cEntity.name,
10339
- cdn: this.item.cdnEnabled
10366
+ cdn: this.item.cdnEnabled,
10367
+ historicDateTime: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime,
10368
+ historicAttrKey: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey
10340
10369
  };
10341
10370
  this.visualsManager.AddRego({
10342
10371
  rego: rego,
@@ -10350,7 +10379,7 @@
10350
10379
  menuItemId: this.item.id,
10351
10380
  requestRender: false
10352
10381
  });
10353
- (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(id, false);
10382
+ (_g = this.clustering) === null || _g === void 0 ? void 0 : _g.RemoveEntity(id, false);
10354
10383
  }
10355
10384
  }
10356
10385
  this.viewer.scene.requestRender();
@@ -13551,12 +13580,13 @@
13551
13580
  EStatus["Loading"] = "LOADING";
13552
13581
  })(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
13553
13582
  var Getter = /** @class */ (function () {
13554
- function Getter(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
13583
+ function Getter(api, viewer, viewPort, typeId, batchSize, attrFilter, historicAttrKey, viaCdn) {
13555
13584
  this.onUpdate = null;
13556
13585
  this.LastStateUpdates = {};
13557
13586
  this.onStateUpdate = null;
13558
13587
  this.onScanUpdate = null;
13559
13588
  this.viewPortChangeRemoval = null;
13589
+ this.viewerDateTimeChangeRemoval = null;
13560
13590
  this.cells = null;
13561
13591
  this.registeredItems = {};
13562
13592
  this.getterLoopId = 0;
@@ -13567,10 +13597,12 @@
13567
13597
  this.viewCenter = null;
13568
13598
  this.api = api;
13569
13599
  this.typeId = typeId;
13600
+ this.historicAttrKey = historicAttrKey;
13570
13601
  this.viaCdn = Boolean(viaCdn);
13571
13602
  this.batchSize = isNaN(batchSize) ? 300 : batchSize;
13572
13603
  this.viewPort = viewPort;
13573
13604
  this.attrFilter = attrFilter;
13605
+ this.viewer = viewer;
13574
13606
  this.updateBounds();
13575
13607
  }
13576
13608
  Object.defineProperty(Getter.prototype, "OnUpdate", {
@@ -13609,7 +13641,14 @@
13609
13641
  * @returns
13610
13642
  */
13611
13643
  Getter.prototype.getIntegrityId = function () {
13612
- return this.tagIds == null ? "" : this.tagIds.join();
13644
+ var integrity = this.tagIds == null ? "" : this.tagIds.join();
13645
+ if (this.historicAttrKey) {
13646
+ integrity += this.historicAttrKey;
13647
+ if (this.historicAttrDateTime) {
13648
+ integrity += this.historicAttrDateTime;
13649
+ }
13650
+ }
13651
+ return integrity;
13613
13652
  };
13614
13653
  Getter.prototype.viewAreaSub = function () {
13615
13654
  var _this = this;
@@ -13622,6 +13661,57 @@
13622
13661
  Getter.prototype.viewAreaDispose = function () {
13623
13662
  var _a;
13624
13663
  (_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
13664
+ this.viewPortChangeRemoval = null;
13665
+ };
13666
+ /**
13667
+ * Monitors the Cesium viewer and updates the historic data filter values.
13668
+ * If there is no historic attr set, this will do nothing.
13669
+ */
13670
+ Getter.prototype.viewerDateTimeSub = function () {
13671
+ var _this = this;
13672
+ this.viewerDateTimeDispose();
13673
+ if (!this.historicAttrKey) {
13674
+ return;
13675
+ }
13676
+ var delayQueue = new bruceModels.DelayQueue(function () {
13677
+ var current = _this.getIntegrityId();
13678
+ _this.updateHistoricDateTime();
13679
+ if (current != _this.getIntegrityId()) {
13680
+ _this.updateState();
13681
+ }
13682
+ }, 250);
13683
+ var postUpdateRemoval = this.viewer.scene.postUpdate.addEventListener(function () {
13684
+ if (delayQueue) {
13685
+ delayQueue.Call();
13686
+ }
13687
+ });
13688
+ this.viewerDateTimeChangeRemoval = function () {
13689
+ delayQueue === null || delayQueue === void 0 ? void 0 : delayQueue.Dispose();
13690
+ postUpdateRemoval === null || postUpdateRemoval === void 0 ? void 0 : postUpdateRemoval();
13691
+ delayQueue = null;
13692
+ postUpdateRemoval = null;
13693
+ };
13694
+ };
13695
+ Getter.prototype.updateHistoricDateTime = function () {
13696
+ var newDateTime = Cesium.JulianDate.toDate(this.viewer.clock.currentTime);
13697
+ // Has previous value. Let's compare.
13698
+ if (this.historicAttrDateTime) {
13699
+ var oldDateTime = new Date(this.historicAttrDateTime);
13700
+ // Change must be at least 0.1 seconds.
13701
+ // TODO: This is just a random value I picked. We may need to make a setting or refine this.
13702
+ if (Math.abs(newDateTime.getTime() - oldDateTime.getTime()) < 100) {
13703
+ return;
13704
+ }
13705
+ }
13706
+ this.historicAttrDateTime = newDateTime.toISOString();
13707
+ // Set min/max to be the value increased/decreased by 1 minute.
13708
+ this.historicAttrDateTimeMin = new Date(newDateTime.getTime() - 60000).toISOString();
13709
+ this.historicAttrDateTimeMax = new Date(newDateTime.getTime() + 60000).toISOString();
13710
+ };
13711
+ Getter.prototype.viewerDateTimeDispose = function () {
13712
+ var _a;
13713
+ (_a = this.viewerDateTimeChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
13714
+ this.viewerDateTimeChangeRemoval = null;
13625
13715
  };
13626
13716
  Getter.prototype.GetMenuItems = function () {
13627
13717
  return Object.keys(this.registeredItems);
@@ -13681,8 +13771,10 @@
13681
13771
  this.minHeight = minHeight;
13682
13772
  this.maxHeight = maxHeight;
13683
13773
  this.updateBounds();
13774
+ this.updateHistoricDateTime();
13684
13775
  this.startGetterLoop();
13685
13776
  this.viewAreaSub();
13777
+ this.viewerDateTimeSub();
13686
13778
  }
13687
13779
  else {
13688
13780
  this.getterLoopId += 1;
@@ -13778,6 +13870,9 @@
13778
13870
  _j.trys.push([8, 10, , 11]);
13779
13871
  return [4 /*yield*/, bruceModels.Entity.GetList({
13780
13872
  api: this.api,
13873
+ historicKey: this.historicAttrKey,
13874
+ historicFrom: this.historicAttrKey ? this.historicAttrDateTimeMin : null,
13875
+ historicTo: this.historicAttrKey ? this.historicAttrDateTimeMax : null,
13781
13876
  filter: {
13782
13877
  pageSize: PAGE_SIZE,
13783
13878
  pageIndex: curCell.FetchPageIndex,
@@ -13875,6 +13970,7 @@
13875
13970
  cacheKey += params.batchSize;
13876
13971
  cacheKey += String(params.cdn);
13877
13972
  cacheKey += JSON.stringify(params.tagIds ? params.tagIds : []);
13973
+ cacheKey += params.historicAttrKey ? params.historicAttrKey : "";
13878
13974
  // This could potentially crash, but if it crashes here then it would crash during API request anyways.
13879
13975
  cacheKey += JSON.stringify(params.attrFilter ? params.attrFilter : {});
13880
13976
  return cacheKey;
@@ -13889,7 +13985,7 @@
13889
13985
  var cacheKey = createFilterGetterCacheKey(params);
13890
13986
  var getter = this.data[cacheKey];
13891
13987
  if (!getter) {
13892
- getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.cdn);
13988
+ getter = new EntityFilterGetter.Getter(params.api, params.viewer, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.historicAttrKey, params.cdn);
13893
13989
  this.data[cacheKey] = getter;
13894
13990
  /**
13895
13991
  * Debug option.
@@ -23281,7 +23377,7 @@
23281
23377
  ViewRenderEngine.Render = Render;
23282
23378
  })(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
23283
23379
 
23284
- var VERSION = "3.7.4";
23380
+ var VERSION = "3.7.6";
23285
23381
 
23286
23382
  exports.VERSION = VERSION;
23287
23383
  exports.CesiumParabola = CesiumParabola;