bruce-cesium 5.3.7 → 5.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { BruceEvent, Cartes, Entity as Entity$1, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, 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, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, HorizontalOrigin, VerticalOrigin, SceneMode, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, BoundingSphere, Matrix3, Matrix4, GeometryInstance, IonResource, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -1406,6 +1406,225 @@ var CesiumAnimatedProperty;
1406
1406
  return series;
1407
1407
  }
1408
1408
  CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity = GetSeriesPossesForHistoricEntity;
1409
+ /**
1410
+ * Animates a tileset position and heading from a series of positions over time.
1411
+ * Unlike other animation functions that directly modify the tileset,
1412
+ * this provides a callback with calculated values for the caller to apply.
1413
+ *
1414
+ * Example:
1415
+ * ```
1416
+ * const dispose = CesiumAnimatedProperty.AnimateTPositionSeries({
1417
+ * viewer: viewer,
1418
+ * posses: positionSeries,
1419
+ * onUpdate: (position, heading) => {}
1420
+ * });
1421
+ *
1422
+ * // To dispose:
1423
+ * dispose();
1424
+ * ```
1425
+ * @param params Animation parameters
1426
+ * @returns Function to stop the animation
1427
+ */
1428
+ class AnimateTPositionSeries {
1429
+ constructor(params) {
1430
+ // Cache for calculated values.
1431
+ this.lastCalcTime = null;
1432
+ this.lastCalcPos3d = null;
1433
+ this.lastCalcHeading = null;
1434
+ this.removal = null;
1435
+ this.viewer = params.viewer;
1436
+ this.onUpdate = params.onUpdate;
1437
+ this.onDone = params.onDone;
1438
+ // No positions to animate.
1439
+ if (!params.posses || params.posses.length === 0) {
1440
+ return;
1441
+ }
1442
+ // Order positions by date.
1443
+ const orderedPosses = [...params.posses].sort((a, b) => {
1444
+ return a.dateTime.getTime() - b.dateTime.getTime();
1445
+ });
1446
+ // Process headings - if all are null or 0, assume all are null.
1447
+ this.positions = this.processHeadings([...orderedPosses]);
1448
+ // Set up the animation loop.
1449
+ this.removal = this.viewer.scene.postUpdate.addEventListener(() => this.update());
1450
+ this.update();
1451
+ }
1452
+ /**
1453
+ * Stop the animation and call the onDone callback if provided.
1454
+ */
1455
+ stop() {
1456
+ if (this.removal) {
1457
+ this.removal();
1458
+ this.removal = null;
1459
+ if (this.onDone) {
1460
+ this.onDone();
1461
+ }
1462
+ }
1463
+ }
1464
+ /**
1465
+ * Update function called on each frame.
1466
+ */
1467
+ update() {
1468
+ let now = this.viewer.scene.lastRenderTime;
1469
+ if (!now) {
1470
+ now = this.viewer.clock.currentTime;
1471
+ }
1472
+ const nowTime = JulianDate.toDate(now);
1473
+ const nowTimeMs = nowTime.getTime();
1474
+ // Skip calculation if time hasn't changed.
1475
+ if (this.lastCalcTime === nowTimeMs) {
1476
+ return;
1477
+ }
1478
+ // Calculate position.
1479
+ const position = this.calculatePosition(nowTimeMs);
1480
+ // Update cache values.
1481
+ this.lastCalcTime = nowTimeMs;
1482
+ this.lastCalcPos3d = position.pos3d;
1483
+ // Calculate heading.
1484
+ this.lastCalcHeading = this.calculateHeading(nowTimeMs, position.indexLast, position.indexNext);
1485
+ // Provide the calculated values to the caller.
1486
+ this.onUpdate(this.lastCalcPos3d, this.lastCalcHeading);
1487
+ }
1488
+ /**
1489
+ * Pre-process headings in the series.
1490
+ * If all are null or 0, then assume all are null.
1491
+ */
1492
+ processHeadings(posses) {
1493
+ let hasHeading = false;
1494
+ for (let i = 0; i < posses.length; i++) {
1495
+ let pos = posses[i];
1496
+ if (pos.heading !== null && pos.heading !== 0) {
1497
+ hasHeading = true;
1498
+ break;
1499
+ }
1500
+ }
1501
+ if (!hasHeading) {
1502
+ for (let i = 0; i < posses.length; i++) {
1503
+ posses[i].heading = null;
1504
+ }
1505
+ }
1506
+ return posses;
1507
+ }
1508
+ /**
1509
+ * Calculate the position at the given time
1510
+ */
1511
+ calculatePosition(currentTimeMs) {
1512
+ const posses = this.positions;
1513
+ // See if we're before the first position
1514
+ if (currentTimeMs <= posses[0].dateTime.getTime()) {
1515
+ return {
1516
+ pos3d: posses[0].pos3d,
1517
+ indexLast: 0,
1518
+ indexNext: 0
1519
+ };
1520
+ }
1521
+ // See if we're after the last position
1522
+ if (currentTimeMs >= posses[posses.length - 1].dateTime.getTime()) {
1523
+ const lastIndex = posses.length - 1;
1524
+ return {
1525
+ pos3d: posses[lastIndex].pos3d,
1526
+ indexLast: lastIndex,
1527
+ indexNext: lastIndex
1528
+ };
1529
+ }
1530
+ // Find the current position
1531
+ let lastIndex = 0;
1532
+ for (let i = 1; i < posses.length; i++) {
1533
+ let pos = posses[i];
1534
+ if (currentTimeMs >= pos.dateTime.getTime()) {
1535
+ lastIndex = i;
1536
+ }
1537
+ else {
1538
+ break;
1539
+ }
1540
+ }
1541
+ const last = posses[lastIndex];
1542
+ const next = posses[lastIndex + 1];
1543
+ // If no next position, use the last one
1544
+ if (!next) {
1545
+ return {
1546
+ pos3d: last.pos3d,
1547
+ indexLast: lastIndex,
1548
+ indexNext: lastIndex
1549
+ };
1550
+ }
1551
+ // Interpolate the position
1552
+ const progress = (currentTimeMs - last.dateTime.getTime()) /
1553
+ (next.dateTime.getTime() - last.dateTime.getTime());
1554
+ const interpolatedPos = Cartesian3.lerp(last.pos3d, next.pos3d, progress, new Cartesian3());
1555
+ return {
1556
+ pos3d: interpolatedPos,
1557
+ indexLast: lastIndex,
1558
+ indexNext: lastIndex + 1
1559
+ };
1560
+ }
1561
+ /**
1562
+ * Calculate the heading at the given time.
1563
+ */
1564
+ calculateHeading(currentTimeMs, lastIndex, nextIndex) {
1565
+ const posses = this.positions;
1566
+ // Ensure valid indices.
1567
+ if (lastIndex < 0 || nextIndex < 0 ||
1568
+ lastIndex >= posses.length || nextIndex >= posses.length) {
1569
+ return null;
1570
+ }
1571
+ const lastPos = posses[lastIndex];
1572
+ const nextPos = posses[nextIndex];
1573
+ // If the heading is present and not null, interpolate or use it directly.
1574
+ if (lastPos.heading !== null && nextPos.heading !== null) {
1575
+ // If they're the same position or same time, just return the heading.
1576
+ if (lastIndex === nextIndex ||
1577
+ lastPos.dateTime.getTime() === nextPos.dateTime.getTime()) {
1578
+ return lastPos.heading;
1579
+ }
1580
+ let deltaHeading = nextPos.heading - lastPos.heading;
1581
+ // Handle wraparound between 359 and 0 degrees.
1582
+ if (deltaHeading > 180) {
1583
+ deltaHeading -= 360;
1584
+ }
1585
+ else if (deltaHeading < -180) {
1586
+ deltaHeading += 360;
1587
+ }
1588
+ const factor = (currentTimeMs - lastPos.dateTime.getTime()) /
1589
+ (nextPos.dateTime.getTime() - lastPos.dateTime.getTime());
1590
+ let interpolatedHeading = lastPos.heading + factor * deltaHeading;
1591
+ interpolatedHeading = (interpolatedHeading + 360) % 360;
1592
+ return interpolatedHeading;
1593
+ }
1594
+ // If no valid heading is available, calculate based on movement direction.
1595
+ else {
1596
+ const previousPos = lastPos.pos3d;
1597
+ const currentPos = nextPos.pos3d;
1598
+ if (!previousPos || isNaN(previousPos.x) ||
1599
+ !currentPos || isNaN(currentPos.x)) {
1600
+ return null;
1601
+ }
1602
+ // Flatten to avoid orientation changes due to height differences.
1603
+ const adjustedPointPrev = Cartographic.fromCartesian(previousPos);
1604
+ const adjustedPos3dPrev = Cartesian3.fromRadians(adjustedPointPrev.longitude, adjustedPointPrev.latitude, 0);
1605
+ const adjustedPointNext = Cartographic.fromCartesian(currentPos);
1606
+ const adjustedPos3dNext = Cartesian3.fromRadians(adjustedPointNext.longitude, adjustedPointNext.latitude, 0);
1607
+ // Check if the positions are too close.
1608
+ if (Cartesian3.distance(adjustedPos3dPrev, adjustedPos3dNext) < 0.05) {
1609
+ return null;
1610
+ }
1611
+ const direction = Cartesian3.subtract(adjustedPos3dNext, adjustedPos3dPrev, new Cartesian3());
1612
+ // No movement.
1613
+ if (direction.x === 0 && direction.y === 0 && direction.z === 0) {
1614
+ return null;
1615
+ }
1616
+ // Calculate heading from the direction vector.
1617
+ Cartesian3.normalize(direction, direction);
1618
+ // Convert the direction to a heading angle.
1619
+ const east = Cartesian3.UNIT_X;
1620
+ const north = Cartesian3.UNIT_Y;
1621
+ const heading = Math.atan2(Cartesian3.dot(direction, east), Cartesian3.dot(direction, north));
1622
+ // Convert to degrees.
1623
+ return (Math$1.toDegrees(heading) + 360) % 360;
1624
+ }
1625
+ }
1626
+ }
1627
+ CesiumAnimatedProperty.AnimateTPositionSeries = AnimateTPositionSeries;
1409
1628
  })(CesiumAnimatedProperty || (CesiumAnimatedProperty = {}));
1410
1629
 
1411
1630
  /**
@@ -16185,43 +16404,48 @@ var TilesetRenderEngine;
16185
16404
  }
16186
16405
  }
16187
16406
  }
16188
- // Quick access dictionary of Entity ID -> Entities.
16189
- const entityMap = {};
16190
- // Gather all Tag IDs from found Entities.
16191
- let tagIds = [];
16192
- for (let i = 0; i < entities.length; i++) {
16193
- const entity = entities[i];
16194
- entityMap[entity.Bruce.ID] = entity;
16195
- if ((_b = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a["Layer.ID"]) === null || _b === void 0 ? void 0 : _b.length) {
16196
- const eTagIds = entity.Bruce["Layer.ID"];
16197
- for (let j = 0; j < eTagIds.length; j++) {
16198
- tagIds.push(eTagIds[j]);
16407
+ if (rerun) {
16408
+ this.recordLoadQueue = this.recordLoadQueue.concat(batch);
16409
+ }
16410
+ else {
16411
+ // Quick access dictionary of Entity ID -> Entities.
16412
+ const entityMap = {};
16413
+ // Gather all Tag IDs from found Entities.
16414
+ let tagIds = [];
16415
+ for (let i = 0; i < entities.length; i++) {
16416
+ const entity = entities[i];
16417
+ entityMap[entity.Bruce.ID] = entity;
16418
+ if ((_b = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a["Layer.ID"]) === null || _b === void 0 ? void 0 : _b.length) {
16419
+ const eTagIds = entity.Bruce["Layer.ID"];
16420
+ for (let j = 0; j < eTagIds.length; j++) {
16421
+ tagIds.push(eTagIds[j]);
16422
+ }
16199
16423
  }
16200
16424
  }
16201
- }
16202
- // Turn into unique list.
16203
- if (tagIds.length) {
16204
- tagIds = tagIds.filter((v, i, a) => a.indexOf(v) === i);
16205
- }
16206
- // Gather records.
16207
- let tags = [];
16208
- if (tagIds.length) {
16209
- tags = (await EntityTag.GetListByIds({
16210
- tagIds: tagIds,
16211
- api: this.api
16212
- })).tags;
16213
- }
16214
- for (let i = 0; i < batch.length; i++) {
16215
- const entityId = batch[i];
16216
- const record = entityMap[entityId];
16217
- const feature = this.getEntityRego(entityId);
16218
- if (feature) {
16219
- const eTags = tags.filter(t => { var _a, _b, _c, _d; return ((_b = (_a = record === null || record === void 0 ? void 0 : record.Bruce) === null || _a === void 0 ? void 0 : _a["Layer.ID"]) === null || _b === void 0 ? void 0 : _b.length) && ((_d = (_c = record === null || record === void 0 ? void 0 : record.Bruce) === null || _c === void 0 ? void 0 : _c["Layer.ID"]) === null || _d === void 0 ? void 0 : _d.includes(t.ID)); });
16220
- this.styleTilesetFeatureFullData(feature, record, eTags);
16425
+ // Turn into unique list.
16426
+ if (tagIds.length) {
16427
+ tagIds = tagIds.filter((v, i, a) => a.indexOf(v) === i);
16428
+ }
16429
+ // Gather records.
16430
+ let tags = [];
16431
+ if (tagIds.length) {
16432
+ tags = (await EntityTag.GetListByIds({
16433
+ tagIds: tagIds,
16434
+ api: this.api
16435
+ })).tags;
16436
+ }
16437
+ for (let i = 0; i < batch.length; i++) {
16438
+ const entityId = batch[i];
16439
+ const record = entityMap[entityId];
16440
+ const feature = this.getEntityRego(entityId);
16441
+ if (feature) {
16442
+ const eTags = tags.filter(t => { var _a, _b, _c, _d; return ((_b = (_a = record === null || record === void 0 ? void 0 : record.Bruce) === null || _a === void 0 ? void 0 : _a["Layer.ID"]) === null || _b === void 0 ? void 0 : _b.length) && ((_d = (_c = record === null || record === void 0 ? void 0 : record.Bruce) === null || _c === void 0 ? void 0 : _c["Layer.ID"]) === null || _d === void 0 ? void 0 : _d.includes(t.ID)); });
16443
+ this.styleTilesetFeatureFullData(feature, record, eTags);
16444
+ }
16221
16445
  }
16446
+ rerun = rerun || batch.length > 0;
16447
+ this.viewer.scene.requestRender();
16222
16448
  }
16223
- rerun = rerun || batch.length > 0;
16224
- this.viewer.scene.requestRender();
16225
16449
  }
16226
16450
  }
16227
16451
  finally {
@@ -16772,6 +16996,11 @@ var TilesetRenderEngine;
16772
16996
  }
16773
16997
  getTilesetFeatureNeedsFullData(entityId, entityTypeId) {
16774
16998
  var _a;
16999
+ if (this.historic) {
17000
+ // Unfortunately when we are working with historic we have to request the entity.
17001
+ // This is because we need to know if a record exists at the point in time.
17002
+ return true;
17003
+ }
16775
17004
  const style = this.getTilesetFeatureStyle(entityId, entityTypeId);
16776
17005
  if (!style) {
16777
17006
  return false;
@@ -16874,7 +17103,7 @@ var TilesetRenderEngine;
16874
17103
  * CAD tilesets are referred to as "MODEL" tilesets in some other areas of Bruce code.
16875
17104
  */
16876
17105
  var TilesetCadRenderManager;
16877
- (function (TilesetCadRenderManager) {
17106
+ (function (TilesetCadRenderManager$$1) {
16878
17107
  class Manager {
16879
17108
  get Disposed() {
16880
17109
  return this.disposed;
@@ -16901,6 +17130,12 @@ var TilesetCadRenderManager;
16901
17130
  // We retain this information as a quick look-up on what has been registered.
16902
17131
  // This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
16903
17132
  this.loadedCesiumEntities = {};
17133
+ // Callback to dispose the link between scene time and the root's historic position.
17134
+ this.viewerDateTimeChangeRemoval = null;
17135
+ // Series of points to help interpolate movement when the timeline changes.
17136
+ this.historicPosses = [];
17137
+ this.historicPossesLoading = false;
17138
+ this.historicPossesLoadingProm = null;
16904
17139
  const { viewer, register: visualsManager, getters, item } = params;
16905
17140
  this.viewer = viewer;
16906
17141
  this.getters = getters;
@@ -17042,6 +17277,8 @@ var TilesetCadRenderManager;
17042
17277
  historic: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic,
17043
17278
  });
17044
17279
  this.viewer.scene.requestRender();
17280
+ // Monitor scene time changes and update the root Entity.
17281
+ this.viewerDateTimeSub(tileset);
17045
17282
  }
17046
17283
  catch (e) {
17047
17284
  console.error(e);
@@ -17331,6 +17568,7 @@ var TilesetCadRenderManager;
17331
17568
  menuItemId: this.item.id,
17332
17569
  doRemove: false
17333
17570
  });
17571
+ this.viewerDateTimeDispose();
17334
17572
  }
17335
17573
  async ReRender(params) {
17336
17574
  let { entityIds, force, entities } = params;
@@ -17350,8 +17588,141 @@ var TilesetCadRenderManager;
17350
17588
  this.styler.SetEntityCache(entityIds, entities);
17351
17589
  this.styler.QueueEntities(regos, true);
17352
17590
  }
17591
+ /**
17592
+ * Monitors the Cesium Viewer and updates the root Entity based on the scene time changing.
17593
+ * If the root Entity is historic, this can allow for movement of the assembly as a whole.
17594
+ * @parma tileset
17595
+ */
17596
+ viewerDateTimeSub(tileset) {
17597
+ var _a, _b;
17598
+ if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historic) || this.viewerDateTimeChangeRemoval) {
17599
+ return;
17600
+ }
17601
+ let accountId = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID;
17602
+ if (!accountId) {
17603
+ accountId = this.getters.GetAccountId();
17604
+ }
17605
+ const api = this.getters.GetBruceApi({
17606
+ accountId: accountId
17607
+ });
17608
+ // Returns a series of positions to use for position interpolation based on time.
17609
+ // If the timeline range is different to the previous query, we'll re-request the data.
17610
+ const getSeriesPosses = async () => {
17611
+ const minDateTime = this.viewer.clock.startTime.toString();
17612
+ const maxDateTime = this.viewer.clock.stopTime.toString();
17613
+ if (this.historicPossesMinDateTime == minDateTime &&
17614
+ this.historicPossesMaxDateTime == maxDateTime) {
17615
+ if (this.historicPossesLoading) {
17616
+ if (!await this.historicPossesLoadingProm) {
17617
+ return false;
17618
+ }
17619
+ }
17620
+ return this.historicPosses;
17621
+ }
17622
+ this.historicPossesMinDateTime = minDateTime;
17623
+ this.historicPossesMaxDateTime = maxDateTime;
17624
+ this.historicPossesLoading = true;
17625
+ this.historicPossesLoadingProm = new Promise(async (res) => {
17626
+ // We'll add/remove 1 second to ensure we cover all records.
17627
+ const startTmp = JulianDate.toDate(this.viewer.clock.startTime);
17628
+ const stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
17629
+ const startStr = new Date(startTmp.getTime() - 1000).toISOString();
17630
+ const stopStr = new Date(stopTmp.getTime() + 1000).toISOString();
17631
+ const historicData = await EntityHistoricData.GetList({
17632
+ attrKey: null,
17633
+ dateTimeFrom: startStr,
17634
+ dateTimeTo: stopStr,
17635
+ entityIds: [this.rootId],
17636
+ api: api
17637
+ });
17638
+ const posses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(this.viewer, HeightReference.NONE, historicData.recordsByIds[this.rootId]);
17639
+ if (this.historicPossesMinDateTime == minDateTime &&
17640
+ this.historicPossesMaxDateTime == maxDateTime) {
17641
+ this.historicPosses = posses;
17642
+ this.historicPossesMinDateTime = minDateTime;
17643
+ this.historicPossesMaxDateTime = maxDateTime;
17644
+ this.historicPossesLoading = false;
17645
+ res(posses);
17646
+ }
17647
+ res(false);
17648
+ });
17649
+ return await this.historicPossesLoadingProm;
17650
+ };
17651
+ getSeriesPosses().then((posses) => {
17652
+ if (this.disposed || posses === false) {
17653
+ return;
17654
+ }
17655
+ let animation = new CesiumAnimatedProperty.AnimateTPositionSeries({
17656
+ viewer: this.viewer,
17657
+ posses: posses,
17658
+ onUpdate: (pos3d, heading) => {
17659
+ if (this.disposed) {
17660
+ return;
17661
+ }
17662
+ const location = Cartographic.fromCartesian(pos3d);
17663
+ const lat = Math$1.toDegrees(location.latitude);
17664
+ const lon = Math$1.toDegrees(location.longitude);
17665
+ const alt = location.height;
17666
+ const cTileset = this.cTileset;
17667
+ const prevCoords = cTileset._bruceCoords;
17668
+ const coords = {
17669
+ "Entity.ID": null,
17670
+ ...prevCoords,
17671
+ transform: {
17672
+ ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.transform,
17673
+ heading: heading
17674
+ },
17675
+ ucs: {
17676
+ name: null,
17677
+ transform: null,
17678
+ ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.ucs,
17679
+ "Entity.ID": this.rootId,
17680
+ location: {
17681
+ altitude: alt,
17682
+ latitude: lat,
17683
+ longitude: lon
17684
+ }
17685
+ }
17686
+ };
17687
+ this.applyCoords(tileset, coords);
17688
+ }
17689
+ });
17690
+ this.viewerDateTimeChangeRemoval = () => {
17691
+ if (animation) {
17692
+ animation.stop();
17693
+ animation = null;
17694
+ }
17695
+ };
17696
+ });
17697
+ }
17698
+ viewerDateTimeDispose() {
17699
+ var _a;
17700
+ (_a = this.viewerDateTimeChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
17701
+ this.viewerDateTimeChangeRemoval = null;
17702
+ }
17703
+ /**
17704
+ * Updates the Tileset with latest coordinates.
17705
+ * This is used to refresh with new values, not to render the first time!
17706
+ * @param tileset
17707
+ * @param coords
17708
+ */
17709
+ applyCoords(tileset, coords) {
17710
+ if (this.disposed || !this.cTileset || this.cTileset.isDestroyed()) {
17711
+ return;
17712
+ }
17713
+ const settings = tileset.settings;
17714
+ TilesetRenderEngine.ApplyPosition({
17715
+ cTileset: this.Tileset,
17716
+ position: {
17717
+ ucs: coords === null || coords === void 0 ? void 0 : coords.ucs,
17718
+ location: (coords === null || coords === void 0 ? void 0 : coords.location) == null ? settings.location : coords.location,
17719
+ transform: (coords === null || coords === void 0 ? void 0 : coords.transform) == null ? settings.transform : coords.transform
17720
+ }
17721
+ });
17722
+ this.viewer.scene.requestRender();
17723
+ }
17353
17724
  }
17354
- TilesetCadRenderManager.Manager = Manager;
17725
+ TilesetCadRenderManager$$1.Manager = Manager;
17355
17726
  })(TilesetCadRenderManager || (TilesetCadRenderManager = {}));
17356
17727
 
17357
17728
  var DataLabRenderManager;
@@ -30105,7 +30476,7 @@ class WidgetViewBar extends Widget.AWidget {
30105
30476
  }
30106
30477
  }
30107
30478
 
30108
- const VERSION = "5.3.7";
30479
+ const VERSION = "5.3.9";
30109
30480
 
30110
30481
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isHistoricMetadataChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, 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 };
30111
30482
  //# sourceMappingURL=bruce-cesium.es5.js.map