bruce-cesium 5.2.1 → 5.2.3

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, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, EllipsoidTerrainProvider, sampleTerrainMostDetailed, defined, PolygonPipeline, CesiumInspector, ClockRange, 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';
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, 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, 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';
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;
@@ -14677,6 +14678,9 @@ var EntityFilterGetter;
14677
14678
  }
14678
14679
  return this.onScanUpdate;
14679
14680
  }
14681
+ get isLooping() {
14682
+ return this.looping > 0;
14683
+ }
14680
14684
  constructor(params) {
14681
14685
  this.onUpdate = null;
14682
14686
  this.LastStateUpdates = {};
@@ -14689,6 +14693,7 @@ var EntityFilterGetter;
14689
14693
  this.registeredItems = {};
14690
14694
  this.getterLoopId = 0;
14691
14695
  this.getterLoopAbortControllers = {};
14696
+ this.looping = 0;
14692
14697
  this.tagIds = null;
14693
14698
  this.minHeight = 0;
14694
14699
  this.maxHeight = 100000;
@@ -14700,9 +14705,9 @@ var EntityFilterGetter;
14700
14705
  // We use this for refreshing historic data without having to repeat geographic queries.
14701
14706
  this.gatheredIntegrity = null;
14702
14707
  this.gatheredEntityIds = [];
14703
- const { api, viewer, viewPort, typeId, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario } = params;
14708
+ const { api, viewer, viewPort, typeIds, schemaId, batchSize, attrFilter, historicAttrKey, historicInterpolation, historic, viaCdn, scenario } = params;
14704
14709
  this.api = api;
14705
- this.typeId = typeId;
14710
+ this.typeIds = typeIds;
14706
14711
  this.schemaId = schemaId;
14707
14712
  this.historic = Boolean(historic);
14708
14713
  this.historicAttrKey = historicAttrKey;
@@ -14732,6 +14737,9 @@ var EntityFilterGetter;
14732
14737
  if (this.scenario) {
14733
14738
  integrity += this.scenario;
14734
14739
  }
14740
+ if (this.typeIds) {
14741
+ integrity += this.typeIds.join();
14742
+ }
14735
14743
  return integrity;
14736
14744
  }
14737
14745
  viewAreaSub() {
@@ -14829,14 +14837,14 @@ var EntityFilterGetter;
14829
14837
  GetMenuItems() {
14830
14838
  return Object.keys(this.registeredItems);
14831
14839
  }
14832
- IncludeMenuItem(menuItemId, layerIds, minHeight, maxHeight) {
14833
- this.registeredItems[menuItemId] = new regMenuItemGetter(layerIds, minHeight, maxHeight);
14840
+ IncludeMenuItem(menuItemId, typeId, layerIds, minHeight, maxHeight) {
14841
+ this.registeredItems[menuItemId] = new regMenuItemGetter(typeId, layerIds, minHeight, maxHeight);
14834
14842
  this.updateState();
14835
14843
  }
14836
14844
  ExcludeMenuItem(menuItemId) {
14837
14845
  this.registeredItems[menuItemId] = null;
14838
14846
  delete this.registeredItems[menuItemId];
14839
- this.updateState();
14847
+ this.updateState(true);
14840
14848
  }
14841
14849
  updateBounds() {
14842
14850
  const viewRect = this.viewPort.GetBounds();
@@ -14852,8 +14860,9 @@ var EntityFilterGetter;
14852
14860
  this.viewCenter = poi;
14853
14861
  }
14854
14862
  }
14855
- updateState() {
14863
+ updateState(onlyIfLooping = false) {
14856
14864
  const tagIds = [];
14865
+ const typeIds = [];
14857
14866
  const menuItemIds = this.GetMenuItems();
14858
14867
  let minHeight = null;
14859
14868
  let maxHeight = null;
@@ -14875,12 +14884,19 @@ var EntityFilterGetter;
14875
14884
  }
14876
14885
  }
14877
14886
  }
14887
+ const itemTypeId = menuItem.TypeId;
14888
+ if (itemTypeId) {
14889
+ if (!typeIds.includes(itemTypeId)) {
14890
+ typeIds.push(itemTypeId);
14891
+ }
14892
+ }
14878
14893
  }
14879
14894
  }
14880
- if (menuItemIds.length > 0) {
14895
+ if (menuItemIds.length > 0 && (!onlyIfLooping || this.isLooping)) {
14881
14896
  // Reset cells so none are marked as fetched.
14882
14897
  this.cells = new EntityGlobe.Grid();
14883
14898
  this.tagIds = tagIds;
14899
+ this.typeIds = typeIds;
14884
14900
  this.minHeight = minHeight;
14885
14901
  this.maxHeight = maxHeight;
14886
14902
  this.updateBounds();
@@ -14917,6 +14933,7 @@ var EntityFilterGetter;
14917
14933
  this.getterLoopAbortControllers = newAbortControllers;
14918
14934
  }
14919
14935
  const abortController = this.getterLoopAbortControllers[abortId] = new AbortController();
14936
+ this.looping += 1;
14920
14937
  (async () => {
14921
14938
  var _a, _b, _c, _d, _e, _f, _g, _h;
14922
14939
  // Larger initial delay for the first loops because terrain is likely loading in.
@@ -14977,7 +14994,7 @@ var EntityFilterGetter;
14977
14994
  nextPage: false,
14978
14995
  nextPageUrl: null
14979
14996
  };
14980
- await SharedGetters.Queue.Run("Loading Entities from Menu Item that loads Entity Type: " + this.typeId, async () => {
14997
+ await SharedGetters.Queue.Run("Loading Entities from Menu Item that loads Entity Type: " + this.typeIds, async () => {
14981
14998
  var _a;
14982
14999
  if (abortController.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
14983
15000
  return;
@@ -15005,7 +15022,7 @@ var EntityFilterGetter;
15005
15022
  filter: {
15006
15023
  pageSize: PAGE_SIZE,
15007
15024
  pageIndex: curCell.FetchPageIndex,
15008
- entityTypeId: this.typeId,
15025
+ entityTypeId: this.typeIds,
15009
15026
  layerIds: this.tagIds,
15010
15027
  // Any tag specified will be allowed.
15011
15028
  layerIdsOperator: "in",
@@ -15117,7 +15134,11 @@ var EntityFilterGetter;
15117
15134
  if (postedScanning) {
15118
15135
  this.postStatus({ msg: EStatus.Scanning, revoking: true });
15119
15136
  }
15120
- })();
15137
+ })().then(() => {
15138
+ this.looping -= 1;
15139
+ }).catch(() => {
15140
+ this.looping -= 1;
15141
+ });
15121
15142
  }
15122
15143
  /**
15123
15144
  * Gets the historic state of found Entities for the current date times and emits them.
@@ -15150,7 +15171,7 @@ var EntityFilterGetter;
15150
15171
  // Controller we can use to abort the request when a new loop starts.
15151
15172
  const controller = this.historicRefreshAbortController = new AbortController();
15152
15173
  let entities = [];
15153
- await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeId, async () => {
15174
+ await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeIds, async () => {
15154
15175
  var _a;
15155
15176
  if (controller.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
15156
15177
  return;
@@ -15164,7 +15185,7 @@ var EntityFilterGetter;
15164
15185
  filter: {
15165
15186
  pageSize: batch.length,
15166
15187
  pageIndex: 0,
15167
- entityTypeId: this.typeId,
15188
+ entityTypeId: this.typeIds,
15168
15189
  layerIds: this.tagIds,
15169
15190
  layerIdsOperator: "in",
15170
15191
  sortOrder: Api.ESortOrder.Asc,
@@ -15220,7 +15241,9 @@ var EntityFilterGetter;
15220
15241
  function createFilterGetterCacheKey(params) {
15221
15242
  let cacheKey = "";
15222
15243
  cacheKey += params.api.GetBaseUrl();
15223
- cacheKey += params.typeId;
15244
+ // Not including Type ID in the cache key now.
15245
+ // This allows us to re-use the same getter between Entity Types.
15246
+ // cacheKey += params.typeId;
15224
15247
  cacheKey += params.batchSize;
15225
15248
  cacheKey += String(params.cdn);
15226
15249
  cacheKey += params.schemaId ? params.schemaId : "";
@@ -15250,7 +15273,7 @@ var SharedGetters;
15250
15273
  api: params.api,
15251
15274
  viewer: params.viewer,
15252
15275
  viewPort: params.monitor,
15253
- typeId: params.typeId,
15276
+ typeIds: !params.typeId ? null : typeof params.typeId == "string" ? [params.typeId] : params.typeId,
15254
15277
  schemaId: params.schemaId,
15255
15278
  batchSize: params.batchSize,
15256
15279
  attrFilter: params.attrFilter,
@@ -29909,7 +29932,7 @@ class WidgetViewBar extends Widget.AWidget {
29909
29932
  }
29910
29933
  }
29911
29934
 
29912
- const VERSION = "5.2.1";
29935
+ const VERSION = "5.2.3";
29913
29936
 
29914
29937
  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 };
29915
29938
  //# sourceMappingURL=bruce-cesium.es5.js.map