bruce-cesium 5.2.0 → 5.2.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 { 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, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, defined, Cesium3DTileset, PolygonPipeline, Matrix4, Matrix3, IonResource, CesiumInspector, ClockRange, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, Quaternion, 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, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, 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, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, Quaternion, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -12183,7 +12183,7 @@ var EntitiesRenderManager;
12183
12183
  const minMax = RenderManager.GetZoomMinMax({
12184
12184
  zoomControl: this.zoomControl
12185
12185
  });
12186
- this.getter.IncludeMenuItem(this.item.id, (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [], minMax[0], minMax[1]);
12186
+ this.getter.IncludeMenuItem(this.item.id, this.item.BruceEntity["EntityType.ID"], (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [], minMax[0], minMax[1]);
12187
12187
  this.getterSub = this.getter.OnUpdate.Subscribe((entities) => {
12188
12188
  if (isTagItem) {
12189
12189
  this.distributeForRender(entities.filter((entity) => {
@@ -14633,7 +14633,8 @@ const MAX_RETRY_ATTEMPTS = 1;
14633
14633
  const RETRY_DELAY_INCREMENT = 500;
14634
14634
  const REQUEST_PAGE_DELAY = 50;
14635
14635
  class regMenuItemGetter {
14636
- constructor(tagIds, minHeight, maxHeight) {
14636
+ constructor(typeId, tagIds, minHeight, maxHeight) {
14637
+ this.TypeId = typeId;
14637
14638
  this.TagIds = tagIds;
14638
14639
  this.MinHeight = minHeight;
14639
14640
  this.MaxHeight = maxHeight;
@@ -14700,9 +14701,9 @@ var EntityFilterGetter;
14700
14701
  // We use this for refreshing historic data without having to repeat geographic queries.
14701
14702
  this.gatheredIntegrity = null;
14702
14703
  this.gatheredEntityIds = [];
14703
- const { api, viewer, viewPort, typeId, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario } = params;
14704
+ const { api, viewer, viewPort, typeIds, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario } = params;
14704
14705
  this.api = api;
14705
- this.typeId = typeId;
14706
+ this.typeIds = typeIds;
14706
14707
  this.schemaId = schemaId;
14707
14708
  this.historic = Boolean(historic);
14708
14709
  this.historicAttrKey = historicAttrKey;
@@ -14732,6 +14733,9 @@ var EntityFilterGetter;
14732
14733
  if (this.scenario) {
14733
14734
  integrity += this.scenario;
14734
14735
  }
14736
+ if (this.typeIds) {
14737
+ integrity += this.typeIds.join();
14738
+ }
14735
14739
  return integrity;
14736
14740
  }
14737
14741
  viewAreaSub() {
@@ -14829,8 +14833,8 @@ var EntityFilterGetter;
14829
14833
  GetMenuItems() {
14830
14834
  return Object.keys(this.registeredItems);
14831
14835
  }
14832
- IncludeMenuItem(menuItemId, layerIds, minHeight, maxHeight) {
14833
- this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
14836
+ IncludeMenuItem(menuItemId, typeId, layerIds, minHeight, maxHeight) {
14837
+ this.registeredItems[menuItemId] = new regMenuItemGetter(typeId, layerIds, minHeight, maxHeight);
14834
14838
  this.updateState();
14835
14839
  }
14836
14840
  ExcludeMenuItem(menuItemId) {
@@ -14854,6 +14858,7 @@ var EntityFilterGetter;
14854
14858
  }
14855
14859
  updateState() {
14856
14860
  const tagIds = [];
14861
+ const typeIds = [];
14857
14862
  const menuItemIds = this.GetMenuItems();
14858
14863
  let minHeight = null;
14859
14864
  let maxHeight = null;
@@ -14875,12 +14880,19 @@ var EntityFilterGetter;
14875
14880
  }
14876
14881
  }
14877
14882
  }
14883
+ const itemTypeId = menuItem.TypeId;
14884
+ if (itemTypeId) {
14885
+ if (!typeIds.includes(itemTypeId)) {
14886
+ typeIds.push(itemTypeId);
14887
+ }
14888
+ }
14878
14889
  }
14879
14890
  }
14880
14891
  if (menuItemIds.length > 0) {
14881
14892
  // Reset cells so none are marked as fetched.
14882
14893
  this.cells = new EntityGlobe.Grid();
14883
14894
  this.tagIds = tagIds;
14895
+ this.typeIds = typeIds;
14884
14896
  this.minHeight = minHeight;
14885
14897
  this.maxHeight = maxHeight;
14886
14898
  this.updateBounds();
@@ -14977,7 +14989,7 @@ var EntityFilterGetter;
14977
14989
  nextPage: false,
14978
14990
  nextPageUrl: null
14979
14991
  };
14980
- await SharedGetters.Queue.Run("Loading Entities from Menu Item that loads Entity Type: " + this.typeId, async () => {
14992
+ await SharedGetters.Queue.Run("Loading Entities from Menu Item that loads Entity Type: " + this.typeIds, async () => {
14981
14993
  var _a;
14982
14994
  if (abortController.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
14983
14995
  return;
@@ -15005,7 +15017,7 @@ var EntityFilterGetter;
15005
15017
  filter: {
15006
15018
  pageSize: PAGE_SIZE,
15007
15019
  pageIndex: curCell.FetchPageIndex,
15008
- entityTypeId: this.typeId,
15020
+ entityTypeId: this.typeIds,
15009
15021
  layerIds: this.tagIds,
15010
15022
  // Any tag specified will be allowed.
15011
15023
  layerIdsOperator: "in",
@@ -15150,7 +15162,7 @@ var EntityFilterGetter;
15150
15162
  // Controller we can use to abort the request when a new loop starts.
15151
15163
  const controller = this.historicRefreshAbortController = new AbortController();
15152
15164
  let entities = [];
15153
- await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeId, async () => {
15165
+ await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeIds, async () => {
15154
15166
  var _a;
15155
15167
  if (controller.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
15156
15168
  return;
@@ -15164,7 +15176,7 @@ var EntityFilterGetter;
15164
15176
  filter: {
15165
15177
  pageSize: batch.length,
15166
15178
  pageIndex: 0,
15167
- entityTypeId: this.typeId,
15179
+ entityTypeId: this.typeIds,
15168
15180
  layerIds: this.tagIds,
15169
15181
  layerIdsOperator: "in",
15170
15182
  sortOrder: Api.ESortOrder.Asc,
@@ -15220,7 +15232,9 @@ var EntityFilterGetter;
15220
15232
  function createFilterGetterCacheKey(params) {
15221
15233
  let cacheKey = "";
15222
15234
  cacheKey += params.api.GetBaseUrl();
15223
- cacheKey += params.typeId;
15235
+ // Not including Type ID in the cache key now.
15236
+ // This allows us to re-use the same getter between Entity Types.
15237
+ // cacheKey += params.typeId;
15224
15238
  cacheKey += params.batchSize;
15225
15239
  cacheKey += String(params.cdn);
15226
15240
  cacheKey += params.schemaId ? params.schemaId : "";
@@ -15250,7 +15264,7 @@ var SharedGetters;
15250
15264
  api: params.api,
15251
15265
  viewer: params.viewer,
15252
15266
  viewPort: params.monitor,
15253
- typeId: params.typeId,
15267
+ typeIds: !params.typeId ? null : typeof params.typeId == "string" ? [params.typeId] : params.typeId,
15254
15268
  schemaId: params.schemaId,
15255
15269
  batchSize: params.batchSize,
15256
15270
  attrFilter: params.attrFilter,
@@ -16893,7 +16907,7 @@ var TilesetCadRenderManager;
16893
16907
  this.renderPriority = 0;
16894
16908
  }
16895
16909
  (async () => {
16896
- var _a, _b;
16910
+ var _a, _b, _c;
16897
16911
  let api = this.getters.GetBruceApi();
16898
16912
  let coords = null;
16899
16913
  let tileset = null;
@@ -16950,13 +16964,33 @@ var TilesetCadRenderManager;
16950
16964
  if (!tileset || this.disposed) {
16951
16965
  return;
16952
16966
  }
16967
+ // Get the model tree if it's in a separate file.
16968
+ // There is a setting that is more explicit but it's lying on the file name so can't trust it yet.
16969
+ if (((_a = tileset.settings) === null || _a === void 0 ? void 0 : _a["tilesetVersion"]) > 1) {
16970
+ try {
16971
+ const modelTreeUrl = Tileset.GetFileUrl({
16972
+ api: api,
16973
+ file: "model_tree.json",
16974
+ tilesetId: tileset.id,
16975
+ cacheToken: tileset.generateVersion,
16976
+ viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled)
16977
+ });
16978
+ this.modelTree = await api.get(modelTreeUrl);
16979
+ }
16980
+ catch (e) {
16981
+ console.error(e);
16982
+ }
16983
+ }
16984
+ if (this.disposed) {
16985
+ return;
16986
+ }
16953
16987
  // Render outside the shared process because we can't control file requests from Cesium.
16954
16988
  const cTileset = this.cTileset = await TilesetRenderEngine.Render({
16955
16989
  apiGetter: this.getters.GetBruceGetter(),
16956
16990
  tileset: tileset,
16957
16991
  viewer: this.viewer,
16958
16992
  coords: coords,
16959
- accountId: (_b = (_a = this.item.tileset) === null || _a === void 0 ? void 0 : _a.ClientAccountID) !== null && _b !== void 0 ? _b : this.getters.GetAccountId(),
16993
+ accountId: (_c = (_b = this.item.tileset) === null || _b === void 0 ? void 0 : _b.ClientAccountID) !== null && _c !== void 0 ? _c : this.getters.GetAccountId(),
16960
16994
  viaCdn: Boolean(this.item.cdnEnabled == null ? true : this.item.cdnEnabled),
16961
16995
  noMemoryLimit: this.item["noMaximumMemory"]
16962
16996
  });
@@ -17077,7 +17111,7 @@ var TilesetCadRenderManager;
17077
17111
  }
17078
17112
  };
17079
17113
  const setByEntityId = () => {
17080
- const bruceIdProp = propertyNames.find(x => String(x).toLowerCase() == "bruceid");
17114
+ const bruceIdProp = propertyNames.find(x => (String(x).toLowerCase() == "bruceid"));
17081
17115
  if (bruceIdProp) {
17082
17116
  rego.entityId = feature.getProperty(bruceIdProp);
17083
17117
  }
@@ -17135,6 +17169,13 @@ var TilesetCadRenderManager;
17135
17169
  getMetaByGeomId(geomId, tileset) {
17136
17170
  var _a;
17137
17171
  let modelTree = (_a = tileset === null || tileset === void 0 ? void 0 : tileset.extensions) === null || _a === void 0 ? void 0 : _a.modelTree;
17172
+ // Wasn't inside tileset.json and instead in a separate file.
17173
+ if (!modelTree) {
17174
+ modelTree = this.modelTree;
17175
+ }
17176
+ if (!modelTree) {
17177
+ return null;
17178
+ }
17138
17179
  return this.digMetaByGeomId(geomId, modelTree, [], 0);
17139
17180
  }
17140
17181
  digMetaByGeomId(geomId, branch, path, depth) {
@@ -29882,7 +29923,7 @@ class WidgetViewBar extends Widget.AWidget {
29882
29923
  }
29883
29924
  }
29884
29925
 
29885
- const VERSION = "5.2.0";
29926
+ const VERSION = "5.2.2";
29886
29927
 
29887
29928
  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 };
29888
29929
  //# sourceMappingURL=bruce-cesium.es5.js.map