bruce-cesium 7.4.8 → 7.5.0

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, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, 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, ClassificationType, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, HorizontalOrigin, VerticalOrigin, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, FeatureDetection, SceneMode, SceneTransforms, KmlDataSource, NearFarScalar, Matrix3, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CustomDataSource, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, Carto, Entity as Entity$1, EntityTag, EntityType, Geometry as Geometry$1, ObjectUtils, Style, ClientFile, EntityLod, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, Bounds, ClientFileValueMap, Color as Color$1, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, 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();
@@ -31413,12 +31462,13 @@ class WidgetLeftPanel extends Widget.AWidget {
31413
31462
  .NextspaceLeftPanel >.NextspaceLeftPanelTabContent {
31414
31463
  display: none;
31415
31464
  width: 300px;
31416
- height: 100%;
31417
31465
  position: absolute;
31418
31466
  top: 0;
31467
+ bottom: 0;
31419
31468
  left: 50px;
31420
31469
  background-color: #21272a;
31421
- padding: 40px 30px 30px;
31470
+ box-sizing: content-box;
31471
+ padding: 30px 20px 12px 20px;
31422
31472
  flex-direction: column;
31423
31473
  flex-grow: 1;
31424
31474
  flex-shrink: 1;
@@ -34239,6 +34289,18 @@ var ViewRenderEngine;
34239
34289
  return typeof ((_b = bSettings.camera) === null || _b === void 0 ? void 0 : _b.zoom) !== "number";
34240
34290
  }
34241
34291
  ViewRenderEngine.IsBookmarkSupported = IsBookmarkSupported;
34292
+ /**
34293
+ * Drops the view's default bookmark when it is not a Cesium scene, so the view renders without it.
34294
+ * A bookmark the caller asked for by ID is kept.
34295
+ */
34296
+ function KeepDefaultBookmark(view, requestedId, bookmark) {
34297
+ // Legacy views store a different bookmark shape.
34298
+ if (requestedId || !bookmark || (view === null || view === void 0 ? void 0 : view.DataVersion) == 1) {
34299
+ return bookmark;
34300
+ }
34301
+ return IsBookmarkSupported(bookmark) ? bookmark : null;
34302
+ }
34303
+ ViewRenderEngine.KeepDefaultBookmark = KeepDefaultBookmark;
34242
34304
  async function Render(params) {
34243
34305
  var _a, _b;
34244
34306
  if (!params.manager && params.viewer) {
@@ -34276,6 +34338,7 @@ var ViewRenderEngine;
34276
34338
  viewId: params.viewId,
34277
34339
  bookmarkId: bookmarkId
34278
34340
  })).bookmark : null;
34341
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34279
34342
  }
34280
34343
  if (!assertIteration$1(params.viewer, iteration)) {
34281
34344
  return;
@@ -34336,6 +34399,7 @@ var ViewRenderEngine;
34336
34399
  viewId: params.viewId,
34337
34400
  bookmarkId: bookmarkId
34338
34401
  })).bookmark : null;
34402
+ bookmark = KeepDefaultBookmark(view, params.bookmarkId, bookmark);
34339
34403
  }
34340
34404
  const viewer = params.manager.Viewer;
34341
34405
  const scene = viewer.scene;
@@ -50950,7 +51014,7 @@ var StyleUtils;
50950
51014
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
50951
51015
  })(StyleUtils || (StyleUtils = {}));
50952
51016
 
50953
- const VERSION = "7.4.8";
51017
+ const VERSION = "7.5.0";
50954
51018
  /**
50955
51019
  * Updates the environment instance used by bruce-cesium to one specified.
50956
51020
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.