bruce-cesium 6.4.1 → 6.4.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
- import { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, EntityCoords, DataLab, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Bounds, Carto, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, AbstractApi, Session, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils } from 'bruce-models';
1
+ import { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, EntityCoords, DataLab, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Bounds, Carto, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, JulianDate, Quaternion, Matrix4, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileset, IonResource, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, BoundingSphere, GeometryInstance, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
3
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, PolygonHierarchy, ConstantPositionProperty, PolylineGraphics, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, JulianDate, Quaternion, Matrix4, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, OrthographicFrustum, EasingFunction, Cesium3DTileset, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, BoundingSphere, GeometryInstance, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -31420,6 +31420,7 @@ var EntityRenderEngineModel3d;
31420
31420
  cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
31421
31421
  cEntity.model.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
31422
31422
  let dateTimeStr = (_b = (_a = entity.Bruce.Outline) === null || _a === void 0 ? void 0 : _a.find(x => !!x.DateTime)) === null || _b === void 0 ? void 0 : _b.DateTime;
31423
+ const isHistoric = Boolean(dateTimeStr);
31423
31424
  let dateTime = dateTimeStr ? new Date(dateTimeStr) : null;
31424
31425
  // Initial animation check to see if we're continuing an animation.
31425
31426
  // This requires historic data, otherwise we continue on and later animate a before vs after movement based on the rendered data.
@@ -31478,18 +31479,20 @@ var EntityRenderEngineModel3d;
31478
31479
  // On true to allow for animation through direct plugin changes.
31479
31480
  // Will see if there are side-effects and make it more elaborate if needed.
31480
31481
  const isLive = true || ViewUtils.GetTimeDetails({ viewer: params.viewer }).isLive;
31482
+ // Just using real time for animation to avoid it teleporting on first movement.
31483
+ // If the prior update was too long ago our velocity estimate will make it teleport.
31484
+ const animStartTime = new Date();
31481
31485
  if (prevPos3d && isLive) {
31482
31486
  posses.push({
31483
31487
  pos3d: prevPos3d,
31484
- // Start time is 'now' so the animation plays forward.
31485
- dateTime: dateTime,
31488
+ dateTime: animStartTime,
31486
31489
  heading: !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading
31487
31490
  });
31488
31491
  }
31489
31492
  posses.push({
31490
31493
  pos3d: pos3d,
31491
31494
  // Target time is in the future so the series interpolates forward.
31492
- dateTime: new Date(dateTime.getTime() + 1000),
31495
+ dateTime: new Date(animStartTime.getTime() + 1000),
31493
31496
  heading: !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading
31494
31497
  });
31495
31498
  animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
@@ -31505,7 +31508,14 @@ var EntityRenderEngineModel3d;
31505
31508
  }
31506
31509
  }
31507
31510
  // If we're animating position then we can animate orientation too based on the interpolated position.
31508
- if (dateTime && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
31511
+ // We avoid interpolating it when there is no historic data AND the created/updated dates have changed.
31512
+ // This is to avoid interpolating towards a just-saved Entity after the user moves it.
31513
+ const prevUpdatedTime = cEntity.model._lastUpdatedTime;
31514
+ const curUpdatedTime = entity.Bruce.Updated || entity.Bruce.Created;
31515
+ const updatedTimeChanged = prevUpdatedTime && curUpdatedTime && prevUpdatedTime !== curUpdatedTime;
31516
+ const hasHistoricSeries = isHistoric || (params.entityHistoric && params.entityHistoric.length > 0);
31517
+ const shouldInterpolateHeading = !updatedTimeChanged || hasHistoricSeries;
31518
+ if (shouldInterpolateHeading && dateTime && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
31509
31519
  cEntity.orientation = new CallbackProperty(() => {
31510
31520
  return animatePosition.GetOrient();
31511
31521
  }, false);
@@ -31648,6 +31658,7 @@ var EntityRenderEngineModel3d;
31648
31658
  };
31649
31659
  model._heading = heading;
31650
31660
  model._lastPos3d = pos3d;
31661
+ model._lastUpdatedTime = entity.Bruce.Updated || entity.Bruce.Created;
31651
31662
  // Generate a polyline 'track' for the historic data.
31652
31663
  // We do this for historic data that exists and is moving.
31653
31664
  if (shouldShowTrack && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetSeries) {
@@ -34804,7 +34815,7 @@ class WidgetViewBar extends Widget.AWidget {
34804
34815
  }
34805
34816
  }
34806
34817
 
34807
- const VERSION = "6.4.1";
34818
+ const VERSION = "6.4.2";
34808
34819
  /**
34809
34820
  * Updates the environment instance used by bruce-cesium to one specified.
34810
34821
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.