bruce-cesium 4.6.9 → 4.7.1

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, EntityAttribute, EntityAttachment, EntityAttachmentType, AbstractApi, 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, AbstractApi, Session, EntityAttribute, EntityAttachment, EntityAttachmentType } 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, SceneMode, ColorBlendMode, HeadingPitchRoll, Transforms, Model, 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, 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, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  /*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15015,12 +15015,13 @@ var TilesetRenderEngine;
15015
15015
  }
15016
15016
  TilesetRenderEngine.RenderLegacy = RenderLegacy;
15017
15017
  var Styler = /** @class */ (function () {
15018
- function Styler(viewer, api, cTileset, fallbackStyleId, styleMapping, menuItemId, register) {
15018
+ function Styler(viewer, api, cTileset, fallbackStyleId, styleMapping, expandSources, menuItemId, register) {
15019
15019
  var _a;
15020
15020
  this.disposed = false;
15021
15021
  this.styleMappingLoaded = false;
15022
15022
  this.styleMappingsLoaded = {};
15023
15023
  this.fallbackStyle = null;
15024
+ this.expandSources = false;
15024
15025
  this.loadingCounter = 0;
15025
15026
  // Dictionary of Entity ID -> boolean to indicate which Entities have been styled.
15026
15027
  // This is used to determine if the Style colour needs to be overriden or not.
@@ -15028,9 +15029,15 @@ var TilesetRenderEngine;
15028
15029
  this.runningQueues = 0;
15029
15030
  this.recordLoadQueue = [];
15030
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();
15031
15037
  this.viewer = viewer;
15032
15038
  this.api = api;
15033
15039
  this.cTileset = cTileset;
15040
+ this.expandSources = expandSources;
15034
15041
  this.fallbackStyleId = fallbackStyleId;
15035
15042
  this.styleMapping = styleMapping;
15036
15043
  if (styleMapping) {
@@ -15059,6 +15066,13 @@ var TilesetRenderEngine;
15059
15066
  enumerable: false,
15060
15067
  configurable: true
15061
15068
  });
15069
+ Object.defineProperty(Styler.prototype, "StyleProgress", {
15070
+ get: function () {
15071
+ return this._styleProgress;
15072
+ },
15073
+ enumerable: false,
15074
+ configurable: true
15075
+ });
15062
15076
  /**
15063
15077
  * Updates style mapping and fallback style.
15064
15078
  * This will trigger a re-style of all entities, and will stop existing style loads.
@@ -15091,6 +15105,9 @@ var TilesetRenderEngine;
15091
15105
  else {
15092
15106
  this.fallbackStyle = null;
15093
15107
  }
15108
+ if (params.expandSources != null) {
15109
+ this.expandSources = params.expandSources;
15110
+ }
15094
15111
  // Empty queues.
15095
15112
  // Requeue all.
15096
15113
  this.recordLoadQueue = [];
@@ -15150,7 +15167,8 @@ var TilesetRenderEngine;
15150
15167
  return [4 /*yield*/, Entity$1.GetListByIds({
15151
15168
  api: this.api,
15152
15169
  entityIds: batch,
15153
- migrated: true
15170
+ migrated: true,
15171
+ expandSources: this.expandSources
15154
15172
  })];
15155
15173
  case 2:
15156
15174
  entities = (_c.sent()).entities;
@@ -15211,9 +15229,35 @@ var TilesetRenderEngine;
15211
15229
  });
15212
15230
  };
15213
15231
  Styler.prototype.getEntityIdsForQueue = function () {
15214
- var BATCH_SIZE = 500;
15232
+ var BATCH_SIZE = this.expandSources ? 100 : 500;
15215
15233
  return this.recordLoadQueue.splice(0, BATCH_SIZE);
15216
15234
  };
15235
+ /**
15236
+ * Calculates the current progress % and updates the progress if there is a change.
15237
+ */
15238
+ Styler.prototype.updateStyleProgress = function () {
15239
+ var _this = this;
15240
+ var progress = 100; // Done when idling.
15241
+ if (this.recordCheckQueue.length || this.recordLoadQueue.length) {
15242
+ var total = Object.keys(this.styledEntityIds).length;
15243
+ var done = Object.keys(this.styledEntityIds).filter(function (x) { return _this.styledEntityIds[x]; }).length;
15244
+ progress = Math.round((done / total) * 100);
15245
+ // Round to 2dp, 0, or 100.
15246
+ if (progress < 0) {
15247
+ progress = 0;
15248
+ }
15249
+ else if (progress < 100) {
15250
+ progress = Math.round(progress * 100) / 100;
15251
+ }
15252
+ else if (progress > 100) {
15253
+ progress = 100;
15254
+ }
15255
+ }
15256
+ if (this._styleProgress != progress) {
15257
+ this._styleProgress = progress;
15258
+ this.OnStyleProgress.Trigger(progress);
15259
+ }
15260
+ };
15217
15261
  Styler.prototype.getEntityRego = function (entityId) {
15218
15262
  return this.register.GetRego({
15219
15263
  entityId: entityId,
@@ -15481,6 +15525,11 @@ var TilesetRenderEngine;
15481
15525
  });
15482
15526
  };
15483
15527
  Styler.prototype.queueTilesetFeatureStyle = function (entity, highPriority) {
15528
+ // Add to the style dict if not already there.
15529
+ // This helps us know the styling progress for things that have loaded in so far.
15530
+ if (!this.styledEntityIds[entity.entityId]) {
15531
+ this.styledEntityIds[entity.entityId] = null;
15532
+ }
15484
15533
  if (this.styleMappingLoaded || this.styleMappingsLoaded[entity.entityTypeId] == true) {
15485
15534
  var needsData = this.getTilesetFeatureNeedsFullData(entity.entityId, entity.entityTypeId);
15486
15535
  if (needsData) {
@@ -15526,6 +15575,7 @@ var TilesetRenderEngine;
15526
15575
  override: this.styledEntityIds[entity.entityId] == true
15527
15576
  });
15528
15577
  this.styledEntityIds[entity.entityId] = true;
15578
+ this.updateStyleProgress();
15529
15579
  };
15530
15580
  Styler.prototype.getTilesetFeatureStyle = function (entityId, entityTypeId) {
15531
15581
  var _a, _b, _c, _d;
@@ -15740,12 +15790,13 @@ var TilesetCadRenderManager;
15740
15790
  }
15741
15791
  this.viewer.scene.requestRender();
15742
15792
  TilesetRenderEngine.OnTilesetReady(this.cTileset).then(function () {
15793
+ var _a;
15743
15794
  try {
15744
15795
  if (_this.disposed || cTileset.isDestroyed()) {
15745
15796
  return;
15746
15797
  }
15747
15798
  _this.onCTilesetLoad();
15748
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
15799
+ _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, (_a = _this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.ExpandSources, _this.item.id, _this.visualsManager);
15749
15800
  _this.viewer.scene.requestRender();
15750
15801
  }
15751
15802
  catch (e) {
@@ -17604,7 +17655,7 @@ var TilesetEntitiesRenderManager;
17604
17655
  }
17605
17656
  if (_this.item.ApplyStyles) {
17606
17657
  var api_1 = _this.getters.GetBruceApi();
17607
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api_1, _this.cTileset, +_this.item.styleId, [], _this.item.id, _this.visualsManager);
17658
+ _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api_1, _this.cTileset, +_this.item.styleId, [], false, _this.item.id, _this.visualsManager);
17608
17659
  }
17609
17660
  _this.onCTilesetLoad();
17610
17661
  _this.viewer.scene.requestRender();
@@ -18273,7 +18324,7 @@ var TilesetArbRenderManager;
18273
18324
  if (_this.item.ApplyStyles ||
18274
18325
  _this.item.Type == MenuItem.EType.IonTileset) {
18275
18326
  var api = _this.getters.GetBruceApi();
18276
- _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, _this.item.id, _this.visualsManager);
18327
+ _this.styler = new TilesetRenderEngine.Styler(_this.viewer, api, _this.cTileset, _this.item.styleId, _this.item.StyleMapping, false, _this.item.id, _this.visualsManager);
18277
18328
  }
18278
18329
  _this.onCTilesetLoad();
18279
18330
  _this.viewer.scene.requestRender();
@@ -25964,7 +26015,7 @@ var MARKER_ICON_SVG = "\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24
25964
26015
  var CLOSE_ICON_SVG = "\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M15.7909 12L21.4767 6.3142C22.1744 5.61648 22.1744 4.48523 21.4767 3.78693L20.2131 2.5233C19.5153 1.82557 18.3841 1.82557 17.6858 2.5233L12 8.20909L6.3142 2.5233C5.61648 1.82557 4.48523 1.82557 3.78693 2.5233L2.5233 3.78693C1.82557 4.48466 1.82557 5.61591 2.5233 6.3142L8.20909 12L2.5233 17.6858C1.82557 18.3835 1.82557 19.5148 2.5233 20.2131L3.78693 21.4767C4.48466 22.1744 5.61648 22.1744 6.3142 21.4767L12 15.7909L17.6858 21.4767C18.3835 22.1744 19.5153 22.1744 20.2131 21.4767L21.4767 20.2131C22.1744 19.5153 22.1744 18.3841 21.4767 17.6858L15.7909 12Z\" fill=\"black\"/>\n </svg>\n";
25965
26016
  function generateEle() {
25966
26017
  var ele = document.createElement("div");
25967
- ele.setAttribute("style", "\n left: 0px;\n top: 0px;\n position: absolute;\n z-index: 3;\n border-radius: 18px;\n background-color: white;\n display: flex;\n align-items: center;\n padding: 3px 4px;\n padding-right: 10px;\n font-size: 15px;\n pointer-events: none;\n box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.24), 0px 18px 36px -4px rgba(18, 22, 25, 0.6);\n ");
26018
+ ele.setAttribute("style", "\n left: 0px;\n top: 0px;\n position: absolute;\n z-index: 3;\n border-radius: 18px;\n background-color: white;\n display: flex;\n align-items: center;\n padding: 3px 4px;\n padding-right: 10px;\n font-size: 15px;\n pointer-events: none;\n box-shadow: 0px 0px 1px rgba(18, 22, 25, 0.24), 0px 18px 36px -4px rgba(18, 22, 25, 0.6);\n color: black;\n ");
25968
26019
  var icon = document.createElement("div");
25969
26020
  icon.innerHTML = MARKER_ICON_SVG;
25970
26021
  icon.setAttribute("style", "\n margin-right: 2px;\n height: 30px;\n width: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n ");
@@ -28225,7 +28276,7 @@ var WidgetViewBar = /** @class */ (function (_super) {
28225
28276
  return WidgetViewBar;
28226
28277
  }(Widget.AWidget));
28227
28278
 
28228
- var VERSION = "4.6.9";
28279
+ var VERSION = "4.7.1";
28229
28280
 
28230
28281
  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 };
28231
28282
  //# sourceMappingURL=bruce-cesium.es5.js.map