bruce-cesium 5.7.5 → 5.7.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
- 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, AbstractApi, Session, EntityAttachment, EntityAttachmentType, EntityAttribute } from 'bruce-models';
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, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, HeadingPitchRange, Cesium3DTileStyle, KmlDataSource, Cesium3DTileColorBlendMode, Ion, Quaternion, Matrix3, Matrix4, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, PolygonPipeline, Cesium3DTileset, IonResource, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, BoundingSphere, GeometryInstance, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, 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, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -3418,6 +3418,7 @@ var EntityUtils;
3418
3418
  * @param params
3419
3419
  */
3420
3420
  async function GetLocation(params) {
3421
+ var _a, _b, _c, _d;
3421
3422
  let { api, viewer, samples, visualRegister, minimumAlt, paddingAlt } = params;
3422
3423
  if (!paddingAlt) {
3423
3424
  paddingAlt = 0;
@@ -3433,6 +3434,22 @@ var EntityUtils;
3433
3434
  // When in model-space, Assembly Entities are all relative to 0,0 lat/lon.
3434
3435
  // Which means we have to ignore the location and calculate based on relative position to 0,0.
3435
3436
  const modelSpace = viewer["nextspace-model-space"] === true;
3437
+ // Quick lookup on what historic Entities we have and what dates they map to.
3438
+ let latestDate = null;
3439
+ const entityIdDates = new Map();
3440
+ for (const sample of samples) {
3441
+ if (!sample.entity) {
3442
+ continue;
3443
+ }
3444
+ const historicDetails = (_b = (_a = sample.entity.Bruce) === null || _a === void 0 ? void 0 : _a.Outline) === null || _b === void 0 ? void 0 : _b.find(x => !!x.DateTime);
3445
+ if (!historicDetails) {
3446
+ continue;
3447
+ }
3448
+ entityIdDates.set(sample.entity.Bruce.ID, historicDetails.DateTime);
3449
+ if (!latestDate || ((_c = new Date(latestDate)) === null || _c === void 0 ? void 0 : _c.getTime()) < ((_d = new Date(historicDetails.DateTime)) === null || _d === void 0 ? void 0 : _d.getTime())) {
3450
+ latestDate = historicDetails.DateTime;
3451
+ }
3452
+ }
3436
3453
  const data = {
3437
3454
  pos3d: null,
3438
3455
  rectangle: null,
@@ -3516,7 +3533,7 @@ var EntityUtils;
3516
3533
  * Returns an array of positions from the entity's currently rendered graphics.
3517
3534
  */
3518
3535
  const evaluateRendered = async () => {
3519
- var _a;
3536
+ var _a, _b, _c;
3520
3537
  const rego = visualRegister ? visualRegister.GetRego({
3521
3538
  entityId: sample.entityId,
3522
3539
  menuItemId: sample.menuItemId
@@ -3524,6 +3541,15 @@ var EntityUtils;
3524
3541
  if (!rego) {
3525
3542
  return [];
3526
3543
  }
3544
+ // If the provided Entity data is historic, ensure we found a rego with the same date.
3545
+ // Because otherwise we're flying to a different dated-location.
3546
+ if (entityIdDates.get(rego.entityId)) {
3547
+ const regoDate = (_b = (_a = rego.outline) === null || _a === void 0 ? void 0 : _a.find(x => !!x.DateTime)) === null || _b === void 0 ? void 0 : _b.DateTime;
3548
+ if (!regoDate || regoDate != entityIdDates.get(rego.entityId)) {
3549
+ // Mismatch.
3550
+ return [];
3551
+ }
3552
+ }
3527
3553
  // If this is a historic Entity but associated with a Tileset, we'll hack the movement in.
3528
3554
  // Our API doesn't account for this at the moment.
3529
3555
  if (rego.visual instanceof Cesium3DTileFeature && rego.outline && rego.outline.some(x => !!x.DateTime)) {
@@ -3531,7 +3557,7 @@ var EntityUtils;
3531
3557
  const tileset = rego.visual.tileset;
3532
3558
  if (tileset === null || tileset === void 0 ? void 0 : tileset._bruceCoords) {
3533
3559
  // The render logic currently swaps out the UCS location when the assembly is moving.
3534
- const location = (_a = tileset._bruceCoords.ucs) === null || _a === void 0 ? void 0 : _a.location;
3560
+ const location = (_c = tileset._bruceCoords.ucs) === null || _c === void 0 ? void 0 : _c.location;
3535
3561
  if (location) {
3536
3562
  const latitude = EnsureNumber(location.latitude);
3537
3563
  const longitude = EnsureNumber(location.longitude);
@@ -3887,6 +3913,7 @@ var EntityUtils;
3887
3913
  if (toSearchIds.length) {
3888
3914
  const { entities } = await Entity$1.GetListByIds({
3889
3915
  entityIds: toSearchIds,
3916
+ historicPoint: latestDate,
3890
3917
  expandLocation: true,
3891
3918
  migrated: true,
3892
3919
  api
@@ -17839,6 +17866,51 @@ var SharedGetters;
17839
17866
  })(Queue = SharedGetters.Queue || (SharedGetters.Queue = {}));
17840
17867
  })(SharedGetters || (SharedGetters = {}));
17841
17868
 
17869
+ function coordsFromHistoricEntity(entity) {
17870
+ var _a;
17871
+ if (!entity) {
17872
+ return null;
17873
+ }
17874
+ const location = entity.Bruce.Location;
17875
+ if (!location || !location.latitude || !location.longitude) {
17876
+ return null;
17877
+ }
17878
+ const pos3d = Cartesian3.fromDegrees(location.longitude, location.latitude, 0);
17879
+ const heading = ((_a = entity.Bruce.Transform) === null || _a === void 0 ? void 0 : _a.heading) || 0;
17880
+ return coordsFromHistoricPos3d(null, entity.Bruce.ID, pos3d, heading);
17881
+ }
17882
+ function coordsFromHistoricPos3d(cTileset, rootId, pos3d, heading) {
17883
+ if (!pos3d) {
17884
+ return null;
17885
+ }
17886
+ // Jank code that hacks the position to be different.
17887
+ // This can mess up our panels so we'll need to disable editing until a better system is in place.
17888
+ const location = Cartographic.fromCartesian(pos3d);
17889
+ const lat = Math$1.toDegrees(location.latitude);
17890
+ const lon = Math$1.toDegrees(location.longitude);
17891
+ const alt = location.height;
17892
+ const prevCoords = cTileset === null || cTileset === void 0 ? void 0 : cTileset._bruceCoords;
17893
+ const coords = {
17894
+ "Entity.ID": null,
17895
+ ...prevCoords,
17896
+ transform: {
17897
+ ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.transform,
17898
+ heading: heading
17899
+ },
17900
+ ucs: {
17901
+ name: null,
17902
+ transform: null,
17903
+ ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.ucs,
17904
+ "Entity.ID": rootId,
17905
+ location: {
17906
+ altitude: alt,
17907
+ latitude: lat,
17908
+ longitude: lon
17909
+ }
17910
+ }
17911
+ };
17912
+ return coords;
17913
+ }
17842
17914
  /**
17843
17915
  * Manager for rendering CAD tilesets.
17844
17916
  * CAD tilesets are referred to as "MODEL" tilesets in some other areas of Bruce code.
@@ -17912,6 +17984,7 @@ var TilesetCadRenderManager;
17912
17984
  // Single shared getter to avoid multiple assemblies fighting to render.
17913
17985
  // This lets one complete, then the next start.
17914
17986
  await SharedGetters.Queue.Run("Rendering assembly.", async () => {
17987
+ var _a;
17915
17988
  if (this.disposed) {
17916
17989
  return;
17917
17990
  }
@@ -17949,10 +18022,30 @@ var TilesetCadRenderManager;
17949
18022
  const settings = tileset.settings;
17950
18023
  const rootId = settings.rootEntityId;
17951
18024
  this.rootId = rootId;
17952
- coords = (await EntityCoords.GetEntityCoords({
17953
- api,
17954
- rootEntityId: rootId
17955
- })).coords;
18025
+ // If historic, we'll see if the root Entity has a historic position to use.
18026
+ if (((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historic) && rootId) {
18027
+ try {
18028
+ const { entity: root } = await Entity$1.Get({
18029
+ entityId: rootId,
18030
+ historicPoint: this.viewer.clock.currentTime.toString(),
18031
+ api: api
18032
+ });
18033
+ coords = coordsFromHistoricEntity(root);
18034
+ }
18035
+ catch (e) {
18036
+ console.error(e);
18037
+ }
18038
+ }
18039
+ if (this.disposed) {
18040
+ return;
18041
+ }
18042
+ // Default process.
18043
+ if (!coords) {
18044
+ coords = (await EntityCoords.GetEntityCoords({
18045
+ api,
18046
+ rootEntityId: rootId
18047
+ })).coords;
18048
+ }
17956
18049
  if (this.disposed) {
17957
18050
  return;
17958
18051
  }
@@ -18095,9 +18188,9 @@ var TilesetCadRenderManager;
18095
18188
  * @returns
18096
18189
  */
18097
18190
  mapTilesetFeature(feature, add) {
18098
- var _a, _b, _c, _d, _e;
18191
+ var _a, _b, _c, _d, _e, _f;
18099
18192
  const accountId = (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
18100
- const canEdit = accountId === this.getters.GetAccountId() && !this.modelSpace;
18193
+ const canEdit = accountId === this.getters.GetAccountId() && !this.modelSpace && !((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historic);
18101
18194
  let rego = {
18102
18195
  canEdit: canEdit,
18103
18196
  entityId: null,
@@ -18107,12 +18200,12 @@ var TilesetCadRenderManager;
18107
18200
  priority: this.renderPriority,
18108
18201
  visual: feature,
18109
18202
  accountId: accountId,
18110
- tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
18203
+ tilesetId: (_d = this.item.tileset) === null || _d === void 0 ? void 0 : _d.TilesetID,
18111
18204
  tilesetType: Tileset.EType.Cad,
18112
18205
  rootId: this.rootId
18113
18206
  };
18114
18207
  const featureAny = feature;
18115
- const propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_d = featureAny.getPropertyIds) === null || _d === void 0 ? void 0 : _d.call(featureAny);
18208
+ const propertyNames = featureAny.getPropertyNames ? featureAny.getPropertyNames() : (_e = featureAny.getPropertyIds) === null || _e === void 0 ? void 0 : _e.call(featureAny);
18116
18209
  if (!propertyNames) {
18117
18210
  return null;
18118
18211
  }
@@ -18160,7 +18253,7 @@ var TilesetCadRenderManager;
18160
18253
  }
18161
18254
  // Optional menu item restriction.
18162
18255
  // Allows only showing certain entities from a tileset.
18163
- const onlyIds = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.EntityIds;
18256
+ const onlyIds = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.EntityIds;
18164
18257
  if ((onlyIds === null || onlyIds === void 0 ? void 0 : onlyIds.length) && !onlyIds.includes(rego.entityId)) {
18165
18258
  if (this.item.BruceEntity.Ghosts) {
18166
18259
  feature.color = Color.WHITE.clone().withAlpha(0.5);
@@ -18556,33 +18649,7 @@ var TilesetCadRenderManager;
18556
18649
  if (heading > 360) {
18557
18650
  heading = heading - 360;
18558
18651
  }
18559
- // Jank code that hacks the position to be different.
18560
- // This can mess up our panels so we'll need to disable editing until a better system is in place.
18561
- const location = Cartographic.fromCartesian(pos3d);
18562
- const lat = Math$1.toDegrees(location.latitude);
18563
- const lon = Math$1.toDegrees(location.longitude);
18564
- const alt = location.height;
18565
- const cTileset = this.cTileset;
18566
- const prevCoords = cTileset._bruceCoords;
18567
- const coords = {
18568
- "Entity.ID": null,
18569
- ...prevCoords,
18570
- transform: {
18571
- ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.transform,
18572
- heading: heading
18573
- },
18574
- ucs: {
18575
- name: null,
18576
- transform: null,
18577
- ...prevCoords === null || prevCoords === void 0 ? void 0 : prevCoords.ucs,
18578
- "Entity.ID": this.rootId,
18579
- location: {
18580
- altitude: alt,
18581
- latitude: lat,
18582
- longitude: lon
18583
- }
18584
- }
18585
- };
18652
+ const coords = coordsFromHistoricPos3d(this.cTileset, this.rootId, pos3d, heading);
18586
18653
  this.applyCoords(tileset, coords);
18587
18654
  },
18588
18655
  onRangeChange: () => {
@@ -32190,7 +32257,7 @@ class WidgetViewBar extends Widget.AWidget {
32190
32257
  }
32191
32258
  }
32192
32259
 
32193
- const VERSION = "5.7.5";
32260
+ const VERSION = "5.7.6";
32194
32261
 
32195
32262
  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 };
32196
32263
  //# sourceMappingURL=bruce-cesium.es5.js.map