bruce-cesium 5.8.2 → 5.8.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 { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, OrthographicFrustum, defined, ClockRange, EasingFunction, NearFarScalar, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -3449,6 +3449,9 @@ var EntityUtils;
3449
3449
  latestDate = historicDetails.DateTime;
3450
3450
  }
3451
3451
  }
3452
+ // Hacky lookup for Entity ID -> related Tileset coords that are currently active.
3453
+ // This helps find ones that are modified due to being historic/moving and apply an Entity's local movement against them.
3454
+ const entityIdTilesetCoords = new Map();
3452
3455
  const data = {
3453
3456
  pos3d: null,
3454
3457
  rectangle: null,
@@ -3532,7 +3535,7 @@ var EntityUtils;
3532
3535
  * Returns an array of positions from the entity's currently rendered graphics.
3533
3536
  */
3534
3537
  const evaluateRendered = async () => {
3535
- var _a, _b, _c;
3538
+ var _a, _b;
3536
3539
  const rego = visualRegister ? visualRegister.GetRego({
3537
3540
  entityId: sample.entityId,
3538
3541
  menuItemId: sample.menuItemId
@@ -3555,19 +3558,26 @@ var EntityUtils;
3555
3558
  // Get the Tileset.
3556
3559
  const tileset = rego.visual.tileset;
3557
3560
  if (tileset === null || tileset === void 0 ? void 0 : tileset._bruceCoords) {
3561
+ // Record so we can use it during record evaluation instead of rendered evaluation.
3562
+ entityIdTilesetCoords.set(entityId, tileset._bruceCoords);
3563
+ return [];
3558
3564
  // The render logic currently swaps out the UCS location when the assembly is moving.
3559
- const location = (_c = tileset._bruceCoords.ucs) === null || _c === void 0 ? void 0 : _c.location;
3560
- if (location) {
3561
- const latitude = EnsureNumber(location.latitude);
3562
- const longitude = EnsureNumber(location.longitude);
3563
- // Disallowing 0.
3564
- if (latitude && longitude) {
3565
- const pos3d = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3566
- const toAdjust = [pos3d];
3567
- await ensureHeightRefs(toAdjust, sample);
3568
- return toAdjust;
3569
- }
3570
- }
3565
+ // const location = tileset._bruceCoords.ucs?.location;
3566
+ // if (location) {
3567
+ // const latitude = EnsureNumber(location.latitude);
3568
+ // const longitude = EnsureNumber(location.longitude);
3569
+ // // Disallowing 0.
3570
+ // if (latitude && longitude) {
3571
+ // const pos3d = Cesium.Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3572
+ // console.log("using tileset pos3d for historic entity", {
3573
+ // pos3d: pos3d,
3574
+ // entity:
3575
+ // })
3576
+ // const toAdjust = [pos3d];
3577
+ // await ensureHeightRefs(toAdjust, sample);
3578
+ // return toAdjust;
3579
+ // }
3580
+ // }
3571
3581
  }
3572
3582
  }
3573
3583
  let posses = [];
@@ -3719,7 +3729,7 @@ var EntityUtils;
3719
3729
  * @param sample
3720
3730
  */
3721
3731
  const getRecordEntityPositions = async (sample) => {
3722
- var _a, _b, _c;
3732
+ var _a, _b, _c, _d;
3723
3733
  let { entityId, entity, disallowRendered } = sample;
3724
3734
  const isAssemblyEntity = ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyRootLocation) != null;
3725
3735
  /**
@@ -3799,6 +3809,74 @@ var EntityUtils;
3799
3809
  return posses;
3800
3810
  };
3801
3811
  if (isAssemblyEntity) {
3812
+ // See if we have tileset coords to use.
3813
+ // This means we have to hack fly-to for a historic/moving assembly.
3814
+ {
3815
+ const tCoords = entityIdTilesetCoords.get(entityId);
3816
+ const location = (_b = tCoords === null || tCoords === void 0 ? void 0 : tCoords.ucs) === null || _b === void 0 ? void 0 : _b.location;
3817
+ if (tCoords && location) {
3818
+ const latitude = EnsureNumber(location.latitude);
3819
+ const longitude = EnsureNumber(location.longitude);
3820
+ if (latitude && longitude) {
3821
+ const worldPosition = entity.Bruce.AssemblyWorldPosition;
3822
+ if (worldPosition) {
3823
+ const offset = new Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
3824
+ const transform = tCoords.transform;
3825
+ let heading = 0;
3826
+ if (+transform.heading) {
3827
+ heading = +transform.heading;
3828
+ }
3829
+ let pitch = 0;
3830
+ if (+transform.pitch) {
3831
+ pitch = +transform.pitch;
3832
+ }
3833
+ let roll = 0;
3834
+ if (+transform.roll) {
3835
+ roll = +transform.roll;
3836
+ }
3837
+ let pos3d = Cartesian3.fromDegrees(EnsureNumber(longitude), EnsureNumber(latitude), EnsureNumber(location.altitude));
3838
+ const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
3839
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new HeadingPitchRoll());
3840
+ const transformHpr = Matrix3.fromHeadingPitchRoll(hpr);
3841
+ const transformedOffset = Matrix3.multiplyByVector(transformHpr, offset, new Cartesian3());
3842
+ pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
3843
+ pos3d = await processPosHeight(pos3d, HeightReference.NONE);
3844
+ const geometryRadius = Entity$1.GetValue({
3845
+ entity: entity,
3846
+ path: ["Bruce", "GeometryRadius"]
3847
+ });
3848
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3849
+ const sphere = BoundingSphere.fromPoints([pos3d]);
3850
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3851
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3852
+ sphere.radius = geometryRadius;
3853
+ spheres.push(sphere);
3854
+ }
3855
+ }
3856
+ return [pos3d];
3857
+ }
3858
+ else {
3859
+ if (location) {
3860
+ let pos3d = Cartesian3.fromDegrees(longitude, latitude, EnsureNumber(location.altitude));
3861
+ pos3d = await processPosHeight(pos3d, HeightReference.NONE);
3862
+ const geometryRadius = Entity$1.GetValue({
3863
+ entity: entity,
3864
+ path: ["Bruce", "GeometryRadius"]
3865
+ });
3866
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3867
+ const sphere = BoundingSphere.fromPoints([pos3d]);
3868
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3869
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3870
+ sphere.radius = geometryRadius;
3871
+ spheres.push(sphere);
3872
+ }
3873
+ }
3874
+ return [pos3d];
3875
+ }
3876
+ }
3877
+ }
3878
+ }
3879
+ }
3802
3880
  let pos3d = null;
3803
3881
  if (modelSpace) {
3804
3882
  pos3d = calcEntityLocation(entity, modelSpace);
@@ -3808,7 +3886,7 @@ var EntityUtils;
3808
3886
  entity: entity,
3809
3887
  path: ["Bruce", "Location"]
3810
3888
  });
3811
- if (eLocation != null && ((_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootLocation) != null) {
3889
+ if (eLocation != null && ((_c = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyRootLocation) != null) {
3812
3890
  pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3813
3891
  }
3814
3892
  }
@@ -3839,7 +3917,7 @@ var EntityUtils;
3839
3917
  entity: entity,
3840
3918
  path: ["Bruce", "Location"]
3841
3919
  });
3842
- if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_c = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _c === void 0 ? void 0 : _c.AssemblyRootLocation) != null) {
3920
+ if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_d = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _d === void 0 ? void 0 : _d.AssemblyRootLocation) != null) {
3843
3921
  pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3844
3922
  if (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x) {
3845
3923
  pos3d = await processPosHeight(pos3d, HeightReference.NONE);
@@ -11789,7 +11867,8 @@ var VisualsRegister;
11789
11867
  entityId: rego.entityId,
11790
11868
  menuItemId: rego.menuItemId,
11791
11869
  doUpdate: false,
11792
- requestRender: false
11870
+ requestRender: false,
11871
+ source: "add-rego-replace"
11793
11872
  });
11794
11873
  }
11795
11874
  const entityId = rego.entityId;
@@ -13157,13 +13236,15 @@ var EntitiesRenderManager;
13157
13236
  if (shouldRender) {
13158
13237
  this.visualsManager.RemoveRegos({
13159
13238
  menuItemId: this.item.id,
13160
- retainTagIds: tagsToRender
13239
+ retainTagIds: tagsToRender,
13240
+ source: "entities-tag-filter"
13161
13241
  });
13162
13242
  (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
13163
13243
  }
13164
13244
  else {
13165
13245
  this.visualsManager.RemoveRegos({
13166
- menuItemId: this.item.id
13246
+ menuItemId: this.item.id,
13247
+ source: "entities-disabled"
13167
13248
  });
13168
13249
  (_k = this.clustering) === null || _k === void 0 ? void 0 : _k.Dispose();
13169
13250
  return;
@@ -13304,7 +13385,8 @@ var EntitiesRenderManager;
13304
13385
  this.unsetGetter();
13305
13386
  this.disposed = true;
13306
13387
  this.visualsManager.RemoveRegos({
13307
- menuItemId: this.item.id
13388
+ menuItemId: this.item.id,
13389
+ source: "entities-dispose"
13308
13390
  });
13309
13391
  (_a = this.entityCheckRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
13310
13392
  (_b = this.viewMonitorRemoval) === null || _b === void 0 ? void 0 : _b.call(this);
@@ -14188,7 +14270,8 @@ var EntitiesLoadedRenderManager;
14188
14270
  }
14189
14271
  this.visualsManager.RemoveRegos({
14190
14272
  entityId: x,
14191
- menuItemId: this.item.id
14273
+ menuItemId: this.item.id,
14274
+ source: "entities-loaded-remove"
14192
14275
  });
14193
14276
  this.renderedEntities[x] = false;
14194
14277
  });
@@ -14204,7 +14287,8 @@ var EntitiesLoadedRenderManager;
14204
14287
  }
14205
14288
  this.item.BruceEntity.Entities = [];
14206
14289
  this.visualsManager.RemoveRegos({
14207
- menuItemId: this.item.id
14290
+ menuItemId: this.item.id,
14291
+ source: "entities-loaded-clear"
14208
14292
  });
14209
14293
  this.renderedEntities = {};
14210
14294
  this.recreateGetter();
@@ -14268,7 +14352,8 @@ var EntitiesLoadedRenderManager;
14268
14352
  this.getterSub = null;
14269
14353
  this.disposed = true;
14270
14354
  this.visualsManager.RemoveRegos({
14271
- menuItemId: this.item.id
14355
+ menuItemId: this.item.id,
14356
+ source: "entities-loaded-dispose"
14272
14357
  });
14273
14358
  for (let i = 0; i < this.sources.length; i++) {
14274
14359
  const source = this.sources[i];
@@ -18385,7 +18470,8 @@ var TilesetCadRenderManager;
18385
18470
  entityId: rego.entityId,
18386
18471
  requestRender: false,
18387
18472
  menuItemId: this.item.id,
18388
- doRemove: false
18473
+ doRemove: false,
18474
+ source: "tileset-dispose"
18389
18475
  });
18390
18476
  // Might have to do something smarter since siblings could still be OK.
18391
18477
  this.loadedCesiumEntities[rego.entityId] = null;
@@ -18479,7 +18565,8 @@ var TilesetCadRenderManager;
18479
18565
  (_b = this.styler) === null || _b === void 0 ? void 0 : _b.Dispose();
18480
18566
  this.visualsManager.RemoveRegos({
18481
18567
  menuItemId: this.item.id,
18482
- doRemove: false
18568
+ doRemove: false,
18569
+ source: "tileset-dispose"
18483
18570
  });
18484
18571
  this.viewerDateTimeDispose();
18485
18572
  }
@@ -18972,7 +19059,8 @@ var TilesetOsmRenderManager;
18972
19059
  this.cTileset = null;
18973
19060
  }
18974
19061
  this.visualsManager.RemoveRegos({
18975
- menuItemId: this.item.id
19062
+ menuItemId: this.item.id,
19063
+ source: "osm-tileset-dispose"
18976
19064
  });
18977
19065
  this.featureQueue = [];
18978
19066
  }
@@ -20155,7 +20243,8 @@ var RelationsRenderManager;
20155
20243
  relation: rego.relation,
20156
20244
  entityId: rego.entityId,
20157
20245
  menuItemId: this.item.id,
20158
- requestRender: false
20246
+ requestRender: false,
20247
+ source: "relations-filter"
20159
20248
  });
20160
20249
  }
20161
20250
  }
@@ -20202,7 +20291,8 @@ var RelationsRenderManager;
20202
20291
  }
20203
20292
  this.disposed = true;
20204
20293
  this.register.RemoveRegos({
20205
- menuItemId: this.item.id
20294
+ menuItemId: this.item.id,
20295
+ source: "relations-dispose"
20206
20296
  });
20207
20297
  }
20208
20298
  /**
@@ -20463,7 +20553,7 @@ var RelationsRenderManager;
20463
20553
  menuItemId: this.item.id,
20464
20554
  relation: relation,
20465
20555
  requestRender: false,
20466
- doUpdate: true
20556
+ source: "relations-filter"
20467
20557
  });
20468
20558
  }
20469
20559
  const key = RelationRenderEngine.GetRenderGroupId(relation);
@@ -32322,7 +32412,7 @@ class WidgetViewBar extends Widget.AWidget {
32322
32412
  }
32323
32413
  }
32324
32414
 
32325
- const VERSION = "5.8.2";
32415
+ const VERSION = "5.8.4";
32326
32416
 
32327
32417
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
32328
32418
  //# sourceMappingURL=bruce-cesium.es5.js.map