bruce-cesium 5.5.6 → 5.5.8

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 (25) hide show
  1. package/dist/bruce-cesium.es5.js +263 -100
  2. package/dist/bruce-cesium.es5.js.map +1 -1
  3. package/dist/bruce-cesium.umd.js +262 -99
  4. package/dist/bruce-cesium.umd.js.map +1 -1
  5. package/dist/lib/bruce-cesium.js +1 -1
  6. package/dist/lib/rendering/menu-item-creator.js +13 -3
  7. package/dist/lib/rendering/menu-item-creator.js.map +1 -1
  8. package/dist/lib/rendering/menu-item-manager.js +56 -14
  9. package/dist/lib/rendering/menu-item-manager.js.map +1 -1
  10. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +15 -7
  11. package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -1
  12. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +9 -3
  13. package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
  14. package/dist/lib/rendering/tileset-render-engine.js +19 -16
  15. package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
  16. package/dist/lib/rendering/view-render-engine.js +58 -31
  17. package/dist/lib/rendering/view-render-engine.js.map +1 -1
  18. package/dist/lib/utils/entity-utils.js +93 -24
  19. package/dist/lib/utils/entity-utils.js.map +1 -1
  20. package/dist/types/bruce-cesium.d.ts +1 -1
  21. package/dist/types/rendering/menu-item-manager.d.ts +1 -0
  22. package/dist/types/rendering/render-managers/other/assembly-render-manager.d.ts +3 -0
  23. package/dist/types/rendering/render-managers/tilesets/tileset-cad-render-manager.d.ts +3 -0
  24. package/dist/types/rendering/tileset-render-engine.d.ts +2 -0
  25. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { BruceEvent, Cartes, Entity as Entity$1, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, ProjectViewTile, 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, 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';
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, Cesium3DTileColorBlendMode, 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, PolygonPipeline, Cesium3DTileset, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -2888,6 +2888,43 @@ const getLocationFromFeature = (feature) => {
2888
2888
  }
2889
2889
  return result;
2890
2890
  };
2891
+ function calcEntityLocation(entity, modelSpace) {
2892
+ let aRootLocation = entity.Bruce.AssemblyRootLocation;
2893
+ // If we're in model-space we cull location.
2894
+ // This puts it at 0,0 lat/lon which we treat as 0,0,0 for model-space viewing.
2895
+ if (modelSpace) {
2896
+ aRootLocation = null;
2897
+ }
2898
+ const worldPosition = entity.Bruce.AssemblyWorldPosition;
2899
+ if (!worldPosition) {
2900
+ return null;
2901
+ }
2902
+ let offset = new Cartesian3(+worldPosition[0][3], +worldPosition[1][3], +worldPosition[2][3]);
2903
+ let heading = 0;
2904
+ let pitch = 0;
2905
+ let roll = 0;
2906
+ {
2907
+ const eTransform = entity.Bruce.Transform;
2908
+ if (eTransform) {
2909
+ if (eTransform.heading) {
2910
+ heading = eTransform.heading;
2911
+ }
2912
+ if (eTransform.pitch) {
2913
+ pitch = eTransform.pitch;
2914
+ }
2915
+ if (eTransform.roll) {
2916
+ roll = eTransform.roll;
2917
+ }
2918
+ }
2919
+ }
2920
+ let pos3d = Cartesian3.fromDegrees(EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.latitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.altitude));
2921
+ const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
2922
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new HeadingPitchRoll());
2923
+ const transform = Matrix3.fromHeadingPitchRoll(hpr);
2924
+ const transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
2925
+ pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
2926
+ return pos3d;
2927
+ }
2891
2928
  var EntityUtils;
2892
2929
  (function (EntityUtils) {
2893
2930
  /**
@@ -2909,6 +2946,9 @@ var EntityUtils;
2909
2946
  let terrainSamples = 0;
2910
2947
  const MAX_VALID_SAMPLES = 20;
2911
2948
  let validSamples = 0;
2949
+ // When in model-space, Assembly Entities are all relative to 0,0 lat/lon.
2950
+ // Which means we have to ignore the location and calculate based on relative position to 0,0.
2951
+ const modelSpace = viewer["nextspace-model-space"] === true;
2912
2952
  const data = {
2913
2953
  pos3d: null,
2914
2954
  rectangle: null,
@@ -3170,8 +3210,9 @@ var EntityUtils;
3170
3210
  * @param sample
3171
3211
  */
3172
3212
  const getRecordEntityPositions = async (sample) => {
3173
- var _a;
3213
+ var _a, _b;
3174
3214
  let { entityId, entity, disallowRendered } = sample;
3215
+ const isAssemblyEntity = ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyRootLocation) != null;
3175
3216
  /**
3176
3217
  * Returns an array of positions from the entity's record.
3177
3218
  */
@@ -3248,38 +3289,59 @@ var EntityUtils;
3248
3289
  }
3249
3290
  return posses;
3250
3291
  };
3251
- const recordPosses = await evaluateRecord();
3252
- if (recordPosses === null || recordPosses === void 0 ? void 0 : recordPosses.length) {
3253
- // See if we can also get the spherical bounds.
3254
- try {
3255
- let pos3d = null;
3256
- const eLocation = Entity$1.GetValue({
3292
+ if (isAssemblyEntity) {
3293
+ let pos3d = calcEntityLocation(entity, modelSpace);
3294
+ if (pos3d) {
3295
+ pos3d = await processPosHeight(pos3d, HeightReference.NONE);
3296
+ const geometryRadius = Entity$1.GetValue({
3257
3297
  entity: entity,
3258
- path: ["Bruce", "Location"]
3298
+ path: ["Bruce", "GeometryRadius"]
3259
3299
  });
3260
- if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyRootLocation) != null) {
3261
- pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3262
- if (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x) {
3263
- pos3d = await processPosHeight(pos3d, HeightReference.NONE);
3300
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3301
+ const sphere = BoundingSphere.fromPoints([pos3d]);
3302
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3303
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3304
+ sphere.radius = geometryRadius;
3305
+ spheres.push(sphere);
3264
3306
  }
3265
- const geometryRadius = Entity$1.GetValue({
3307
+ }
3308
+ return [pos3d];
3309
+ }
3310
+ }
3311
+ else {
3312
+ const recordPosses = await evaluateRecord();
3313
+ if (recordPosses === null || recordPosses === void 0 ? void 0 : recordPosses.length) {
3314
+ // See if we can also get the spherical bounds.
3315
+ try {
3316
+ let pos3d = null;
3317
+ const eLocation = Entity$1.GetValue({
3266
3318
  entity: entity,
3267
- path: ["Bruce", "GeometryRadius"]
3319
+ path: ["Bruce", "Location"]
3268
3320
  });
3269
- if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3270
- const sphere = BoundingSphere.fromPoints([pos3d]);
3271
- // For now making sure it's less than x amount because we had a bug which made it huge.
3272
- if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3273
- sphere.radius = geometryRadius;
3274
- spheres.push(sphere);
3321
+ if ((eLocation === null || eLocation === void 0 ? void 0 : eLocation.longitude) && ((_b = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _b === void 0 ? void 0 : _b.AssemblyRootLocation) != null) {
3322
+ pos3d = Cartesian3.fromDegrees(EnsureNumber(eLocation.longitude), EnsureNumber(eLocation.latitude), EnsureNumber(eLocation.altitude));
3323
+ if (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x) {
3324
+ pos3d = await processPosHeight(pos3d, HeightReference.NONE);
3325
+ }
3326
+ const geometryRadius = Entity$1.GetValue({
3327
+ entity: entity,
3328
+ path: ["Bruce", "GeometryRadius"]
3329
+ });
3330
+ if (geometryRadius && (pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
3331
+ const sphere = BoundingSphere.fromPoints([pos3d]);
3332
+ // For now making sure it's less than x amount because we had a bug which made it huge.
3333
+ if (geometryRadius && geometryRadius < 500 && geometryRadius > 0.1) {
3334
+ sphere.radius = geometryRadius;
3335
+ spheres.push(sphere);
3336
+ }
3275
3337
  }
3276
3338
  }
3277
3339
  }
3340
+ catch (e) {
3341
+ console.error(e);
3342
+ }
3343
+ return recordPosses;
3278
3344
  }
3279
- catch (e) {
3280
- console.error(e);
3281
- }
3282
- return recordPosses;
3283
3345
  }
3284
3346
  return [];
3285
3347
  };
@@ -3443,10 +3505,13 @@ var EntityUtils;
3443
3505
  * @returns
3444
3506
  */
3445
3507
  function GetPos(params) {
3508
+ var _a;
3446
3509
  let { viewer, entity, visualRegister, allowRendered } = params;
3447
3510
  if (allowRendered == null) {
3448
3511
  allowRendered = true;
3449
3512
  }
3513
+ const isModelSpace = viewer["nextspace-model-space"] === true;
3514
+ const isAssemblyEntity = ((_a = entity === null || entity === void 0 ? void 0 : entity.Bruce) === null || _a === void 0 ? void 0 : _a.AssemblyRootLocation) != null;
3450
3515
  function evaluateRendered() {
3451
3516
  const rego = visualRegister ? visualRegister.GetRego({
3452
3517
  entityId: entity.Bruce.ID,
@@ -3492,6 +3557,9 @@ var EntityUtils;
3492
3557
  return null;
3493
3558
  }
3494
3559
  function evaluateRecord() {
3560
+ if (isAssemblyEntity) {
3561
+ return calcEntityLocation(entity, isModelSpace);
3562
+ }
3495
3563
  const location = Entity$1.GetValue({
3496
3564
  entity: entity,
3497
3565
  path: ["Bruce", "Location"]
@@ -15897,7 +15965,7 @@ var TilesetRenderEngine;
15897
15965
  const cTileset = params.cTileset;
15898
15966
  const root = cTileset.root;
15899
15967
  const position = params.position;
15900
- const location = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.location) ? position.ucs.location : position.location;
15968
+ let location = ((_a = position.ucs) === null || _a === void 0 ? void 0 : _a.location) ? position.ucs.location : position.location;
15901
15969
  let transform = position.transform;
15902
15970
  transform = {
15903
15971
  heading: 0,
@@ -15913,6 +15981,10 @@ var TilesetRenderEngine;
15913
15981
  if (transform.scale <= 0) {
15914
15982
  transform.scale = 0.000001;
15915
15983
  }
15984
+ // If we're in model-space we'll just go at 0,0 lat/lon.
15985
+ if (params.modelSpace) {
15986
+ location = null;
15987
+ }
15916
15988
  /**
15917
15989
  * Very cursed.
15918
15990
  */
@@ -16019,20 +16091,18 @@ var TilesetRenderEngine;
16019
16091
  }
16020
16092
  }
16021
16093
  else {
16022
- if ((location === null || location === void 0 ? void 0 : location.latitude) || (location === null || location === void 0 ? void 0 : location.longitude)) {
16023
- const translationMatrix = Matrix4.fromTranslation(new Cartesian3(EnsureNumber(transform.x), EnsureNumber(transform.y), EnsureNumber(transform.z)), new Matrix4());
16024
- const pos3d = Cartesian3.fromDegrees(EnsureNumber(location.longitude), EnsureNumber(location.latitude), EnsureNumber(location.altitude));
16025
- const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
16026
- const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(transform.heading), EnsureNumber(transform.pitch), EnsureNumber(transform.roll), new HeadingPitchRoll());
16027
- const hprRotation = Matrix3.fromHeadingPitchRoll(hpr);
16028
- const scaleMatrix = Matrix4.fromUniformScale(EnsureNumber(transform.scale), new Matrix4());
16029
- let combinedMatrix = Matrix4.multiply(m1, translationMatrix, new Matrix4());
16030
- combinedMatrix = Matrix4.multiply(combinedMatrix, Matrix4.fromRotation(hprRotation), new Matrix4());
16031
- combinedMatrix = Matrix4.multiply(combinedMatrix, scaleMatrix, new Matrix4());
16032
- root.transform = combinedMatrix;
16033
- // Force matrix to update
16034
- root.updateTransform();
16035
- }
16094
+ const translationMatrix = Matrix4.fromTranslation(new Cartesian3(EnsureNumber(transform.x), EnsureNumber(transform.y), EnsureNumber(transform.z)), new Matrix4());
16095
+ const pos3d = Cartesian3.fromDegrees(EnsureNumber(location === null || location === void 0 ? void 0 : location.longitude), EnsureNumber(location === null || location === void 0 ? void 0 : location.latitude), EnsureNumber(location === null || location === void 0 ? void 0 : location.altitude));
16096
+ const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
16097
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(transform.heading), EnsureNumber(transform.pitch), EnsureNumber(transform.roll), new HeadingPitchRoll());
16098
+ const hprRotation = Matrix3.fromHeadingPitchRoll(hpr);
16099
+ const scaleMatrix = Matrix4.fromUniformScale(EnsureNumber(transform.scale), new Matrix4());
16100
+ let combinedMatrix = Matrix4.multiply(m1, translationMatrix, new Matrix4());
16101
+ combinedMatrix = Matrix4.multiply(combinedMatrix, Matrix4.fromRotation(hprRotation), new Matrix4());
16102
+ combinedMatrix = Matrix4.multiply(combinedMatrix, scaleMatrix, new Matrix4());
16103
+ root.transform = combinedMatrix;
16104
+ // Force matrix to update
16105
+ root.updateTransform();
16036
16106
  }
16037
16107
  // Store data in the tileset as we can't interpret it using the cesium primitive later.
16038
16108
  const cTilesetExt = cTileset;
@@ -16110,7 +16180,8 @@ var TilesetRenderEngine;
16110
16180
  ucs: (_b = params.coords) === null || _b === void 0 ? void 0 : _b.ucs,
16111
16181
  location: ((_c = params.coords) === null || _c === void 0 ? void 0 : _c.location) == null ? settings.location : params.coords.location,
16112
16182
  transform: ((_d = params.coords) === null || _d === void 0 ? void 0 : _d.transform) == null ? settings.transform : params.coords.transform
16113
- }
16183
+ },
16184
+ modelSpace: params.modelSpace
16114
16185
  });
16115
16186
  params.viewer.scene.requestRender();
16116
16187
  }
@@ -17368,6 +17439,9 @@ var TilesetCadRenderManager;
17368
17439
  get Disposed() {
17369
17440
  return this.disposed;
17370
17441
  }
17442
+ get ModelSpace() {
17443
+ return this.modelSpace;
17444
+ }
17371
17445
  get Tileset() {
17372
17446
  return this.cTileset;
17373
17447
  }
@@ -17376,6 +17450,7 @@ var TilesetCadRenderManager;
17376
17450
  }
17377
17451
  constructor(params) {
17378
17452
  this.disposed = false;
17453
+ this.modelSpace = false;
17379
17454
  this.cTileset = null;
17380
17455
  this.styler = new TilesetRenderEngine.Styler();
17381
17456
  // Quick look-up of the model tree nodes by entity/geomId.
@@ -17396,11 +17471,12 @@ var TilesetCadRenderManager;
17396
17471
  this.historicPosses = [];
17397
17472
  this.historicAnimation = null;
17398
17473
  this.historicPossesLoadingProm = null;
17399
- const { viewer, register: visualsManager, getters, item } = params;
17474
+ const { viewer, register: visualsManager, getters, item, modelSpace } = params;
17400
17475
  this.viewer = viewer;
17401
17476
  this.getters = getters;
17402
17477
  this.item = item;
17403
17478
  this.visualsManager = visualsManager;
17479
+ this.modelSpace = Boolean(modelSpace);
17404
17480
  }
17405
17481
  Init() {
17406
17482
  var _a, _b;
@@ -17502,7 +17578,8 @@ var TilesetCadRenderManager;
17502
17578
  coords: coords,
17503
17579
  accountId: accountId,
17504
17580
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled),
17505
- noMemoryLimit: this.item["noMaximumMemory"]
17581
+ noMemoryLimit: this.item["noMaximumMemory"],
17582
+ modelSpace: this.modelSpace
17506
17583
  });
17507
17584
  if (this.disposed) {
17508
17585
  this.doDispose();
@@ -17610,7 +17687,7 @@ var TilesetCadRenderManager;
17610
17687
  mapTilesetFeature(feature, add) {
17611
17688
  var _a, _b, _c, _d, _e;
17612
17689
  const accountId = (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId();
17613
- const canEdit = accountId === this.getters.GetAccountId();
17690
+ const canEdit = accountId === this.getters.GetAccountId() && !this.modelSpace;
17614
17691
  let rego = {
17615
17692
  canEdit: canEdit,
17616
17693
  entityId: null,
@@ -21329,15 +21406,20 @@ var AssemblyRenderManager;
21329
21406
  get Disposed() {
21330
21407
  return this.disposed;
21331
21408
  }
21409
+ get ModelSpace() {
21410
+ return this.modelSpace;
21411
+ }
21332
21412
  constructor(params) {
21333
21413
  this.disposed = false;
21334
21414
  // Cache of the hierarchy so that our scene-tree can reference it.
21335
21415
  this.hierarchy = null;
21416
+ this.modelSpace = false;
21336
21417
  const { viewer, register: visualsManager, getters, item } = params;
21337
21418
  this.viewer = viewer;
21338
21419
  this.getters = getters;
21339
21420
  this.item = item;
21340
21421
  this.visualsManager = visualsManager;
21422
+ this.modelSpace = Boolean(params.modelSpace);
21341
21423
  }
21342
21424
  Init() {
21343
21425
  this.renderPriority = this.item.renderPriority;
@@ -21400,7 +21482,7 @@ var AssemblyRenderManager;
21400
21482
  // Won't bother with vector data for this experiment.
21401
21483
  continue;
21402
21484
  }
21403
- const pos3d = calcEntityLocation(entity);
21485
+ const pos3d = calcEntityLocation$1(entity, this.modelSpace);
21404
21486
  const orient = calcEntityOrientation(entity, pos3d);
21405
21487
  if (!pos3d || !orient) {
21406
21488
  continue;
@@ -21462,10 +21544,12 @@ var AssemblyRenderManager;
21462
21544
  AssemblyRenderManager.Manager = Manager;
21463
21545
  })(AssemblyRenderManager || (AssemblyRenderManager = {}));
21464
21546
  const axis_shift = new Quaternion(0, 0, -Math.SQRT1_2, Math.SQRT1_2);
21465
- function calcEntityLocation(entity) {
21466
- const aRootLocation = entity.Bruce.AssemblyRootLocation;
21467
- if (!(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude) || !aRootLocation.latitude) {
21468
- return null;
21547
+ function calcEntityLocation$1(entity, modelSpace) {
21548
+ let aRootLocation = entity.Bruce.AssemblyRootLocation;
21549
+ // If we're in model-space we cull location.
21550
+ // This puts it at 0,0 lat/lon which we treat as 0,0,0 for model-space viewing.
21551
+ if (modelSpace) {
21552
+ aRootLocation = null;
21469
21553
  }
21470
21554
  const worldPosition = entity.Bruce.AssemblyWorldPosition;
21471
21555
  if (!worldPosition) {
@@ -21489,9 +21573,9 @@ function calcEntityLocation(entity) {
21489
21573
  }
21490
21574
  }
21491
21575
  }
21492
- let pos3d = Cartesian3.fromDegrees(aRootLocation.longitude, aRootLocation.latitude, aRootLocation.altitude || 0);
21576
+ let pos3d = Cartesian3.fromDegrees(EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.longitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.latitude), EnsureNumber(aRootLocation === null || aRootLocation === void 0 ? void 0 : aRootLocation.altitude));
21493
21577
  const m1 = Transforms.eastNorthUpToFixedFrame(pos3d);
21494
- const hpr = HeadingPitchRoll.fromDegrees(heading, pitch, roll, new HeadingPitchRoll());
21578
+ const hpr = HeadingPitchRoll.fromDegrees(EnsureNumber(heading), EnsureNumber(pitch), EnsureNumber(roll), new HeadingPitchRoll());
21495
21579
  const transform = Matrix3.fromHeadingPitchRoll(hpr);
21496
21580
  const transformedOffset = Matrix3.multiplyByVector(transform, offset, new Cartesian3());
21497
21581
  pos3d = Matrix4.multiplyByPoint(m1, transformedOffset, new Cartesian3());
@@ -21595,7 +21679,7 @@ var MenuItemManager;
21595
21679
  * @returns
21596
21680
  */
21597
21681
  RenderItem(params) {
21598
- var _a, _b, _c, _d;
21682
+ var _a, _b, _c, _d, _e;
21599
21683
  if (this.viewer.isDestroyed()) {
21600
21684
  return null;
21601
21685
  }
@@ -21612,7 +21696,11 @@ var MenuItemManager;
21612
21696
  else if (!params.apiGetter) {
21613
21697
  params.apiGetter = params.getters.GetBruceGetter();
21614
21698
  }
21699
+ if (params.modelSpace == null) {
21700
+ params.modelSpace = false;
21701
+ }
21615
21702
  let rItem = this.items.find(x => x.id == params.item.id);
21703
+ let create = true;
21616
21704
  if (rItem) {
21617
21705
  // This means we're updating a tag menu item.
21618
21706
  // Tag menu items have alternative states based on bookmark settings.
@@ -21625,6 +21713,7 @@ var MenuItemManager;
21625
21713
  });
21626
21714
  rItem.item = params.item;
21627
21715
  }
21716
+ create = false;
21628
21717
  }
21629
21718
  // This means we're updating a entities tileset menu item.
21630
21719
  // These have different point scaling settings based on bookmark settings.
@@ -21633,6 +21722,7 @@ var MenuItemManager;
21633
21722
  item: params.item,
21634
21723
  });
21635
21724
  rItem.item = params.item;
21725
+ create = false;
21636
21726
  }
21637
21727
  // This means we're updating a rendered relationships menu item.
21638
21728
  // Eg: different entities need to be rendered, or one of the relationship data entities changed.
@@ -21642,6 +21732,7 @@ var MenuItemManager;
21642
21732
  item: params.item,
21643
21733
  });
21644
21734
  rItem.item = params.item;
21735
+ create = false;
21645
21736
  }
21646
21737
  // This means we're updating a rendered relationships menu item.
21647
21738
  // Eg: different entities need to be rendered, or one of the relationship data entities changed.
@@ -21650,17 +21741,50 @@ var MenuItemManager;
21650
21741
  item: params.item,
21651
21742
  });
21652
21743
  rItem.item = params.item;
21744
+ create = false;
21745
+ }
21746
+ // Re-init in case model-space changed to geo-spatial or vice-versa.
21747
+ else if (rItem.type == MenuItem.EType.CadTileset && params.item.Type == MenuItem.EType.CadTileset) {
21748
+ if (rItem.renderManager && rItem.renderManager.ModelSpace == params.modelSpace) {
21749
+ create = false;
21750
+ }
21751
+ }
21752
+ // Re-init in case model-space changed to geo-spatial or vice-versa.
21753
+ else if (rItem.type == MenuItem.EType.Assembly && params.item.Type == MenuItem.EType.Assembly) {
21754
+ if (rItem.renderManager && rItem.renderManager.ModelSpace == params.modelSpace) {
21755
+ create = false;
21756
+ }
21757
+ }
21758
+ else if (rItem.type != params.item.Type) {
21759
+ create = true;
21760
+ }
21761
+ if (create) {
21762
+ try {
21763
+ (_b = rItem.renderManager) === null || _b === void 0 ? void 0 : _b.Dispose();
21764
+ }
21765
+ catch (e) {
21766
+ console.error(e);
21767
+ }
21768
+ this.items = this.items.filter(x => x.id !== rItem.id);
21653
21769
  }
21654
21770
  }
21655
- else {
21656
- rItem = {
21657
- id: (_b = params.item.id) !== null && _b !== void 0 ? _b : ObjectUtils.UId(),
21658
- childIds: [],
21659
- item: params.item,
21660
- renderManager: null,
21661
- type: params.item.Type,
21662
- errors: []
21663
- };
21771
+ if (create) {
21772
+ if (!rItem) {
21773
+ rItem = {
21774
+ id: (_c = params.item.id) !== null && _c !== void 0 ? _c : ObjectUtils.UId(),
21775
+ childIds: [],
21776
+ item: params.item,
21777
+ renderManager: null,
21778
+ type: params.item.Type,
21779
+ errors: []
21780
+ };
21781
+ }
21782
+ else {
21783
+ rItem.item = params.item;
21784
+ rItem.type = params.item.Type;
21785
+ rItem.renderManager = null;
21786
+ rItem.errors = [];
21787
+ }
21664
21788
  this.items.push(rItem);
21665
21789
  if (!params.item.Type) {
21666
21790
  params.item.Type = MenuItem.EType.None;
@@ -21708,7 +21832,8 @@ var MenuItemManager;
21708
21832
  viewer: this.viewer,
21709
21833
  register: this.visualsRegister,
21710
21834
  getters: params.getters,
21711
- item: params.item
21835
+ item: params.item,
21836
+ modelSpace: params.modelSpace,
21712
21837
  });
21713
21838
  break;
21714
21839
  case MenuItem.EType.Assembly:
@@ -21716,7 +21841,8 @@ var MenuItemManager;
21716
21841
  viewer: this.viewer,
21717
21842
  register: this.visualsRegister,
21718
21843
  getters: params.getters,
21719
- item: params.item
21844
+ item: params.item,
21845
+ modelSpace: params.modelSpace,
21720
21846
  });
21721
21847
  break;
21722
21848
  case MenuItem.EType.Osm:
@@ -21844,8 +21970,8 @@ var MenuItemManager;
21844
21970
  rItem.childIds.push(childId);
21845
21971
  }
21846
21972
  }
21847
- if (rItem.renderManager && !((_c = rItem.renderManager) === null || _c === void 0 ? void 0 : _c.Disposed)) {
21848
- (_d = this.onUpdate) === null || _d === void 0 ? void 0 : _d.Trigger({ isEnabling: true, itemId: rItem.id });
21973
+ if (rItem.renderManager && !((_d = rItem.renderManager) === null || _d === void 0 ? void 0 : _d.Disposed)) {
21974
+ (_e = this.onUpdate) === null || _e === void 0 ? void 0 : _e.Trigger({ isEnabling: true, itemId: rItem.id });
21849
21975
  }
21850
21976
  return rItem.id;
21851
21977
  }
@@ -22923,7 +23049,7 @@ var MenuItemCreator;
22923
23049
  }
22924
23050
  MenuItemCreator.RenderTileset = RenderTileset;
22925
23051
  async function RenderBookmarkItems(params) {
22926
- var _a;
23052
+ var _a, _b;
22927
23053
  let { viewId, bookmarkId, apiGetter, getters, manager, viewer } = params;
22928
23054
  if (!getters) {
22929
23055
  getters = ENVIRONMENT.Api();
@@ -22970,10 +23096,19 @@ var MenuItemCreator;
22970
23096
  enabledIds = bSettings.selectedItemIds;
22971
23097
  }
22972
23098
  }
22973
- let alternations = (_a = bookmark.Settings) === null || _a === void 0 ? void 0 : _a.menuItemAlternations;
23099
+ const bSettings = bookmark.Settings;
23100
+ const defaults = (_a = view.Settings) === null || _a === void 0 ? void 0 : _a.defaults;
23101
+ let alternations = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemAlternations;
22974
23102
  if (!alternations) {
22975
23103
  alternations = {};
22976
23104
  }
23105
+ let contentType = bSettings.contentType;
23106
+ if (!contentType && ((_b = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _b === void 0 ? void 0 : _b.contentType)) {
23107
+ contentType = defaults.settings.contentType;
23108
+ }
23109
+ if (contentType == null) {
23110
+ contentType = ProjectViewBookmark.EContentType.WEB_3D;
23111
+ }
22977
23112
  const renderedItemIds = [];
22978
23113
  if ((menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) && (enabledIds === null || enabledIds === void 0 ? void 0 : enabledIds.length)) {
22979
23114
  const traverseItems = async (item) => {
@@ -23001,7 +23136,8 @@ var MenuItemCreator;
23001
23136
  if (enabledIds.includes(item.id)) {
23002
23137
  const itemId = await manager.RenderItem({
23003
23138
  item: item,
23004
- getters: getters
23139
+ getters: getters,
23140
+ modelSpace: contentType === ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE
23005
23141
  });
23006
23142
  renderedItemIds.push(itemId);
23007
23143
  }
@@ -24910,6 +25046,9 @@ const ITERATION_KEY$1 = "nextspace-view-render-engine-iteration";
24910
25046
  // 1- new accounts get our token set.
24911
25047
  // 2- we reference to the template account's token.
24912
25048
  const CESIUM_DEFAULT_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiODI1OWQyZC0wYzdlLTRlOTctODFlOC1kYjIwOGYzOWE0NGIiLCJpZCI6MTE3NDg0LCJpYXQiOjE2NzAzODczOTR9.sx0EZdD-Y33FQ7gB_R3CkTsk3KhNpODoQGrnpvSH4UQ";
25049
+ // Model-space flag so we know if we're changing from and to model-space.
25050
+ // This helps determine if we should instantly transition.
25051
+ const MODEL_SPACE_FLAG = "nextspace-model-space";
24913
25052
  /**
24914
25053
  * Creates a new iteration state.
24915
25054
  * This will stop any existing renders from processing to their end.
@@ -25074,7 +25213,7 @@ async function renderLegacyNavigator(iteration, params, bookmark, view) {
25074
25213
  * @param view
25075
25214
  */
25076
25215
  async function renderNavigator(iteration, params, bookmark, view, getters) {
25077
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
25216
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
25078
25217
  const viewer = params.manager.Viewer;
25079
25218
  const scene = viewer.scene;
25080
25219
  let cTokenSet = Ion.defaultAccessToken ? await ViewerUtils.AssertIonToken(Ion.defaultAccessToken) : false;
@@ -25110,21 +25249,28 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25110
25249
  const vSettings = view.Settings;
25111
25250
  const bSettings = ((_a = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Settings) !== null && _a !== void 0 ? _a : {});
25112
25251
  const defaults = (_b = vSettings.defaults) !== null && _b !== void 0 ? _b : {};
25113
- let camera = ((_c = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Camera) !== null && _c !== void 0 ? _c : {});
25252
+ let contentType = bSettings.contentType;
25253
+ if (!contentType && ((_c = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _c === void 0 ? void 0 : _c.contentType)) {
25254
+ contentType = defaults.settings.contentType;
25255
+ }
25256
+ if (contentType == null) {
25257
+ contentType = ProjectViewBookmark.EContentType.WEB_3D;
25258
+ }
25259
+ let camera = ((_d = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Camera) !== null && _d !== void 0 ? _d : {});
25114
25260
  if (!Carto.ValidateCarto(camera)) {
25115
25261
  camera = {
25116
25262
  ...camera,
25117
- altitude: (_d = defaults.camera) === null || _d === void 0 ? void 0 : _d.altitude,
25118
- latitude: (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.latitude,
25119
- longitude: (_f = defaults.camera) === null || _f === void 0 ? void 0 : _f.longitude,
25120
- heading: (_g = defaults.camera) === null || _g === void 0 ? void 0 : _g.heading,
25121
- pitch: (_h = defaults.camera) === null || _h === void 0 ? void 0 : _h.pitch,
25122
- roll: (_j = defaults.camera) === null || _j === void 0 ? void 0 : _j.roll
25263
+ altitude: (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.altitude,
25264
+ latitude: (_f = defaults.camera) === null || _f === void 0 ? void 0 : _f.latitude,
25265
+ longitude: (_g = defaults.camera) === null || _g === void 0 ? void 0 : _g.longitude,
25266
+ heading: (_h = defaults.camera) === null || _h === void 0 ? void 0 : _h.heading,
25267
+ pitch: (_j = defaults.camera) === null || _j === void 0 ? void 0 : _j.pitch,
25268
+ roll: (_k = defaults.camera) === null || _k === void 0 ? void 0 : _k.roll
25123
25269
  };
25124
25270
  }
25125
25271
  let newLens = camera.cameraFrustum;
25126
25272
  if (newLens == null) {
25127
- newLens = (_k = defaults.camera) === null || _k === void 0 ? void 0 : _k.cameraFrustum;
25273
+ newLens = (_l = defaults.camera) === null || _l === void 0 ? void 0 : _l.cameraFrustum;
25128
25274
  }
25129
25275
  if (newLens == null) {
25130
25276
  // TODO: Need global default.
@@ -25144,7 +25290,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25144
25290
  if (!params.skipCamera) {
25145
25291
  let transition = params.skipTransition ? 0 : shouldBe2d === curIs2d ? camera.transition : 0;
25146
25292
  if (transition == null) {
25147
- transition = (_l = defaults.camera) === null || _l === void 0 ? void 0 : _l.transition;
25293
+ transition = (_m = defaults.camera) === null || _m === void 0 ? void 0 : _m.transition;
25148
25294
  }
25149
25295
  if (transition == null) {
25150
25296
  // TODO: Need global default.
@@ -25152,6 +25298,20 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25152
25298
  }
25153
25299
  if (Carto.ValidateCarto(camera)) {
25154
25300
  const pos = Cartesian3.fromDegrees(+camera.longitude, +camera.latitude, +camera.altitude);
25301
+ if (
25302
+ // Moving into model-space.
25303
+ (contentType == ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE) ||
25304
+ // Moving away from model-space.
25305
+ // @ts-expect-error
25306
+ (contentType != ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE && viewer[MODEL_SPACE_FLAG] == true)) {
25307
+ const cameraPos3d = viewer.camera.position;
25308
+ if (!cameraPos3d || (cameraPos3d.x == 0 && cameraPos3d.y == 0 && cameraPos3d.z == 0)) {
25309
+ transition = 0;
25310
+ }
25311
+ else if (Cartesian3.distance(cameraPos3d, pos) > 10000) {
25312
+ transition = 0;
25313
+ }
25314
+ }
25155
25315
  scene.camera.flyTo({
25156
25316
  destination: pos,
25157
25317
  orientation: {
@@ -25165,7 +25325,8 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25165
25325
  });
25166
25326
  }
25167
25327
  }
25168
- let terrain = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain) != null ? bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain : (_m = defaults.settings) === null || _m === void 0 ? void 0 : _m.terrain;
25328
+ viewer[MODEL_SPACE_FLAG] = contentType == ProjectViewBookmark.EContentType.WEB_3D_MODEL_SPACE;
25329
+ let terrain = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain) != null ? bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrain : (_o = defaults.settings) === null || _o === void 0 ? void 0 : _o.terrain;
25169
25330
  if (terrain) {
25170
25331
  // If there is no Cesium token set then we'll swap cesium terrain to flat terrain.
25171
25332
  // This allows a scene to render even if it's not the correct one.
@@ -25188,7 +25349,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25188
25349
  }
25189
25350
  let hillShades = bSettings === null || bSettings === void 0 ? void 0 : bSettings.hillShades;
25190
25351
  if (hillShades == null) {
25191
- hillShades = (_o = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _o === void 0 ? void 0 : _o.hillShades;
25352
+ hillShades = (_p = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _p === void 0 ? void 0 : _p.hillShades;
25192
25353
  }
25193
25354
  if (hillShades == null) {
25194
25355
  hillShades = true;
@@ -25196,7 +25357,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25196
25357
  scene.globe.enableLighting = Boolean(hillShades);
25197
25358
  let baseColor = bSettings === null || bSettings === void 0 ? void 0 : bSettings.globeColor;
25198
25359
  if (baseColor == null) {
25199
- baseColor = (_p = defaults.settings) === null || _p === void 0 ? void 0 : _p.globeColor;
25360
+ baseColor = (_q = defaults.settings) === null || _q === void 0 ? void 0 : _q.globeColor;
25200
25361
  }
25201
25362
  if (baseColor == null) {
25202
25363
  // TODO: Need global default.
@@ -25205,7 +25366,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25205
25366
  scene.globe.baseColor = Color.fromCssColorString(baseColor);
25206
25367
  let globeHidden = bSettings === null || bSettings === void 0 ? void 0 : bSettings.globeHidden;
25207
25368
  if (globeHidden == null) {
25208
- globeHidden = (_q = defaults.settings) === null || _q === void 0 ? void 0 : _q.globeHidden;
25369
+ globeHidden = (_r = defaults.settings) === null || _r === void 0 ? void 0 : _r.globeHidden;
25209
25370
  }
25210
25371
  if (globeHidden == null) {
25211
25372
  globeHidden = false;
@@ -25213,7 +25374,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25213
25374
  scene.globe.show = !globeHidden;
25214
25375
  let terrainWireframe = bSettings === null || bSettings === void 0 ? void 0 : bSettings.terrainWireframe;
25215
25376
  if (terrainWireframe == null) {
25216
- terrainWireframe = (_r = defaults.settings) === null || _r === void 0 ? void 0 : _r.terrainWireframe;
25377
+ terrainWireframe = (_s = defaults.settings) === null || _s === void 0 ? void 0 : _s.terrainWireframe;
25217
25378
  }
25218
25379
  if (terrainWireframe == null) {
25219
25380
  terrainWireframe = false;
@@ -25224,7 +25385,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25224
25385
  });
25225
25386
  let globeAlpha = +(bSettings === null || bSettings === void 0 ? void 0 : bSettings.globeAlpha);
25226
25387
  if (isNaN(globeAlpha)) {
25227
- globeAlpha = +((_s = defaults.settings) === null || _s === void 0 ? void 0 : _s.globeAlpha);
25388
+ globeAlpha = +((_t = defaults.settings) === null || _t === void 0 ? void 0 : _t.globeAlpha);
25228
25389
  }
25229
25390
  if (!scene.globe.translucency.enabled) {
25230
25391
  scene.globe.translucency.enabled = true;
@@ -25234,7 +25395,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25234
25395
  scene.globe.translucency.frontFaceAlphaByDistance.nearValue = EnsureNumber(globeAlpha, 1);
25235
25396
  let shadows = bSettings === null || bSettings === void 0 ? void 0 : bSettings.shadows;
25236
25397
  if (shadows == null) {
25237
- shadows = (_t = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _t === void 0 ? void 0 : _t.shadows;
25398
+ shadows = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.shadows;
25238
25399
  }
25239
25400
  if (shadows == null) {
25240
25401
  shadows = {
@@ -25255,7 +25416,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25255
25416
  viewer.shadowMap.darkness = EnsureNumber(shadows.darkness, 0.3);
25256
25417
  let ambientOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.ambientOcclusion;
25257
25418
  if (ambientOcclusion == null) {
25258
- ambientOcclusion = (_u = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _u === void 0 ? void 0 : _u.ambientOcclusion;
25419
+ ambientOcclusion = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.ambientOcclusion;
25259
25420
  }
25260
25421
  if (ambientOcclusion == null) {
25261
25422
  ambientOcclusion = {
@@ -25278,7 +25439,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25278
25439
  }
25279
25440
  let lighting = bSettings === null || bSettings === void 0 ? void 0 : bSettings.lighting;
25280
25441
  if (lighting == null) {
25281
- lighting = (_v = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _v === void 0 ? void 0 : _v.lighting;
25442
+ lighting = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.lighting;
25282
25443
  }
25283
25444
  if (lighting == null) {
25284
25445
  lighting = {
@@ -25293,7 +25454,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25293
25454
  }
25294
25455
  let quality = bSettings === null || bSettings === void 0 ? void 0 : bSettings.quality;
25295
25456
  if (quality == null) {
25296
- quality = (_w = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _w === void 0 ? void 0 : _w.quality;
25457
+ quality = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.quality;
25297
25458
  }
25298
25459
  if (quality == null) {
25299
25460
  quality = {
@@ -25304,11 +25465,11 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25304
25465
  fxaa.enabled = Boolean(quality.fxaa);
25305
25466
  let dateTime = bSettings === null || bSettings === void 0 ? void 0 : bSettings.dateTime;
25306
25467
  if (dateTime == null) {
25307
- dateTime = (_x = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _x === void 0 ? void 0 : _x.dateTime;
25468
+ dateTime = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.dateTime;
25308
25469
  }
25309
25470
  let timeline = bSettings === null || bSettings === void 0 ? void 0 : bSettings.timeline;
25310
25471
  if (timeline == null) {
25311
- timeline = (_y = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _y === void 0 ? void 0 : _y.timeline;
25472
+ timeline = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.timeline;
25312
25473
  }
25313
25474
  if (timeline == null) {
25314
25475
  timeline = {
@@ -25332,7 +25493,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25332
25493
  // Newer version that has states per Entity ID + Menu Item ID.
25333
25494
  let states = bSettings === null || bSettings === void 0 ? void 0 : bSettings.states;
25334
25495
  if (states == null) {
25335
- states = (_z = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _z === void 0 ? void 0 : _z.states;
25496
+ states = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.states;
25336
25497
  }
25337
25498
  if (states != null) {
25338
25499
  params.manager.VisualsRegister.OverrideStates(states);
@@ -25341,7 +25502,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25341
25502
  else {
25342
25503
  let selectedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.selectedEntityIds;
25343
25504
  if (selectedIds == null) {
25344
- selectedIds = (_0 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _0 === void 0 ? void 0 : _0.selectedEntityIds;
25505
+ selectedIds = (_1 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _1 === void 0 ? void 0 : _1.selectedEntityIds;
25345
25506
  }
25346
25507
  if (selectedIds != null) {
25347
25508
  params.manager.VisualsRegister.ClearSelected();
@@ -25355,7 +25516,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25355
25516
  params.manager.VisualsRegister.ClearHidden();
25356
25517
  let hiddenIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.hiddenEntityIds;
25357
25518
  if (hiddenIds == null) {
25358
- hiddenIds = (_1 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _1 === void 0 ? void 0 : _1.hiddenEntityIds;
25519
+ hiddenIds = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.hiddenEntityIds;
25359
25520
  }
25360
25521
  if (hiddenIds != null) {
25361
25522
  params.manager.VisualsRegister.SetHidden({
@@ -25367,7 +25528,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25367
25528
  params.manager.VisualsRegister.ClearIsolated();
25368
25529
  let isolatedIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.isolatedEntityIds;
25369
25530
  if (isolatedIds == null) {
25370
- isolatedIds = (_2 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _2 === void 0 ? void 0 : _2.isolatedEntityIds;
25531
+ isolatedIds = (_3 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _3 === void 0 ? void 0 : _3.isolatedEntityIds;
25371
25532
  }
25372
25533
  if (isolatedIds != null) {
25373
25534
  params.manager.VisualsRegister.SetIsolated({
@@ -25378,7 +25539,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25378
25539
  }
25379
25540
  let labelledIds = bSettings === null || bSettings === void 0 ? void 0 : bSettings.labelledEntityIds;
25380
25541
  if (labelledIds == null) {
25381
- labelledIds = (_3 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _3 === void 0 ? void 0 : _3.labelledEntityIds;
25542
+ labelledIds = (_4 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _4 === void 0 ? void 0 : _4.labelledEntityIds;
25382
25543
  }
25383
25544
  if (!(labelledIds === null || labelledIds === void 0 ? void 0 : labelledIds.length)) {
25384
25545
  params.manager.VisualsRegister.ClearLabelled({
@@ -25402,7 +25563,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25402
25563
  params.manager.VisualsRegister.ClearOpacity();
25403
25564
  let entityOpacityMap = bSettings === null || bSettings === void 0 ? void 0 : bSettings.entityOpacityMap;
25404
25565
  if (entityOpacityMap == null) {
25405
- entityOpacityMap = (_4 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _4 === void 0 ? void 0 : _4.entityOpacityMap;
25566
+ entityOpacityMap = (_5 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _5 === void 0 ? void 0 : _5.entityOpacityMap;
25406
25567
  }
25407
25568
  if (entityOpacityMap != null) {
25408
25569
  for (const entityId in entityOpacityMap) {
@@ -25417,7 +25578,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25417
25578
  }
25418
25579
  }
25419
25580
  }
25420
- let imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_5 = defaults.settings) === null || _5 === void 0 ? void 0 : _5.imagery;
25581
+ let imagery = (bSettings === null || bSettings === void 0 ? void 0 : bSettings.imagery) != null ? bSettings.imagery : (_6 = defaults.settings) === null || _6 === void 0 ? void 0 : _6.imagery;
25421
25582
  if (imagery == null) {
25422
25583
  // TODO: Need global default.
25423
25584
  imagery = [
@@ -25478,11 +25639,13 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25478
25639
  relations = [];
25479
25640
  }
25480
25641
  viewer.scene.requestRender();
25642
+ // TODO: When in model-space we should remove all unsupported items.
25643
+ // This prevents junk settings causing problems.
25481
25644
  // Only disable menu items we don't want.
25482
25645
  // Otherwise we cause a flicker of rendered graphics.
25483
25646
  // Maybe TODO to such a function for menu item manager.
25484
25647
  const curEnabled = params.manager.GetEnabledItemIds();
25485
- const newItemIds = (_6 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _6 !== void 0 ? _6 : [];
25648
+ const newItemIds = (_7 = bSettings === null || bSettings === void 0 ? void 0 : bSettings.menuItemIds) !== null && _7 !== void 0 ? _7 : [];
25486
25649
  for (const id of curEnabled) {
25487
25650
  let shouldRemove;
25488
25651
  if (id == RELATION_MENU_ITEM_ID) {
@@ -25553,7 +25716,7 @@ async function renderNavigator(iteration, params, bookmark, view, getters) {
25553
25716
  }
25554
25717
  let gOcclusion = bSettings === null || bSettings === void 0 ? void 0 : bSettings.groundOcclusion;
25555
25718
  if (gOcclusion == null) {
25556
- gOcclusion = (_7 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _7 === void 0 ? void 0 : _7.groundOcclusion;
25719
+ gOcclusion = (_8 = defaults === null || defaults === void 0 ? void 0 : defaults.settings) === null || _8 === void 0 ? void 0 : _8.groundOcclusion;
25557
25720
  }
25558
25721
  if (gOcclusion == null) {
25559
25722
  // TODO: Need global default.
@@ -31458,7 +31621,7 @@ class WidgetViewBar extends Widget.AWidget {
31458
31621
  }
31459
31622
  }
31460
31623
 
31461
- const VERSION = "5.5.6";
31624
+ const VERSION = "5.5.8";
31462
31625
 
31463
31626
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isHistoricMetadataChanged, 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 };
31464
31627
  //# sourceMappingURL=bruce-cesium.es5.js.map