bruce-cesium 5.6.1 → 5.6.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, 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, 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, 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';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -12722,6 +12722,10 @@ var EntitiesRenderManager;
12722
12722
  this.zoomControl = [];
12723
12723
  // Scenario for retrieving Entities.
12724
12724
  this.scenario = null;
12725
+ // Type IDs that we'll allow to be rendered when receiving Entities.
12726
+ // This is a band-aid for that fact that locally sourced Entities across Types are trickier to filter out.
12727
+ // So we request source info and use that to figure the situation out.
12728
+ this.allowedTypeIDs = [];
12725
12729
  const { viewer, apiGetter, monitor, item, register: visualsManager, sharedGetters } = params;
12726
12730
  this.viewer = viewer;
12727
12731
  this.sharedGetters = sharedGetters;
@@ -12735,81 +12739,115 @@ var EntitiesRenderManager;
12735
12739
  }
12736
12740
  }
12737
12741
  Init(params) {
12738
- var _a, _b, _c, _d, _e, _f, _g;
12739
12742
  if (this.disposed) {
12740
12743
  throw (new Error("This item is disposed."));
12741
12744
  }
12742
12745
  if (params === null || params === void 0 ? void 0 : params.item) {
12743
12746
  this.item = params.item;
12744
12747
  }
12745
- this.zoomControl = this.item.CameraZoomSettings;
12746
- if (!((_a = this.zoomControl) === null || _a === void 0 ? void 0 : _a.length)) {
12747
- this.zoomControl = [
12748
- {
12749
- MinZoom: 0,
12750
- MaxZoom: 200000,
12751
- DisplayType: ZoomControl.EDisplayType.Model3D,
12752
- LODCategoryID: "glb",
12753
- LODLevel: 0,
12754
- StyleID: 0
12748
+ (async () => {
12749
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12750
+ if (this.disposed) {
12751
+ return;
12752
+ }
12753
+ try {
12754
+ // Get type sources to look for locally sourced entity types.
12755
+ if ((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) {
12756
+ this.allowedTypeIDs = [];
12757
+ this.allowedTypeIDs.push((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"]);
12758
+ try {
12759
+ const api = this.apiGetter.getApi();
12760
+ const typeId = (_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"];
12761
+ const { Items: items } = await api.GET(`entitytype/${typeId}/sources`);
12762
+ for (const item of items) {
12763
+ if (item.Type == 0 && item["Source.EntityType.ID"] && (item.Kind == "ENTITY" || item.Kind == "UNSET")) {
12764
+ const typeId = item["Source.EntityType.ID"];
12765
+ if (typeId && !this.allowedTypeIDs.includes(typeId)) {
12766
+ this.allowedTypeIDs.push(typeId);
12767
+ }
12768
+ }
12769
+ }
12770
+ }
12771
+ catch (e) {
12772
+ console.error(e);
12773
+ }
12755
12774
  }
12756
- ];
12757
- }
12758
- this.renderPriority = this.item.renderPriority;
12759
- if (this.renderPriority == null) {
12760
- this.renderPriority = 1;
12761
- }
12762
- if (this.useGeojson && this.zoomControl.length > 1) {
12763
- console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12764
- this.zoomControl = [this.zoomControl[0]];
12765
- }
12766
- this.scenario = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.Scenario;
12767
- const isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
12768
- let tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
12769
- if (!tagsToRender) {
12770
- tagsToRender = [];
12771
- }
12772
- tagsToRender = [].concat(tagsToRender);
12773
- const shouldRender = !isTagItem || tagsToRender.length > 0;
12774
- this.unsetGetter();
12775
- (_c = this.viewMonitorRemoval) === null || _c === void 0 ? void 0 : _c.call(this);
12776
- this.viewMonitorRemoval = null;
12777
- (_d = this.entityCheckQueue) === null || _d === void 0 ? void 0 : _d.Dispose();
12778
- this.entityCheckQueue = null;
12779
- clearInterval(this.renderQueueInterval);
12780
- this.renderQueueInterval = null;
12781
- this.renderQueue = [];
12782
- // Remove just the ones that shouldn't be rendered.
12783
- // Eg: for a tag menu item we can see what tags are selected and only render those.
12784
- if (shouldRender) {
12785
- this.visualsManager.RemoveRegos({
12786
- menuItemId: this.item.id,
12787
- retainTagIds: tagsToRender
12788
- });
12789
- (_e = this.clustering) === null || _e === void 0 ? void 0 : _e.Dispose();
12790
- }
12791
- else {
12792
- this.visualsManager.RemoveRegos({
12793
- menuItemId: this.item.id
12794
- });
12795
- (_f = this.clustering) === null || _f === void 0 ? void 0 : _f.Dispose();
12796
- return;
12797
- }
12798
- if (this.item.enableClustering) {
12799
- this.clustering = new PointClustering(this.visualsManager, this.item.id, (_g = this.item) === null || _g === void 0 ? void 0 : _g.clustering);
12800
- }
12801
- this.setGetter();
12802
- this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
12803
- this.entityCheckQueue.Call();
12804
- });
12805
- this.entityCheckQueue = new DelayQueue(() => {
12806
- // Don't bother checking for zoom control changes if we only have 1 item.
12807
- // We'll let Cesium handle hide/show at max zoom range.
12808
- const shouldCheck = this.zoomControl && this.zoomControl.length > 1;
12809
- if (shouldCheck) {
12810
- this.doEntityCheck(Object.keys(this.renderedEntities));
12775
+ if (this.disposed) {
12776
+ return;
12777
+ }
12778
+ this.zoomControl = this.item.CameraZoomSettings;
12779
+ if (!((_d = this.zoomControl) === null || _d === void 0 ? void 0 : _d.length)) {
12780
+ this.zoomControl = [
12781
+ {
12782
+ MinZoom: 0,
12783
+ MaxZoom: 200000,
12784
+ DisplayType: ZoomControl.EDisplayType.Model3D,
12785
+ LODCategoryID: "glb",
12786
+ LODLevel: 0,
12787
+ StyleID: 0
12788
+ }
12789
+ ];
12790
+ }
12791
+ this.renderPriority = this.item.renderPriority;
12792
+ if (this.renderPriority == null) {
12793
+ this.renderPriority = 1;
12794
+ }
12795
+ if (this.useGeojson && this.zoomControl.length > 1) {
12796
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12797
+ this.zoomControl = [this.zoomControl[0]];
12798
+ }
12799
+ this.scenario = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.Scenario;
12800
+ const isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
12801
+ let tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
12802
+ if (!tagsToRender) {
12803
+ tagsToRender = [];
12804
+ }
12805
+ tagsToRender = [].concat(tagsToRender);
12806
+ const shouldRender = !isTagItem || tagsToRender.length > 0;
12807
+ this.unsetGetter();
12808
+ (_f = this.viewMonitorRemoval) === null || _f === void 0 ? void 0 : _f.call(this);
12809
+ this.viewMonitorRemoval = null;
12810
+ (_g = this.entityCheckQueue) === null || _g === void 0 ? void 0 : _g.Dispose();
12811
+ this.entityCheckQueue = null;
12812
+ clearInterval(this.renderQueueInterval);
12813
+ this.renderQueueInterval = null;
12814
+ this.renderQueue = [];
12815
+ // Remove just the ones that shouldn't be rendered.
12816
+ // Eg: for a tag menu item we can see what tags are selected and only render those.
12817
+ if (shouldRender) {
12818
+ this.visualsManager.RemoveRegos({
12819
+ menuItemId: this.item.id,
12820
+ retainTagIds: tagsToRender
12821
+ });
12822
+ (_h = this.clustering) === null || _h === void 0 ? void 0 : _h.Dispose();
12823
+ }
12824
+ else {
12825
+ this.visualsManager.RemoveRegos({
12826
+ menuItemId: this.item.id
12827
+ });
12828
+ (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
12829
+ return;
12830
+ }
12831
+ if (this.item.enableClustering) {
12832
+ this.clustering = new PointClustering(this.visualsManager, this.item.id, (_k = this.item) === null || _k === void 0 ? void 0 : _k.clustering);
12833
+ }
12834
+ this.setGetter();
12835
+ this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
12836
+ this.entityCheckQueue.Call();
12837
+ });
12838
+ this.entityCheckQueue = new DelayQueue(() => {
12839
+ // Don't bother checking for zoom control changes if we only have 1 item.
12840
+ // We'll let Cesium handle hide/show at max zoom range.
12841
+ const shouldCheck = this.zoomControl && this.zoomControl.length > 1;
12842
+ if (shouldCheck) {
12843
+ this.doEntityCheck(Object.keys(this.renderedEntities));
12844
+ }
12845
+ }, 3000);
12811
12846
  }
12812
- }, 3000);
12847
+ catch (e) {
12848
+ console.error(e);
12849
+ }
12850
+ })();
12813
12851
  }
12814
12852
  setGetter() {
12815
12853
  var _a, _b, _c;
@@ -13032,9 +13070,11 @@ var EntitiesRenderManager;
13032
13070
  return;
13033
13071
  }
13034
13072
  // Ensuring a re-render call with improper entity ids doesn't cause them to render here.
13035
- const typeId = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"];
13036
- if (typeId) {
13037
- entities = entities.filter(x => { var _a; return ((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) == typeId; });
13073
+ if (this.allowedTypeIDs) {
13074
+ const typeId = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"];
13075
+ if (typeId) {
13076
+ entities = entities.filter(x => { var _a; return this.allowedTypeIDs.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); });
13077
+ }
13038
13078
  }
13039
13079
  if (this.useGeojson) {
13040
13080
  const zoomItem = this.zoomControl[0];
@@ -31621,7 +31661,7 @@ class WidgetViewBar extends Widget.AWidget {
31621
31661
  }
31622
31662
  }
31623
31663
 
31624
- const VERSION = "5.6.1";
31664
+ const VERSION = "5.6.2";
31625
31665
 
31626
31666
  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, 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 };
31627
31667
  //# sourceMappingURL=bruce-cesium.es5.js.map