bruce-cesium 5.9.6 → 5.9.7

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, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, 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, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, 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, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -1146,10 +1146,10 @@ var CesiumAnimatedProperty;
1146
1146
  constructor(params) {
1147
1147
  // Animation state.
1148
1148
  this.currentAnimatedPos = null;
1149
- this.currentTargetPos = null;
1149
+ this.actualTargetPos = null;
1150
1150
  this.animationStartPos = null;
1151
1151
  this.animationStartTime = null;
1152
- this.animationDuration = 200;
1152
+ this.animationDuration = 350;
1153
1153
  // Cached data for performance.
1154
1154
  this.lastDesiredPosIndex = -1;
1155
1155
  this.lastDesiredNextIndex = -1;
@@ -1238,11 +1238,11 @@ var CesiumAnimatedProperty;
1238
1238
  * Calculate the desired position based on current time without any animation smoothing.
1239
1239
  */
1240
1240
  calculateDesiredPosition(timeMs) {
1241
- // No positions available
1241
+ // No positions available.
1242
1242
  if (!this.positions || this.positions.length === 0) {
1243
1243
  return { position: null, lastIndex: -1, nextIndex: -1 };
1244
1244
  }
1245
- // Only one position.
1245
+ // Only one position..
1246
1246
  if (this.positions.length === 1) {
1247
1247
  return {
1248
1248
  position: this.positions[0].pos3d || null,
@@ -1318,59 +1318,65 @@ var CesiumAnimatedProperty;
1318
1318
  * Main method to get the current position based on time.
1319
1319
  */
1320
1320
  GetValue() {
1321
- let now = this.viewer.scene.lastRenderTime;
1322
- if (!now) {
1323
- now = this.viewer.clock.currentTime;
1321
+ let viewerTime = this.viewer.scene.lastRenderTime;
1322
+ if (!viewerTime) {
1323
+ viewerTime = this.viewer.clock.currentTime;
1324
1324
  }
1325
- const nowTimeMs = JulianDate.toDate(now).getTime();
1325
+ const viewerTimeMs = JulianDate.toDate(viewerTime).getTime();
1326
1326
  const currentRealTimeMs = Date.now();
1327
1327
  // Calculate the desired position based on time.
1328
- const desired = this.calculateDesiredPosition(nowTimeMs);
1329
- // If no desired position, return empty position.
1328
+ const desired = this.calculateDesiredPosition(viewerTimeMs);
1330
1329
  if (!desired.position) {
1331
1330
  this.currentAnimatedPos = null;
1332
- this.currentTargetPos = null;
1331
+ this.actualTargetPos = null;
1333
1332
  return new Cartesian3();
1334
1333
  }
1335
- // Cache the desired position info for orientation calculations.
1336
1334
  this.lastDesiredPosIndex = desired.lastIndex;
1337
1335
  this.lastDesiredNextIndex = desired.nextIndex;
1336
+ // Determine the desired position without interpolation.
1337
+ let discreteTarget;
1338
+ if (desired.lastIndex === desired.nextIndex) {
1339
+ discreteTarget = this.positions[desired.lastIndex].pos3d;
1340
+ }
1341
+ // Use the next position as the target.
1342
+ else {
1343
+ discreteTarget = this.positions[desired.nextIndex].pos3d;
1344
+ }
1345
+ // Check if we have a new actual target
1346
+ const actualTargetChanged = !this.actualTargetPos || !Cartesian3.equals(this.actualTargetPos, discreteTarget);
1338
1347
  // First time or no previous position - start here.
1339
1348
  if (!this.currentAnimatedPos) {
1340
- // If we have a starting animation position, animate from it.
1341
1349
  if (this.animationStartPos) {
1342
- this.currentTargetPos = desired.position;
1350
+ this.actualTargetPos = discreteTarget;
1343
1351
  const progress = this.getAnimationProgress(currentRealTimeMs, this.animationStartTime);
1352
+ // Animation from start position complete.
1344
1353
  if (progress >= 1.0) {
1345
- // Animation complete.
1346
1354
  this.currentAnimatedPos = desired.position;
1347
1355
  this.animationStartPos = null;
1348
1356
  this.animationStartTime = null;
1349
1357
  return desired.position;
1350
1358
  }
1359
+ // Still animating from initial position.
1351
1360
  else {
1352
- // Continue animation.
1353
1361
  const easedProgress = this.easeInOutQuad(progress);
1354
1362
  this.currentAnimatedPos = Cartesian3.lerp(this.animationStartPos, desired.position, easedProgress, new Cartesian3());
1355
1363
  return this.currentAnimatedPos;
1356
1364
  }
1357
1365
  }
1366
+ // No initial animation needed.
1358
1367
  else {
1359
- // No animation, start at desired position.
1360
1368
  this.currentAnimatedPos = desired.position;
1361
- this.currentTargetPos = desired.position;
1369
+ this.actualTargetPos = discreteTarget;
1362
1370
  return desired.position;
1363
1371
  }
1364
1372
  }
1365
- // Check if target has changed.
1366
- const targetChanged = !this.currentTargetPos || !Cartesian3.equals(this.currentTargetPos, desired.position);
1367
- if (targetChanged) {
1368
- // Target changed mid-animation - start new animation from current position.
1373
+ // Target changed.
1374
+ if (actualTargetChanged) {
1369
1375
  this.animationStartPos = this.currentAnimatedPos;
1370
1376
  this.animationStartTime = currentRealTimeMs;
1371
- this.currentTargetPos = desired.position;
1377
+ this.actualTargetPos = discreteTarget;
1372
1378
  }
1373
- // Continue or start animation to target.
1379
+ // Continue or start animation to target if we have an active animation.
1374
1380
  if (this.animationStartPos && this.animationStartTime) {
1375
1381
  const progress = this.getAnimationProgress(currentRealTimeMs, this.animationStartTime);
1376
1382
  // Animation complete.
@@ -1380,14 +1386,14 @@ var CesiumAnimatedProperty;
1380
1386
  this.animationStartTime = null;
1381
1387
  return desired.position;
1382
1388
  }
1383
- // Continue animation.
1389
+ // Continue animation to interpolated position.
1384
1390
  else {
1385
1391
  const easedProgress = this.easeInOutQuad(progress);
1386
1392
  this.currentAnimatedPos = Cartesian3.lerp(this.animationStartPos, desired.position, easedProgress, new Cartesian3());
1387
1393
  return this.currentAnimatedPos;
1388
1394
  }
1389
1395
  }
1390
- // No animation needed - already at target.
1396
+ // No active animation - follow interpolated path directly.
1391
1397
  this.currentAnimatedPos = desired.position;
1392
1398
  return desired.position;
1393
1399
  }
@@ -1420,8 +1426,7 @@ var CesiumAnimatedProperty;
1420
1426
  this.lastCalcSeriesPos3d = [];
1421
1427
  return [];
1422
1428
  }
1423
- const totalDuration = this.positions[this.positions.length - 1].dateTime.getTime() -
1424
- this.positions[0].dateTime.getTime();
1429
+ const totalDuration = this.positions[this.positions.length - 1].dateTime.getTime() - this.positions[0].dateTime.getTime();
1425
1430
  // Percentage of the polyline to be visible before and after each point.
1426
1431
  const visibilityPercentage = 0.05; // 5%
1427
1432
  const visibilityDuration = totalDuration * visibilityPercentage;
@@ -1429,8 +1434,9 @@ var CesiumAnimatedProperty;
1429
1434
  const newPosses = [];
1430
1435
  for (let i = 0; i < this.positions.length; i++) {
1431
1436
  const pos = this.positions[i];
1432
- if (!pos.pos3d)
1437
+ if (!pos.pos3d) {
1433
1438
  continue;
1439
+ }
1434
1440
  let add = nowDate >= new Date(pos.dateTime.getTime() - visibilityDuration / 2) &&
1435
1441
  nowDate <= new Date(pos.dateTime.getTime() + visibilityDuration / 2);
1436
1442
  // Also include the segment we're currently traversing.
@@ -33243,7 +33249,7 @@ class WidgetViewBar extends Widget.AWidget {
33243
33249
  }
33244
33250
  }
33245
33251
 
33246
- const VERSION = "5.9.6";
33252
+ const VERSION = "5.9.7";
33247
33253
 
33248
33254
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, 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 };
33249
33255
  //# sourceMappingURL=bruce-cesium.es5.js.map