bruce-cesium 7.6.3 → 7.6.4

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, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, HeightReference, Matrix4, ConstantPositionProperty, DistanceDisplayCondition, ColorBlendMode, ShadowMode, ClassificationType, Model, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ArcType, CornerType, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, SceneMode, IntersectionTests, Ray, SceneTransforms, HorizontalOrigin, VerticalOrigin, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, FeatureDetection, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, IonResource, Cesium3DTileset, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Intersect, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, PolygonPipeline, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1, EntityLod, EntityTag, EntityType, ObjectUtils, Style, UrlUtils, Carto, Geometry as Geometry$1, Bounds, ClientFileValueMap, Color as Color$1, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, Api, DataLab, DelayQueue, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, EntitySource, ProgramKey, ProjectViewLegacyTile, Camera, Account, AccountLimits, Session, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
2
+ import { Cartographic, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, Cartesian2, Cartesian4, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, PixelDatatype, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, JulianDate, Quaternion, HeadingPitchRoll, HeightReference, ConstantPositionProperty, DistanceDisplayCondition, ColorBlendMode, ShadowMode, ClassificationType, Model, ArcType, CornerType, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, HorizontalOrigin, VerticalOrigin, SceneMode, IntersectionTests, Ray, SceneTransforms, FeatureDetection, Matrix3, NearFarScalar, KmlDataSource, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Intersect, OrthographicFrustum, EasingFunction, CustomDataSource, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, ScreenSpaceEventHandler, ScreenSpaceEventType, GeometryInstance, Fullscreen, PolygonPipeline, CzmlDataSource } from 'cesium';
3
+ import { Cartes, LRUCache, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, Entity as Entity$1, EntityLod, EntityTag, EntityType, ObjectUtils, Style, UrlUtils, Carto, Geometry as Geometry$1, Bounds, ClientFileValueMap, Color as Color$1, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DataLab, DelayQueue, AccountConcept, RecordChangeFeed, EntityRelation, BruceApi, ProgramKey, ProjectViewLegacyTile, EntitySource, Camera, Account, AccountLimits, Session, 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.
@@ -44112,37 +44112,46 @@ class WidgetNavCompass$$1 extends Widget.AWidget {
44112
44112
 
44113
44113
  const CESIUM_VIEWER_MANAGER_KEY = "_cesiumViewerManager";
44114
44114
  const CESIUM_VIEWER_EVENT_TRACKER_KEY = "_cesiumViewerEventTracker";
44115
- /**
44116
- * Bug related to entities not being visible after they were added then a render was requested.
44117
- * It was 4 point entities in York. They would not appear until a request render was recalled.
44118
- * Adding this slow render loop as a band-aid fix.
44119
- */
44120
44115
  const BACKGROUND_RENDERING_KEY = "_backgroundRendering";
44116
+ // How long after the scene last drew it is drawn once more.
44117
+ const FOLLOW_UP_RENDER_MS = 3000;
44118
+ /*
44119
+ * Draws once more a few seconds after the scene last drew, for graphics not ready by the render that asked for them.
44120
+ */
44121
44121
  function backgroundRendering(viewer) {
44122
44122
  if (viewer[BACKGROUND_RENDERING_KEY]) {
44123
44123
  return;
44124
44124
  }
44125
44125
  viewer[BACKGROUND_RENDERING_KEY] = true;
44126
+ // Wall time, since scene.lastRenderTime is the scene clock's and stands still while the clock is paused.
44127
+ let lastRenderAt = performance.now();
44128
+ // Whether the last render was the follow up, so a still scene is drawn once more rather than forever.
44129
+ let followedUp = false;
44130
+ let requested = false;
44131
+ const removeListener = viewer.scene.postRender.addEventListener(() => {
44132
+ lastRenderAt = performance.now();
44133
+ followedUp = requested;
44134
+ requested = false;
44135
+ });
44126
44136
  const interval = setInterval(() => {
44127
44137
  var _a;
44128
44138
  if (!(viewer === null || viewer === void 0 ? void 0 : viewer.cesiumWidget) || !(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
44129
44139
  clearInterval(interval);
44140
+ removeListener();
44130
44141
  return;
44131
44142
  }
44132
44143
  // We'll ignore the call if the viewer container is not visible.
44133
44144
  if (!viewer.container || ((_a = viewer.container.style) === null || _a === void 0 ? void 0 : _a.display) == "none") {
44134
44145
  return;
44135
44146
  }
44147
+ if (followedUp || requested || performance.now() - lastRenderAt < FOLLOW_UP_RENDER_MS) {
44148
+ return;
44149
+ }
44136
44150
  try {
44137
- // Check if last render time is greater than 3 seconds ago.
44138
- // We check in case something else is also requesting renders.
44139
- const lastRenderTime = viewer.scene.lastRenderTime;
44140
- if (!lastRenderTime || JulianDate.secondsDifference(JulianDate.now(), lastRenderTime) > 3) {
44141
- // Check if window is active/in focus.
44142
- // TODO: Should render the moment it is in focus as well.
44143
- if (document.hasFocus()) {
44144
- viewer.scene.requestRender();
44145
- }
44151
+ // Only while the window has focus. TODO: should render the moment it regains focus as well.
44152
+ if (document.hasFocus()) {
44153
+ requested = true;
44154
+ viewer.scene.requestRender();
44146
44155
  }
44147
44156
  }
44148
44157
  catch (e) {
@@ -55584,7 +55593,7 @@ var StyleUtils;
55584
55593
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
55585
55594
  })(StyleUtils || (StyleUtils = {}));
55586
55595
 
55587
- const VERSION = "7.6.3";
55596
+ const VERSION = "7.6.4";
55588
55597
  /**
55589
55598
  * Updates the environment instance used by bruce-cesium to one specified.
55590
55599
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.