bruce-cesium 5.5.1 → 5.5.3

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.
@@ -1668,11 +1668,34 @@
1668
1668
  pos3d = this.lastCalcPos3d;
1669
1669
  }
1670
1670
  // Calculate heading.
1671
- const posses = this.positions;
1672
- const lastPos = posses[targetPosition.indexLast];
1673
- const nextPos = posses[targetPosition.indexNext];
1674
- if (lastPos && nextPos) {
1675
- this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1671
+ if (this.lastCalcPos3dApplyOverTimeTarget) {
1672
+ if (this.lastCalcPos3d) {
1673
+ const minDistanceThreshold = 0.05;
1674
+ const currentToTargetDistance = Cesium.Cartesian3.distance(this.lastCalcPos3d, this.lastCalcPos3dApplyOverTimeTarget);
1675
+ if (currentToTargetDistance >= minDistanceThreshold) {
1676
+ const lastPos = {
1677
+ pos3d: this.lastCalcPos3d,
1678
+ dateTime: this.lastCalcPos3dApplyOverTimeTimeStart ? new Date(this.lastCalcPos3dApplyOverTimeTimeStart) : null,
1679
+ heading: null
1680
+ };
1681
+ const nextPos = {
1682
+ pos3d: this.lastCalcPos3dApplyOverTimeTarget,
1683
+ dateTime: null,
1684
+ heading: null
1685
+ };
1686
+ if (lastPos && nextPos) {
1687
+ this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1688
+ }
1689
+ }
1690
+ }
1691
+ }
1692
+ else {
1693
+ const posses = this.positions;
1694
+ const lastPos = posses[targetPosition.indexLast];
1695
+ const nextPos = posses[targetPosition.indexNext];
1696
+ if (lastPos && nextPos) {
1697
+ this.lastCalcHeading = this.calculateHeading(nowTimeMs, lastPos, nextPos);
1698
+ }
1676
1699
  }
1677
1700
  // Provide the calculated values to the caller.
1678
1701
  this.onUpdate(pos3d, this.lastCalcHeading);
@@ -23998,8 +24021,28 @@
23998
24021
  }
23999
24022
  else if (tileset.type === BModels.Tileset.EType.ExternalTerrain) {
24000
24023
  const settings = tileset.settings;
24001
- url = settings.url;
24002
24024
  vertexes = settings.requestVertexNormals == null ? true : settings.requestVertexNormals;
24025
+ if (!settings.terrainType || settings.terrainType === "Default") {
24026
+ url = settings.url;
24027
+ }
24028
+ else if (settings.terrainType == "CesiumIon") {
24029
+ const ionId = settings.externalId;
24030
+ const key = settings.key ? settings.key : await findKey(params.apiGetter, params.apiGetter.accountId, BModels.ProgramKey.EProgramId.CesiumIon);
24031
+ const resource = Cesium.IonResource.fromAssetId(Number(ionId), {
24032
+ accessToken: key
24033
+ });
24034
+ if (Cesium.CesiumTerrainProvider.hasOwnProperty("fromUrl")) {
24035
+ provider = await CESIUM.CesiumTerrainProvider.fromUrl(resource, {
24036
+ requestVertexNormals: vertexes
24037
+ });
24038
+ }
24039
+ else {
24040
+ provider = new CESIUM.CesiumTerrainProvider({
24041
+ url: resource,
24042
+ requestVertexNormals: vertexes
24043
+ });
24044
+ }
24045
+ }
24003
24046
  }
24004
24047
  else {
24005
24048
  console.error("Invalid tileset type.", tileset);
@@ -30759,7 +30802,7 @@
30759
30802
  }
30760
30803
  }
30761
30804
 
30762
- const VERSION = "5.5.1";
30805
+ const VERSION = "5.5.3";
30763
30806
 
30764
30807
  exports.VERSION = VERSION;
30765
30808
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;