bruce-cesium 5.8.9 → 5.9.0

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, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, 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, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, 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, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, Primitive, Cesium3DTileFeature, SceneMode, HorizontalOrigin, VerticalOrigin, GeoJsonDataSource, HeadingPitchRange, Ion, Cesium3DTileStyle, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, IonResource, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -22416,6 +22416,7 @@ var AssemblyRenderManager;
22416
22416
  // Quick look-up of the hierarchy nodes by entity ID.
22417
22417
  this.hierarchyNodeByEntityId = null;
22418
22418
  this.modelSpace = false;
22419
+ this.rootId = null;
22419
22420
  const { viewer, register: visualsManager, getters, item } = params;
22420
22421
  this.viewer = viewer;
22421
22422
  this.getters = getters;
@@ -22429,7 +22430,6 @@ var AssemblyRenderManager;
22429
22430
  this.renderPriority = 1;
22430
22431
  }
22431
22432
  (async () => {
22432
- var _a, _b, _c;
22433
22433
  if (this.disposed) {
22434
22434
  return;
22435
22435
  }
@@ -22461,81 +22461,100 @@ var AssemblyRenderManager;
22461
22461
  rootId = hierarchy.Root.ID;
22462
22462
  }
22463
22463
  }
22464
+ this.rootId = rootId;
22464
22465
  if (this.disposed) {
22465
22466
  return;
22466
22467
  }
22467
- const BATCH_SIZE = 200;
22468
- let batches = Math.ceil(flatEntityIds.length / BATCH_SIZE);
22469
- for (let i = 0; i < batches; i++) {
22470
- const batch = flatEntityIds.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE);
22471
- if (!batch.length) {
22472
- continue;
22473
- }
22474
- const { entities } = await Entity$1.GetListByIds({
22475
- entityIds: batch,
22476
- api: this.getters.GetBruceApi(),
22477
- expandLODs: true,
22478
- expandLocation: true
22479
- });
22480
- if (this.disposed) {
22481
- return;
22482
- }
22483
- for (const entity of entities) {
22484
- const lod = entity.Bruce.LOD ? entity.Bruce.LOD[0] : null;
22485
- if (!lod || !((_a = lod["ClientFile"]) === null || _a === void 0 ? void 0 : _a.URL)) {
22486
- // Won't bother with vector data for this experiment.
22487
- continue;
22488
- }
22489
- const pos3d = calcEntityLocation$1(entity, this.modelSpace);
22490
- const orient = calcEntityOrientation(entity, pos3d, this.modelSpace);
22491
- if (!pos3d || !orient) {
22492
- continue;
22493
- }
22494
- const cEntity = this.viewer.entities.add({
22495
- model: {
22496
- uri: lod["ClientFile"].URL,
22497
- heightReference: HeightReference.NONE
22498
- },
22499
- // point: {
22500
- // pixelSize: 50,
22501
- // disableDepthTestDistance: Number.POSITIVE_INFINITY,
22502
- // color: Cesium.Color.fromCssColorString("#FF0000"),
22503
- // heightReference: Cesium.HeightReference.NONE
22504
- // },
22505
- position: pos3d,
22506
- orientation: new ConstantProperty(orient)
22507
- });
22508
- const geometryRadius = Entity$1.GetValue({
22509
- entity: entity,
22510
- path: ["Bruce", "GeometryRadius"]
22511
- });
22512
- cEntity.model["_radius"] = geometryRadius;
22513
- cEntity.model["_radiusLoaded"] = true;
22514
- this.visualsManager.AddRego({
22515
- rego: {
22516
- canEdit: true,
22517
- entityId: entity.Bruce.ID,
22518
- menuItemId: this.item.id,
22519
- menuItemType: this.item.Type,
22520
- priority: this.renderPriority,
22521
- visual: cEntity,
22522
- accountId: this.getters.GetAccountId(),
22523
- entityTypeId: entity.Bruce["EntityType.ID"],
22524
- name: entity.Bruce.Name,
22525
- rootId: rootId,
22526
- parentId: (_c = (_b = this.hierarchyNodeByEntityId) === null || _b === void 0 ? void 0 : _b[entity.Bruce.ID]) === null || _c === void 0 ? void 0 : _c.parentId
22527
- },
22528
- requestRender: false
22529
- });
22530
- }
22531
- this.viewer.scene.requestRender();
22468
+ else if (flatEntityIds.length === 0) {
22469
+ return;
22532
22470
  }
22471
+ this.processEntityIds(flatEntityIds);
22533
22472
  }
22534
22473
  catch (e) {
22535
22474
  console.error("AssemblyRenderManager.Manager.Init()", e);
22536
22475
  }
22537
22476
  })();
22538
22477
  }
22478
+ /**
22479
+ * Processes given entity IDs and renders them in the viewer.
22480
+ * @param entityIds
22481
+ * @returns
22482
+ */
22483
+ async processEntityIds(entityIds) {
22484
+ var _a, _b, _c;
22485
+ if (!entityIds || !entityIds.length) {
22486
+ return;
22487
+ }
22488
+ else if (this.disposed) {
22489
+ return;
22490
+ }
22491
+ const BATCH_SIZE = 200;
22492
+ let batches = Math.ceil(entityIds.length / BATCH_SIZE);
22493
+ for (let i = 0; i < batches; i++) {
22494
+ const batch = entityIds.slice(i * BATCH_SIZE, (i + 1) * BATCH_SIZE);
22495
+ if (!batch.length) {
22496
+ continue;
22497
+ }
22498
+ const { entities: fetched } = await Entity$1.GetListByIds({
22499
+ entityIds: batch,
22500
+ api: this.getters.GetBruceApi(),
22501
+ expandLODs: true,
22502
+ expandLocation: true
22503
+ });
22504
+ if (this.disposed) {
22505
+ return;
22506
+ }
22507
+ for (const entity of fetched) {
22508
+ const lod = entity.Bruce.LOD ? entity.Bruce.LOD[0] : null;
22509
+ if (!lod || !((_a = lod["ClientFile"]) === null || _a === void 0 ? void 0 : _a.URL)) {
22510
+ // Won't bother with vector data for this experiment.
22511
+ continue;
22512
+ }
22513
+ const pos3d = calcEntityLocation$1(entity, this.modelSpace);
22514
+ const orient = calcEntityOrientation(entity, pos3d, this.modelSpace);
22515
+ if (!pos3d || !orient) {
22516
+ continue;
22517
+ }
22518
+ const cEntity = this.viewer.entities.add({
22519
+ model: {
22520
+ uri: lod["ClientFile"].URL,
22521
+ heightReference: HeightReference.NONE
22522
+ },
22523
+ // point: {
22524
+ // pixelSize: 50,
22525
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
22526
+ // color: Cesium.Color.fromCssColorString("#FF0000"),
22527
+ // heightReference: Cesium.HeightReference.NONE
22528
+ // },
22529
+ position: pos3d,
22530
+ orientation: new ConstantProperty(orient)
22531
+ });
22532
+ const geometryRadius = Entity$1.GetValue({
22533
+ entity: entity,
22534
+ path: ["Bruce", "GeometryRadius"]
22535
+ });
22536
+ cEntity.model["_radius"] = geometryRadius;
22537
+ cEntity.model["_radiusLoaded"] = true;
22538
+ this.visualsManager.AddRego({
22539
+ rego: {
22540
+ canEdit: true,
22541
+ entityId: entity.Bruce.ID,
22542
+ menuItemId: this.item.id,
22543
+ menuItemType: this.item.Type,
22544
+ priority: this.renderPriority,
22545
+ visual: cEntity,
22546
+ accountId: this.getters.GetAccountId(),
22547
+ entityTypeId: entity.Bruce["EntityType.ID"],
22548
+ name: entity.Bruce.Name,
22549
+ rootId: this.rootId,
22550
+ parentId: (_c = (_b = this.hierarchyNodeByEntityId) === null || _b === void 0 ? void 0 : _b[entity.Bruce.ID]) === null || _c === void 0 ? void 0 : _c.parentId
22551
+ },
22552
+ requestRender: false
22553
+ });
22554
+ }
22555
+ this.viewer.scene.requestRender();
22556
+ }
22557
+ }
22539
22558
  Dispose() {
22540
22559
  if (this.disposed) {
22541
22560
  return;
@@ -22550,6 +22569,10 @@ var AssemblyRenderManager;
22550
22569
  if (entities && !entityIds) {
22551
22570
  entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
22552
22571
  }
22572
+ if (!entityIds && entities) {
22573
+ entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
22574
+ }
22575
+ this.processEntityIds(entityIds);
22553
22576
  }
22554
22577
  /**
22555
22578
  * Builds quick look-up of the hierarchy nodes by entity ID.
@@ -33092,7 +33115,7 @@ class WidgetViewBar extends Widget.AWidget {
33092
33115
  }
33093
33116
  }
33094
33117
 
33095
- const VERSION = "5.8.9";
33118
+ const VERSION = "5.9.0";
33096
33119
 
33097
33120
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, DEFAULT_LIVE_PADDING_SECONDS, 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 };
33098
33121
  //# sourceMappingURL=bruce-cesium.es5.js.map