bruce-cesium 5.3.2 → 5.3.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, 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, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, 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, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -1539,12 +1539,12 @@ function getColor$1(viewer, key, graphic) {
1539
1539
  storeColor(key, color, graphic);
1540
1540
  }
1541
1541
  }
1542
- else if (key == "select") {
1543
- color = _selectColor;
1544
- }
1545
1542
  else if (key == "highlight") {
1546
1543
  color = _highlightColor;
1547
1544
  }
1545
+ else if (key == "select") {
1546
+ color = _selectColor;
1547
+ }
1548
1548
  }
1549
1549
  return color;
1550
1550
  }
@@ -1570,19 +1570,19 @@ function refreshColor(viewer, graphic, opacity) {
1570
1570
  var _a, _b;
1571
1571
  // Calculate what color key we should apply.
1572
1572
  let key = "default";
1573
- if (getKeyState(graphic, "select")) {
1574
- key = "select";
1575
- }
1576
- else if (getKeyState(graphic, "highlight")) {
1573
+ if (getKeyState(graphic, "highlight")) {
1577
1574
  key = "highlight";
1578
1575
  }
1576
+ else if (getKeyState(graphic, "select")) {
1577
+ key = "select";
1578
+ }
1579
1579
  // This ensures that the default color is always stored prior to applying a new color.
1580
1580
  if (key != "default") {
1581
1581
  getColor$1(viewer, "default", graphic);
1582
1582
  }
1583
1583
  let color = (_a = getColor$1(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Color.WHITE;
1584
- // If we're highlighting and it's selected, don't change the color.
1585
- if (key != "highlight" || getKeyState(graphic, "select") == false) {
1584
+ // If we're selecting and it's highlighted, don't change the color.
1585
+ if (key != "select" || getKeyState(graphic, "highlight") == false) {
1586
1586
  let animateMs = key == "highlight" ? ANIMATE_COLOR_HIGHLIGHT_MS : ANIMATE_COLOR_MS;
1587
1587
  color = color.clone();
1588
1588
  // Multiply opacity if one is set.
@@ -1738,12 +1738,12 @@ function getKeyState(graphic, key) {
1738
1738
  var CesiumEntityStyler;
1739
1739
  (function (CesiumEntityStyler) {
1740
1740
  function UpdateColorSetting(key, color) {
1741
- if (key == "select") {
1742
- _selectColor = color.clone();
1743
- }
1744
- else if (key == "highlight") {
1741
+ if (key == "highlight") {
1745
1742
  _highlightColor = color.clone();
1746
1743
  }
1744
+ else if (key == "select") {
1745
+ _selectColor = color.clone();
1746
+ }
1747
1747
  }
1748
1748
  CesiumEntityStyler.UpdateColorSetting = UpdateColorSetting;
1749
1749
  function Refresh(params) {
@@ -10700,18 +10700,7 @@ var VisualsRegister;
10700
10700
  return state.isolated === true;
10701
10701
  }
10702
10702
  GetIsIsolatedAny() {
10703
- const entityIds = Object.keys(this.states);
10704
- for (let i = 0; i < entityIds.length; i++) {
10705
- const state = this.states[entityIds[i]];
10706
- const menuItemIds = state ? Object.keys(state) : [];
10707
- for (let j = 0; j < menuItemIds.length; j++) {
10708
- const menuItemId = menuItemIds[j];
10709
- if (state[menuItemId].isolated) {
10710
- return true;
10711
- }
10712
- }
10713
- }
10714
- return false;
10703
+ return Object.values(this.states).some(state => state && Object.values(state).some(item => item.isolated));
10715
10704
  }
10716
10705
  /**
10717
10706
  * @deprecated Use GetStates() or GetState().
@@ -24584,6 +24573,100 @@ var ViewRenderEngine;
24584
24573
  }
24585
24574
  }
24586
24575
  ViewRenderEngine.Render = Render;
24576
+ /**
24577
+ * Moves the camera to a given view + bookmark.
24578
+ * @param params
24579
+ */
24580
+ async function FlyTo(params) {
24581
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24582
+ if (!params.manager && params.viewer) {
24583
+ params.manager = ViewerUtils.GetManager({
24584
+ viewer: params.viewer,
24585
+ createIfMissing: true
24586
+ });
24587
+ }
24588
+ else if (!params.viewer && params.manager) {
24589
+ params.viewer = params.manager.Viewer;
24590
+ }
24591
+ if (!params.getters) {
24592
+ params.getters = ENVIRONMENT.Api();
24593
+ }
24594
+ const api = params.getters.GetBruceApi();
24595
+ const view = params.view ? params.view : (await ProjectView.Get({
24596
+ api,
24597
+ viewId: params.viewId
24598
+ })).view;
24599
+ let bookmark = params.bookmark;
24600
+ if (!bookmark) {
24601
+ let bookmarkId = params.bookmarkId;
24602
+ if (!bookmarkId) {
24603
+ bookmarkId = view.DefaultUISlideID;
24604
+ }
24605
+ bookmark = bookmarkId ? (await ProjectViewBookmark.Get({
24606
+ api,
24607
+ viewId: params.viewId,
24608
+ bookmarkId: bookmarkId
24609
+ })).bookmark : null;
24610
+ }
24611
+ const viewer = params.manager.Viewer;
24612
+ const scene = viewer.scene;
24613
+ const vSettings = view.Settings;
24614
+ const defaults = (_a = vSettings.defaults) !== null && _a !== void 0 ? _a : {};
24615
+ let camera = ((_b = bookmark === null || bookmark === void 0 ? void 0 : bookmark.Camera) !== null && _b !== void 0 ? _b : {});
24616
+ if (!Carto.ValidateCarto(camera)) {
24617
+ camera = {
24618
+ ...camera,
24619
+ altitude: (_c = defaults.camera) === null || _c === void 0 ? void 0 : _c.altitude,
24620
+ latitude: (_d = defaults.camera) === null || _d === void 0 ? void 0 : _d.latitude,
24621
+ longitude: (_e = defaults.camera) === null || _e === void 0 ? void 0 : _e.longitude,
24622
+ heading: (_f = defaults.camera) === null || _f === void 0 ? void 0 : _f.heading,
24623
+ pitch: (_g = defaults.camera) === null || _g === void 0 ? void 0 : _g.pitch,
24624
+ roll: (_h = defaults.camera) === null || _h === void 0 ? void 0 : _h.roll
24625
+ };
24626
+ }
24627
+ let newLens = camera.cameraFrustum;
24628
+ if (newLens == null) {
24629
+ newLens = (_j = defaults.camera) === null || _j === void 0 ? void 0 : _j.cameraFrustum;
24630
+ }
24631
+ if (newLens == null) {
24632
+ // TODO: Need global default.
24633
+ newLens = Camera.EFrustum.Perspective;
24634
+ }
24635
+ const shouldBe2d = newLens == Camera.EFrustum.Orthographic;
24636
+ const curIs2d = ViewUtils.Get2dStatus({
24637
+ viewer
24638
+ });
24639
+ if (shouldBe2d != curIs2d) {
24640
+ ViewUtils.Set2dStatus({
24641
+ status: shouldBe2d,
24642
+ viewer,
24643
+ moveCamera: false
24644
+ });
24645
+ }
24646
+ let transition = params.skipTransition ? 0 : shouldBe2d === curIs2d ? camera.transition : 0;
24647
+ if (transition == null) {
24648
+ transition = (_k = defaults.camera) === null || _k === void 0 ? void 0 : _k.transition;
24649
+ }
24650
+ if (transition == null) {
24651
+ // TODO: Need global default.
24652
+ transition = 2000;
24653
+ }
24654
+ if (Carto.ValidateCarto(camera)) {
24655
+ const pos = Cartesian3.fromDegrees(+camera.longitude, +camera.latitude, +camera.altitude);
24656
+ scene.camera.flyTo({
24657
+ destination: pos,
24658
+ orientation: {
24659
+ heading: Math$1.toRadians(+camera.heading),
24660
+ pitch: Math$1.toRadians(+camera.pitch),
24661
+ roll: Math$1.toRadians(+camera.roll)
24662
+ },
24663
+ duration: transition != 0 ? transition / 1000 : 0,
24664
+ // Make it ease in and out.
24665
+ easingFunction: EasingFunction.CUBIC_IN_OUT
24666
+ });
24667
+ }
24668
+ }
24669
+ ViewRenderEngine.FlyTo = FlyTo;
24587
24670
  })(ViewRenderEngine || (ViewRenderEngine = {}));
24588
24671
 
24589
24672
  const VIEWER_LEFT_PANEL_WIDGET_KEY = "_viewerLeftPanelWidget";
@@ -30007,7 +30090,7 @@ class WidgetViewBar extends Widget.AWidget {
30007
30090
  }
30008
30091
  }
30009
30092
 
30010
- const VERSION = "5.3.2";
30093
+ const VERSION = "5.3.4";
30011
30094
 
30012
30095
  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, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, 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 };
30013
30096
  //# sourceMappingURL=bruce-cesium.es5.js.map