bruce-cesium 6.9.1 → 6.9.2

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 * as Cesium from 'cesium';
2
- import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ArcType, CornerType, JulianDate, Quaternion, Matrix4, SceneTransforms, NearFarScalar, Cartesian2, Matrix3, Rectangle, KmlDataSource, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, Cesium3DTileColorBlendMode, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, Cesium3DTileset, OrthographicFrustum, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
3
- import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Api, Bounds, Geometry, Carto, BruceEvent, EntityCoords, MenuItem, Tileset, ProjectView, ProjectViewBookmark, ZoomControl, DataLab, DelayQueue, EntityHistoricData, AccountConcept, RecordChangeFeed, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, Session, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, EntityRelationType } from 'bruce-models';
2
+ import { Cartographic, ColorMaterialProperty, Entity, Color, ConstantProperty, CallbackProperty, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, HeightReference, ColorBlendMode, HeadingPitchRoll, Math as Math$1, Transforms, ShadowMode, Cartesian3, ClassificationType, Model, ArcType, CornerType, ConstantPositionProperty, JulianDate, Quaternion, Matrix4, HorizontalOrigin, VerticalOrigin, Cartesian2, SceneTransforms, NearFarScalar, Matrix3, Rectangle, KmlDataSource, PolygonHierarchy, PolylineGraphics, GeoJsonDataSource, SceneMode, Cesium3DTileStyle, HeadingPitchRange, Ion, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, OrthographicFrustum, EasingFunction, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Cesium3DTileset, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, Cesium3DTileColorBlendMode, PolygonPipeline, CesiumInspector, ClockRange, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Fullscreen, Intersect, CzmlDataSource } from 'cesium';
3
+ import { Cartes, Entity as Entity$1, ENVIRONMENT, Calculator, ClientFile, EntityLod, EntityTag, EntityType, LRUCache, ObjectUtils, Style, Carto, Geometry, Api, MenuItem, ProjectView, ProjectViewBookmark, Tileset, ZoomControl, BruceEvent, EntityCoords, Bounds, DataLab, DelayQueue, EntityHistoricData, BruceApi, EntityRelation, ProgramKey, EntitySource, ProjectViewLegacyTile, ProjectViewTile, Camera, AccountConcept, RecordChangeFeed, EntityAttachment, EntityAttachmentType, EntityAttribute, MathUtils, Session, EntityRelationType } from 'bruce-models';
4
4
 
5
5
  /**
6
6
  * Ensures a number is returned from a given value.
@@ -2607,7 +2607,9 @@ var Widget;
2607
2607
  constructor(params) {
2608
2608
  this.widgetId = ObjectUtils.UId();
2609
2609
  let { viewer, container, manager } = params;
2610
- if (!container) {
2610
+ // A host app can pass an undefined viewer (eg. mid-teardown); fall back to
2611
+ // no container rather than crashing on viewer.container.
2612
+ if (!container && viewer) {
2611
2613
  container = viewer.container;
2612
2614
  }
2613
2615
  this._viewer = viewer;
@@ -3164,7 +3166,10 @@ class WidgetViewBar extends Widget.AWidget {
3164
3166
  this.customControls = new Map();
3165
3167
  this._generateStyles();
3166
3168
  this._generateElement();
3167
- this._viewer[VIEWER_VIEW_BAR_WIDGET_KEY] = this;
3169
+ // Guard against a host app constructing this widget with no live viewer.
3170
+ if (this._viewer) {
3171
+ this._viewer[VIEWER_VIEW_BAR_WIDGET_KEY] = this;
3172
+ }
3168
3173
  }
3169
3174
  Dispose() {
3170
3175
  super.Dispose();
@@ -23429,7 +23434,10 @@ class WidgetLeftPanel extends Widget.AWidget {
23429
23434
  this._viewId = params.viewId;
23430
23435
  this._generateStyles();
23431
23436
  this._generateElement();
23432
- this._viewer[VIEWER_LEFT_PANEL_WIDGET_KEY] = this;
23437
+ // Guard against a host app constructing this widget with no live viewer.
23438
+ if (this._viewer) {
23439
+ this._viewer[VIEWER_LEFT_PANEL_WIDGET_KEY] = this;
23440
+ }
23433
23441
  this._loading = this.loadBookmarks();
23434
23442
  this._loading.then(() => {
23435
23443
  if (params.runFirstBookmark && this.bookmarks.length) {
@@ -23871,10 +23879,18 @@ class WidgetLeftPanel extends Widget.AWidget {
23871
23879
  return;
23872
23880
  }
23873
23881
  const clazz = this.customTabs.get(this._enabledPanelTab);
23874
- tabContent = new clazz({
23875
- widget: this,
23876
- container: container
23877
- });
23882
+ try {
23883
+ tabContent = new clazz({
23884
+ widget: this,
23885
+ container: container
23886
+ });
23887
+ }
23888
+ catch (e) {
23889
+ // Partner-supplied tab content class; a throwing constructor shouldn't take
23890
+ // down the whole panel.
23891
+ console.error(e);
23892
+ return;
23893
+ }
23878
23894
  break;
23879
23895
  }
23880
23896
  this._enabledTabContent = tabContent;
@@ -23896,17 +23912,18 @@ class WidgetLeftPanel extends Widget.AWidget {
23896
23912
  document.documentElement.style.setProperty(VIEWER_LEFT_PANEL_CSS_VAR_LEFT, "0px");
23897
23913
  }
23898
23914
  SelectBookmark(bookmark) {
23915
+ var _a;
23899
23916
  const isFirstEnabled = !this._lastEnabledBookmarkId;
23900
23917
  this._lastEnabledBookmarkId = bookmark.ID;
23901
23918
  ViewRenderEngine.Render({
23902
- apiGetter: this._apiGetters.GetBruceGetter(),
23919
+ apiGetter: (_a = this._apiGetters) === null || _a === void 0 ? void 0 : _a.GetBruceGetter(),
23903
23920
  bookmark: bookmark,
23904
23921
  bookmarkId: bookmark.ID,
23905
23922
  manager: this._manager,
23906
23923
  skipTransition: isFirstEnabled,
23907
23924
  viewer: this._viewer,
23908
23925
  viewId: this._viewId
23909
- });
23926
+ }).catch((e) => console.error(e));
23910
23927
  if (this._onBookmarkSelect) {
23911
23928
  this._onBookmarkSelect.Trigger(bookmark);
23912
23929
  }
@@ -26608,7 +26625,10 @@ class WidgetBookmarks extends Widget.AWidget {
26608
26625
  }
26609
26626
  this._updateBookmarks();
26610
26627
  });
26611
- this._viewer[VIEWER_BOOKMARKS_WIDGET_KEY] = this;
26628
+ // Guard against a host app constructing this widget with no live viewer.
26629
+ if (this._viewer) {
26630
+ this._viewer[VIEWER_BOOKMARKS_WIDGET_KEY] = this;
26631
+ }
26612
26632
  }
26613
26633
  LoadViewId(params) {
26614
26634
  let { viewId, runFirstBookmark, autoPlay, bookmarkId } = params;
@@ -26986,9 +27006,10 @@ class WidgetBookmarks extends Widget.AWidget {
26986
27006
  `;
26987
27007
  }
26988
27008
  _updateBookmarks() {
27009
+ var _a;
26989
27010
  const bookmarks = this.bookmarks;
26990
27011
  this._element.style.display = bookmarks.length ? "flex" : "none";
26991
- const api = this._apiGetters.GetBruceApi();
27012
+ const api = (_a = this._apiGetters) === null || _a === void 0 ? void 0 : _a.GetBruceApi();
26992
27013
  const row = this._row;
26993
27014
  row.innerHTML = "";
26994
27015
  for (const bookmark of bookmarks) {
@@ -27030,7 +27051,7 @@ class WidgetBookmarks extends Widget.AWidget {
27030
27051
  skipTransition: isFirstEnabled,
27031
27052
  viewId: this._viewId,
27032
27053
  viewer: this._viewer
27033
- });
27054
+ }).catch((e) => console.error(e));
27034
27055
  }
27035
27056
  _updateBookmark() {
27036
27057
  const allBookmarks = this._row.querySelectorAll(".NextspaceBookmarksRowItem");
@@ -29116,7 +29137,12 @@ class WidgetCursorBar extends Widget.AWidget {
29116
29137
  this._cesiumEventRemoval = null;
29117
29138
  }
29118
29139
  _listenSelection() {
29140
+ var _a, _b;
29119
29141
  this._disposeCesiumEvent();
29142
+ // No live viewer/scene to attach cursor listeners to (eg. widget constructed without one).
29143
+ if (!((_b = (_a = this._viewer) === null || _a === void 0 ? void 0 : _a.scene) === null || _b === void 0 ? void 0 : _b.canvas)) {
29144
+ return;
29145
+ }
29120
29146
  const events = new ScreenSpaceEventHandler(this._viewer.scene.canvas);
29121
29147
  const throttle = new CursorBarMouseEventThrottle(this._viewer);
29122
29148
  let lastHoverPos = null;
@@ -38419,7 +38445,7 @@ var StyleUtils;
38419
38445
  StyleUtils.ApplyTypeStyle = ApplyTypeStyle;
38420
38446
  })(StyleUtils || (StyleUtils = {}));
38421
38447
 
38422
- const VERSION = "6.9.1";
38448
+ const VERSION = "6.9.2";
38423
38449
  /**
38424
38450
  * Updates the environment instance used by bruce-cesium to one specified.
38425
38451
  * This can be used to ensure that the instance a parent is referencing is shared between bruce-cesium, bruce-models, and the parent app.