bruce-cesium 6.4.2 → 6.4.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.
Files changed (31) hide show
  1. package/dist/bruce-cesium.es5.js +226 -62
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +225 -61
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/entity-gatherer.js +4 -2
  7. package/dist/lib/rendering/entity-gatherer.js.map +1 -1
  8. package/dist/lib/rendering/entity-render-engine-model3d.js +80 -20
  9. package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
  10. package/dist/lib/rendering/entity-render-engine-point.js +33 -5
  11. package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
  12. package/dist/lib/rendering/entity-render-engine-polygon.js +33 -5
  13. package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
  14. package/dist/lib/rendering/entity-render-engine-polyline.js +33 -5
  15. package/dist/lib/rendering/entity-render-engine-polyline.js.map +1 -1
  16. package/dist/lib/rendering/relation-render-engine.js +2 -1
  17. package/dist/lib/rendering/relation-render-engine.js.map +1 -1
  18. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +1 -0
  19. package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
  20. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js +3 -1
  21. package/dist/lib/rendering/render-managers/entities/entities-loaded-render-manager.js.map +1 -1
  22. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +25 -19
  23. package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
  24. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +4 -1
  25. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -1
  26. package/dist/lib/utils/entity-utils.js +2 -0
  27. package/dist/lib/utils/entity-utils.js.map +1 -1
  28. package/dist/lib/utils/simplify-geometry.js +4 -1
  29. package/dist/lib/utils/simplify-geometry.js.map +1 -1
  30. package/dist/types/bruce-cesium.d.ts +1 -1
  31. package/package.json +2 -2
@@ -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, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, PolygonHierarchy, ConstantPositionProperty, PolylineGraphics, ArcType, CornerType, HorizontalOrigin, VerticalOrigin, JulianDate, Quaternion, Matrix4, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, OrthographicFrustum, EasingFunction, Cesium3DTileset, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, BoundingSphere, GeometryInstance, 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.
@@ -3019,7 +3019,8 @@ var RelationRenderEngine;
3019
3019
  let entities = (await Entity$1.GetListByIds({
3020
3020
  entityIds: neededEntityIdsIds,
3021
3021
  api: apiGetter.getApi(),
3022
- migrated: true
3022
+ migrated: true,
3023
+ maxSearchTimeSec: 60 * 2
3023
3024
  })).entities;
3024
3025
  // Create a map for quick reference.
3025
3026
  const entitiesMap = {};
@@ -7833,6 +7834,9 @@ class PointClustering {
7833
7834
  }
7834
7835
  }
7835
7836
 
7837
+ function isTurfAvailable() {
7838
+ return window && window.turf != null;
7839
+ }
7836
7840
  /**
7837
7841
  * Util for simplifying geometry on the fly.
7838
7842
  */
@@ -7880,7 +7884,7 @@ var SimplifyGeometry;
7880
7884
  */
7881
7885
  function Simplify(entityId, geometry, tolerance) {
7882
7886
  var _a;
7883
- if (!geometry || !turf || !turf.simplify) {
7887
+ if (!geometry || !isTurfAvailable() || !turf.simplify) {
7884
7888
  return geometry;
7885
7889
  }
7886
7890
  // Convert to geojson so that we can interact with turf.
@@ -8234,7 +8238,7 @@ var EntitiesRenderManager;
8234
8238
  this.item = params.item;
8235
8239
  }
8236
8240
  (async () => {
8237
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
8241
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
8238
8242
  if (this.disposed) {
8239
8243
  return;
8240
8244
  }
@@ -8281,8 +8285,6 @@ var EntitiesRenderManager;
8281
8285
  this.unsetGetter();
8282
8286
  (_g = this.viewMonitorRemoval) === null || _g === void 0 ? void 0 : _g.call(this);
8283
8287
  this.viewMonitorRemoval = null;
8284
- (_h = this.entityCheckQueue) === null || _h === void 0 ? void 0 : _h.Dispose();
8285
- this.entityCheckQueue = null;
8286
8288
  clearInterval(this.renderQueueInterval);
8287
8289
  this.renderQueueInterval = null;
8288
8290
  this.renderQueue = [];
@@ -8293,30 +8295,23 @@ var EntitiesRenderManager;
8293
8295
  menuItemId: this.item.id,
8294
8296
  retainTagIds: tagsToRender
8295
8297
  });
8296
- (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
8298
+ (_h = this.clustering) === null || _h === void 0 ? void 0 : _h.Dispose();
8297
8299
  }
8298
8300
  else {
8299
8301
  this.visualsManager.RemoveRegos({
8300
8302
  menuItemId: this.item.id
8301
8303
  });
8302
- (_k = this.clustering) === null || _k === void 0 ? void 0 : _k.Dispose();
8304
+ (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
8303
8305
  return;
8304
8306
  }
8305
8307
  if (this.item.enableClustering) {
8306
- this.clustering = new PointClustering(this.visualsManager, this.item.id, (_l = this.item) === null || _l === void 0 ? void 0 : _l.clustering);
8308
+ this.clustering = new PointClustering(this.visualsManager, this.item.id, (_k = this.item) === null || _k === void 0 ? void 0 : _k.clustering);
8307
8309
  }
8308
8310
  this.setGetter();
8309
8311
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
8310
- this.entityCheckQueue.Call();
8312
+ var _a;
8313
+ (_a = this.entityCheckQueue) === null || _a === void 0 ? void 0 : _a.Call();
8311
8314
  });
8312
- this.entityCheckQueue = new DelayQueue(() => {
8313
- // Don't bother checking for zoom control changes if we only have 1 item.
8314
- // We'll let Cesium handle hide/show at max zoom range.
8315
- const shouldCheck = this.zoomControl && this.zoomControl.length > 1;
8316
- if (shouldCheck) {
8317
- this.doEntityCheck(Object.keys(this.renderedEntities));
8318
- }
8319
- }, 3000);
8320
8315
  }
8321
8316
  catch (e) {
8322
8317
  console.error(e);
@@ -8368,7 +8363,7 @@ var EntitiesRenderManager;
8368
8363
  }
8369
8364
  }
8370
8365
  setGetter() {
8371
- var _a, _b, _c;
8366
+ var _a, _b, _c, _d;
8372
8367
  this.unsetGetter();
8373
8368
  const isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
8374
8369
  let tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
@@ -8419,13 +8414,22 @@ var EntitiesRenderManager;
8419
8414
  this.distributeForRender(data.entities);
8420
8415
  }
8421
8416
  });
8417
+ // Cesium itself handles single-visibility ranges very well.
8418
+ // That means we only occasionally check if there is 1 display item for the purpose of cleaning up the registry.
8419
+ const displayItems = this.zoomControl ? (_d = this.zoomControl) === null || _d === void 0 ? void 0 : _d.filter(x => x.DisplayType != ZoomControl.EDisplayType.Hidden) : [];
8420
+ const shouldCheck = displayItems.length > 1;
8421
+ this.entityCheckQueue = new DelayQueue(() => {
8422
+ this.doEntityCheck(Object.keys(this.renderedEntities));
8423
+ }, shouldCheck ? 3000 : 30000);
8422
8424
  }
8423
8425
  unsetGetter() {
8424
- var _a, _b;
8426
+ var _a, _b, _c;
8425
8427
  (_a = this.getter) === null || _a === void 0 ? void 0 : _a.ExcludeMenuItem(this.item.id);
8426
8428
  this.getter = null;
8427
8429
  (_b = this.getterSub) === null || _b === void 0 ? void 0 : _b.call(this);
8428
8430
  this.getterSub = null;
8431
+ (_c = this.entityCheckQueue) === null || _c === void 0 ? void 0 : _c.Dispose();
8432
+ this.entityCheckQueue = null;
8429
8433
  }
8430
8434
  Dispose() {
8431
8435
  if (this.disposed) {
@@ -8481,7 +8485,10 @@ var EntitiesRenderManager;
8481
8485
  historicKey: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey,
8482
8486
  historicPoint: this.viewer.clock.currentTime.toString(),
8483
8487
  schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId,
8484
- migrated: true
8488
+ expandSources: true,
8489
+ scenario: this.scenario,
8490
+ migrated: true,
8491
+ maxSearchTimeSec: 60 * 2
8485
8492
  });
8486
8493
  this.renderEntities(data.entities, true);
8487
8494
  }
@@ -8556,7 +8563,10 @@ var EntitiesRenderManager;
8556
8563
  historicKey: (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey,
8557
8564
  historicPoint: this.viewer.clock.currentTime.toString(),
8558
8565
  schemaId: (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.schemaId,
8559
- migrated: true
8566
+ scenario: this.scenario,
8567
+ expandSources: true,
8568
+ migrated: true,
8569
+ maxSearchTimeSec: 60 * 2
8560
8570
  });
8561
8571
  if (this.disposed) {
8562
8572
  return;
@@ -9448,7 +9458,9 @@ var EntitiesLoadedRenderManager;
9448
9458
  const { entities } = await Entity$1.GetListByIds({
9449
9459
  api,
9450
9460
  entityIds,
9451
- migrated: true
9461
+ expandSources: true,
9462
+ migrated: true,
9463
+ maxSearchTimeSec: 60 * 2
9452
9464
  });
9453
9465
  if (this.disposed) {
9454
9466
  return;
@@ -10068,6 +10080,7 @@ var EntitiesIdsRenderManager;
10068
10080
  entityIds,
10069
10081
  historicPoint: newDateTime,
10070
10082
  historicKey: this.item.BruceEntity.historicAttrKey,
10083
+ expandSources: true,
10071
10084
  migrated: true,
10072
10085
  // If we're taking 5+ minutes to make a query, it's a dud.
10073
10086
  // This is a timeout imposed on our DB and not external sources.
@@ -10868,7 +10881,8 @@ class EntityGatherer {
10868
10881
  entityIds: batch,
10869
10882
  historicPoint: this.historic ? rTime : null,
10870
10883
  expandSources: this.expandSources,
10871
- api: this.api
10884
+ api: this.api,
10885
+ maxSearchTimeSec: 60 * 2
10872
10886
  });
10873
10887
  handleResponse(entities);
10874
10888
  requestedIds.push(...batch);
@@ -10904,7 +10918,8 @@ class EntityGatherer {
10904
10918
  entityIds: batch,
10905
10919
  historicPoint: this.historic ? rTime : null,
10906
10920
  expandSources: this.expandSources,
10907
- api: this.api
10921
+ api: this.api,
10922
+ maxSearchTimeSec: 60 * 2
10908
10923
  });
10909
10924
  handleResponse(entities);
10910
10925
  requestedIds.push(...batch);
@@ -18558,7 +18573,10 @@ var AssemblyRenderManager;
18558
18573
  entityIds: batch,
18559
18574
  api: this.getters.GetBruceApi(),
18560
18575
  expandLODs: true,
18561
- expandLocation: true
18576
+ expandLocation: true,
18577
+ expandSources: true,
18578
+ migrated: true,
18579
+ maxSearchTimeSec: 60 * 2
18562
18580
  });
18563
18581
  if (this.disposed) {
18564
18582
  return;
@@ -29148,7 +29166,9 @@ var EntityUtils;
29148
29166
  entityIds: toSearchIds,
29149
29167
  historicPoint: latestDate,
29150
29168
  expandLocation: true,
29169
+ expandSources: true,
29151
29170
  migrated: true,
29171
+ maxSearchTimeSec: 60 * 2,
29152
29172
  api
29153
29173
  });
29154
29174
  const entitiesMap = new Map();
@@ -30905,17 +30925,45 @@ var EntityRenderEnginePoint;
30905
30925
  var _a, _b, _c, _d, _e;
30906
30926
  const api = params.apiGetter.getApi();
30907
30927
  const cEntities = new Map();
30928
+ // Gathering tags in case styling needs it.
30929
+ // TODO: analyze styles before requesting tags.
30930
+ const tagMap = new Map();
30931
+ {
30932
+ // Gather all tags from the Entities to minimize number of requests.
30933
+ let tagIds = [];
30934
+ for (let i = 0; i < params.entities.length; i++) {
30935
+ const entity = params.entities[i];
30936
+ const entityTagIds = entity.Bruce["Layer.ID"];
30937
+ if (entityTagIds && entityTagIds.length > 0) {
30938
+ tagIds = tagIds.concat(entityTagIds);
30939
+ }
30940
+ }
30941
+ // De-dupe the tag IDs.
30942
+ tagIds = Array.from(new Set(tagIds));
30943
+ // Request if at least one then create a quick lookup map for tags.
30944
+ const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
30945
+ api,
30946
+ tagIds
30947
+ })).tags : [];
30948
+ for (let i = 0; i < tags.length; i++) {
30949
+ const tag = tags[i];
30950
+ tagMap.set(tag.ID, tag);
30951
+ }
30952
+ }
30908
30953
  for (let i = 0; i < params.entities.length; i++) {
30909
30954
  const entity = params.entities[i];
30910
30955
  const zoomItem = params.zoomItems[entity.Bruce.ID];
30911
30956
  const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$1(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
30957
+ // Pass through tags that may be needed for styling.
30912
30958
  const tagIds = entity.Bruce["Layer.ID"];
30913
- let tags = [];
30959
+ const tags = [];
30914
30960
  if (tagIds && tagIds.length > 0) {
30915
- tags = (await EntityTag.GetListByIds({
30916
- api,
30917
- tagIds
30918
- })).tags;
30961
+ for (let j = 0; j < tagIds.length; j++) {
30962
+ const tag = tagMap.get(tagIds[j]);
30963
+ if (tag) {
30964
+ tags.push(tag);
30965
+ }
30966
+ }
30919
30967
  }
30920
30968
  const pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
30921
30969
  let rego = null;
@@ -31372,7 +31420,8 @@ var EntityRenderEngineModel3d;
31372
31420
  else {
31373
31421
  const hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31374
31422
  getOrient = new CallbackProperty(() => {
31375
- return Transforms.headingPitchRollQuaternion(pos3d, hpr);
31423
+ const currentPos = position ? GetCValue(params.viewer, position) : pos3d;
31424
+ return Transforms.headingPitchRollQuaternion(currentPos, hpr);
31376
31425
  }, false);
31377
31426
  }
31378
31427
  cEntity = new Entity({
@@ -31482,9 +31531,23 @@ var EntityRenderEngineModel3d;
31482
31531
  // Just using real time for animation to avoid it teleporting on first movement.
31483
31532
  // If the prior update was too long ago our velocity estimate will make it teleport.
31484
31533
  const animStartTime = new Date();
31485
- if (prevPos3d && isLive) {
31534
+ // Get the current animated position if available, otherwise fall back to prevPos3d.
31535
+ // This prevents flickering when direction changes mid-animation.
31536
+ let currentAnimatedPos = prevPos3d;
31537
+ if (cEntity.position && isLive) {
31538
+ try {
31539
+ const animPos = GetCValue(params.viewer, cEntity.position);
31540
+ if (animPos) {
31541
+ currentAnimatedPos = animPos;
31542
+ }
31543
+ }
31544
+ catch (e) {
31545
+ // Fall back to prevPos3d if we can't get current position.
31546
+ }
31547
+ }
31548
+ if (currentAnimatedPos && isLive) {
31486
31549
  posses.push({
31487
- pos3d: prevPos3d,
31550
+ pos3d: currentAnimatedPos,
31488
31551
  dateTime: animStartTime,
31489
31552
  heading: !EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading) ? null : heading
31490
31553
  });
@@ -31515,7 +31578,17 @@ var EntityRenderEngineModel3d;
31515
31578
  const updatedTimeChanged = prevUpdatedTime && curUpdatedTime && prevUpdatedTime !== curUpdatedTime;
31516
31579
  const hasHistoricSeries = isHistoric || (params.entityHistoric && params.entityHistoric.length > 0);
31517
31580
  const shouldInterpolateHeading = !updatedTimeChanged || hasHistoricSeries;
31518
- if (shouldInterpolateHeading && dateTime && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
31581
+ const hasExplicitTransformHeading = (transform === null || transform === void 0 ? void 0 : transform.heading) != null && !isNaN(EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading));
31582
+ const isDirectRealtimeUpdate = !isHistoric && !(params.entityHistoric && params.entityHistoric.length > 0);
31583
+ const preferTransformHeadingForRealtime = isDirectRealtimeUpdate && hasExplicitTransformHeading;
31584
+ if (preferTransformHeadingForRealtime) {
31585
+ const hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31586
+ cEntity.orientation = new CallbackProperty(() => {
31587
+ const currentPos = GetCValue(params.viewer, cEntity.position);
31588
+ return Transforms.headingPitchRollQuaternion(currentPos || pos3d, hpr);
31589
+ }, false);
31590
+ }
31591
+ else if (shouldInterpolateHeading && dateTime && animatePosition && animatePosition instanceof CesiumAnimatedProperty.AnimatePositionSeries && animatePosition.GetOrient) {
31519
31592
  cEntity.orientation = new CallbackProperty(() => {
31520
31593
  return animatePosition.GetOrient();
31521
31594
  }, false);
@@ -31525,8 +31598,11 @@ var EntityRenderEngineModel3d;
31525
31598
  // Not worth animating.
31526
31599
  if (prevHeading == null || prevHeading == heading || isNaN(prevHeading)) {
31527
31600
  const hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31528
- const orient = Transforms.headingPitchRollQuaternion(pos3d, hpr);
31529
- cEntity.orientation = new CallbackProperty(() => orient, true);
31601
+ cEntity.orientation = new CallbackProperty(() => {
31602
+ const currentPos = GetCValue(params.viewer, cEntity.position);
31603
+ const orient = Transforms.headingPitchRollQuaternion(currentPos || pos3d, hpr);
31604
+ return orient;
31605
+ }, false);
31530
31606
  }
31531
31607
  // Animate the change.
31532
31608
  else {
@@ -31539,7 +31615,8 @@ var EntityRenderEngineModel3d;
31539
31615
  cEntity.orientation = new CallbackProperty(() => {
31540
31616
  const calcHeading = animateHeading.GetValue();
31541
31617
  const hpr = new HeadingPitchRoll(Math$1.toRadians(calcHeading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
31542
- const orient = Transforms.headingPitchRollQuaternion(pos3d, hpr);
31618
+ const currentPos = GetCValue(params.viewer, cEntity.position);
31619
+ const orient = Transforms.headingPitchRollQuaternion(currentPos || pos3d, hpr);
31543
31620
  // We'll stop the costly animation if it's done.
31544
31621
  if (animateHeading.IsDone()) {
31545
31622
  cEntity.orientation = new ConstantProperty(orient);
@@ -31726,17 +31803,45 @@ var EntityRenderEngineModel3d;
31726
31803
  "externalSources": false,
31727
31804
  "Items": []
31728
31805
  };
31806
+ // Gathering tags in case styling needs it.
31807
+ // TODO: analyze styles before requesting tags.
31808
+ const tagMap = new Map();
31809
+ {
31810
+ // Gather all tags from the Entities to minimize number of requests.
31811
+ let tagIds = [];
31812
+ for (let i = 0; i < params.entities.length; i++) {
31813
+ const entity = params.entities[i];
31814
+ const entityTagIds = entity.Bruce["Layer.ID"];
31815
+ if (entityTagIds && entityTagIds.length > 0) {
31816
+ tagIds = tagIds.concat(entityTagIds);
31817
+ }
31818
+ }
31819
+ // De-dupe the tag IDs.
31820
+ tagIds = Array.from(new Set(tagIds));
31821
+ // Request if at least one then create a quick lookup map for tags.
31822
+ const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
31823
+ api,
31824
+ tagIds
31825
+ })).tags : [];
31826
+ for (let i = 0; i < tags.length; i++) {
31827
+ const tag = tags[i];
31828
+ tagMap.set(tag.ID, tag);
31829
+ }
31830
+ }
31729
31831
  for (let i = 0; i < params.entities.length; i++) {
31730
31832
  const entity = params.entities[i];
31731
31833
  const zoomItem = params.zoomItems[entity.Bruce.ID];
31732
31834
  const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
31835
+ // Pass through tags that may be needed for styling.
31733
31836
  const tagIds = entity.Bruce["Layer.ID"];
31734
- let tags = [];
31837
+ const tags = [];
31735
31838
  if (tagIds && tagIds.length > 0) {
31736
- tags = (await EntityTag.GetListByIds({
31737
- api,
31738
- tagIds
31739
- })).tags;
31839
+ for (let j = 0; j < tagIds.length; j++) {
31840
+ const tag = tagMap.get(tagIds[j]);
31841
+ if (tag) {
31842
+ tags.push(tag);
31843
+ }
31844
+ }
31740
31845
  }
31741
31846
  const mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
31742
31847
  let group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
@@ -31766,18 +31871,21 @@ var EntityRenderEngineModel3d;
31766
31871
  const entity = params.entities[i];
31767
31872
  const zoomItem = params.zoomItems[entity.Bruce.ID];
31768
31873
  const style = zoomItem.StyleID != -1 ? (_c = (await getStyle$2(api, entity, zoomItem.StyleID))) === null || _c === void 0 ? void 0 : _c.Settings : zoomItem.Style;
31769
- const tagIds = entity.Bruce["Layer.ID"];
31770
- let tags = [];
31771
- if (tagIds && tagIds.length > 0) {
31772
- tags = (await EntityTag.GetListByIds({
31773
- api,
31774
- tagIds
31775
- })).tags;
31776
- }
31777
31874
  const lod = lodData.find(x => x.entityId == entity.Bruce.ID);
31778
31875
  if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
31779
31876
  continue;
31780
31877
  }
31878
+ // Pass through tags that may be needed for styling.
31879
+ const tagIds = entity.Bruce["Layer.ID"];
31880
+ const tags = [];
31881
+ if (tagIds && tagIds.length > 0) {
31882
+ for (let j = 0; j < tagIds.length; j++) {
31883
+ const tag = tagMap.get(tagIds[j]);
31884
+ if (tag) {
31885
+ tags.push(tag);
31886
+ }
31887
+ }
31888
+ }
31781
31889
  let rego = null;
31782
31890
  // Only used for historic tracks right now.
31783
31891
  // So won't bother getting it if we don't have historic data.
@@ -32208,17 +32316,45 @@ var EntityRenderEnginePolyline;
32208
32316
  var _a, _b, _c;
32209
32317
  const api = params.apiGetter.getApi();
32210
32318
  const cEntities = new Map();
32319
+ // Gathering tags in case styling needs it.
32320
+ // TODO: analyze styles before requesting tags.
32321
+ const tagMap = new Map();
32322
+ {
32323
+ // Gather all tags from the Entities to minimize number of requests.
32324
+ let tagIds = [];
32325
+ for (let i = 0; i < params.entities.length; i++) {
32326
+ const entity = params.entities[i];
32327
+ const entityTagIds = entity.Bruce["Layer.ID"];
32328
+ if (entityTagIds && entityTagIds.length > 0) {
32329
+ tagIds = tagIds.concat(entityTagIds);
32330
+ }
32331
+ }
32332
+ // De-dupe the tag IDs.
32333
+ tagIds = Array.from(new Set(tagIds));
32334
+ // Request if at least one then create a quick lookup map for tags.
32335
+ const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
32336
+ api,
32337
+ tagIds
32338
+ })).tags : [];
32339
+ for (let i = 0; i < tags.length; i++) {
32340
+ const tag = tags[i];
32341
+ tagMap.set(tag.ID, tag);
32342
+ }
32343
+ }
32211
32344
  for (let i = 0; i < params.entities.length; i++) {
32212
32345
  const entity = params.entities[i];
32213
32346
  const zoomItem = params.zoomItems[entity.Bruce.ID];
32214
32347
  const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$3(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
32348
+ // Pass through tags that may be needed for styling.
32215
32349
  const tagIds = entity.Bruce["Layer.ID"];
32216
- let tags = [];
32350
+ const tags = [];
32217
32351
  if (tagIds && tagIds.length > 0) {
32218
- tags = (await EntityTag.GetListByIds({
32219
- api,
32220
- tagIds
32221
- })).tags;
32352
+ for (let j = 0; j < tagIds.length; j++) {
32353
+ const tag = tagMap.get(tagIds[j]);
32354
+ if (tag) {
32355
+ tags.push(tag);
32356
+ }
32357
+ }
32222
32358
  }
32223
32359
  const lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
32224
32360
  const cEntity = Render({
@@ -32674,17 +32810,45 @@ var EntityRenderEnginePolygon;
32674
32810
  var _a, _b, _c;
32675
32811
  const api = params.apiGetter.getApi();
32676
32812
  const cEntities = new Map();
32813
+ // Gathering tags in case styling needs it.
32814
+ // TODO: analyze styles before requesting tags.
32815
+ const tagMap = new Map();
32816
+ {
32817
+ // Gather all tags from the Entities to minimize number of requests.
32818
+ let tagIds = [];
32819
+ for (let i = 0; i < params.entities.length; i++) {
32820
+ const entity = params.entities[i];
32821
+ const entityTagIds = entity.Bruce["Layer.ID"];
32822
+ if (entityTagIds && entityTagIds.length > 0) {
32823
+ tagIds = tagIds.concat(entityTagIds);
32824
+ }
32825
+ }
32826
+ // De-dupe the tag IDs.
32827
+ tagIds = Array.from(new Set(tagIds));
32828
+ // Request if at least one then create a quick lookup map for tags.
32829
+ const tags = tagIds.length > 0 ? (await EntityTag.GetListByIds({
32830
+ api,
32831
+ tagIds
32832
+ })).tags : [];
32833
+ for (let i = 0; i < tags.length; i++) {
32834
+ const tag = tags[i];
32835
+ tagMap.set(tag.ID, tag);
32836
+ }
32837
+ }
32677
32838
  for (let i = 0; i < params.entities.length; i++) {
32678
32839
  const entity = params.entities[i];
32679
32840
  const zoomItem = params.zoomItems[entity.Bruce.ID];
32680
32841
  const style = zoomItem.StyleID != -1 ? (_a = (await getStyle$4(api, entity, zoomItem.StyleID))) === null || _a === void 0 ? void 0 : _a.Settings : zoomItem.Style;
32842
+ // Pass through tags that may be needed for styling.
32681
32843
  const tagIds = entity.Bruce["Layer.ID"];
32682
- let tags = [];
32844
+ const tags = [];
32683
32845
  if (tagIds && tagIds.length > 0) {
32684
- tags = (await EntityTag.GetListByIds({
32685
- api,
32686
- tagIds
32687
- })).tags;
32846
+ for (let j = 0; j < tagIds.length; j++) {
32847
+ const tag = tagMap.get(tagIds[j]);
32848
+ if (tag) {
32849
+ tags.push(tag);
32850
+ }
32851
+ }
32688
32852
  }
32689
32853
  const pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
32690
32854
  const cEntity = Render({
@@ -34815,7 +34979,7 @@ class WidgetViewBar extends Widget.AWidget {
34815
34979
  }
34816
34980
  }
34817
34981
 
34818
- const VERSION = "6.4.2";
34982
+ const VERSION = "6.4.4";
34819
34983
  /**
34820
34984
  * Updates the environment instance used by bruce-cesium to one specified.
34821
34985
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.