bruce-cesium 5.6.1 → 5.6.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, 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,9 @@ 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 might be exactly the Menu Item Type ID because of local data sources.
12727
+ this.allowedTypeIDs = [];
12725
12728
  const { viewer, apiGetter, monitor, item, register: visualsManager, sharedGetters } = params;
12726
12729
  this.viewer = viewer;
12727
12730
  this.sharedGetters = sharedGetters;
@@ -12735,81 +12738,145 @@ var EntitiesRenderManager;
12735
12738
  }
12736
12739
  }
12737
12740
  Init(params) {
12738
- var _a, _b, _c, _d, _e, _f, _g;
12739
12741
  if (this.disposed) {
12740
12742
  throw (new Error("This item is disposed."));
12741
12743
  }
12742
12744
  if (params === null || params === void 0 ? void 0 : params.item) {
12743
12745
  this.item = params.item;
12744
12746
  }
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
12747
+ (async () => {
12748
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12749
+ if (this.disposed) {
12750
+ return;
12751
+ }
12752
+ try {
12753
+ // Reset allowed list if there's change.
12754
+ if (((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]) && !this.allowedTypeIDs.includes((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"])) {
12755
+ this.allowedTypeIDs = [];
12756
+ if ((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c["EntityType.ID"]) {
12757
+ this.allowedTypeIDs.push((_d = this.item.BruceEntity) === null || _d === void 0 ? void 0 : _d["EntityType.ID"]);
12758
+ }
12755
12759
  }
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);
12760
+ if (this.disposed) {
12761
+ return;
12762
+ }
12763
+ this.zoomControl = this.item.CameraZoomSettings;
12764
+ if (!((_e = this.zoomControl) === null || _e === void 0 ? void 0 : _e.length)) {
12765
+ this.zoomControl = [
12766
+ {
12767
+ MinZoom: 0,
12768
+ MaxZoom: 200000,
12769
+ DisplayType: ZoomControl.EDisplayType.Model3D,
12770
+ LODCategoryID: "glb",
12771
+ LODLevel: 0,
12772
+ StyleID: 0
12773
+ }
12774
+ ];
12775
+ }
12776
+ this.renderPriority = this.item.renderPriority;
12777
+ if (this.renderPriority == null) {
12778
+ this.renderPriority = 1;
12779
+ }
12780
+ if (this.useGeojson && this.zoomControl.length > 1) {
12781
+ console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12782
+ this.zoomControl = [this.zoomControl[0]];
12783
+ }
12784
+ this.scenario = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.Scenario;
12785
+ const isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
12786
+ let tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
12787
+ if (!tagsToRender) {
12788
+ tagsToRender = [];
12789
+ }
12790
+ tagsToRender = [].concat(tagsToRender);
12791
+ const shouldRender = !isTagItem || tagsToRender.length > 0;
12792
+ this.unsetGetter();
12793
+ (_g = this.viewMonitorRemoval) === null || _g === void 0 ? void 0 : _g.call(this);
12794
+ this.viewMonitorRemoval = null;
12795
+ (_h = this.entityCheckQueue) === null || _h === void 0 ? void 0 : _h.Dispose();
12796
+ this.entityCheckQueue = null;
12797
+ clearInterval(this.renderQueueInterval);
12798
+ this.renderQueueInterval = null;
12799
+ this.renderQueue = [];
12800
+ // Remove just the ones that shouldn't be rendered.
12801
+ // Eg: for a tag menu item we can see what tags are selected and only render those.
12802
+ if (shouldRender) {
12803
+ this.visualsManager.RemoveRegos({
12804
+ menuItemId: this.item.id,
12805
+ retainTagIds: tagsToRender
12806
+ });
12807
+ (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
12808
+ }
12809
+ else {
12810
+ this.visualsManager.RemoveRegos({
12811
+ menuItemId: this.item.id
12812
+ });
12813
+ (_k = this.clustering) === null || _k === void 0 ? void 0 : _k.Dispose();
12814
+ return;
12815
+ }
12816
+ if (this.item.enableClustering) {
12817
+ this.clustering = new PointClustering(this.visualsManager, this.item.id, (_l = this.item) === null || _l === void 0 ? void 0 : _l.clustering);
12818
+ }
12819
+ this.setGetter();
12820
+ this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
12821
+ this.entityCheckQueue.Call();
12822
+ });
12823
+ this.entityCheckQueue = new DelayQueue(() => {
12824
+ // Don't bother checking for zoom control changes if we only have 1 item.
12825
+ // We'll let Cesium handle hide/show at max zoom range.
12826
+ const shouldCheck = this.zoomControl && this.zoomControl.length > 1;
12827
+ if (shouldCheck) {
12828
+ this.doEntityCheck(Object.keys(this.renderedEntities));
12829
+ }
12830
+ }, 3000);
12831
+ }
12832
+ catch (e) {
12833
+ console.error(e);
12834
+ }
12835
+ })();
12836
+ }
12837
+ /**
12838
+ * Updates allowedTypeIDs values based in incoming data.
12839
+ * We might request 'x' Entity Type, but get 'y' Entities due to local Data Sources.
12840
+ * So we'll dynamically construct allowed type IDs to help filter out unwanted Entities from further ReRender calls.
12841
+ * @param typeSources
12842
+ * @param entities
12843
+ */
12844
+ updateAllowedTypeIDs(typeSources, entities) {
12845
+ var _a, _b;
12846
+ const sourceLookup = new Map();
12847
+ if (typeSources) {
12848
+ for (const source of typeSources) {
12849
+ sourceLookup.set(source.ID, source);
12850
+ }
12800
12851
  }
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));
12852
+ for (let i = 0; i < entities.length; i++) {
12853
+ const entity = entities[i];
12854
+ const typeId = (_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"];
12855
+ if (!typeId || this.allowedTypeIDs.includes(typeId)) {
12856
+ continue;
12857
+ }
12858
+ // If an Entity is not from the allowed Entity Type, but has a source matching it, then it's allowed.
12859
+ // Therefor we will add it to the allowedTypeIDs list.
12860
+ if (!((_b = entity.Bruce["Sources"]) === null || _b === void 0 ? void 0 : _b.length)) {
12861
+ continue;
12811
12862
  }
12812
- }, 3000);
12863
+ const sources = entity.Bruce["Sources"];
12864
+ for (const source of sources) {
12865
+ if (!source["EntityType.Source.ID"]) {
12866
+ continue;
12867
+ }
12868
+ const sRecord = sourceLookup.get(source["EntityType.Source.ID"]);
12869
+ if (!sRecord) {
12870
+ continue;
12871
+ }
12872
+ if (sRecord["EntityType.ID"] && this.allowedTypeIDs.includes(sRecord["EntityType.ID"])) {
12873
+ const toAddTypeId = sRecord["Source.EntityType.ID"];
12874
+ if (toAddTypeId && !this.allowedTypeIDs.includes(toAddTypeId)) {
12875
+ this.allowedTypeIDs.push(toAddTypeId);
12876
+ }
12877
+ }
12878
+ }
12879
+ }
12813
12880
  }
12814
12881
  setGetter() {
12815
12882
  var _a, _b, _c;
@@ -12842,9 +12909,14 @@ var EntitiesRenderManager;
12842
12909
  zoomControl: this.zoomControl
12843
12910
  });
12844
12911
  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]);
12845
- this.getterSub = this.getter.OnUpdate.Subscribe((entities) => {
12912
+ this.getterSub = this.getter.OnUpdate.Subscribe((data) => {
12913
+ var _a;
12914
+ if (!((_a = data === null || data === void 0 ? void 0 : data.entities) === null || _a === void 0 ? void 0 : _a.length)) {
12915
+ return;
12916
+ }
12917
+ this.updateAllowedTypeIDs(data.entityTypeSources, data.entities);
12846
12918
  if (isTagItem) {
12847
- this.distributeForRender(entities.filter((entity) => {
12919
+ this.distributeForRender(data.entities.filter((entity) => {
12848
12920
  let entityTags = entity.Bruce["Layer.ID"];
12849
12921
  if (!entityTags) {
12850
12922
  entityTags = [];
@@ -12855,7 +12927,7 @@ var EntitiesRenderManager;
12855
12927
  }));
12856
12928
  }
12857
12929
  else {
12858
- this.distributeForRender(entities);
12930
+ this.distributeForRender(data.entities);
12859
12931
  }
12860
12932
  });
12861
12933
  }
@@ -13032,9 +13104,11 @@ var EntitiesRenderManager;
13032
13104
  return;
13033
13105
  }
13034
13106
  // 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; });
13107
+ if (this.allowedTypeIDs) {
13108
+ const typeId = (_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a["EntityType.ID"];
13109
+ if (typeId) {
13110
+ entities = entities.filter(x => { var _a; return this.allowedTypeIDs.includes((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); });
13111
+ }
13038
13112
  }
13039
13113
  if (this.useGeojson) {
13040
13114
  const zoomItem = this.zoomControl[0];
@@ -17019,7 +17093,9 @@ var EntityFilterGetter;
17019
17093
  response = {
17020
17094
  entities: tmpResponse.Items ? tmpResponse.Items : [],
17021
17095
  nextPage: tmpResponse.NextPage,
17022
- nextPageUrl: tmpResponse.NextPageURL
17096
+ nextPageUrl: tmpResponse.NextPageURL,
17097
+ sources: tmpResponse.Source,
17098
+ entityTypeSources: tmpResponse["EntityType.Source"]
17023
17099
  };
17024
17100
  }
17025
17101
  else {
@@ -17058,7 +17134,11 @@ var EntityFilterGetter;
17058
17134
  const entities = response.entities;
17059
17135
  const integrity = this.getIntegrityId();
17060
17136
  if (loopIntegrity == integrity && entities) {
17061
- (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger(entities);
17137
+ (_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({
17138
+ entities: entities,
17139
+ sources: response.sources,
17140
+ entityTypeSources: response.entityTypeSources
17141
+ });
17062
17142
  }
17063
17143
  if (this.gatheredIntegrity != integrity) {
17064
17144
  this.gatheredIntegrity = integrity;
@@ -17181,12 +17261,14 @@ var EntityFilterGetter;
17181
17261
  // Controller we can use to abort the request when a new loop starts.
17182
17262
  const controller = this.historicRefreshAbortController = new AbortController();
17183
17263
  let entities = [];
17264
+ let sources = [];
17265
+ let entityTypeSources = [];
17184
17266
  await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeIds, async () => {
17185
17267
  var _a;
17186
17268
  if (controller.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
17187
17269
  return;
17188
17270
  }
17189
- entities = (await Entity$1.GetList({
17271
+ const data = await Entity$1.GetList({
17190
17272
  api: this.api,
17191
17273
  scenario: this.scenario,
17192
17274
  historicKey: this.historicAttrKey,
@@ -17217,7 +17299,10 @@ var EntityFilterGetter;
17217
17299
  noCache: true,
17218
17300
  abortSignal: controller.signal
17219
17301
  }
17220
- })).entities;
17302
+ });
17303
+ entities = data.entities;
17304
+ sources = data.sources;
17305
+ entityTypeSources = data.entityTypeSources;
17221
17306
  });
17222
17307
  // Date changed.
17223
17308
  if (this.historicAttrDateTime != historicAttrDateTime) {
@@ -17231,7 +17316,11 @@ var EntityFilterGetter;
17231
17316
  if (!this.GetMenuItems().length) {
17232
17317
  break;
17233
17318
  }
17234
- (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger(entities);
17319
+ (_a = this.onUpdate) === null || _a === void 0 ? void 0 : _a.Trigger({
17320
+ entities: entities,
17321
+ sources: sources,
17322
+ entityTypeSources: entityTypeSources
17323
+ });
17235
17324
  }
17236
17325
  }
17237
17326
  catch (e) {
@@ -31621,7 +31710,7 @@ class WidgetViewBar extends Widget.AWidget {
31621
31710
  }
31622
31711
  }
31623
31712
 
31624
- const VERSION = "5.6.1";
31713
+ const VERSION = "5.6.3";
31625
31714
 
31626
31715
  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
31716
  //# sourceMappingURL=bruce-cesium.es5.js.map