bruce-cesium 5.2.6 → 5.2.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.
@@ -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, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
3
+ import { Cartographic, JulianDate, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, HorizontalOrigin, VerticalOrigin, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -16899,6 +16899,10 @@ var TilesetCadRenderManager;
16899
16899
  // This likely means poor data so we have to disable drilling otherwise lag would be too bad.
16900
16900
  // The result is no entity type IDs are known so most styles fail.
16901
16901
  this.hasHitDepthLimit = false;
16902
+ // Cache of 'something isolated' that we detect and use to calculate a default show state.
16903
+ // It's pretty expensive so we save it for a few seconds inbetween checks.
16904
+ this.somethingIsolated = null;
16905
+ this.somethingIsolatedDateTime = null;
16902
16906
  const { viewer, register: visualsManager, getters, item } = params;
16903
16907
  this.viewer = viewer;
16904
16908
  this.getters = getters;
@@ -16906,24 +16910,29 @@ var TilesetCadRenderManager;
16906
16910
  this.visualsManager = visualsManager;
16907
16911
  }
16908
16912
  Init() {
16909
- var _a;
16913
+ var _a, _b;
16910
16914
  const tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
16911
16915
  if (!tilesetId) {
16912
16916
  return;
16913
16917
  }
16918
+ let accountId = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID;
16919
+ if (!accountId) {
16920
+ accountId = this.getters.GetAccountId();
16921
+ }
16914
16922
  this.renderPriority = this.item.renderPriority;
16915
16923
  if (this.renderPriority == null) {
16916
16924
  this.renderPriority = 0;
16917
16925
  }
16918
16926
  (async () => {
16919
- var _a, _b, _c;
16920
- let api = this.getters.GetBruceApi();
16927
+ var _a;
16928
+ const api = this.getters.GetBruceApi({
16929
+ accountId: accountId
16930
+ });
16921
16931
  let coords = null;
16922
16932
  let tileset = null;
16923
16933
  // Single shared getter to avoid multiple assemblies fighting to render.
16924
16934
  // This lets one complete, then the next start.
16925
16935
  await SharedGetters.Queue.Run("Rendering assembly.", async () => {
16926
- var _a, _b;
16927
16936
  if (this.disposed) {
16928
16937
  return;
16929
16938
  }
@@ -16931,7 +16940,7 @@ var TilesetCadRenderManager;
16931
16940
  let canAccess = false;
16932
16941
  try {
16933
16942
  canAccess = await Tileset.Publish.IsAccessAllowed({
16934
- sourceAccountId: (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID,
16943
+ sourceAccountId: accountId,
16935
16944
  tilesetId: tilesetId,
16936
16945
  forAccountId: this.getters.GetAccountId(),
16937
16946
  getters: this.getters
@@ -16944,14 +16953,13 @@ var TilesetCadRenderManager;
16944
16953
  console.error(e);
16945
16954
  }
16946
16955
  if (!canAccess) {
16947
- console.warn(`Cannot access tileset: ${tilesetId}, from account: ${(_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID}.`);
16956
+ console.warn(`Cannot access tileset: ${tilesetId}, from account: ${accountId}.`);
16948
16957
  return;
16949
16958
  }
16950
16959
  }
16951
16960
  else {
16952
16961
  console.warn("No tileset id found. Skipping access check.");
16953
16962
  }
16954
- api = this.getters.GetBruceApi();
16955
16963
  tileset = (await Tileset.Get({
16956
16964
  api,
16957
16965
  tilesetId
@@ -16999,7 +17007,7 @@ var TilesetCadRenderManager;
16999
17007
  tileset: tileset,
17000
17008
  viewer: this.viewer,
17001
17009
  coords: coords,
17002
- accountId: (_c = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID) !== null && _c !== void 0 ? _c : this.getters.GetAccountId(),
17010
+ accountId: accountId,
17003
17011
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled),
17004
17012
  noMemoryLimit: this.item["noMaximumMemory"]
17005
17013
  });
@@ -17014,10 +17022,18 @@ var TilesetCadRenderManager;
17014
17022
  if (this.disposed || cTileset.isDestroyed()) {
17015
17023
  return;
17016
17024
  }
17025
+ // We style Entities to be hidden by default so that we can selectively-
17026
+ // do a default later.
17027
+ // This stops them flickering in/out as Bookmark settings get applied.
17028
+ this.cTileset.style = new Cesium3DTileStyle({
17029
+ show: "false"
17030
+ });
17017
17031
  this.onCTilesetLoad();
17018
17032
  this.styler.Init({
17019
17033
  viewer: this.viewer,
17020
- api,
17034
+ // Default API instead of the account one.
17035
+ // Records are driven by the account loading it instead of the source account.
17036
+ api: this.getters.GetBruceApi(),
17021
17037
  cTileset: this.cTileset,
17022
17038
  fallbackStyleId: this.item.styleId,
17023
17039
  styleMapping: this.item.StyleMapping,
@@ -17074,7 +17090,12 @@ var TilesetCadRenderManager;
17074
17090
  for (let i = 0; i < content.featuresLength; i++) {
17075
17091
  const feature = content.getFeature(i);
17076
17092
  let rego = this.mapTilesetFeature(feature, load);
17077
- if ((rego === null || rego === void 0 ? void 0 : rego.entityId) && this.styler) {
17093
+ if (!(rego === null || rego === void 0 ? void 0 : rego.entityId)) {
17094
+ // Override the default hide state set by the style.
17095
+ feature.show = true;
17096
+ continue;
17097
+ }
17098
+ if (this.styler) {
17078
17099
  this.styler.QueueEntities([rego]);
17079
17100
  }
17080
17101
  }
@@ -17094,7 +17115,7 @@ var TilesetCadRenderManager;
17094
17115
  menuItemType: this.item.Type,
17095
17116
  priority: this.renderPriority,
17096
17117
  visual: feature,
17097
- accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17118
+ accountId: (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17098
17119
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
17099
17120
  tilesetType: Tileset.EType.Cad,
17100
17121
  rootId: this.rootId,
@@ -17160,6 +17181,31 @@ var TilesetCadRenderManager;
17160
17181
  return null;
17161
17182
  }
17162
17183
  if (add) {
17184
+ // Get the initial hide/show state.
17185
+ const state = this.visualsManager.GetState({
17186
+ entityId: rego.entityId,
17187
+ menuItemId: this.item.id,
17188
+ });
17189
+ if (this.somethingIsolated == null ||
17190
+ // 5s cache.
17191
+ (this.somethingIsolatedDateTime && this.somethingIsolatedDateTime.getTime() + 5000 < new Date().getTime())) {
17192
+ this.somethingIsolated = this.visualsManager.GetIsIsolatedAny();
17193
+ this.somethingIsolatedDateTime = new Date();
17194
+ }
17195
+ // Override the default hide state set by the style.
17196
+ let hide = false;
17197
+ if (state) {
17198
+ if (state.hidden) {
17199
+ hide = true;
17200
+ }
17201
+ else if (state.opacity === 0) {
17202
+ hide = true;
17203
+ }
17204
+ else if (!state.isolated && this.somethingIsolated) {
17205
+ hide = true;
17206
+ }
17207
+ }
17208
+ feature.show = !hide;
17163
17209
  this.visualsManager.AddRego({
17164
17210
  rego,
17165
17211
  requestRender: false
@@ -29933,7 +29979,7 @@ class WidgetViewBar extends Widget.AWidget {
29933
29979
  }
29934
29980
  }
29935
29981
 
29936
- const VERSION = "5.2.6";
29982
+ const VERSION = "5.2.8";
29937
29983
 
29938
29984
  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 };
29939
29985
  //# sourceMappingURL=bruce-cesium.es5.js.map