bruce-cesium 4.7.0 → 4.7.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
- 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, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, AbstractApi, EntityAttribute, EntityAttachment, EntityAttachmentType, Session } from 'bruce-models';
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, EntitySource, MenuItem, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttribute, EntityAttachment, EntityAttachmentType, Session, AbstractApi } from 'bruce-models';
2
2
  import * as Cesium from 'cesium';
3
- import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, Entity, DistanceDisplayCondition, JulianDate, 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, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, Quaternion, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, 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, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, Primitive, Cesium3DTileFeature, GeoJsonDataSource, SceneMode, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, Quaternion, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15029,6 +15029,11 @@ var TilesetRenderEngine;
15029
15029
  this.runningQueues = 0;
15030
15030
  this.recordLoadQueue = [];
15031
15031
  this.recordCheckQueue = [];
15032
+ // % progress for how many Entities have been styled so far.
15033
+ // This can change as Tiles load in and more queue.
15034
+ this._styleProgress = 0;
15035
+ // Event for when the style progress changes.
15036
+ this.OnStyleProgress = new BruceEvent();
15032
15037
  this.viewer = viewer;
15033
15038
  this.api = api;
15034
15039
  this.cTileset = cTileset;
@@ -15061,6 +15066,13 @@ var TilesetRenderEngine;
15061
15066
  enumerable: false,
15062
15067
  configurable: true
15063
15068
  });
15069
+ Object.defineProperty(Styler.prototype, "StyleProgress", {
15070
+ get: function () {
15071
+ return this._styleProgress;
15072
+ },
15073
+ enumerable: false,
15074
+ configurable: true
15075
+ });
15064
15076
  /**
15065
15077
  * Updates style mapping and fallback style.
15066
15078
  * This will trigger a re-style of all entities, and will stop existing style loads.
@@ -15103,6 +15115,8 @@ var TilesetRenderEngine;
15103
15115
  var regos = this.register.GetRegos({
15104
15116
  menuItemId: this.menuItemId
15105
15117
  });
15118
+ // Reset progress.
15119
+ this.updateStyleProgress();
15106
15120
  this.styleMappingLoaded = false;
15107
15121
  this.styleMappingsLoaded = {};
15108
15122
  this.QueueEntities(regos);
@@ -15217,9 +15231,37 @@ var TilesetRenderEngine;
15217
15231
  });
15218
15232
  };
15219
15233
  Styler.prototype.getEntityIdsForQueue = function () {
15220
- var BATCH_SIZE = this.expandSources ? 200 : 500;
15234
+ var BATCH_SIZE = this.expandSources ? 100 : 500;
15221
15235
  return this.recordLoadQueue.splice(0, BATCH_SIZE);
15222
15236
  };
15237
+ /**
15238
+ * Calculates the current progress % and updates the progress if there is a change.
15239
+ */
15240
+ Styler.prototype.updateStyleProgress = function () {
15241
+ var progress = 100; // Done when idling.
15242
+ if (this.recordCheckQueue.length || this.recordLoadQueue.length) {
15243
+ var total = Object.keys(this.styledEntityIds).length;
15244
+ // Done is the total minus the amount left.
15245
+ // We have to ensure the same ID isn't counted within or across these arrays as well.
15246
+ var uniqueSet = new Set(this.recordCheckQueue.concat(this.recordLoadQueue));
15247
+ var done = total - uniqueSet.size;
15248
+ progress = done / total * 100;
15249
+ // Round to 2dp, 0, or 100.
15250
+ if (progress < 0) {
15251
+ progress = 0;
15252
+ }
15253
+ else if (progress < 100) {
15254
+ progress = Math.round(progress * 100) / 100;
15255
+ }
15256
+ else if (progress > 100) {
15257
+ progress = 100;
15258
+ }
15259
+ }
15260
+ if (this._styleProgress != progress) {
15261
+ this._styleProgress = progress;
15262
+ this.OnStyleProgress.Trigger(progress);
15263
+ }
15264
+ };
15223
15265
  Styler.prototype.getEntityRego = function (entityId) {
15224
15266
  return this.register.GetRego({
15225
15267
  entityId: entityId,
@@ -15457,8 +15499,8 @@ var TilesetRenderEngine;
15457
15499
  }
15458
15500
  }
15459
15501
  var _loop_3 = function (i) {
15460
- var hash = batch[i];
15461
- var index = _this.recordCheckQueue.findIndex(function (x) { return x == hash; });
15502
+ var entityId = batch[i];
15503
+ var index = _this.recordCheckQueue.findIndex(function (x) { return x == entityId; });
15462
15504
  if (index > -1) {
15463
15505
  _this.recordCheckQueue.splice(index, 1);
15464
15506
  }
@@ -15487,6 +15529,11 @@ var TilesetRenderEngine;
15487
15529
  });
15488
15530
  };
15489
15531
  Styler.prototype.queueTilesetFeatureStyle = function (entity, highPriority) {
15532
+ // Add to the style dict if not already there.
15533
+ // This helps us know the styling progress for things that have loaded in so far.
15534
+ if (!this.styledEntityIds[entity.entityId]) {
15535
+ this.styledEntityIds[entity.entityId] = null;
15536
+ }
15490
15537
  if (this.styleMappingLoaded || this.styleMappingsLoaded[entity.entityTypeId] == true) {
15491
15538
  var needsData = this.getTilesetFeatureNeedsFullData(entity.entityId, entity.entityTypeId);
15492
15539
  if (needsData) {
@@ -15532,6 +15579,7 @@ var TilesetRenderEngine;
15532
15579
  override: this.styledEntityIds[entity.entityId] == true
15533
15580
  });
15534
15581
  this.styledEntityIds[entity.entityId] = true;
15582
+ this.updateStyleProgress();
15535
15583
  };
15536
15584
  Styler.prototype.getTilesetFeatureStyle = function (entityId, entityTypeId) {
15537
15585
  var _a, _b, _c, _d;
@@ -28232,7 +28280,7 @@ var WidgetViewBar = /** @class */ (function (_super) {
28232
28280
  return WidgetViewBar;
28233
28281
  }(Widget.AWidget));
28234
28282
 
28235
- var VERSION = "4.7.0";
28283
+ var VERSION = "4.7.2";
28236
28284
 
28237
28285
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, 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, 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 };
28238
28286
  //# sourceMappingURL=bruce-cesium.es5.js.map