bruce-cesium 7.2.5 → 7.2.6

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, Matrix4, ShaderSource, Ellipsoid, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, Cartesian2, DistanceDisplayCondition, HeightReference, HorizontalOrigin, VerticalOrigin, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, Model, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileset, Cesium3DTileColorBlendMode, OrthographicFrustum, EasingFunction, Intersect, 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, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, GeometryInstance, CustomDataSource, ScreenSpaceEventHandler, ScreenSpaceEventType, Fullscreen, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ProjectViewTile, ENVIRONMENT, Api, Calculator, ClientFile, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry as Geometry$1, EntityLod, Color as Color$1, Bounds, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, DelayQueue, DataLab, BruceApi, EntityRelation, AccountConcept, RecordChangeFeed, EntitySource, Camera, ProgramKey, ProjectViewLegacyTile, Account, AccountLimits, Session, UrlUtils, ProjectViewBookmarkGroup, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType, EntityHistoricData } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, ShaderSource, Cartesian3, Math as Math$1, Ellipsoid, Transforms, Matrix4, Geometry, GeometryAttribute, ComponentDatatype, PrimitiveType, BoundingSphere, GeometryPipeline, sampleTerrain, Texture, PixelFormat, Sampler, TextureWrap, TextureMinificationFilter, TextureMagnificationFilter, VertexArray, BufferUsage, ShaderProgram, RenderState, BlendingState, DrawCommand, Pass, Cartesian2, HeightReference, ColorBlendMode, HeadingPitchRoll, ShadowMode, ClassificationType, Model, DistanceDisplayCondition, JulianDate, Quaternion, ArcType, CornerType, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, SceneTransforms, ImageMaterialProperty, PolygonHierarchy, PolylineGraphics, Rectangle, KmlDataSource, NearFarScalar, Matrix3, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, Intersect, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, GeometryInstance, CesiumInspector, ClockRange, DynamicEnvironmentMapManager, ScreenSpaceEventHandler, ScreenSpaceEventType, CustomDataSource, Fullscreen, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ProjectViewTile, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry as Geometry$1, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, Bounds, Color as Color$1, DataLab, DelayQueue, EntityRelation, BruceApi, AccountConcept, RecordChangeFeed, ProgramKey, ProjectViewLegacyTile, EntitySource, 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.
@@ -14131,6 +14131,8 @@ class EntityGatherer {
14131
14131
  this.lastFoundDateTimes = new Map();
14132
14132
  // ID of Entity IDs that need to be requested.
14133
14133
  this.eIdQueue = [];
14134
+ // Membership mirror of eIdQueue for quick checks.
14135
+ this.eIdQueued = new Set();
14134
14136
  // Resolves where an Entity sits without reading its record, when the caller can say.
14135
14137
  // Unset leaves the queue in insertion order, which is what sources that bake no coordinates get.
14136
14138
  this.positionOf = null;
@@ -14240,6 +14242,7 @@ class EntityGatherer {
14240
14242
  return;
14241
14243
  }
14242
14244
  this.eIdQueue = [];
14245
+ this.eIdQueued.clear();
14243
14246
  this.priorityCount = 0;
14244
14247
  this.lastOrderFocus = null;
14245
14248
  this.allEIds.clear();
@@ -14251,6 +14254,7 @@ class EntityGatherer {
14251
14254
  return;
14252
14255
  }
14253
14256
  this.eIdQueue = Array.from(this.allEIds);
14257
+ this.eIdQueued = new Set(this.eIdQueue);
14254
14258
  this.priorityCount = 0;
14255
14259
  this.lastOrderFocus = null;
14256
14260
  }
@@ -14340,27 +14344,58 @@ class EntityGatherer {
14340
14344
  return;
14341
14345
  }
14342
14346
  let changes = 0;
14343
- for (let i = 0; i < entityIds.length; i++) {
14344
- const eId = entityIds[i];
14345
- const index = this.eIdQueue.indexOf(eId);
14346
- if (topOfQueue) {
14347
- // If we want it to be at the top of the queue, remove it from the queue first.
14348
- if (index !== -1) {
14349
- this.eIdQueue.splice(index, 1);
14350
- if (index < this.priorityCount) {
14351
- this.priorityCount -= 1;
14352
- }
14353
- }
14354
- this.eIdQueue.unshift(eId);
14355
- this.priorityCount += 1;
14356
- changes += 1;
14347
+ if (topOfQueue) {
14348
+ // Walked back to front so a repeated ID keeps the position of its last occurrence, then
14349
+ // laid down in that order, which is where inserting one at a time leaves them.
14350
+ const toFront = [];
14351
+ const promoting = new Set();
14352
+ let anyAlreadyQueued = false;
14353
+ for (let i = entityIds.length - 1; i >= 0; i--) {
14354
+ const eId = entityIds[i];
14355
+ this.allEIds.add(eId);
14356
+ if (promoting.has(eId)) {
14357
+ continue;
14358
+ }
14359
+ promoting.add(eId);
14360
+ toFront.push(eId);
14361
+ if (this.eIdQueued.has(eId)) {
14362
+ anyAlreadyQueued = true;
14363
+ }
14364
+ }
14365
+ if (anyAlreadyQueued && this.eIdQueue.length) {
14366
+ const kept = [];
14367
+ let removedFromPriority = 0;
14368
+ for (let i = 0; i < this.eIdQueue.length; i++) {
14369
+ const eId = this.eIdQueue[i];
14370
+ if (promoting.has(eId)) {
14371
+ if (i < this.priorityCount) {
14372
+ removedFromPriority += 1;
14373
+ }
14374
+ continue;
14375
+ }
14376
+ kept.push(eId);
14377
+ }
14378
+ this.eIdQueue = kept;
14379
+ this.priorityCount = Math.max(0, this.priorityCount - removedFromPriority);
14357
14380
  }
14358
- else if (index === -1) {
14381
+ this.eIdQueue = toFront.concat(this.eIdQueue);
14382
+ this.priorityCount += toFront.length;
14383
+ for (let i = 0; i < toFront.length; i++) {
14384
+ this.eIdQueued.add(toFront[i]);
14385
+ }
14386
+ changes = toFront.length;
14387
+ }
14388
+ else {
14389
+ for (let i = 0; i < entityIds.length; i++) {
14390
+ const eId = entityIds[i];
14391
+ this.allEIds.add(eId);
14392
+ if (this.eIdQueued.has(eId)) {
14393
+ continue;
14394
+ }
14395
+ this.eIdQueued.add(eId);
14359
14396
  this.eIdQueue.push(eId);
14360
14397
  changes += 1;
14361
14398
  }
14362
- // Flag that we've seen this ID.
14363
- this.allEIds.add(entityIds[i]);
14364
14399
  }
14365
14400
  if (!changes) {
14366
14401
  return;
@@ -14494,7 +14529,7 @@ class EntityGatherer {
14494
14529
  this.emitEntities(toEmit, tags);
14495
14530
  };
14496
14531
  const QUEUE_BATCH_SIZE = 500;
14497
- const requestedIds = [];
14532
+ const requestedIds = new Set();
14498
14533
  // If we have a queue, we need to request those first.
14499
14534
  if (this.eIdQueue.length) {
14500
14535
  const total = this.eIdQueue.length;
@@ -14506,6 +14541,9 @@ class EntityGatherer {
14506
14541
  this.orderQueueByCamera();
14507
14542
  const batch = this.eIdQueue.splice(0, QUEUE_BATCH_SIZE);
14508
14543
  this.priorityCount = Math.max(0, this.priorityCount - batch.length);
14544
+ for (let i = 0; i < batch.length; i++) {
14545
+ this.eIdQueued.delete(batch[i]);
14546
+ }
14509
14547
  const { entities } = await Entity$1.GetListByIds({
14510
14548
  entityIds: batch,
14511
14549
  historicPoint: this.historic ? rTime : null,
@@ -14514,7 +14552,9 @@ class EntityGatherer {
14514
14552
  maxSearchTimeSec: 60 * 2
14515
14553
  });
14516
14554
  handleResponse(batch, entities);
14517
- requestedIds.push(...batch);
14555
+ for (let i = 0; i < batch.length; i++) {
14556
+ requestedIds.add(batch[i]);
14557
+ }
14518
14558
  done += batch.length;
14519
14559
  if (this._onQueueProgress) {
14520
14560
  let progress = (done / total) * 100;
@@ -14534,8 +14574,8 @@ class EntityGatherer {
14534
14574
  // Now run through all IDs that we've seen and request them.
14535
14575
  // We'll skip those that we just requested.
14536
14576
  let allEIds = Array.from(this.allEIds);
14537
- if (requestedIds.length) {
14538
- allEIds = allEIds.filter((eId) => requestedIds.indexOf(eId) === -1);
14577
+ if (requestedIds.size) {
14578
+ allEIds = allEIds.filter((eId) => !requestedIds.has(eId));
14539
14579
  }
14540
14580
  if (allEIds.length) {
14541
14581
  // A historic tick re-reads the whole set, so the near ones are worth resolving
@@ -14554,7 +14594,9 @@ class EntityGatherer {
14554
14594
  maxSearchTimeSec: 60 * 2
14555
14595
  });
14556
14596
  handleResponse(batch, entities);
14557
- requestedIds.push(...batch);
14597
+ for (let i = 0; i < batch.length; i++) {
14598
+ requestedIds.add(batch[i]);
14599
+ }
14558
14600
  }
14559
14601
  }
14560
14602
  // If we had leftovers because we stopped early, we need to re-run the tick.
@@ -45911,7 +45953,7 @@ var StyleUtils;
45911
45953
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
45912
45954
  })(StyleUtils || (StyleUtils = {}));
45913
45955
 
45914
- const VERSION = "7.2.5";
45956
+ const VERSION = "7.2.6";
45915
45957
  /**
45916
45958
  * Updates the environment instance used by bruce-cesium to one specified.
45917
45959
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.