bruce-cesium 6.5.0 → 6.5.2

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 { Cartes, Entity as Entity$1, Calculator, EntityRelationType, EntityType, Style, ENVIRONMENT, ProjectViewTile, DelayQueue, LRUCache, BruceEvent, ObjectUtils, Geometry, EntityHistoricData, EntityLod, ZoomControl, EntityTag, Tileset, Api, EntityCoords, DataLab, EntitySource, ClientFile, MenuItem, EntityRelation, ProgramKey, Bounds, Carto, ProjectView, ProjectViewBookmark, ProjectViewLegacyTile, Camera, AbstractApi, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, Rectangle, NearFarScalar, Matrix3, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
3
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, Math as Math$1, Cartesian3, JulianDate, Quaternion, Transforms, HeadingPitchRoll, Matrix4, DistanceDisplayCondition, HeightReference, ColorBlendMode, ShadowMode, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, BoundingSphere, GeometryInstance, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, Intersect, CzmlDataSource, Fullscreen } from 'cesium';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -8582,7 +8582,7 @@ var EntitiesRenderManager;
8582
8582
  this.sources = [];
8583
8583
  }
8584
8584
  async ReRender(params) {
8585
- var _a, _b, _c, _d;
8585
+ var _a, _b, _c, _d, _e;
8586
8586
  let { entityIds, force, entities, maintain } = params;
8587
8587
  if (entities && !entityIds) {
8588
8588
  entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
@@ -8635,9 +8635,10 @@ var EntitiesRenderManager;
8635
8635
  const data = await Entity$1.GetListByIds({
8636
8636
  api: this.apiGetter.getApi(),
8637
8637
  entityIds: apiIds,
8638
- historicKey: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historicAttrKey,
8638
+ entityTypeId: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"],
8639
+ historicKey: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.historicAttrKey,
8639
8640
  historicPoint: this.viewer.clock.currentTime.toString(),
8640
- schemaId: (_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d.schemaId,
8641
+ schemaId: (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.schemaId,
8641
8642
  expandSources: true,
8642
8643
  scenario: this.scenario,
8643
8644
  migrated: true,
@@ -8731,7 +8732,7 @@ var EntitiesRenderManager;
8731
8732
  return !maintainedLookup[id] && !this.reRenderState.shouldSkipInRun(id, runId);
8732
8733
  });
8733
8734
  const checkBatch = async () => {
8734
- var _a, _b;
8735
+ var _a, _b, _c;
8735
8736
  apiIds = this.reRenderState.filterNonSkippedIds(apiIds, runId);
8736
8737
  const entityIds = apiIds.splice(0, CHECK_BATCH_SIZE);
8737
8738
  if (!entityIds.length) {
@@ -8741,9 +8742,10 @@ var EntitiesRenderManager;
8741
8742
  const { entities } = await Entity$1.GetListByIds({
8742
8743
  api,
8743
8744
  entityIds,
8744
- historicKey: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey,
8745
+ entityTypeId: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"],
8746
+ historicKey: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historicAttrKey,
8745
8747
  historicPoint: this.viewer.clock.currentTime.toString(),
8746
- schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId,
8748
+ schemaId: (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.schemaId,
8747
8749
  scenario: this.scenario,
8748
8750
  expandSources: true,
8749
8751
  migrated: true,
@@ -10938,6 +10940,14 @@ class EntityGatherer {
10938
10940
  this.viewer = viewer;
10939
10941
  this.emitEntities = emitEntities;
10940
10942
  }
10943
+ createFallbackEntity(entityId) {
10944
+ return {
10945
+ id: entityId,
10946
+ Bruce: {
10947
+ ID: entityId
10948
+ }
10949
+ };
10950
+ }
10941
10951
  SetEntityDataOverride(eId, entity) {
10942
10952
  if (this.disposed) {
10943
10953
  return;
@@ -11082,26 +11092,44 @@ class EntityGatherer {
11082
11092
  this.runningTick = true;
11083
11093
  let rerun = false;
11084
11094
  try {
11085
- const handleResponse = async (entities) => {
11086
- var _a, _b;
11087
- if (!(entities === null || entities === void 0 ? void 0 : entities.length)) {
11088
- return;
11095
+ const handleResponse = async (requestedBatch, entities) => {
11096
+ var _a, _b, _c, _d;
11097
+ const resolvedEntities = [];
11098
+ const foundById = new Map();
11099
+ for (const entity of entities || []) {
11100
+ const entityId = ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID) || (entity === null || entity === void 0 ? void 0 : entity.id);
11101
+ if (entityId) {
11102
+ foundById.set(entityId, entity);
11103
+ }
11104
+ }
11105
+ for (const entityId of requestedBatch || []) {
11106
+ const override = this.entityDataOverrides.get(entityId);
11107
+ if (override) {
11108
+ resolvedEntities.push(override);
11109
+ continue;
11110
+ }
11111
+ const found = foundById.get(entityId);
11112
+ if (found) {
11113
+ resolvedEntities.push(found);
11114
+ continue;
11115
+ }
11116
+ resolvedEntities.push(this.createFallbackEntity(entityId));
11089
11117
  }
11090
- // Lazy substitution of the entity data overrides.
11091
- if (this.entityDataOverrides.size) {
11092
- for (let i = 0; i < entities.length; i++) {
11093
- const entity = entities[i];
11094
- const eId = entity.Bruce.ID;
11095
- if (this.entityDataOverrides.has(eId)) {
11096
- entities[i] = this.entityDataOverrides.get(eId);
11097
- }
11118
+ for (const entity of entities || []) {
11119
+ const entityId = ((_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.ID) || (entity === null || entity === void 0 ? void 0 : entity.id);
11120
+ if (!entityId || foundById.get(entityId) !== entity || (requestedBatch === null || requestedBatch === void 0 ? void 0 : requestedBatch.includes(entityId))) {
11121
+ continue;
11098
11122
  }
11123
+ resolvedEntities.push(entity);
11124
+ }
11125
+ if (!resolvedEntities.length) {
11126
+ return;
11099
11127
  }
11100
11128
  // Gather all Tag IDs from found Entities.
11101
11129
  let tagIds = new Set();
11102
- for (let i = 0; i < entities.length; i++) {
11103
- const entity = entities[i];
11104
- if ((_b = (_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a["Layer.ID"]) === null || _b === void 0 ? void 0 : _b.length) {
11130
+ for (let i = 0; i < resolvedEntities.length; i++) {
11131
+ const entity = resolvedEntities[i];
11132
+ if ((_d = (_c = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _c === void 0 ? void 0 : _c["Layer.ID"]) === null || _d === void 0 ? void 0 : _d.length) {
11105
11133
  const eTagIds = entity.Bruce["Layer.ID"];
11106
11134
  for (let j = 0; j < eTagIds.length; j++) {
11107
11135
  const tagId = eTagIds[j];
@@ -11130,8 +11158,10 @@ class EntityGatherer {
11130
11158
  if (this.historic) {
11131
11159
  // We can emit Entities if the last resolved time (per Entity) isn't newer than rTime.
11132
11160
  // We compare using the changeDir to determine if we should emit or not.
11133
- toEmit = entities.filter((e) => {
11134
- const lastFoundDateTime = this.lastFoundDateTimes.get(e.id);
11161
+ toEmit = resolvedEntities.filter((e) => {
11162
+ var _a;
11163
+ const entityId = ((_a = e === null || e === void 0 ? void 0 : e.Bruce) === null || _a === void 0 ? void 0 : _a.ID) || (e === null || e === void 0 ? void 0 : e.id);
11164
+ const lastFoundDateTime = this.lastFoundDateTimes.get(entityId);
11135
11165
  if (lastFoundDateTime) {
11136
11166
  if (changeDir === 1) {
11137
11167
  return lastFoundDateTime <= rTime;
@@ -11144,12 +11174,16 @@ class EntityGatherer {
11144
11174
  });
11145
11175
  // Update the last found date times for the filtered Entities.
11146
11176
  toEmit.forEach((e) => {
11147
- this.lastFoundDateTimes.set(e.id, rTime);
11177
+ var _a;
11178
+ const entityId = ((_a = e === null || e === void 0 ? void 0 : e.Bruce) === null || _a === void 0 ? void 0 : _a.ID) || (e === null || e === void 0 ? void 0 : e.id);
11179
+ if (entityId) {
11180
+ this.lastFoundDateTimes.set(entityId, rTime);
11181
+ }
11148
11182
  });
11149
11183
  }
11150
11184
  else {
11151
11185
  // If we're not historic, we can just emit everything.
11152
- toEmit = entities;
11186
+ toEmit = resolvedEntities;
11153
11187
  }
11154
11188
  this.emitEntities(toEmit, tags);
11155
11189
  };
@@ -11171,7 +11205,7 @@ class EntityGatherer {
11171
11205
  api: this.api,
11172
11206
  maxSearchTimeSec: 60 * 2
11173
11207
  });
11174
- handleResponse(entities);
11208
+ handleResponse(batch, entities);
11175
11209
  requestedIds.push(...batch);
11176
11210
  done += batch.length;
11177
11211
  if (this._onQueueProgress) {
@@ -11208,7 +11242,7 @@ class EntityGatherer {
11208
11242
  api: this.api,
11209
11243
  maxSearchTimeSec: 60 * 2
11210
11244
  });
11211
- handleResponse(entities);
11245
+ handleResponse(batch, entities);
11212
11246
  requestedIds.push(...batch);
11213
11247
  }
11214
11248
  }
@@ -35295,7 +35329,7 @@ class WidgetViewBar extends Widget.AWidget {
35295
35329
  }
35296
35330
  }
35297
35331
 
35298
- const VERSION = "6.5.0";
35332
+ const VERSION = "6.5.2";
35299
35333
  /**
35300
35334
  * Updates the environment instance used by bruce-cesium to one specified.
35301
35335
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.