bruce-cesium 5.5.0 → 5.5.2

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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -1144,34 +1144,57 @@ var CesiumAnimatedProperty;
1144
1144
  */
1145
1145
  class AnimatePositionSeries {
1146
1146
  constructor(params) {
1147
+ // Current position state.
1147
1148
  this.lastCalcPos3d = null;
1148
1149
  this.lastCalcPosIndexLast = -1;
1149
1150
  this.lastCalcPosIndexNext = -1;
1150
- this.lastCalcTime = null;
1151
+ // Series data for rendering path.
1151
1152
  this.lastCalcSeriesPos3d = [];
1152
1153
  this.lastCalcSeriesTime = null;
1154
+ // Orientation.
1153
1155
  this.lastCalcOrient = null;
1154
1156
  this.lastCalcOrientTime = null;
1155
- // Indicates that the first time we get a GetValue position, we need to animate into it.
1157
+ // Starting animation state.
1156
1158
  this.animateFromPos3d = null;
1157
1159
  this.animateFromPos3dTimeStart = null;
1160
+ this.animationDuration = 200; // milliseconds
1158
1161
  this.viewer = params.viewer;
1159
- this.positions = params.posses;
1160
- this.pitch = params.pitch;
1161
- this.roll = params.roll;
1162
- this.animateFromPos3d = params.animateFromPos3d;
1163
- this.animateFromPos3dTimeStart = Date.now();
1162
+ this.positions = params.posses || [];
1163
+ this.pitch = params.pitch || 0;
1164
+ this.roll = params.roll || 0;
1165
+ // Animation from a starting position.
1166
+ if (params.animateFromPos3d) {
1167
+ this.animateFromPos3d = params.animateFromPos3d;
1168
+ const currentTime = Date.now();
1169
+ const providedTime = params.animateFromPos3dTimeStart || 0;
1170
+ // Check if the provided timestamp is stale (animation would have already completed)
1171
+ // If so, use current time to restart the animation.
1172
+ if (!providedTime || (currentTime - providedTime) >= this.animationDuration) {
1173
+ this.animateFromPos3dTimeStart = currentTime;
1174
+ }
1175
+ else {
1176
+ this.animateFromPos3dTimeStart = providedTime;
1177
+ }
1178
+ }
1164
1179
  this.processHeadings();
1165
1180
  // Order positions by date.
1166
- this.positions.sort((a, b) => {
1167
- return a.dateTime.getTime() - b.dateTime.getTime();
1168
- });
1181
+ if (this.positions.length > 0) {
1182
+ this.positions.sort((a, b) => {
1183
+ return a.dateTime.getTime() - b.dateTime.getTime();
1184
+ });
1185
+ }
1186
+ }
1187
+ GetAnimateFromDateTime() {
1188
+ return this.animateFromPos3dTimeStart;
1169
1189
  }
1170
1190
  /**
1171
1191
  * Pre-process headings in the series.
1172
1192
  * If all are null or 0, then we assume all are null.
1173
1193
  */
1174
1194
  processHeadings() {
1195
+ if (!this.positions || this.positions.length === 0) {
1196
+ return;
1197
+ }
1175
1198
  let hasHeading = false;
1176
1199
  for (let i = 0; i < this.positions.length; i++) {
1177
1200
  let pos = this.positions[i];
@@ -1189,100 +1212,130 @@ var CesiumAnimatedProperty;
1189
1212
  GetPositions() {
1190
1213
  return this.positions;
1191
1214
  }
1215
+ easeInOutQuad(t) {
1216
+ return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
1217
+ }
1218
+ /**
1219
+ * Interpolates between the starting position and target position.
1220
+ */
1221
+ interpolateToTargetPosition(startPos, targetPos, startTimeMs, currentTimeMs) {
1222
+ if (!startPos || !targetPos) {
1223
+ return startPos || targetPos || new Cartesian3();
1224
+ }
1225
+ const elapsedTime = currentTimeMs - startTimeMs;
1226
+ let progress = Math.min(elapsedTime / this.animationDuration, 1.0);
1227
+ // Apply easing for more natural motion.
1228
+ progress = this.easeInOutQuad(progress);
1229
+ try {
1230
+ return Cartesian3.lerp(startPos, targetPos, progress, new Cartesian3());
1231
+ }
1232
+ catch (e) {
1233
+ console.error("Error in position interpolation: ", e);
1234
+ return targetPos;
1235
+ }
1236
+ }
1237
+ /**
1238
+ * Main method to get the current position based on time
1239
+ */
1192
1240
  GetValue() {
1193
1241
  let now = this.viewer.scene.lastRenderTime;
1194
1242
  if (!now) {
1195
1243
  now = this.viewer.clock.currentTime;
1196
1244
  }
1197
1245
  const nowTimeMs = JulianDate.toDate(now).getTime();
1198
- // Skip calculation if time hasn't changed.
1199
- if (this.lastCalcTime === nowTimeMs) {
1246
+ const currentRealTimeMs = Date.now();
1247
+ // Calculate the ideal position based on time.
1248
+ const idealPosition = this.calculateIdealPosition(nowTimeMs);
1249
+ // First run initialization.
1250
+ if (!this.lastCalcPos3d) {
1251
+ this.lastCalcPos3d = idealPosition;
1252
+ // If we have a starting position, animate from it.
1200
1253
  if (this.animateFromPos3d) {
1201
- // We emit an interpolated position if we're animating from the start position.
1202
- const interpolatedPos = this.interpolateToStartPos3d(this.animateFromPos3dTimeStart, Date.now());
1203
- if (Cartesian3.equals(interpolatedPos, this.animateFromPos3d)) {
1204
- this.animateFromPos3d = null;
1205
- }
1206
- return interpolatedPos;
1207
- }
1208
- return this.lastCalcPos3d;
1209
- }
1210
- const calculate = () => {
1211
- // See if we're before the first position.
1212
- if (nowTimeMs <= this.positions[0].dateTime.getTime()) {
1213
- this.lastCalcPosIndexLast = 0;
1214
- this.lastCalcPosIndexNext = 0;
1215
- return this.positions[0].pos3d;
1216
- }
1217
- // See if we're after the last position.
1218
- if (nowTimeMs >= this.positions[this.positions.length - 1].dateTime.getTime()) {
1219
- this.lastCalcPosIndexLast = this.positions.length - 1;
1220
- this.lastCalcPosIndexNext = this.positions.length - 1;
1221
- return this.positions[this.positions.length - 1].pos3d;
1222
- }
1223
- // Find the current position.
1224
- let lastIndex = 0;
1225
- for (let i = 1; i < this.positions.length; i++) {
1226
- let pos = this.positions[i];
1227
- if (nowTimeMs >= pos.dateTime.getTime()) {
1228
- lastIndex = i;
1229
- }
1230
- else {
1231
- break;
1232
- }
1254
+ return this.interpolateToTargetPosition(this.animateFromPos3d, idealPosition, this.animateFromPos3dTimeStart, currentRealTimeMs);
1233
1255
  }
1234
- const last = this.positions[lastIndex];
1235
- this.lastCalcPosIndexLast = lastIndex;
1236
- // Interpolate the position.
1237
- let next = this.positions[lastIndex + 1];
1238
- if (!next) {
1239
- this.lastCalcPosIndexNext = lastIndex;
1240
- return last.pos3d;
1241
- }
1242
- this.lastCalcPosIndexNext = lastIndex + 1;
1243
- let progress = (nowTimeMs - last.dateTime.getTime()) / (next.dateTime.getTime() - last.dateTime.getTime());
1244
- return Cartesian3.lerp(last.pos3d, next.pos3d, progress, new Cartesian3());
1245
- };
1246
- this.lastCalcTime = nowTimeMs;
1247
- this.lastCalcPos3d = calculate();
1248
- let pos3d = this.lastCalcPos3d;
1249
- // We emit an interpolated position if we're animating from the start position.
1250
- if (this.animateFromPos3d && Cartes.ValidateCartes3(this.lastCalcPos3d)) {
1251
- if (Cartesian3.equals(this.animateFromPos3d, this.lastCalcPos3d)) {
1256
+ return idealPosition;
1257
+ }
1258
+ // If we're animating from a start position.
1259
+ if (this.animateFromPos3d) {
1260
+ const elapsedTime = currentRealTimeMs - this.animateFromPos3dTimeStart;
1261
+ // If animation is complete, just return ideal position and clear animation state.
1262
+ if (elapsedTime >= this.animationDuration) {
1252
1263
  this.animateFromPos3d = null;
1264
+ this.lastCalcPos3d = idealPosition;
1265
+ return idealPosition;
1253
1266
  }
1254
- else if (this.animateFromPos3d) {
1255
- pos3d = this.interpolateToStartPos3d(this.animateFromPos3dTimeStart, Date.now());
1256
- if (Cartesian3.equals(pos3d, this.animateFromPos3d)) {
1257
- this.animateFromPos3d = null;
1258
- }
1259
- }
1267
+ // Otherwise continue interpolation.
1268
+ const interpolatedPos = this.interpolateToTargetPosition(this.animateFromPos3d, idealPosition, this.animateFromPos3dTimeStart, currentRealTimeMs);
1269
+ this.lastCalcPos3d = interpolatedPos;
1270
+ return interpolatedPos;
1260
1271
  }
1261
- return pos3d;
1272
+ // If we're not animating, directly use the ideal position.
1273
+ // This ensures we're exactly where we should be based on time.
1274
+ this.lastCalcPos3d = idealPosition;
1275
+ return idealPosition;
1262
1276
  }
1263
1277
  /**
1264
- * Interpolates between the start position and the last calculated position.
1265
- * This lets us animate in the series positions.
1266
- * @param nowMs
1278
+ * Calculate the ideal position based on current time without any smoothing.
1267
1279
  */
1268
- interpolateToStartPos3d(startMs, nowMs) {
1269
- const startPos = this.animateFromPos3d;
1270
- const targetPos = this.lastCalcPos3d;
1271
- if (!startPos || !targetPos) {
1272
- return startPos ? startPos : targetPos;
1280
+ calculateIdealPosition(timeMs) {
1281
+ if (!this.positions || this.positions.length === 0) {
1282
+ return new Cartesian3();
1273
1283
  }
1274
- const duration = nowMs - startMs;
1275
- let progress = duration / 300; // 300ms duration.
1276
- if (progress > 1) {
1277
- progress = 1;
1284
+ // Before first position.
1285
+ if (timeMs <= this.positions[0].dateTime.getTime()) {
1286
+ this.lastCalcPosIndexLast = 0;
1287
+ this.lastCalcPosIndexNext = 0;
1288
+ return this.positions[0].pos3d || new Cartesian3();
1289
+ }
1290
+ // After last position.
1291
+ if (timeMs >= this.positions[this.positions.length - 1].dateTime.getTime()) {
1292
+ const lastIndex = this.positions.length - 1;
1293
+ this.lastCalcPosIndexLast = lastIndex;
1294
+ this.lastCalcPosIndexNext = lastIndex;
1295
+ return this.positions[lastIndex].pos3d || new Cartesian3();
1296
+ }
1297
+ // Find the position before and after the current time.
1298
+ let lastIndex = 0;
1299
+ for (let i = 0; i < this.positions.length - 1; i++) {
1300
+ if (timeMs >= this.positions[i].dateTime.getTime() &&
1301
+ timeMs < this.positions[i + 1].dateTime.getTime()) {
1302
+ lastIndex = i;
1303
+ break;
1304
+ }
1305
+ }
1306
+ const last = this.positions[lastIndex];
1307
+ this.lastCalcPosIndexLast = lastIndex;
1308
+ // If we're exactly at this position's time.
1309
+ if (timeMs === last.dateTime.getTime()) {
1310
+ this.lastCalcPosIndexNext = lastIndex;
1311
+ return last.pos3d || new Cartesian3();
1312
+ }
1313
+ // Interpolate between surrounding positions.
1314
+ const next = this.positions[lastIndex + 1];
1315
+ if (!next) {
1316
+ this.lastCalcPosIndexNext = lastIndex;
1317
+ return last.pos3d || new Cartesian3();
1318
+ }
1319
+ this.lastCalcPosIndexNext = lastIndex + 1;
1320
+ try {
1321
+ // Ensure both position vectors are valid.
1322
+ if (!last.pos3d || !next.pos3d) {
1323
+ return last.pos3d || next.pos3d || new Cartesian3();
1324
+ }
1325
+ const progress = (timeMs - last.dateTime.getTime()) /
1326
+ (next.dateTime.getTime() - last.dateTime.getTime());
1327
+ return Cartesian3.lerp(last.pos3d, next.pos3d, progress, new Cartesian3());
1328
+ }
1329
+ catch (e) {
1330
+ console.error("Error in ideal position calculation: ", e);
1331
+ return last.pos3d || new Cartesian3();
1278
1332
  }
1279
- return Cartesian3.lerp(startPos, targetPos, progress, new Cartesian3());
1280
1333
  }
1281
1334
  /**
1282
- * Returns a series of positions to use for rendering the path.
1335
+ * Returns a series of positions to use for rendering the path..
1283
1336
  */
1284
1337
  GetSeries() {
1285
- // We update 30 times a second.
1338
+ // Update at 30 fps.
1286
1339
  let doUpdate = this.lastCalcSeriesTime == null;
1287
1340
  if (!doUpdate && this.lastCalcSeriesTime && (new Date().getTime() - this.lastCalcSeriesTime) > 1000 / 30) {
1288
1341
  doUpdate = true;
@@ -1290,7 +1343,7 @@ var CesiumAnimatedProperty;
1290
1343
  if (!doUpdate) {
1291
1344
  return this.lastCalcSeriesPos3d;
1292
1345
  }
1293
- // Refresh cached values.
1346
+ // Ensure position indices are up-to-date.
1294
1347
  this.GetValue();
1295
1348
  let now = this.viewer.scene.lastRenderTime;
1296
1349
  if (!now) {
@@ -1298,17 +1351,25 @@ var CesiumAnimatedProperty;
1298
1351
  }
1299
1352
  const nowDate = JulianDate.toDate(now);
1300
1353
  // Get total duration.
1301
- const totalDuration = this.positions[this.positions.length - 1].dateTime.getTime() - this.positions[0].dateTime.getTime();
1354
+ if (!this.positions || this.positions.length < 2) {
1355
+ this.lastCalcSeriesTime = nowDate.getTime();
1356
+ this.lastCalcSeriesPos3d = [];
1357
+ return [];
1358
+ }
1359
+ const totalDuration = this.positions[this.positions.length - 1].dateTime.getTime() -
1360
+ this.positions[0].dateTime.getTime();
1302
1361
  // Percentage of the polyline to be visible before and after each point.
1303
1362
  const visibilityPercentage = 0.05; // 5%
1304
1363
  const visibilityDuration = totalDuration * visibilityPercentage;
1305
1364
  // Gather positions that fall within the visibility duration.
1306
- // No positions is valid.
1307
1365
  const newPosses = [];
1308
1366
  for (let i = 0; i < this.positions.length; i++) {
1309
1367
  const pos = this.positions[i];
1310
- let add = nowDate >= new Date(pos.dateTime.getTime() - visibilityDuration / 2) && nowDate <= new Date(pos.dateTime.getTime() + visibilityDuration / 2);
1311
- // Not valid time-wise but if we're currently rendering this segment then we'll show it.
1368
+ if (!pos.pos3d)
1369
+ continue;
1370
+ let add = nowDate >= new Date(pos.dateTime.getTime() - visibilityDuration / 2) &&
1371
+ nowDate <= new Date(pos.dateTime.getTime() + visibilityDuration / 2);
1372
+ // Also include the segment we're currently traversing.
1312
1373
  if (!add && this.lastCalcPosIndexLast > -1 && this.lastCalcPosIndexNext > -1) {
1313
1374
  add = i >= this.lastCalcPosIndexLast && i <= this.lastCalcPosIndexNext;
1314
1375
  }
@@ -1321,93 +1382,112 @@ var CesiumAnimatedProperty;
1321
1382
  return newPosses;
1322
1383
  }
1323
1384
  /**
1324
- * Returns the orientation of the Entity.
1325
- * This will be based on either the series data, or a calculated heading if it's not available in the data.
1326
- * @returns
1385
+ * Returns the orientation based on current position and heading.
1327
1386
  */
1328
1387
  GetOrient() {
1388
+ // Update at 30 fps.
1329
1389
  let doUpdate = this.lastCalcOrientTime == null;
1330
1390
  if (!doUpdate && this.lastCalcOrientTime && (new Date().getTime() - this.lastCalcOrientTime) > 1000 / 30) {
1331
1391
  doUpdate = true;
1332
1392
  }
1333
- if (!doUpdate) {
1393
+ if (!doUpdate && this.lastCalcOrient) {
1334
1394
  return this.lastCalcOrient;
1335
1395
  }
1336
- if (this.positions.length === 0) {
1337
- return this.lastCalcOrient;
1396
+ // Default quaternion to return if we can't calculate.
1397
+ const defaultQuaternion = new Quaternion();
1398
+ if (!this.positions || this.positions.length === 0) {
1399
+ return defaultQuaternion;
1400
+ }
1401
+ // Ensure position is up-to-date.
1402
+ const currentPosition = this.GetValue();
1403
+ if (!currentPosition) {
1404
+ return defaultQuaternion;
1338
1405
  }
1339
- // Refresh cached values.
1340
- this.GetValue();
1341
1406
  let now = this.viewer.scene.lastRenderTime;
1342
1407
  if (!now) {
1343
1408
  now = this.viewer.clock.currentTime;
1344
1409
  }
1345
1410
  const nowTime = JulianDate.toDate(now).getTime();
1346
- // Determine the indices of the last and next positions
1347
- const lastIndex = this.lastCalcPosIndexLast;
1348
- const nextIndex = this.lastCalcPosIndexNext;
1349
- // Ensure valid indices
1350
- if (lastIndex < 0 || nextIndex < 0 || lastIndex >= this.positions.length || nextIndex >= this.positions.length) {
1351
- return this.lastCalcOrient;
1352
- }
1353
- const lastPos = this.positions[lastIndex];
1354
- const nextPos = this.positions[nextIndex];
1355
- // If the heading is present and not null, interpolate or use it directly
1356
- if (lastPos.heading !== null && nextPos.heading !== null) {
1357
- let deltaHeading = nextPos.heading - lastPos.heading;
1358
- // Handle wraparound between 359 and 0 degrees
1359
- if (deltaHeading > 180) {
1360
- deltaHeading -= 360;
1361
- }
1362
- else if (deltaHeading < -180) {
1363
- deltaHeading += 360;
1411
+ try {
1412
+ // Get last and next position indices.
1413
+ const lastIndex = this.lastCalcPosIndexLast;
1414
+ const nextIndex = this.lastCalcPosIndexNext;
1415
+ // Validate indices.
1416
+ if (lastIndex < 0 || nextIndex < 0 ||
1417
+ lastIndex >= this.positions.length || nextIndex >= this.positions.length) {
1418
+ return this.lastCalcOrient || defaultQuaternion;
1419
+ }
1420
+ const lastPos = this.positions[lastIndex];
1421
+ const nextPos = this.positions[nextIndex];
1422
+ if (!lastPos || !nextPos) {
1423
+ return this.lastCalcOrient || defaultQuaternion;
1424
+ }
1425
+ // Use explicit heading values if available.
1426
+ if (lastPos.heading !== null && nextPos.heading !== null) {
1427
+ // Calculate interpolated heading.
1428
+ let deltaHeading = nextPos.heading - lastPos.heading;
1429
+ // Handle wrap-around between 359° and 0°.
1430
+ if (deltaHeading > 180) {
1431
+ deltaHeading -= 360;
1432
+ }
1433
+ else if (deltaHeading < -180) {
1434
+ deltaHeading += 360;
1435
+ }
1436
+ // Calculate interpolation factor.
1437
+ let factor = 0;
1438
+ if (lastIndex !== nextIndex &&
1439
+ lastPos.dateTime.getTime() !== nextPos.dateTime.getTime()) {
1440
+ factor = (nowTime - lastPos.dateTime.getTime()) /
1441
+ (nextPos.dateTime.getTime() - lastPos.dateTime.getTime());
1442
+ factor = Math.max(0, Math.min(1, factor));
1443
+ }
1444
+ // Apply easing for smoother rotation.
1445
+ factor = this.easeInOutQuad(factor);
1446
+ // Calculate final heading.
1447
+ let interpolatedHeading = lastPos.heading + factor * deltaHeading;
1448
+ interpolatedHeading = (interpolatedHeading + 360) % 360;
1449
+ // Create quaternion from heading, pitch, roll.
1450
+ this.lastCalcOrient = Transforms.headingPitchRollQuaternion(currentPosition, new HeadingPitchRoll(Math$1.toRadians(interpolatedHeading), Math$1.toRadians(this.pitch), Math$1.toRadians(this.roll)));
1451
+ }
1452
+ // Calculate heading from position changes if not available.
1453
+ else {
1454
+ if (!lastPos.pos3d || !nextPos.pos3d) {
1455
+ return this.lastCalcOrient || defaultQuaternion;
1456
+ }
1457
+ // Flatten positions to avoid altitude-related heading changes.
1458
+ const adjustedPointPrev = Cartographic.fromCartesian(lastPos.pos3d);
1459
+ const adjustedPos3dPrev = Cartesian3.fromRadians(adjustedPointPrev.longitude, adjustedPointPrev.latitude, 0);
1460
+ const adjustedPointNext = Cartographic.fromCartesian(nextPos.pos3d);
1461
+ const adjustedPos3dNext = Cartesian3.fromRadians(adjustedPointNext.longitude, adjustedPointNext.latitude, 0);
1462
+ // Skip if positions are too close (less than 5cm).
1463
+ const distance = Cartesian3.distance(adjustedPos3dPrev, adjustedPos3dNext);
1464
+ if (distance < 0.05) {
1465
+ return this.lastCalcOrient || defaultQuaternion;
1466
+ }
1467
+ // Calculate direction vector.
1468
+ const direction = Cartesian3.subtract(adjustedPos3dNext, adjustedPos3dPrev, new Cartesian3());
1469
+ // Skip if no movement.
1470
+ if (direction.x === 0 && direction.y === 0 && direction.z === 0) {
1471
+ return this.lastCalcOrient || defaultQuaternion;
1472
+ }
1473
+ // Normalize the direction vector.
1474
+ Cartesian3.normalize(direction, direction);
1475
+ // Calculate rotation based on movement direction.
1476
+ const rotationMatrix = Transforms.rotationMatrixFromPositionVelocity(currentPosition, direction);
1477
+ // Convert to quaternion.
1478
+ const quaternion = Quaternion.fromRotationMatrix(rotationMatrix);
1479
+ // Add pitch and roll adjustments.
1480
+ const hpr = new HeadingPitchRoll(0, Math$1.toRadians(this.pitch), Math$1.toRadians(this.roll));
1481
+ const pitchRollQuaternion = Quaternion.fromHeadingPitchRoll(hpr);
1482
+ // Combine quaternions.
1483
+ this.lastCalcOrient = Quaternion.multiply(quaternion, pitchRollQuaternion, new Quaternion());
1364
1484
  }
1365
- const factor = (nowTime - lastPos.dateTime.getTime()) / (nextPos.dateTime.getTime() - lastPos.dateTime.getTime());
1366
- let interpolatedHeading = lastPos.heading + factor * deltaHeading;
1367
- interpolatedHeading = (interpolatedHeading + 360) % 360;
1368
- this.lastCalcOrient = Transforms.headingPitchRollQuaternion(this.lastCalcPos3d, new HeadingPitchRoll(Math$1.toRadians(interpolatedHeading), Math$1.toRadians(this.pitch), Math$1.toRadians(this.roll)));
1369
1485
  }
1370
- // If no valid heading is available, calculate based on movement direction
1371
- else {
1372
- const previousPos = this.positions[lastIndex].pos3d;
1373
- if (!previousPos || isNaN(previousPos.x)) {
1374
- return this.lastCalcOrient;
1375
- }
1376
- const nextPos = this.positions[nextIndex].pos3d;
1377
- if (!nextPos || isNaN(nextPos.x)) {
1378
- return this.lastCalcOrient;
1379
- }
1380
- // Flatten to avoid orientation changes due to height differences.
1381
- const adjustedPointPrev = Cartographic.fromCartesian(previousPos);
1382
- const adjustedPos3dPrev = Cartesian3.fromRadians(adjustedPointPrev.longitude, adjustedPointPrev.latitude, 0);
1383
- const adjustedPointNext = Cartographic.fromCartesian(nextPos);
1384
- const adjustedPos3dNext = Cartesian3.fromRadians(adjustedPointNext.longitude, adjustedPointNext.latitude, 0);
1385
- // Check if the previous and current positions are the same.
1386
- // We apply a threshold as well to avoid jittering.
1387
- if (Cartesian3.distance(adjustedPos3dPrev, adjustedPos3dNext) < 0.05) {
1388
- return this.lastCalcOrient;
1389
- }
1390
- const direction = Cartesian3.subtract(adjustedPos3dNext, adjustedPos3dPrev, new Cartesian3());
1391
- // No movement, return the last calculated orientation.
1392
- if (direction.x == 0 && direction.y == 0 && direction.z == 0) {
1393
- return this.lastCalcOrient;
1394
- }
1395
- Cartesian3.normalize(direction, direction);
1396
- // Calculate the rotation matrix from the position and direction.
1397
- let curPosition = this.lastCalcPos3d;
1398
- if (!curPosition || isNaN(curPosition.x)) {
1399
- curPosition = adjustedPos3dPrev;
1400
- }
1401
- const rotationMatrix = Transforms.rotationMatrixFromPositionVelocity(curPosition, direction);
1402
- // Convert the rotation matrix to a quaternion.
1403
- const quaternion = Quaternion.fromRotationMatrix(rotationMatrix);
1404
- // Apply pitch and roll adjustments
1405
- const hpr = new HeadingPitchRoll(0, Math$1.toRadians(this.pitch), Math$1.toRadians(this.roll));
1406
- const pitchRollQuaternion = Quaternion.fromHeadingPitchRoll(hpr);
1407
- // Combine the direction quaternion with pitch and roll.
1408
- Quaternion.multiply(quaternion, pitchRollQuaternion, quaternion);
1409
- this.lastCalcOrient = quaternion;
1486
+ catch (e) {
1487
+ console.error("Error calculating orientation: ", e);
1488
+ return this.lastCalcOrient || defaultQuaternion;
1410
1489
  }
1490
+ this.lastCalcOrientTime = Date.now();
1411
1491
  return this.lastCalcOrient;
1412
1492
  }
1413
1493
  }
@@ -1544,91 +1624,100 @@ var CesiumAnimatedProperty;
1544
1624
  }
1545
1625
  }
1546
1626
  }
1547
- /**
1548
- * Update function called on each render frame.
1549
- */
1550
1627
  update() {
1551
1628
  if (!this.positions || this.positions.length === 0) {
1552
1629
  return;
1553
1630
  }
1554
- let now = this.viewer.scene.lastRenderTime;
1555
- if (!now) {
1556
- now = this.viewer.clock.currentTime;
1557
- }
1631
+ // Get current time.
1632
+ let now = this.viewer.scene.lastRenderTime || this.viewer.clock.currentTime;
1558
1633
  const nowTime = JulianDate.toDate(now);
1559
1634
  const nowTimeMs = nowTime.getTime();
1560
- // Skip calculation if time hasn't changed.
1561
- if (this.lastCalcTime === nowTimeMs) {
1562
- // If we're currently mid-animation, we need to update the position over time.
1563
- if (this.lastCalcPosApplyOverTime) {
1564
- const interpolatedPos = this.interpolatePos3dOverTime(this.lastCalcPos3dApplyOverTimeTimeStart, Date.now());
1565
- if (Cartesian3.equals(interpolatedPos, this.lastCalcPos3dApplyOverTimeTarget)) {
1566
- this.lastCalcPosApplyOverTime = false;
1567
- this.lastCalcPos3d = interpolatedPos;
1568
- }
1569
- this.onUpdate(interpolatedPos, this.lastCalcHeading);
1570
- }
1635
+ const currentRealTimeMs = Date.now();
1636
+ // Calculate the ideal position based on current time.
1637
+ const targetPosition = this.calculatePosition(nowTimeMs);
1638
+ // Initialize if this is the first update.
1639
+ if (!this.lastCalcPos3d) {
1640
+ this.lastCalcPos3d = targetPosition.pos3d;
1641
+ this.onUpdate(targetPosition.pos3d, this.lastCalcHeading);
1571
1642
  return;
1572
1643
  }
1573
- // Calculate position.
1574
- const position = this.calculatePosition(nowTimeMs);
1575
- // Calculate what position to emit.
1576
- let pos3d = null;
1577
- // Update cache values.
1578
- this.lastCalcTime = nowTimeMs;
1579
- if (position.applyOverTime && Cartes.ValidateCartes3(this.lastCalcPos3d)) {
1580
- if (Cartesian3.equals(this.lastCalcPos3d, position.pos3d)) {
1581
- pos3d = position.pos3d;
1644
+ // Check if target has changed.
1645
+ if (!this.lastCalcPos3dApplyOverTimeTarget ||
1646
+ !Cartesian3.equals(this.lastCalcPos3dApplyOverTimeTarget, targetPosition.pos3d)) {
1647
+ // If we were already interpolating, get the current interpolated position as our new starting point.
1648
+ if (this.lastCalcPosApplyOverTime && this.lastCalcPos3dApplyOverTimeTimeStart) {
1649
+ // Calculate where we are in the current interpolation.
1650
+ const currentInterpolatedPos = this.interpolatePos3dOverTime(this.lastCalcPos3dApplyOverTimeTimeStart, currentRealTimeMs);
1651
+ // Use this as our new starting position.
1652
+ this.lastCalcPos3d = currentInterpolatedPos;
1653
+ }
1654
+ // Set new target and start time.
1655
+ this.lastCalcPos3dApplyOverTimeTarget = targetPosition.pos3d;
1656
+ this.lastCalcPos3dApplyOverTimeTimeStart = currentRealTimeMs;
1657
+ this.lastCalcPosApplyOverTime = true;
1658
+ }
1659
+ // Calculate the interpolated position.
1660
+ let pos3d;
1661
+ if (this.lastCalcPosApplyOverTime) {
1662
+ pos3d = this.interpolatePos3dOverTime(this.lastCalcPos3dApplyOverTimeTimeStart, currentRealTimeMs);
1663
+ // If we've reached the target, update our base position.
1664
+ if (Cartesian3.distance(pos3d, this.lastCalcPos3dApplyOverTimeTarget) < 0.01) {
1665
+ this.lastCalcPos3d = this.lastCalcPos3dApplyOverTimeTarget;
1582
1666
  this.lastCalcPosApplyOverTime = false;
1583
1667
  }
1584
- else if (Cartesian3.equals(this.lastCalcPos3dApplyOverTimeTarget, position.pos3d)) {
1585
- pos3d = this.interpolatePos3dOverTime(this.lastCalcPos3dApplyOverTimeTimeStart, Date.now());
1586
- if (Cartesian3.equals(pos3d, this.lastCalcPos3dApplyOverTimeTarget)) {
1587
- this.lastCalcPos3d = pos3d;
1588
- this.lastCalcPosApplyOverTime = false;
1589
- }
1590
- }
1591
- else {
1592
- if (!this.lastCalcPosApplyOverTime) {
1593
- this.lastCalcPos3dApplyOverTimeTimeStart = Date.now();
1594
- }
1595
- this.lastCalcPosApplyOverTime = true;
1596
- this.lastCalcPos3dApplyOverTimeTarget = position.pos3d;
1597
- pos3d = this.interpolatePos3dOverTime(this.lastCalcPos3dApplyOverTimeTimeStart, Date.now());
1598
- }
1599
1668
  }
1600
1669
  else {
1601
- this.lastCalcPos3d = position.pos3d;
1602
- pos3d = position.pos3d;
1670
+ pos3d = this.lastCalcPos3d;
1603
1671
  }
1604
1672
  // Calculate heading.
1605
- const posses = this.positions;
1606
- const lastPos = posses[position.indexLast];
1607
- const nextPos = posses[position.indexNext];
1608
- if (lastPos && nextPos) {
1609
- this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1673
+ if (this.lastCalcPos3dApplyOverTimeTarget) {
1674
+ if (this.lastCalcPos3d) {
1675
+ const minDistanceThreshold = 0.05;
1676
+ const currentToTargetDistance = Cartesian3.distance(this.lastCalcPos3d, this.lastCalcPos3dApplyOverTimeTarget);
1677
+ if (currentToTargetDistance >= minDistanceThreshold) {
1678
+ const lastPos = {
1679
+ pos3d: this.lastCalcPos3d,
1680
+ dateTime: this.lastCalcPos3dApplyOverTimeTimeStart ? new Date(this.lastCalcPos3dApplyOverTimeTimeStart) : null,
1681
+ heading: null
1682
+ };
1683
+ const nextPos = {
1684
+ pos3d: this.lastCalcPos3dApplyOverTimeTarget,
1685
+ dateTime: null,
1686
+ heading: null
1687
+ };
1688
+ if (lastPos && nextPos) {
1689
+ this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1690
+ }
1691
+ }
1692
+ }
1693
+ }
1694
+ else {
1695
+ const posses = this.positions;
1696
+ const lastPos = posses[targetPosition.indexLast];
1697
+ const nextPos = posses[targetPosition.indexNext];
1698
+ if (lastPos && nextPos) {
1699
+ this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1700
+ }
1610
1701
  }
1611
1702
  // Provide the calculated values to the caller.
1612
1703
  this.onUpdate(pos3d, this.lastCalcHeading);
1613
1704
  }
1614
- /**
1615
- * Interpolates the position over time between the last and target positions.
1616
- * This is used when we reach a boundary position so to smoothly animate to it, we move from the current position to it.
1617
- * @param nowMs
1618
- */
1619
- interpolatePos3dOverTime(prevMs, nowMs) {
1705
+ interpolatePos3dOverTime(startTimeMs, currentTimeMs) {
1620
1706
  const lastPos = this.lastCalcPos3d;
1621
1707
  const targetPos = this.lastCalcPos3dApplyOverTimeTarget;
1622
1708
  if (!lastPos || !targetPos) {
1623
1709
  return lastPos ? lastPos : targetPos;
1624
1710
  }
1625
- const duration = nowMs - prevMs;
1626
- let progress = duration / 300; // 300ms duration.
1627
- if (progress > 1) {
1628
- progress = 1;
1629
- }
1711
+ const interpolationDuration = 200;
1712
+ const elapsedTime = currentTimeMs - startTimeMs;
1713
+ let progress = Math.min(elapsedTime / interpolationDuration, 1.0);
1714
+ // Optional step to make it smoother.
1715
+ progress = this.easeInOutQuad(progress);
1630
1716
  return Cartesian3.lerp(lastPos, targetPos, progress, new Cartesian3());
1631
1717
  }
1718
+ easeInOutQuad(t) {
1719
+ return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
1720
+ }
1632
1721
  /**
1633
1722
  * Pre-process headings in the series.
1634
1723
  * If all are null or 0, then assume all are null.
@@ -4611,6 +4700,7 @@ var EntityRenderEnginePoint;
4611
4700
  viewer: params.viewer
4612
4701
  });
4613
4702
  position = new CallbackProperty(() => animatePosition.GetValue(), false);
4703
+ position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
4614
4704
  }
4615
4705
  else {
4616
4706
  position = new CallbackProperty(() => EntityUtils.GetPos({
@@ -4622,7 +4712,7 @@ var EntityRenderEnginePoint;
4622
4712
  }), true);
4623
4713
  }
4624
4714
  cEntity = new Entity({
4625
- id: ObjectUtils.UId(10),
4715
+ id: ObjectUtils.UId(15),
4626
4716
  billboard: {
4627
4717
  horizontalOrigin: HorizontalOrigin.CENTER,
4628
4718
  verticalOrigin: VerticalOrigin.BOTTOM,
@@ -4668,15 +4758,21 @@ var EntityRenderEnginePoint;
4668
4758
  cEntity.billboard.width = undefined;
4669
4759
  cEntity.billboard.height = undefined;
4670
4760
  const prevPos3d = GetCValue(params.viewer, cEntity.position);
4761
+ let prevStartTime = null;
4762
+ if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
4763
+ prevStartTime = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"].GetAnimateFromDateTime();
4764
+ }
4671
4765
  // If we have a series of time-based positions then we'll animate as time changes.
4672
4766
  const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
4673
4767
  if (series.length > 1) {
4674
4768
  animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
4675
4769
  posses: series,
4676
4770
  viewer: params.viewer,
4677
- animateFromPos3d: prevPos3d
4771
+ animateFromPos3d: prevPos3d,
4772
+ animateFromPos3dTimeStart: prevStartTime
4678
4773
  });
4679
4774
  cEntity.position = new CallbackProperty(() => animatePosition.GetValue(), false);
4775
+ cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
4680
4776
  }
4681
4777
  else {
4682
4778
  const pos3d = EntityUtils.GetPos({
@@ -4761,7 +4857,7 @@ var EntityRenderEnginePoint;
4761
4857
  }
4762
4858
  if (!params.rendered || !params.rendered.ellipse) {
4763
4859
  cEntity = new Entity({
4764
- id: ObjectUtils.UId(10),
4860
+ id: ObjectUtils.UId(15),
4765
4861
  ellipse: {
4766
4862
  semiMajorAxis: radius,
4767
4863
  semiMinorAxis: radius,
@@ -4879,7 +4975,7 @@ var EntityRenderEnginePoint;
4879
4975
  }
4880
4976
  else {
4881
4977
  outlineEntity = new Entity({
4882
- id: ObjectUtils.UId(10),
4978
+ id: ObjectUtils.UId(15),
4883
4979
  ellipse: {
4884
4980
  semiMajorAxis: radius + outlineWidth,
4885
4981
  semiMinorAxis: radius + outlineWidth,
@@ -4930,6 +5026,7 @@ var EntityRenderEnginePoint;
4930
5026
  viewer: params.viewer
4931
5027
  });
4932
5028
  position = new CallbackProperty(() => animatePosition.GetValue(), false);
5029
+ position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
4933
5030
  }
4934
5031
  else {
4935
5032
  position = new CallbackProperty(() => EntityUtils.GetPos({
@@ -4941,7 +5038,7 @@ var EntityRenderEnginePoint;
4941
5038
  }), true);
4942
5039
  }
4943
5040
  cEntity = new Entity({
4944
- id: ObjectUtils.UId(10),
5041
+ id: ObjectUtils.UId(15),
4945
5042
  // point: {
4946
5043
  // pixelSize: size,
4947
5044
  // color: cColor,
@@ -4992,15 +5089,21 @@ var EntityRenderEnginePoint;
4992
5089
  cEntity.billboard.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
4993
5090
  cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
4994
5091
  const prevPos3d = GetCValue(params.viewer, cEntity.position);
5092
+ let prevStartTime = null;
5093
+ if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
5094
+ prevStartTime = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"].GetAnimateFromDateTime();
5095
+ }
4995
5096
  // If we have a series of time-based positions then we'll animate as time changes.
4996
5097
  const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
4997
5098
  if (series.length > 1) {
4998
5099
  animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
4999
5100
  posses: series,
5000
5101
  viewer: params.viewer,
5001
- animateFromPos3d: prevPos3d
5102
+ animateFromPos3d: prevPos3d,
5103
+ animateFromPos3dTimeStart: prevStartTime
5002
5104
  });
5003
5105
  cEntity.position = new CallbackProperty(() => animatePosition.GetValue(), false);
5106
+ cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
5004
5107
  }
5005
5108
  else {
5006
5109
  const pos3d = EntityUtils.GetPos({
@@ -5048,7 +5151,7 @@ var EntityRenderEnginePoint;
5048
5151
  let trackEntity = siblings === null || siblings === void 0 ? void 0 : siblings[0];
5049
5152
  if (!trackEntity || !trackEntity.polyline) {
5050
5153
  trackEntity = new Entity({
5051
- id: ObjectUtils.UId(10),
5154
+ id: ObjectUtils.UId(15),
5052
5155
  polyline: {
5053
5156
  positions: [],
5054
5157
  width: width,
@@ -6529,6 +6632,7 @@ var EntityRenderEngineModel3d;
6529
6632
  roll: roll
6530
6633
  });
6531
6634
  position = new CallbackProperty(() => animatePosition.GetValue(), false);
6635
+ position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
6532
6636
  }
6533
6637
  else {
6534
6638
  position = new CallbackProperty(() => EntityUtils.GetPos({
@@ -6552,7 +6656,7 @@ var EntityRenderEngineModel3d;
6552
6656
  }, false);
6553
6657
  }
6554
6658
  cEntity = new Entity({
6555
- id: ObjectUtils.UId(10),
6659
+ id: ObjectUtils.UId(15),
6556
6660
  model: {
6557
6661
  uri: params.lodUrl,
6558
6662
  heightReference: heightRef,
@@ -6596,6 +6700,10 @@ var EntityRenderEngineModel3d;
6596
6700
  cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
6597
6701
  cEntity.model.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
6598
6702
  const prevPos3d = GetCValue(params.viewer, cEntity.position);
6703
+ let prevStartTime = null;
6704
+ if (cEntity.position && cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"]) {
6705
+ prevStartTime = cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"].GetAnimateFromDateTime();
6706
+ }
6599
6707
  // If we have a series of time-based positions then we'll animate as time changes.
6600
6708
  const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
6601
6709
  if (series.length > 1) {
@@ -6604,9 +6712,11 @@ var EntityRenderEngineModel3d;
6604
6712
  viewer: params.viewer,
6605
6713
  pitch: pitch,
6606
6714
  roll: roll,
6607
- animateFromPos3d: prevPos3d
6715
+ animateFromPos3d: prevPos3d,
6716
+ animateFromPos3dTimeStart: prevStartTime
6608
6717
  });
6609
6718
  cEntity.position = new CallbackProperty(() => animatePosition.GetValue(), false);
6719
+ cEntity.position["CesiumAnimatedProperty.AnimatePositionSeries"] = animatePosition;
6610
6720
  }
6611
6721
  else {
6612
6722
  const posChanged = !prevPos3d || !Cartesian3.equals(prevPos3d, pos3d);
@@ -6776,7 +6886,7 @@ var EntityRenderEngineModel3d;
6776
6886
  let trackEntity = siblings === null || siblings === void 0 ? void 0 : siblings[0];
6777
6887
  if (!trackEntity || !trackEntity.polyline) {
6778
6888
  trackEntity = new Entity({
6779
- id: ObjectUtils.UId(10),
6889
+ id: ObjectUtils.UId(15),
6780
6890
  polyline: {
6781
6891
  positions: [],
6782
6892
  width: width,
@@ -7164,7 +7274,7 @@ var EntityRenderEnginePolyline;
7164
7274
  if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
7165
7275
  (!params.rendered.corridor && units == "m"))) {
7166
7276
  cEntity = new Entity({
7167
- id: ObjectUtils.UId(10),
7277
+ id: ObjectUtils.UId(15),
7168
7278
  polyline: units == "px" ? {
7169
7279
  positions: posses,
7170
7280
  material: cColor,
@@ -7547,7 +7657,7 @@ var EntityRenderEnginePolygon;
7547
7657
  let cEntity = null;
7548
7658
  if (!params.rendered || !params.rendered.polygon) {
7549
7659
  cEntity = new Entity({
7550
- id: ObjectUtils.UId(10),
7660
+ id: ObjectUtils.UId(15),
7551
7661
  polygon: {
7552
7662
  hierarchy: new PolygonHierarchy(posses, holePosses.map(x => new PolygonHierarchy(x))),
7553
7663
  material: cFillColor,
@@ -7643,7 +7753,7 @@ var EntityRenderEnginePolygon;
7643
7753
  if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
7644
7754
  (!cEntityBorder.corridor && units == "m"))) {
7645
7755
  cEntityBorder = new Entity({
7646
- id: ObjectUtils.UId(10),
7756
+ id: ObjectUtils.UId(15),
7647
7757
  polyline: units == "px" ? new PolylineGraphics({
7648
7758
  positions: borderPosses,
7649
7759
  material: cLineColor,
@@ -7736,7 +7846,7 @@ var EntityRenderEnginePolygon;
7736
7846
  const posses = holePosses[i];
7737
7847
  Cartes.CloseRing3(posses);
7738
7848
  const cEntityHole = new Entity({
7739
- id: ObjectUtils.UId(10),
7849
+ id: ObjectUtils.UId(15),
7740
7850
  polyline: units == "px" ? new PolylineGraphics({
7741
7851
  positions: posses,
7742
7852
  material: cLineColor,
@@ -8363,7 +8473,7 @@ var EntityRenderEngine;
8363
8473
  rendered = rendered.filter(x => x != null);
8364
8474
  if (rendered.length) {
8365
8475
  const rootEntity = new Entity({
8366
- id: ObjectUtils.UId(10)
8476
+ id: ObjectUtils.UId(15)
8367
8477
  });
8368
8478
  rootEntity._siblingGraphics = [];
8369
8479
  rootEntity._renderGroup = GetRenderGroupId(zoomItem);
@@ -17110,7 +17220,7 @@ var SharedGetters;
17110
17220
  if (params.viewer && params.debugShowBounds) {
17111
17221
  // Cell id -> entity.
17112
17222
  const cellCache = {};
17113
- const cellPrefix = ObjectUtils.UId(10) + "_";
17223
+ const cellPrefix = ObjectUtils.UId(15) + "_";
17114
17224
  getter.OnScanUpdate.Subscribe((cells) => {
17115
17225
  if (window.ON_SCAN_UPDATE_PAUSED == true) {
17116
17226
  return;
@@ -17909,7 +18019,7 @@ var TilesetCadRenderManager;
17909
18019
  if (this.disposed) {
17910
18020
  return;
17911
18021
  }
17912
- // Reverse heading .
18022
+ // Reverse heading.
17913
18023
  // Not sure if calc or model is the issue.
17914
18024
  // This is all for a single demo until we figure out how we configure assemblies for this anyways.
17915
18025
  heading = heading + 180;
@@ -30769,7 +30879,7 @@ class WidgetViewBar extends Widget.AWidget {
30769
30879
  }
30770
30880
  }
30771
30881
 
30772
- const VERSION = "5.5.0";
30882
+ const VERSION = "5.5.2";
30773
30883
 
30774
30884
  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, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, DEFAULT_LIVE_PADDING_SECONDS, 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 };
30775
30885
  //# sourceMappingURL=bruce-cesium.es5.js.map