bruce-cesium 5.8.3 → 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, ColorBlendMode, HeadingPitchRoll, Transforms, Model, HorizontalOrigin, VerticalOrigin, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, 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, SceneTransforms, 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);
@@ -32334,7 +32412,7 @@ class WidgetViewBar extends Widget.AWidget {
32334
32412
  }
32335
32413
  }
32336
32414
 
32337
- const VERSION = "5.8.3";
32415
+ const VERSION = "5.8.4";
32338
32416
 
32339
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 };
32340
32418
  //# sourceMappingURL=bruce-cesium.es5.js.map