bruce-cesium 7.4.8 → 7.4.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 * as Cesium from 'cesium';
2
- import { Cartographic, Entity, ConstantPositionProperty, HeightReference, Color, DistanceDisplayCondition, ColorMaterialProperty, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ColorBlendMode, ShadowMode, ClassificationType, Model, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Rectangle, HorizontalOrigin, VerticalOrigin, SceneTransforms, FeatureDetection, SceneMode, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, Intersect, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CustomDataSource, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1, EntityLod, EntityTag, EntityType, ObjectUtils, Style, Bounds, ClientFileValueMap, Color as Color$1, Geometry as Geometry$1, Api, Carto, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, BruceApi, RecordChangeFeed, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ConstantPositionProperty, HeightReference, DistanceDisplayCondition, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, JulianDate, Quaternion, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, HorizontalOrigin, VerticalOrigin, ArcType, CornerType, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, SceneMode, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1, EntityLod, EntityTag, EntityType, ObjectUtils, Style, Api, Carto, Geometry as Geometry$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, BruceApi, EntityRelation, RecordChangeFeed, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, UrlUtils, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, ProjectViewBookmarkGroup, EntityRelationType, EntityHistoricData } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -1465,6 +1465,48 @@ var ViewUtils;
1465
1465
  ViewUtils.GetModelSpace = GetModelSpace;
1466
1466
  })(ViewUtils || (ViewUtils = {}));
1467
1467
 
1468
+ // End time of the frames already being requested for a viewer, so overlapping animations share one loop.
1469
+ const renderDriverEnds = new WeakMap();
1470
+ // A browser frame where there is one, so the requests keep pace with Cesium's own loop.
1471
+ function nextFrame(callback) {
1472
+ if (typeof requestAnimationFrame === "function") {
1473
+ requestAnimationFrame(callback);
1474
+ }
1475
+ else {
1476
+ setTimeout(callback, 16);
1477
+ }
1478
+ }
1479
+ /**
1480
+ * Keeps frames coming until a time based animation has ended, then draws one more for its final value.
1481
+ */
1482
+ function requestRendersFor(viewer, durationMs) {
1483
+ var _a;
1484
+ const scene = viewer === null || viewer === void 0 ? void 0 : viewer.scene;
1485
+ if (typeof (scene === null || scene === void 0 ? void 0 : scene.requestRender) !== "function" || ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer))) {
1486
+ return;
1487
+ }
1488
+ scene.requestRender();
1489
+ const endAt = Date.now() + Math.max(durationMs || 0, 0);
1490
+ if (renderDriverEnds.has(viewer)) {
1491
+ renderDriverEnds.set(viewer, Math.max(renderDriverEnds.get(viewer), endAt));
1492
+ return;
1493
+ }
1494
+ renderDriverEnds.set(viewer, endAt);
1495
+ const tick = () => {
1496
+ var _a;
1497
+ if ((_a = viewer.isDestroyed) === null || _a === void 0 ? void 0 : _a.call(viewer)) {
1498
+ renderDriverEnds.delete(viewer);
1499
+ return;
1500
+ }
1501
+ scene.requestRender();
1502
+ if (Date.now() >= renderDriverEnds.get(viewer)) {
1503
+ renderDriverEnds.delete(viewer);
1504
+ return;
1505
+ }
1506
+ nextFrame(tick);
1507
+ };
1508
+ nextFrame(tick);
1509
+ }
1468
1510
  function getColor(viewer, obj) {
1469
1511
  let value = null;
1470
1512
  if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
@@ -1582,6 +1624,7 @@ var CesiumAnimatedProperty;
1582
1624
  this.durationMs = 0;
1583
1625
  }
1584
1626
  this.startTime = new Date();
1627
+ requestRendersFor(this.viewer, this.durationMs);
1585
1628
  }
1586
1629
  IsDone() {
1587
1630
  const now = new Date();
@@ -1633,12 +1676,14 @@ var CesiumAnimatedProperty;
1633
1676
  }
1634
1677
  if (!this.paused) {
1635
1678
  this.startTime = new Date();
1679
+ requestRendersFor(this.viewer, this.durationMs);
1636
1680
  }
1637
1681
  }
1638
1682
  Play() {
1639
1683
  if (this.paused) {
1640
1684
  this.paused = false;
1641
1685
  this.startTime = new Date();
1686
+ requestRendersFor(this.viewer, this.durationMs);
1642
1687
  }
1643
1688
  }
1644
1689
  GetValue() {
@@ -1716,6 +1761,8 @@ var CesiumAnimatedProperty;
1716
1761
  setMark(startColor, mark);
1717
1762
  setMark(color, mark);
1718
1763
  let startTime = new Date();
1764
+ // A feature's colour change does not ask for a frame, the final one included.
1765
+ requestRendersFor(viewer, durationMs);
1719
1766
  let removal = viewer.scene.postUpdate.addEventListener(() => {
1720
1767
  if (!isFeatureAlive(viewer, feature)) {
1721
1768
  removal === null || removal === void 0 ? void 0 : removal();
@@ -1787,6 +1834,7 @@ var CesiumAnimatedProperty;
1787
1834
  this.startPos3d = Cartesian3.clone(this.targetPos3d);
1788
1835
  }
1789
1836
  this.startTime = new Date();
1837
+ requestRendersFor(this.viewer, this.durationMs);
1790
1838
  }
1791
1839
  GetValue() {
1792
1840
  const now = new Date();
@@ -1818,6 +1866,7 @@ var CesiumAnimatedProperty;
1818
1866
  this.startHeadingDeg = 0;
1819
1867
  }
1820
1868
  this.startTime = new Date();
1869
+ requestRendersFor(this.viewer, this.durationMs);
1821
1870
  }
1822
1871
  IsDone() {
1823
1872
  const now = new Date();
@@ -34239,6 +34288,18 @@ var ViewRenderEngine;
34239
34288
  return typeof ((_b = bSettings.camera) === null || _b === void 0 ? void 0 : _b.zoom) !== "number";
34240
34289
  }
34241
34290
  ViewRenderEngine.IsBookmarkSupported = IsBookmarkSupported;
34291
+ /**
34292
+ * Drops the view's default bookmark when it is not a Cesium scene, so the view renders without it.
34293
+ * A bookmark the caller asked for by ID is kept.
34294
+ */
34295
+ function KeepDefaultBookmark(view, requestedId, bookmark) {
34296
+ // Legacy views store a different bookmark shape.
34297
+ if (requestedId || !bookmark || (view === null || view === void 0 ? void 0 : view.DataVersion) == 1) {
34298
+ return bookmark;
34299
+ }
34300
+ return IsBookmarkSupported(bookmark) ? bookmark : null;
34301
+ }
34302
+ ViewRenderEngine.KeepDefaultBookmark = KeepDefaultBookmark;
34242
34303
  async function Render(params) {
34243
34304
  var _a, _b;
34244
34305
  if (!params.manager && params.viewer) {
@@ -34276,6 +34337,7 @@ var ViewRenderEngine;
34276
34337
  viewId: params.viewId,
34277
34338
  bookmarkId: bookmarkId
34278
34339
  })).bookmark : null;
34340
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34279
34341
  }
34280
34342
  if (!assertIteration$1(params.viewer, iteration)) {
34281
34343
  return;
@@ -34336,6 +34398,7 @@ var ViewRenderEngine;
34336
34398
  viewId: params.viewId,
34337
34399
  bookmarkId: bookmarkId
34338
34400
  })).bookmark : null;
34401
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34339
34402
  }
34340
34403
  const viewer = params.manager.Viewer;
34341
34404
  const scene = viewer.scene;
@@ -50950,7 +51013,7 @@ var StyleUtils;
50950
51013
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
50951
51014
  })(StyleUtils || (StyleUtils = {}));
50952
51015
 
50953
- const VERSION = "7.4.8";
51016
+ const VERSION = "7.4.9";
50954
51017
  /**
50955
51018
  * Updates the environment instance used by bruce-cesium to one specified.
50956
51019
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.