bruce-cesium 5.3.2 → 5.3.3

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.
@@ -10667,18 +10667,7 @@
10667
10667
  return state.isolated === true;
10668
10668
  }
10669
10669
  GetIsIsolatedAny() {
10670
- const entityIds = Object.keys(this.states);
10671
- for (let i = 0; i < entityIds.length; i++) {
10672
- const state = this.states[entityIds[i]];
10673
- const menuItemIds = state ? Object.keys(state) : [];
10674
- for (let j = 0; j < menuItemIds.length; j++) {
10675
- const menuItemId = menuItemIds[j];
10676
- if (state[menuItemId].isolated) {
10677
- return true;
10678
- }
10679
- }
10680
- }
10681
- return false;
10670
+ return Object.values(this.states).some(state => state && Object.values(state).some(item => item.isolated));
10682
10671
  }
10683
10672
  /**
10684
10673
  * @deprecated Use GetStates() or GetState().
@@ -24495,6 +24484,100 @@
24495
24484
  }
24496
24485
  }
24497
24486
  ViewRenderEngine.Render = Render;
24487
+ /**
24488
+ * Moves the camera to a given view + bookmark.
24489
+ * @param params
24490
+ */
24491
+ async function FlyTo(params) {
24492
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24493
+ if (!params.manager && params.viewer) {
24494
+ params.manager = exports.ViewerUtils.GetManager({
24495
+ viewer: params.viewer,
24496
+ createIfMissing: true
24497
+ });
24498
+ }
24499
+ else if (!params.viewer && params.manager) {
24500
+ params.viewer = params.manager.Viewer;
24501
+ }
24502
+ if (!params.getters) {
24503
+ params.getters = BModels.ENVIRONMENT.Api();
24504
+ }
24505
+ const api = params.getters.GetBruceApi();
24506
+ const view = params.view ? params.view : (await BModels.ProjectView.Get({
24507
+ api,
24508
+ viewId: params.viewId
24509
+ })).view;
24510
+ let bookmark = params.bookmark;
24511
+ if (!bookmark) {
24512
+ let bookmarkId = params.bookmarkId;
24513
+ if (!bookmarkId) {
24514
+ bookmarkId = view.DefaultUISlideID;
24515
+ }
24516
+ bookmark = bookmarkId ? (await BModels.ProjectViewBookmark.Get({
24517
+ api,
24518
+ viewId: params.viewId,
24519
+ bookmarkId: bookmarkId
24520
+ })).bookmark : null;
24521
+ }
24522
+ const viewer = params.manager.Viewer;
24523
+ const scene = viewer.scene;
24524
+ const vSettings = view.Settings;
24525
+ const defaults = (_a = vSettings.defaults) !== null && _a !== void 0 ? _a : {};
24526
+ let camera = ((_b = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Camera) !== null && _b !== void 0 ? _b : {});
24527
+ if (!BModels.Carto.ValidateCarto(camera)) {
24528
+ camera = {
24529
+ ...camera,
24530
+ altitude: (_c = defaults.camera) === null || _c === void 0 ? void 0 : _c.altitude,
24531
+ latitude: (_d = defaults.camera) === null || _d === void 0 ? void 0 : _d.latitude,
24532
+ longitude: (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.longitude,
24533
+ heading: (_f = defaults.camera) === null || _f === void 0 ? void 0 : _f.heading,
24534
+ pitch: (_g = defaults.camera) === null || _g === void 0 ? void 0 : _g.pitch,
24535
+ roll: (_h = defaults.camera) === null || _h === void 0 ? void 0 : _h.roll
24536
+ };
24537
+ }
24538
+ let newLens = camera.cameraFrustum;
24539
+ if (newLens == null) {
24540
+ newLens = (_j = defaults.camera) === null || _j === void 0 ? void 0 : _j.cameraFrustum;
24541
+ }
24542
+ if (newLens == null) {
24543
+ // TODO: Need global default.
24544
+ newLens = BModels.Camera.EFrustum.Perspective;
24545
+ }
24546
+ const shouldBe2d = newLens == BModels.Camera.EFrustum.Orthographic;
24547
+ const curIs2d = exports.ViewUtils.Get2dStatus({
24548
+ viewer
24549
+ });
24550
+ if (shouldBe2d != curIs2d) {
24551
+ exports.ViewUtils.Set2dStatus({
24552
+ status: shouldBe2d,
24553
+ viewer,
24554
+ moveCamera: false
24555
+ });
24556
+ }
24557
+ let transition = params.skipTransition ? 0 : shouldBe2d === curIs2d ? camera.transition : 0;
24558
+ if (transition == null) {
24559
+ transition = (_k = defaults.camera) === null || _k === void 0 ? void 0 : _k.transition;
24560
+ }
24561
+ if (transition == null) {
24562
+ // TODO: Need global default.
24563
+ transition = 2000;
24564
+ }
24565
+ if (BModels.Carto.ValidateCarto(camera)) {
24566
+ const pos = Cesium.Cartesian3.fromDegrees(+camera.longitude, +camera.latitude, +camera.altitude);
24567
+ scene.camera.flyTo({
24568
+ destination: pos,
24569
+ orientation: {
24570
+ heading: Cesium.Math.toRadians(+camera.heading),
24571
+ pitch: Cesium.Math.toRadians(+camera.pitch),
24572
+ roll: Cesium.Math.toRadians(+camera.roll)
24573
+ },
24574
+ duration: transition != 0 ? transition / 1000 : 0,
24575
+ // Make it ease in and out.
24576
+ easingFunction: Cesium.EasingFunction.CUBIC_IN_OUT
24577
+ });
24578
+ }
24579
+ }
24580
+ ViewRenderEngine.FlyTo = FlyTo;
24498
24581
  })(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
24499
24582
 
24500
24583
  const VIEWER_LEFT_PANEL_WIDGET_KEY = "_viewerLeftPanelWidget";
@@ -29910,7 +29993,7 @@
29910
29993
  }
29911
29994
  }
29912
29995
 
29913
- const VERSION = "5.3.2";
29996
+ const VERSION = "5.3.3";
29914
29997
 
29915
29998
  exports.VERSION = VERSION;
29916
29999
  exports.isHistoricMetadataChanged = isHistoricMetadataChanged;