bruce-cesium 4.4.2 → 4.4.4

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.
@@ -1273,8 +1273,12 @@
1273
1273
  */
1274
1274
  var AnimatePositionSeries = /** @class */ (function () {
1275
1275
  function AnimatePositionSeries(params) {
1276
- this.cachedCalc = null;
1277
- this.cachedTime = null;
1276
+ this.lastCalcPos3d = null;
1277
+ this.lastCalcPosIndexLast = -1;
1278
+ this.lastCalcPosIndexNext = -1;
1279
+ this.lastCalcTime = null;
1280
+ this.lastCalcSeriesPos3d = [];
1281
+ this.lastCalcSeriesTime = null;
1278
1282
  this.viewer = params.viewer;
1279
1283
  this.positions = params.posses;
1280
1284
  // Order positions by date.
@@ -1289,16 +1293,20 @@
1289
1293
  now = this.viewer.clock.currentTime;
1290
1294
  }
1291
1295
  var nowTime = Cesium.JulianDate.toDate(now);
1292
- if (this.cachedTime == nowTime.getTime()) {
1293
- return this.cachedCalc;
1296
+ if (this.lastCalcTime == nowTime.getTime()) {
1297
+ return this.lastCalcPos3d;
1294
1298
  }
1295
1299
  var calculate = function () {
1296
1300
  // See if we're before the first position.
1297
1301
  if (nowTime.getTime() <= _this.positions[0].dateTime.getTime()) {
1302
+ _this.lastCalcPosIndexLast = 0;
1303
+ _this.lastCalcPosIndexNext = 0;
1298
1304
  return _this.positions[0].pos3d;
1299
1305
  }
1300
1306
  // See if we're after the last position.
1301
1307
  if (nowTime.getTime() >= _this.positions[_this.positions.length - 1].dateTime.getTime()) {
1308
+ _this.lastCalcPosIndexLast = _this.positions.length - 1;
1309
+ _this.lastCalcPosIndexNext = _this.positions.length - 1;
1302
1310
  return _this.positions[_this.positions.length - 1].pos3d;
1303
1311
  }
1304
1312
  // Find the current position.
@@ -1313,17 +1321,62 @@
1313
1321
  }
1314
1322
  }
1315
1323
  var last = _this.positions[lastIndex];
1324
+ _this.lastCalcPosIndexLast = lastIndex;
1316
1325
  // Interpolate the position.
1317
1326
  var next = _this.positions[lastIndex + 1];
1318
1327
  if (!next) {
1328
+ _this.lastCalcPosIndexNext = lastIndex;
1319
1329
  return last.pos3d;
1320
1330
  }
1331
+ _this.lastCalcPosIndexNext = lastIndex + 1;
1321
1332
  var progress = (nowTime.getTime() - last.dateTime.getTime()) / (next.dateTime.getTime() - last.dateTime.getTime());
1322
1333
  return Cesium.Cartesian3.lerp(last.pos3d, next.pos3d, progress, new Cesium.Cartesian3());
1323
1334
  };
1324
- this.cachedTime = nowTime.getTime();
1325
- this.cachedCalc = calculate();
1326
- return this.cachedCalc;
1335
+ this.lastCalcTime = nowTime.getTime();
1336
+ this.lastCalcPos3d = calculate();
1337
+ return this.lastCalcPos3d;
1338
+ };
1339
+ /**
1340
+ * Returns a series of positions to use for rendering the path.
1341
+ */
1342
+ AnimatePositionSeries.prototype.GetSeries = function () {
1343
+ // We update 30 times a second.
1344
+ var doUpdate = this.lastCalcSeriesTime == null;
1345
+ if (!doUpdate && this.lastCalcSeriesTime && (new Date().getTime() - this.lastCalcSeriesTime) > 1000 / 30) {
1346
+ doUpdate = true;
1347
+ }
1348
+ if (!doUpdate) {
1349
+ return this.lastCalcSeriesPos3d;
1350
+ }
1351
+ // Refresh cached values.
1352
+ this.GetValue();
1353
+ var now = this.viewer.scene.lastRenderTime;
1354
+ if (!now) {
1355
+ now = this.viewer.clock.currentTime;
1356
+ }
1357
+ var nowDate = Cesium.JulianDate.toDate(now);
1358
+ // Get total duration.
1359
+ var totalDuration = this.positions[this.positions.length - 1].dateTime.getTime() - this.positions[0].dateTime.getTime();
1360
+ // Percentage of the polyline to be visible before and after each point.
1361
+ var visibilityPercentage = 0.05; // 5%
1362
+ var visibilityDuration = totalDuration * visibilityPercentage;
1363
+ // Gather positions that fall within the visibility duration.
1364
+ // No positions is valid.
1365
+ var newPosses = [];
1366
+ for (var i = 0; i < this.positions.length; i++) {
1367
+ var pos = this.positions[i];
1368
+ var add = nowDate >= new Date(pos.dateTime.getTime() - visibilityDuration / 2) && nowDate <= new Date(pos.dateTime.getTime() + visibilityDuration / 2);
1369
+ // Not valid time-wise but if we're currently rendering this segment then we'll show it.
1370
+ if (!add && this.lastCalcPosIndexLast > -1 && this.lastCalcPosIndexNext > -1) {
1371
+ add = i >= this.lastCalcPosIndexLast && i <= this.lastCalcPosIndexNext;
1372
+ }
1373
+ if (add) {
1374
+ newPosses.push(pos.pos3d);
1375
+ }
1376
+ }
1377
+ this.lastCalcSeriesTime = nowDate.getTime();
1378
+ this.lastCalcSeriesPos3d = newPosses;
1379
+ return newPosses;
1327
1380
  };
1328
1381
  return AnimatePositionSeries;
1329
1382
  }());
@@ -1536,7 +1589,6 @@
1536
1589
  }
1537
1590
  }
1538
1591
  else if (graphic instanceof Cesium.ModelGraphics) {
1539
- // graphic.color = new Cesium.ConstantProperty(color);
1540
1592
  var animateColor_1 = new exports.CesiumAnimatedProperty.AnimateColor({
1541
1593
  targetColor: color,
1542
1594
  durationMs: animateMs,
@@ -1551,16 +1603,38 @@
1551
1603
  }
1552
1604
  }
1553
1605
  else if (graphic instanceof Cesium.PolygonGraphics) {
1554
- graphic.material = new Cesium.ColorMaterialProperty(color);
1606
+ // See if it's changed before applying.
1607
+ // Applying a new material to a polygon causes a flicker we want to avoid when possible.
1608
+ var currentColor = calculateCurColor(viewer, graphic);
1609
+ if (currentColor == null || !currentColor.equals(color)) {
1610
+ graphic.material = new Cesium.ColorMaterialProperty(color);
1611
+ }
1555
1612
  }
1556
1613
  else if (graphic instanceof Cesium.PolylineGraphics) {
1557
- graphic.material = new Cesium.ColorMaterialProperty(color);
1614
+ // See if it's changed before applying.
1615
+ // Applying a new material to a polyline causes a flicker we want to avoid when possible.
1616
+ var currentColor = calculateCurColor(viewer, graphic);
1617
+ if (currentColor == null || !currentColor.equals(color)) {
1618
+ // If the current material is not a simple colour one then we'll mimic it with the new colour.
1619
+ // Eg: retain a stripe material.
1620
+ var currentMaterial = graphic.material;
1621
+ if (currentMaterial instanceof Cesium.PolylineDashMaterialProperty) {
1622
+ graphic.material = new Cesium.PolylineDashMaterialProperty({
1623
+ color: color,
1624
+ gapColor: currentMaterial.gapColor,
1625
+ dashLength: currentMaterial.dashLength,
1626
+ dashPattern: currentMaterial.dashPattern
1627
+ });
1628
+ }
1629
+ else {
1630
+ graphic.material = new Cesium.ColorMaterialProperty(color);
1631
+ }
1632
+ }
1558
1633
  }
1559
1634
  else if (graphic instanceof Cesium.CorridorGraphics) {
1560
1635
  graphic.material = new Cesium.ColorMaterialProperty(color);
1561
1636
  }
1562
1637
  else if (graphic instanceof Cesium.PointGraphics) {
1563
- // graphic.color = new Cesium.ConstantProperty(color);
1564
1638
  var animateColor_2 = new exports.CesiumAnimatedProperty.AnimateColor({
1565
1639
  targetColor: color,
1566
1640
  durationMs: animateMs,
@@ -1590,7 +1664,12 @@
1590
1664
  }
1591
1665
  }
1592
1666
  else if (graphic instanceof Cesium.EllipseGraphics) {
1593
- graphic.material = new Cesium.ColorMaterialProperty(color);
1667
+ // See if it's changed before applying.
1668
+ // Applying a new material to a ellipse causes a flicker we want to avoid when possible.
1669
+ var currentColor = calculateCurColor(viewer, graphic);
1670
+ if (currentColor == null || !currentColor.equals(color)) {
1671
+ graphic.material = new Cesium.ColorMaterialProperty(color);
1672
+ }
1594
1673
  }
1595
1674
  graphic[LAST_APPLIED_OPACITY_KEY] = opacity;
1596
1675
  }
@@ -1643,7 +1722,8 @@
1643
1722
  return;
1644
1723
  }
1645
1724
  var parts = exports.EntityUtils.GatherEntity({
1646
- entity: entity
1725
+ entity: entity,
1726
+ selectable: true
1647
1727
  });
1648
1728
  for (var i = 0; i < parts.length; i++) {
1649
1729
  var part = parts[i];
@@ -1711,7 +1791,8 @@
1711
1791
  colorMap = new Map();
1712
1792
  }
1713
1793
  var parts = exports.EntityUtils.GatherEntity({
1714
- entity: entity
1794
+ entity: entity,
1795
+ selectable: true
1715
1796
  });
1716
1797
  for (var i = 0; i < parts.length; i++) {
1717
1798
  var part = parts[i];
@@ -1799,7 +1880,8 @@
1799
1880
  return;
1800
1881
  }
1801
1882
  var parts = exports.EntityUtils.GatherEntity({
1802
- entity: entity
1883
+ entity: entity,
1884
+ selectable: true
1803
1885
  });
1804
1886
  for (var i = 0; i < parts.length; i++) {
1805
1887
  var part = parts[i];
@@ -1866,7 +1948,8 @@
1866
1948
  return;
1867
1949
  }
1868
1950
  var parts = exports.EntityUtils.GatherEntity({
1869
- entity: entity
1951
+ entity: entity,
1952
+ selectable: true
1870
1953
  });
1871
1954
  for (var i = 0; i < parts.length; i++) {
1872
1955
  var part = parts[i];
@@ -1916,7 +1999,8 @@
1916
1999
  return null;
1917
2000
  }
1918
2001
  var parts = exports.EntityUtils.GatherEntity({
1919
- entity: entity
2002
+ entity: entity,
2003
+ selectable: true
1920
2004
  });
1921
2005
  for (var i = 0; i < parts.length; i++) {
1922
2006
  var part = parts[i];
@@ -1974,7 +2058,8 @@
1974
2058
  return;
1975
2059
  }
1976
2060
  var parts = exports.EntityUtils.GatherEntity({
1977
- entity: entity
2061
+ entity: entity,
2062
+ selectable: true
1978
2063
  });
1979
2064
  for (var i = 0; i < parts.length; i++) {
1980
2065
  var part = parts[i];
@@ -2033,7 +2118,8 @@
2033
2118
  return;
2034
2119
  }
2035
2120
  var parts = exports.EntityUtils.GatherEntity({
2036
- entity: entity
2121
+ entity: entity,
2122
+ selectable: true
2037
2123
  });
2038
2124
  for (var i = 0; i < parts.length; i++) {
2039
2125
  var part = parts[i];
@@ -2092,7 +2178,8 @@
2092
2178
  return;
2093
2179
  }
2094
2180
  var parts = exports.EntityUtils.GatherEntity({
2095
- entity: entity
2181
+ entity: entity,
2182
+ selectable: true
2096
2183
  });
2097
2184
  for (var i = 0; i < parts.length; i++) {
2098
2185
  var part = parts[i];
@@ -2149,7 +2236,8 @@
2149
2236
  return;
2150
2237
  }
2151
2238
  var parts = exports.EntityUtils.GatherEntity({
2152
- entity: entity
2239
+ entity: entity,
2240
+ selectable: true
2153
2241
  });
2154
2242
  for (var i = 0; i < parts.length; i++) {
2155
2243
  var part = parts[i];
@@ -2198,17 +2286,19 @@
2198
2286
  CesiumEntityStyler.Unhighlight = Unhighlight;
2199
2287
  })(exports.CesiumEntityStyler || (exports.CesiumEntityStyler = {}));
2200
2288
 
2201
- function traverseEntity(cEntity, arr, ignoreParent) {
2289
+ function traverseEntity(cEntity, arr, ignoreParent, onlyEditable, onlySelectable) {
2202
2290
  if (cEntity._parentEntity && !ignoreParent) {
2203
- traverseEntity(cEntity._parentEntity, arr, false);
2291
+ traverseEntity(cEntity._parentEntity, arr, false, onlyEditable, onlySelectable);
2204
2292
  }
2205
2293
  if (cEntity._siblingGraphics) {
2206
2294
  for (var i = 0; i < cEntity._siblingGraphics.length; i++) {
2207
2295
  var sibling = cEntity._siblingGraphics[i];
2208
- traverseEntity(sibling, arr, true);
2296
+ traverseEntity(sibling, arr, true, onlyEditable, onlySelectable);
2209
2297
  }
2210
2298
  }
2211
- arr.push(cEntity);
2299
+ if ((!cEntity._noEdit || !onlyEditable) && (!cEntity._noSelect || !onlySelectable)) {
2300
+ arr.push(cEntity);
2301
+ }
2212
2302
  }
2213
2303
  function GetValue(viewer, obj) {
2214
2304
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
@@ -3090,11 +3180,17 @@
3090
3180
  * @param entity
3091
3181
  */
3092
3182
  function GatherEntity(params) {
3093
- var entity = params.entity;
3183
+ var entity = params.entity, editable = params.editable, selectable = params.selectable;
3184
+ if (editable == null) {
3185
+ editable = false;
3186
+ }
3187
+ if (selectable == null) {
3188
+ selectable = false;
3189
+ }
3094
3190
  if (entity instanceof Cesium.Entity) {
3095
3191
  var cEntity = entity;
3096
3192
  var items = [];
3097
- traverseEntity(cEntity, items, false);
3193
+ traverseEntity(cEntity, items, false, editable, selectable);
3098
3194
  return items;
3099
3195
  }
3100
3196
  return [entity];
@@ -5325,6 +5421,10 @@
5325
5421
  var series = [];
5326
5422
  for (var i = 0; i < historic.length; i++) {
5327
5423
  var item = historic[i];
5424
+ var dateTime = new Date(item.dateTime);
5425
+ if (!dateTime) {
5426
+ continue;
5427
+ }
5328
5428
  var pos3d = exports.EntityUtils.GetPos({
5329
5429
  entity: item.data,
5330
5430
  viewer: viewer,
@@ -5332,8 +5432,7 @@
5332
5432
  returnHeightRef: heightRef,
5333
5433
  allowRendered: false
5334
5434
  });
5335
- var dateTime = new Date(item.dateTime);
5336
- if (!dateTime || !pos3d || isNaN(pos3d.x) || isNaN(pos3d.y) || isNaN(pos3d.z)) {
5435
+ if (!pos3d || isNaN(pos3d.x) || isNaN(pos3d.y) || isNaN(pos3d.z)) {
5337
5436
  continue;
5338
5437
  }
5339
5438
  series.push({
@@ -5575,7 +5674,7 @@
5575
5674
  }
5576
5675
  }
5577
5676
  if (!(models.length > 0)) return [3 /*break*/, 2];
5578
- mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models, entitiesHistoric: params.entitiesHistoric });
5677
+ mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models, entitiesHistoric: params.entitiesHistoric, entityHistoricDrawTrack: params.entityHistoricDrawTrack });
5579
5678
  return [4 /*yield*/, Model3d.RenderGroup(mParams)];
5580
5679
  case 1:
5581
5680
  mEntities = _g.sent();
@@ -5711,7 +5810,7 @@
5711
5810
  _g.label = 10;
5712
5811
  case 10:
5713
5812
  if (!(points.length > 0)) return [3 /*break*/, 12];
5714
- pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities, entitiesHistoric: params.entitiesHistoric });
5813
+ pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities, entitiesHistoric: params.entitiesHistoric, entityHistoricDrawTrack: params.entityHistoricDrawTrack });
5715
5814
  return [4 /*yield*/, Point.RenderGroup(pParams)];
5716
5815
  case 11:
5717
5816
  pEntities = _g.sent();
@@ -5780,7 +5879,7 @@
5780
5879
  function Render(params) {
5781
5880
  var _a, _b, _c, _d;
5782
5881
  return __awaiter(this, void 0, void 0, function () {
5783
- var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor, heightRef_1, animateColorIn_1, position, series, animatePosition_1, currentImgKey, series, animatePosition_2, pos3d, prevPos3d, animatePosition_3, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, heightRef_2, circleBillboard, disableDepthTest, animateColorIn_2, position, series, animatePosition_4, imgKey, currentImgKey, series, animatePosition_5, pos3d, prevPos3d, animatePosition_6;
5882
+ var entity, style, type, cEntity, siblings, heightRef, animatePosition, shouldShowTrack, prepareExistingGraphic, updateShouldShowTrack, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor, animateColorIn_1, position, series, currentImgKey, series, pos3d, prevPos3d, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, circleBillboard, disableDepthTest, animateColorIn_2, position, series, imgKey, currentImgKey, series, animatePosition_1, pos3d, prevPos3d, animatePosition_2, lStyle, bColor, cColor, material, width, trackEntity;
5784
5883
  return __generator(this, function (_e) {
5785
5884
  switch (_e.label) {
5786
5885
  case 0:
@@ -5798,15 +5897,18 @@
5798
5897
  }
5799
5898
  cEntity = null;
5800
5899
  siblings = [];
5801
- prepareExistingGraphic = function (cEntity, siblings) {
5802
- if (siblings === void 0) { siblings = 0; }
5900
+ heightRef = null;
5901
+ animatePosition = null;
5902
+ shouldShowTrack = false;
5903
+ prepareExistingGraphic = function (cEntity, maxSiblings) {
5904
+ if (maxSiblings === void 0) { maxSiblings = 0; }
5803
5905
  // Gather entity in case previous version had sibling graphics we no longer need.
5804
5906
  var parts = exports.EntityUtils.GatherEntity({
5805
5907
  entity: cEntity,
5806
5908
  });
5807
5909
  if (parts.length > 1) {
5808
5910
  // We'll cull all except the allowed number of siblings.
5809
- cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
5911
+ cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, maxSiblings);
5810
5912
  // We'll remove all that aren't in the allowed (direct) list.
5811
5913
  for (var i = 0; i < parts.length - 1; i++) {
5812
5914
  var part = parts[i];
@@ -5818,6 +5920,33 @@
5818
5920
  console.warn("Point.Render: Parent entity was not null. This should not happen.");
5819
5921
  }
5820
5922
  }
5923
+ siblings = cEntity._siblingGraphics;
5924
+ cEntity._siblingGraphics = [];
5925
+ };
5926
+ updateShouldShowTrack = function () {
5927
+ var _a, _b, _c;
5928
+ if (!params.entityHistoricDrawTrack) {
5929
+ return;
5930
+ }
5931
+ if ((_a = params.entityHistoric) === null || _a === void 0 ? void 0 : _a.length) {
5932
+ var lStyle = (_c = (_b = params.fullStyle) === null || _b === void 0 ? void 0 : _b.polylineStyle) !== null && _c !== void 0 ? _c : {};
5933
+ var width = lStyle.width ? EnsureNumber(BModels.Calculator.GetNumber(lStyle.width, entity, params.tags)) : 2;
5934
+ if (width == null) {
5935
+ width = 2;
5936
+ }
5937
+ width = EnsureNumber(width);
5938
+ if (width > 0.01) {
5939
+ var bColor = lStyle.lineColor ? BModels.Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
5940
+ var cColor = bColor ? colorToCColor(bColor) : Cesium.Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
5941
+ if (cColor.alpha > 0) {
5942
+ var seriesTrackPosses = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
5943
+ seriesTrackPosses.reverse();
5944
+ var posses = seriesTrackPosses.map(function (x) { return x.pos3d; });
5945
+ posses = cullDuplicatePoints(posses);
5946
+ shouldShowTrack = posses.length > 1;
5947
+ }
5948
+ }
5949
+ }
5821
5950
  };
5822
5951
  if (!(type == BModels.Style.EPointType.Icon)) return [3 /*break*/, 9];
5823
5952
  iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
@@ -5882,9 +6011,10 @@
5882
6011
  }
5883
6012
  disableDepthTest = Boolean(style.renderOnTop);
5884
6013
  if (iconScale > 0) {
6014
+ updateShouldShowTrack();
5885
6015
  bColor = style.iconTintColor ? BModels.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
5886
6016
  cColor = bColor ? colorToCColor(bColor) : Cesium.Color.WHITE.clone();
5887
- heightRef_1 = getHeightRef(style);
6017
+ heightRef = getHeightRef(style);
5888
6018
  if (!params.rendered || !params.rendered.billboard) {
5889
6019
  animateColorIn_1 = new exports.CesiumAnimatedProperty.AnimateColor({
5890
6020
  durationMs: 200,
@@ -5893,20 +6023,20 @@
5893
6023
  viewer: params.viewer
5894
6024
  });
5895
6025
  position = null;
5896
- series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_1, params.entityHistoric);
6026
+ series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
5897
6027
  if (series.length > 1) {
5898
- animatePosition_1 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6028
+ animatePosition = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
5899
6029
  posses: series,
5900
6030
  viewer: params.viewer
5901
6031
  });
5902
- position = new Cesium.CallbackProperty(function () { return animatePosition_1.GetValue(); }, false);
6032
+ position = new Cesium.CallbackProperty(function () { return animatePosition.GetValue(); }, false);
5903
6033
  }
5904
6034
  else {
5905
6035
  position = new Cesium.CallbackProperty(function () { return exports.EntityUtils.GetPos({
5906
6036
  viewer: params.viewer,
5907
6037
  entity: entity,
5908
- recordHeightRef: heightRef_1,
5909
- returnHeightRef: heightRef_1,
6038
+ recordHeightRef: heightRef,
6039
+ returnHeightRef: heightRef,
5910
6040
  allowRendered: false
5911
6041
  }); }, true);
5912
6042
  }
@@ -5943,7 +6073,7 @@
5943
6073
  });
5944
6074
  }
5945
6075
  else {
5946
- prepareExistingGraphic(params.rendered);
6076
+ prepareExistingGraphic(params.rendered, shouldShowTrack ? 1 : 0);
5947
6077
  cEntity = params.rendered;
5948
6078
  currentImgKey = cEntity.billboard._billboardImgKey;
5949
6079
  if (currentImgKey != iconUrl) {
@@ -5953,31 +6083,31 @@
5953
6083
  cEntity.billboard.heightReference = new Cesium.ConstantProperty(getHeightRef(style));
5954
6084
  cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
5955
6085
  cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
5956
- series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_1, params.entityHistoric);
6086
+ series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
5957
6087
  if (series.length > 1) {
5958
- animatePosition_2 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6088
+ animatePosition = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
5959
6089
  posses: series,
5960
6090
  viewer: params.viewer
5961
6091
  });
5962
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_2.GetValue(); }, false);
6092
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition.GetValue(); }, false);
5963
6093
  }
5964
6094
  else {
5965
6095
  pos3d = exports.EntityUtils.GetPos({
5966
6096
  viewer: params.viewer,
5967
6097
  entity: entity,
5968
- recordHeightRef: heightRef_1,
5969
- returnHeightRef: heightRef_1,
6098
+ recordHeightRef: heightRef,
6099
+ returnHeightRef: heightRef,
5970
6100
  allowRendered: false
5971
6101
  });
5972
6102
  prevPos3d = getValue$1(params.viewer, cEntity.position);
5973
6103
  if (!prevPos3d || !Cesium.Cartesian3.equals(prevPos3d, pos3d)) {
5974
- animatePosition_3 = new exports.CesiumAnimatedProperty.AnimatePosition({
6104
+ animatePosition = new exports.CesiumAnimatedProperty.AnimatePosition({
5975
6105
  durationMs: 200,
5976
6106
  targetPos3d: pos3d,
5977
6107
  viewer: params.viewer,
5978
6108
  startPos3d: prevPos3d
5979
6109
  });
5980
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_3.GetValue(); }, false);
6110
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition.GetValue(); }, false);
5981
6111
  }
5982
6112
  }
5983
6113
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
@@ -6071,7 +6201,7 @@
6071
6201
  if (!outlineExtrusion.value && extrusion.value) {
6072
6202
  outlineExtrusion.exHeightRef = extrusion.exHeightRef;
6073
6203
  }
6074
- outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
6204
+ outlineEntity = siblings === null || siblings === void 0 ? void 0 : siblings[0];
6075
6205
  if (outlineEntity && outlineEntity.ellipse) {
6076
6206
  outlineEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
6077
6207
  outlineEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
@@ -6124,9 +6254,10 @@
6124
6254
  if (size <= 0) {
6125
6255
  return [2 /*return*/, null];
6126
6256
  }
6127
- heightRef_2 = getHeightRef(style);
6257
+ heightRef = getHeightRef(style);
6128
6258
  circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
6129
6259
  disableDepthTest = Boolean(style.renderOnTop);
6260
+ updateShouldShowTrack();
6130
6261
  if (!params.rendered || !params.rendered.billboard) {
6131
6262
  animateColorIn_2 = new exports.CesiumAnimatedProperty.AnimateColor({
6132
6263
  durationMs: 200,
@@ -6135,20 +6266,20 @@
6135
6266
  viewer: params.viewer
6136
6267
  });
6137
6268
  position = null;
6138
- series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_2, params.entityHistoric);
6269
+ series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
6139
6270
  if (series.length > 1) {
6140
- animatePosition_4 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6271
+ animatePosition = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6141
6272
  posses: series,
6142
6273
  viewer: params.viewer
6143
6274
  });
6144
- position = new Cesium.CallbackProperty(function () { return animatePosition_4.GetValue(); }, false);
6275
+ position = new Cesium.CallbackProperty(function () { return animatePosition.GetValue(); }, false);
6145
6276
  }
6146
6277
  else {
6147
6278
  position = new Cesium.CallbackProperty(function () { return exports.EntityUtils.GetPos({
6148
6279
  viewer: params.viewer,
6149
6280
  entity: entity,
6150
- recordHeightRef: heightRef_2,
6151
- returnHeightRef: heightRef_2,
6281
+ recordHeightRef: heightRef,
6282
+ returnHeightRef: heightRef,
6152
6283
  allowRendered: false
6153
6284
  }); }, true);
6154
6285
  }
@@ -6174,7 +6305,7 @@
6174
6305
  }
6175
6306
  return color;
6176
6307
  }, false),
6177
- heightReference: heightRef_2,
6308
+ heightReference: heightRef,
6178
6309
  distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
6179
6310
  disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
6180
6311
  },
@@ -6191,7 +6322,7 @@
6191
6322
  });
6192
6323
  }
6193
6324
  else {
6194
- prepareExistingGraphic(params.rendered);
6325
+ prepareExistingGraphic(params.rendered, shouldShowTrack ? 1 : 0);
6195
6326
  cEntity = params.rendered;
6196
6327
  imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
6197
6328
  currentImgKey = cEntity.billboard._billboardImgKey;
@@ -6200,34 +6331,34 @@
6200
6331
  }
6201
6332
  cEntity.billboard.height = new Cesium.ConstantProperty(circleBillboard.height);
6202
6333
  cEntity.billboard.width = new Cesium.ConstantProperty(circleBillboard.width);
6203
- cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef_2);
6334
+ cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef);
6204
6335
  cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
6205
6336
  cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
6206
- series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_2, params.entityHistoric);
6337
+ series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
6207
6338
  if (series.length > 1) {
6208
- animatePosition_5 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6339
+ animatePosition_1 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
6209
6340
  posses: series,
6210
6341
  viewer: params.viewer
6211
6342
  });
6212
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_5.GetValue(); }, false);
6343
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_1.GetValue(); }, false);
6213
6344
  }
6214
6345
  else {
6215
6346
  pos3d = exports.EntityUtils.GetPos({
6216
6347
  viewer: params.viewer,
6217
6348
  entity: entity,
6218
- recordHeightRef: heightRef_2,
6219
- returnHeightRef: heightRef_2,
6349
+ recordHeightRef: heightRef,
6350
+ returnHeightRef: heightRef,
6220
6351
  allowRendered: false
6221
6352
  });
6222
6353
  prevPos3d = getValue$1(params.viewer, cEntity.position);
6223
6354
  if (!prevPos3d || !Cesium.Cartesian3.equals(prevPos3d, pos3d)) {
6224
- animatePosition_6 = new exports.CesiumAnimatedProperty.AnimatePosition({
6355
+ animatePosition_2 = new exports.CesiumAnimatedProperty.AnimatePosition({
6225
6356
  durationMs: 200,
6226
6357
  targetPos3d: pos3d,
6227
6358
  viewer: params.viewer,
6228
6359
  startPos3d: prevPos3d
6229
6360
  });
6230
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_6.GetValue(); }, false);
6361
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_2.GetValue(); }, false);
6231
6362
  }
6232
6363
  }
6233
6364
  // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
@@ -6243,9 +6374,50 @@
6243
6374
  }
6244
6375
  cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
6245
6376
  }
6246
- if (cEntity) {
6247
- cEntity._siblingGraphics = siblings;
6377
+ // Generate a polyline 'track' for the historic data.
6378
+ // We do this for historic data that exists and is moving.
6379
+ if (shouldShowTrack && animatePosition && animatePosition instanceof exports.CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
6380
+ lStyle = (_d = (_c = params.fullStyle) === null || _c === void 0 ? void 0 : _c.polylineStyle) !== null && _d !== void 0 ? _d : {};
6381
+ bColor = lStyle.lineColor ? BModels.Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
6382
+ cColor = bColor ? colorToCColor(bColor) : Cesium.Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
6383
+ material = new Cesium.PolylineDashMaterialProperty({
6384
+ color: cColor
6385
+ });
6386
+ width = lStyle.lineWidth ? EnsureNumber(BModels.Calculator.GetNumber(lStyle.lineWidth, entity, params.tags)) : 2;
6387
+ if (width == null) {
6388
+ width = 2;
6389
+ }
6390
+ width = EnsureNumber(width);
6391
+ trackEntity = siblings === null || siblings === void 0 ? void 0 : siblings[0];
6392
+ if (!trackEntity) {
6393
+ trackEntity = new Cesium.Entity({
6394
+ id: BModels.ObjectUtils.UId(10),
6395
+ polyline: {
6396
+ positions: [],
6397
+ width: width,
6398
+ material: material,
6399
+ clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
6400
+ zIndex: 0,
6401
+ classificationType: Cesium.ClassificationType.BOTH
6402
+ }
6403
+ });
6404
+ }
6405
+ trackEntity._noEdit = true;
6406
+ trackEntity.polyline.positions = new Cesium.CallbackProperty(function () {
6407
+ return animatePosition.GetSeries();
6408
+ }, false);
6409
+ // We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
6410
+ // WARNING: polyline does not support animation (yet?).
6411
+ exports.CesiumEntityStyler.SetDefaultColor({
6412
+ color: cColor,
6413
+ entity: trackEntity,
6414
+ viewer: params.viewer,
6415
+ override: true,
6416
+ requestRender: false
6417
+ });
6418
+ siblings.push(trackEntity);
6248
6419
  }
6420
+ cEntity._siblingGraphics = siblings;
6249
6421
  return [2 /*return*/, cEntity];
6250
6422
  }
6251
6423
  });
@@ -6299,7 +6471,9 @@
6299
6471
  maxDistance: zoomItem.MaxZoom,
6300
6472
  minDistance: zoomItem.MinZoom,
6301
6473
  rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID),
6302
- entityHistoric: (_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]
6474
+ entityHistoric: (_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID],
6475
+ entityHistoricDrawTrack: params.entityHistoricDrawTrack,
6476
+ fullStyle: style
6303
6477
  })];
6304
6478
  case 7:
6305
6479
  cEntity = _f.sent();
@@ -7033,11 +7207,11 @@
7033
7207
  // If we have a series of time-based positions then we'll animate as time changes.
7034
7208
  var series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
7035
7209
  if (series.length > 1) {
7036
- var animatePosition_7 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
7210
+ var animatePosition_3 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
7037
7211
  posses: series,
7038
7212
  viewer: params.viewer
7039
7213
  });
7040
- position = new Cesium.CallbackProperty(function () { return animatePosition_7.GetValue(); }, false);
7214
+ position = new Cesium.CallbackProperty(function () { return animatePosition_3.GetValue(); }, false);
7041
7215
  }
7042
7216
  else {
7043
7217
  position = new Cesium.CallbackProperty(function () { return exports.EntityUtils.GetPos({
@@ -7083,7 +7257,7 @@
7083
7257
  else {
7084
7258
  // Gather entity in case previous version had sibling graphics we no longer need.
7085
7259
  var parts = exports.EntityUtils.GatherEntity({
7086
- entity: cEntity,
7260
+ entity: cEntity
7087
7261
  });
7088
7262
  if (parts.length > 1) {
7089
7263
  // Kill all expect last part. Last one is the primary entity.
@@ -7110,24 +7284,24 @@
7110
7284
  // If we have a series of time-based positions then we'll animate as time changes.
7111
7285
  var series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
7112
7286
  if (series.length > 1) {
7113
- var animatePosition_8 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
7287
+ var animatePosition_4 = new exports.CesiumAnimatedProperty.AnimatePositionSeries({
7114
7288
  posses: series,
7115
7289
  viewer: params.viewer
7116
7290
  });
7117
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_8.GetValue(); }, false);
7291
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_4.GetValue(); }, false);
7118
7292
  }
7119
7293
  else {
7120
7294
  var prevPos3d = getValue$1(params.viewer, cEntity.position);
7121
7295
  var posChanged = !prevPos3d || !Cesium.Cartesian3.equals(prevPos3d, pos3d);
7122
- var animatePosition_9 = null;
7296
+ var animatePosition_5 = null;
7123
7297
  if (posChanged) {
7124
- animatePosition_9 = new exports.CesiumAnimatedProperty.AnimatePosition({
7298
+ animatePosition_5 = new exports.CesiumAnimatedProperty.AnimatePosition({
7125
7299
  durationMs: 200,
7126
7300
  targetPos3d: pos3d,
7127
7301
  viewer: params.viewer,
7128
7302
  startPos3d: prevPos3d
7129
7303
  });
7130
- cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_9.GetValue(); }, false);
7304
+ cEntity.position = new Cesium.CallbackProperty(function () { return animatePosition_5.GetValue(); }, false);
7131
7305
  }
7132
7306
  }
7133
7307
  // cEntity.orientation = new Cesium.ConstantProperty(orientation);
@@ -8754,7 +8928,7 @@
8754
8928
  var viewer = params.viewer, entity = params.entity;
8755
8929
  if (entity instanceof Cesium.Entity) {
8756
8930
  var pieces = exports.EntityUtils.GatherEntity({
8757
- entity: entity,
8931
+ entity: entity
8758
8932
  });
8759
8933
  var leaderSet = false;
8760
8934
  var removed_1 = false;
@@ -9936,7 +10110,7 @@
9936
10110
  VisualsRegister.Register = Register;
9937
10111
  })(exports.VisualsRegister || (exports.VisualsRegister = {}));
9938
10112
 
9939
- function GetValue$1(viewer, obj) {
10113
+ function GetValue$2(viewer, obj) {
9940
10114
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
9941
10115
  var date = viewer.scene.lastRenderTime;
9942
10116
  if (!date) {
@@ -10726,12 +10900,12 @@
10726
10900
  if (entity.polygon || entity.polyline) {
10727
10901
  return false;
10728
10902
  }
10729
- var pos3d = GetValue$1(this.viewer, entity.position);
10903
+ var pos3d = GetValue$2(this.viewer, entity.position);
10730
10904
  if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
10731
10905
  return false;
10732
10906
  }
10733
10907
  if (!this.pointColorBg && entity.point) {
10734
- var pointColorBg = GetValue$1(this.viewer, entity.point.color);
10908
+ var pointColorBg = GetValue$2(this.viewer, entity.point.color);
10735
10909
  if (pointColorBg) {
10736
10910
  var cColor = null;
10737
10911
  if (pointColorBg instanceof Object) {
@@ -10755,7 +10929,7 @@
10755
10929
  }
10756
10930
  }
10757
10931
  if (!this.iconUrl && entity.billboard) {
10758
- var iconUrl = GetValue$1(this.viewer, entity.billboard.image);
10932
+ var iconUrl = GetValue$2(this.viewer, entity.billboard.image);
10759
10933
  if (typeof iconUrl == "string") {
10760
10934
  this.iconUrl = iconUrl;
10761
10935
  }
@@ -11618,6 +11792,7 @@
11618
11792
  visualRegister: this.visualsManager,
11619
11793
  zoomControl: this.item.CameraZoomSettings,
11620
11794
  entitiesHistoric: entitiesHistoric,
11795
+ entityHistoricDrawTrack: this.item.historicDrawTrack,
11621
11796
  force: force,
11622
11797
  optimizeGeometry: this.item.optimizeGeometry,
11623
11798
  optimizeMinPoints: this.item.optimizeMinPoints,
@@ -24906,15 +25081,15 @@
24906
25081
  this._disposeCesiumEvent();
24907
25082
  var events = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
24908
25083
  var lastHoverPos = null;
24909
- var lastHoveredEntityId = null;
24910
- var unhighlightTimeout = null;
25084
+ //let lastHoveredEntityId: string = null;
25085
+ //let unhighlightTimeout: any = null;
24911
25086
  var process2dCursor = function (pos2d, isHover) {
24912
25087
  try {
24913
25088
  var regos = _this._manager.VisualsRegister.GetRegosFromCursor({
24914
25089
  cursor: pos2d
24915
25090
  }).regos;
24916
25091
  var first = regos.length ? regos[0] : null;
24917
- var firstId_1 = first === null || first === void 0 ? void 0 : first.entityId;
25092
+ var firstId = first === null || first === void 0 ? void 0 : first.entityId;
24918
25093
  if (isHover) {
24919
25094
  if (regos.length) {
24920
25095
  _this._viewer.canvas.style.cursor = "pointer";
@@ -24922,37 +25097,40 @@
24922
25097
  else if (_this._viewer.canvas.style.cursor) {
24923
25098
  _this._viewer.canvas.style.removeProperty("cursor");
24924
25099
  }
25100
+ /*
24925
25101
  clearTimeout(unhighlightTimeout);
24926
- if (lastHoveredEntityId && lastHoveredEntityId != firstId_1) {
24927
- _this._manager.VisualsRegister.SetHighlighted({
25102
+ if (lastHoveredEntityId && lastHoveredEntityId != firstId) {
25103
+ this._manager.VisualsRegister.SetHighlighted({
24928
25104
  entityIds: [lastHoveredEntityId],
24929
25105
  highlighted: false
24930
25106
  });
24931
25107
  }
24932
- if (firstId_1) {
24933
- unhighlightTimeout = setTimeout(function () {
24934
- if (lastHoveredEntityId == firstId_1) {
24935
- _this._manager.VisualsRegister.SetHighlighted({
24936
- entityIds: [firstId_1],
25108
+ if (firstId) {
25109
+ unhighlightTimeout = setTimeout(() => {
25110
+ if (lastHoveredEntityId == firstId) {
25111
+ this._manager.VisualsRegister.SetHighlighted({
25112
+ entityIds: [firstId],
24937
25113
  highlighted: false
24938
25114
  });
24939
25115
  lastHoveredEntityId = null;
24940
25116
  }
24941
25117
  }, 5000);
24942
- if (lastHoveredEntityId != firstId_1) {
24943
- _this._manager.VisualsRegister.SetHighlighted({
24944
- entityIds: [firstId_1],
25118
+ if (lastHoveredEntityId != firstId) {
25119
+ this._manager.VisualsRegister.SetHighlighted({
25120
+ entityIds: [firstId],
24945
25121
  highlighted: true
24946
25122
  });
24947
25123
  }
24948
25124
  }
24949
- lastHoveredEntityId = firstId_1;
25125
+
25126
+ lastHoveredEntityId = firstId;
25127
+ */
24950
25128
  }
24951
25129
  else {
24952
25130
  _this._manager.VisualsRegister.ClearSelected();
24953
25131
  if (first) {
24954
25132
  _this._manager.VisualsRegister.SetSelected({
24955
- entityIds: [firstId_1],
25133
+ entityIds: [firstId],
24956
25134
  selected: true
24957
25135
  });
24958
25136
  }
@@ -26219,7 +26397,7 @@
26219
26397
  ViewerUtils.AssertIonToken = AssertIonToken;
26220
26398
  })(exports.ViewerUtils || (exports.ViewerUtils = {}));
26221
26399
 
26222
- var VERSION = "4.4.2";
26400
+ var VERSION = "4.4.4";
26223
26401
 
26224
26402
  exports.VERSION = VERSION;
26225
26403
  exports.CesiumParabola = CesiumParabola;