bruce-cesium 5.2.7 → 5.2.9

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, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, 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, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, SceneMode, Primitive, Cesium3DTileFeature, 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, CesiumInspector, defined, ClockRange, PolygonPipeline, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, 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;
@@ -16903,6 +16903,10 @@ var TilesetCadRenderManager;
16903
16903
  // It's pretty expensive so we save it for a few seconds inbetween checks.
16904
16904
  this.somethingIsolated = null;
16905
16905
  this.somethingIsolatedDateTime = null;
16906
+ // Entity ID -> rego.
16907
+ // We retain this information as a quick look-up on what has been registered.
16908
+ // This lets us properly assign siblings to the same rego when hierarchy items are marked as collapsed.
16909
+ this.loadedCesiumEntities = {};
16906
16910
  const { viewer, register: visualsManager, getters, item } = params;
16907
16911
  this.viewer = viewer;
16908
16912
  this.getters = getters;
@@ -16910,24 +16914,29 @@ var TilesetCadRenderManager;
16910
16914
  this.visualsManager = visualsManager;
16911
16915
  }
16912
16916
  Init() {
16913
- var _a;
16917
+ var _a, _b;
16914
16918
  const tilesetId = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.TilesetID;
16915
16919
  if (!tilesetId) {
16916
16920
  return;
16917
16921
  }
16922
+ let accountId = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID;
16923
+ if (!accountId) {
16924
+ accountId = this.getters.GetAccountId();
16925
+ }
16918
16926
  this.renderPriority = this.item.renderPriority;
16919
16927
  if (this.renderPriority == null) {
16920
16928
  this.renderPriority = 0;
16921
16929
  }
16922
16930
  (async () => {
16923
- var _a, _b, _c;
16924
- let api = this.getters.GetBruceApi();
16931
+ var _a;
16932
+ const api = this.getters.GetBruceApi({
16933
+ accountId: accountId
16934
+ });
16925
16935
  let coords = null;
16926
16936
  let tileset = null;
16927
16937
  // Single shared getter to avoid multiple assemblies fighting to render.
16928
16938
  // This lets one complete, then the next start.
16929
16939
  await SharedGetters.Queue.Run("Rendering assembly.", async () => {
16930
- var _a, _b;
16931
16940
  if (this.disposed) {
16932
16941
  return;
16933
16942
  }
@@ -16935,7 +16944,7 @@ var TilesetCadRenderManager;
16935
16944
  let canAccess = false;
16936
16945
  try {
16937
16946
  canAccess = await Tileset.Publish.IsAccessAllowed({
16938
- sourceAccountId: (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID,
16947
+ sourceAccountId: accountId,
16939
16948
  tilesetId: tilesetId,
16940
16949
  forAccountId: this.getters.GetAccountId(),
16941
16950
  getters: this.getters
@@ -16948,14 +16957,13 @@ var TilesetCadRenderManager;
16948
16957
  console.error(e);
16949
16958
  }
16950
16959
  if (!canAccess) {
16951
- console.warn(`Cannot access tileset: ${tilesetId}, from account: ${(_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID}.`);
16960
+ console.warn(`Cannot access tileset: ${tilesetId}, from account: ${accountId}.`);
16952
16961
  return;
16953
16962
  }
16954
16963
  }
16955
16964
  else {
16956
16965
  console.warn("No tileset id found. Skipping access check.");
16957
16966
  }
16958
- api = this.getters.GetBruceApi();
16959
16967
  tileset = (await Tileset.Get({
16960
16968
  api,
16961
16969
  tilesetId
@@ -17003,7 +17011,7 @@ var TilesetCadRenderManager;
17003
17011
  tileset: tileset,
17004
17012
  viewer: this.viewer,
17005
17013
  coords: coords,
17006
- accountId: (_c = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID) !== null && _c !== void 0 ? _c : this.getters.GetAccountId(),
17014
+ accountId: accountId,
17007
17015
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled),
17008
17016
  noMemoryLimit: this.item["noMaximumMemory"]
17009
17017
  });
@@ -17027,7 +17035,9 @@ var TilesetCadRenderManager;
17027
17035
  this.onCTilesetLoad();
17028
17036
  this.styler.Init({
17029
17037
  viewer: this.viewer,
17030
- api,
17038
+ // Default API instead of the account one.
17039
+ // Records are driven by the account loading it instead of the source account.
17040
+ api: this.getters.GetBruceApi(),
17031
17041
  cTileset: this.cTileset,
17032
17042
  fallbackStyleId: this.item.styleId,
17033
17043
  styleMapping: this.item.StyleMapping,
@@ -17109,7 +17119,7 @@ var TilesetCadRenderManager;
17109
17119
  menuItemType: this.item.Type,
17110
17120
  priority: this.renderPriority,
17111
17121
  visual: feature,
17112
- accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17122
+ accountId: (_b = ((_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID)) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
17113
17123
  tilesetId: (_c = this.item.tileset) === null || _c === void 0 ? void 0 : _c.TilesetID,
17114
17124
  tilesetType: Tileset.EType.Cad,
17115
17125
  rootId: this.rootId,
@@ -17200,6 +17210,26 @@ var TilesetCadRenderManager;
17200
17210
  }
17201
17211
  }
17202
17212
  feature.show = !hide;
17213
+ // Already exists, so we add this graphic as a sibling.
17214
+ if (this.loadedCesiumEntities[rego.entityId]) {
17215
+ rego = this.loadedCesiumEntities[rego.entityId];
17216
+ if (!rego.visual) {
17217
+ // No parent graphic.
17218
+ rego.visual = feature;
17219
+ }
17220
+ else if (rego.visual == feature) ;
17221
+ else {
17222
+ const visual = rego.visual;
17223
+ // Sibling graphic.
17224
+ if (!visual._siblingGraphics) {
17225
+ visual._siblingGraphics = [];
17226
+ }
17227
+ if (visual._siblingGraphics.indexOf(feature) < 0) {
17228
+ visual._siblingGraphics.push(feature);
17229
+ }
17230
+ }
17231
+ }
17232
+ this.loadedCesiumEntities[rego.entityId] = rego;
17203
17233
  this.visualsManager.AddRego({
17204
17234
  rego,
17205
17235
  requestRender: false
@@ -17213,6 +17243,9 @@ var TilesetCadRenderManager;
17213
17243
  menuItemId: this.item.id,
17214
17244
  doRemove: false
17215
17245
  });
17246
+ // Might have to do something smarter since siblings could still be OK.
17247
+ this.loadedCesiumEntities[rego.entityId] = null;
17248
+ delete this.loadedCesiumEntities[rego.entityId];
17216
17249
  }
17217
17250
  }
17218
17251
  getMetaByGeomId(geomId, tileset) {
@@ -17225,9 +17258,9 @@ var TilesetCadRenderManager;
17225
17258
  if (!modelTree) {
17226
17259
  return null;
17227
17260
  }
17228
- return this.digMetaByGeomId(geomId, modelTree, [], 0);
17261
+ return this.digMetaByGeomId(geomId, modelTree, [], 0, null);
17229
17262
  }
17230
- digMetaByGeomId(geomId, branch, path, depth) {
17263
+ digMetaByGeomId(geomId, branch, path, depth, firstFoundCollapsedBranch) {
17231
17264
  if (this.hasHitDepthLimit || depth > 10) {
17232
17265
  if (!this.hasHitDepthLimit) {
17233
17266
  console.error("digMetaByGeomId: depth > 10. Disabling further attempts.");
@@ -17237,12 +17270,19 @@ var TilesetCadRenderManager;
17237
17270
  }
17238
17271
  path = [].concat(path);
17239
17272
  path.push(branch.id);
17273
+ if (!firstFoundCollapsedBranch && branch.collapsed) {
17274
+ firstFoundCollapsedBranch = branch;
17275
+ }
17240
17276
  if (branch.geomId == geomId) {
17241
- return { id: path[path.length - 1], typeId: branch.typeId, name: branch.name };
17277
+ // If we collapsed on a higher branch then we return it instead.
17278
+ if (firstFoundCollapsedBranch) {
17279
+ branch = firstFoundCollapsedBranch;
17280
+ }
17281
+ return { id: branch.id, typeId: branch.typeId, name: branch.name };
17242
17282
  }
17243
17283
  else if (branch.children) {
17244
17284
  for (let i = 0; i < branch.children.length; i++) {
17245
- let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1);
17285
+ let meta = this.digMetaByGeomId(geomId, branch.children[i], path, depth + 1, firstFoundCollapsedBranch);
17246
17286
  if (meta) {
17247
17287
  return meta;
17248
17288
  }
@@ -29973,7 +30013,7 @@ class WidgetViewBar extends Widget.AWidget {
29973
30013
  }
29974
30014
  }
29975
30015
 
29976
- const VERSION = "5.2.7";
30016
+ const VERSION = "5.2.9";
29977
30017
 
29978
30018
  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 };
29979
30019
  //# sourceMappingURL=bruce-cesium.es5.js.map