bruce-cesium 5.6.2 → 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.
@@ -12723,8 +12723,7 @@ var EntitiesRenderManager;
12723
12723
  // Scenario for retrieving Entities.
12724
12724
  this.scenario = null;
12725
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.
12726
+ // This might be exactly the Menu Item Type ID because of local data sources.
12728
12727
  this.allowedTypeIDs = [];
12729
12728
  const { viewer, apiGetter, monitor, item, register: visualsManager, sharedGetters } = params;
12730
12729
  this.viewer = viewer;
@@ -12746,37 +12745,23 @@ var EntitiesRenderManager;
12746
12745
  this.item = params.item;
12747
12746
  }
12748
12747
  (async () => {
12749
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12748
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
12750
12749
  if (this.disposed) {
12751
12750
  return;
12752
12751
  }
12753
12752
  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"]) {
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"])) {
12756
12755
  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);
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"]);
12773
12758
  }
12774
12759
  }
12775
12760
  if (this.disposed) {
12776
12761
  return;
12777
12762
  }
12778
12763
  this.zoomControl = this.item.CameraZoomSettings;
12779
- if (!((_d = this.zoomControl) === null || _d === void 0 ? void 0 : _d.length)) {
12764
+ if (!((_e = this.zoomControl) === null || _e === void 0 ? void 0 : _e.length)) {
12780
12765
  this.zoomControl = [
12781
12766
  {
12782
12767
  MinZoom: 0,
@@ -12796,7 +12781,7 @@ var EntitiesRenderManager;
12796
12781
  console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
12797
12782
  this.zoomControl = [this.zoomControl[0]];
12798
12783
  }
12799
- this.scenario = (_e = this.item.BruceEntity) === null || _e === void 0 ? void 0 : _e.Scenario;
12784
+ this.scenario = (_f = this.item.BruceEntity) === null || _f === void 0 ? void 0 : _f.Scenario;
12800
12785
  const isTagItem = Boolean(this.item.BruceEntity.ExpandLayers);
12801
12786
  let tagsToRender = isTagItem ? this.item.BruceEntity.SelectedExpandLayers : null;
12802
12787
  if (!tagsToRender) {
@@ -12805,9 +12790,9 @@ var EntitiesRenderManager;
12805
12790
  tagsToRender = [].concat(tagsToRender);
12806
12791
  const shouldRender = !isTagItem || tagsToRender.length > 0;
12807
12792
  this.unsetGetter();
12808
- (_f = this.viewMonitorRemoval) === null || _f === void 0 ? void 0 : _f.call(this);
12793
+ (_g = this.viewMonitorRemoval) === null || _g === void 0 ? void 0 : _g.call(this);
12809
12794
  this.viewMonitorRemoval = null;
12810
- (_g = this.entityCheckQueue) === null || _g === void 0 ? void 0 : _g.Dispose();
12795
+ (_h = this.entityCheckQueue) === null || _h === void 0 ? void 0 : _h.Dispose();
12811
12796
  this.entityCheckQueue = null;
12812
12797
  clearInterval(this.renderQueueInterval);
12813
12798
  this.renderQueueInterval = null;
@@ -12819,17 +12804,17 @@ var EntitiesRenderManager;
12819
12804
  menuItemId: this.item.id,
12820
12805
  retainTagIds: tagsToRender
12821
12806
  });
12822
- (_h = this.clustering) === null || _h === void 0 ? void 0 : _h.Dispose();
12807
+ (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
12823
12808
  }
12824
12809
  else {
12825
12810
  this.visualsManager.RemoveRegos({
12826
12811
  menuItemId: this.item.id
12827
12812
  });
12828
- (_j = this.clustering) === null || _j === void 0 ? void 0 : _j.Dispose();
12813
+ (_k = this.clustering) === null || _k === void 0 ? void 0 : _k.Dispose();
12829
12814
  return;
12830
12815
  }
12831
12816
  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);
12817
+ this.clustering = new PointClustering(this.visualsManager, this.item.id, (_l = this.item) === null || _l === void 0 ? void 0 : _l.clustering);
12833
12818
  }
12834
12819
  this.setGetter();
12835
12820
  this.viewMonitorRemoval = this.monitor.Updated().Subscribe(() => {
@@ -12849,6 +12834,50 @@ var EntitiesRenderManager;
12849
12834
  }
12850
12835
  })();
12851
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
+ }
12851
+ }
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;
12862
+ }
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
+ }
12880
+ }
12852
12881
  setGetter() {
12853
12882
  var _a, _b, _c;
12854
12883
  this.unsetGetter();
@@ -12880,9 +12909,14 @@ var EntitiesRenderManager;
12880
12909
  zoomControl: this.zoomControl
12881
12910
  });
12882
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]);
12883
- 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);
12884
12918
  if (isTagItem) {
12885
- this.distributeForRender(entities.filter((entity) => {
12919
+ this.distributeForRender(data.entities.filter((entity) => {
12886
12920
  let entityTags = entity.Bruce["Layer.ID"];
12887
12921
  if (!entityTags) {
12888
12922
  entityTags = [];
@@ -12893,7 +12927,7 @@ var EntitiesRenderManager;
12893
12927
  }));
12894
12928
  }
12895
12929
  else {
12896
- this.distributeForRender(entities);
12930
+ this.distributeForRender(data.entities);
12897
12931
  }
12898
12932
  });
12899
12933
  }
@@ -17059,7 +17093,9 @@ var EntityFilterGetter;
17059
17093
  response = {
17060
17094
  entities: tmpResponse.Items ? tmpResponse.Items : [],
17061
17095
  nextPage: tmpResponse.NextPage,
17062
- nextPageUrl: tmpResponse.NextPageURL
17096
+ nextPageUrl: tmpResponse.NextPageURL,
17097
+ sources: tmpResponse.Source,
17098
+ entityTypeSources: tmpResponse["EntityType.Source"]
17063
17099
  };
17064
17100
  }
17065
17101
  else {
@@ -17098,7 +17134,11 @@ var EntityFilterGetter;
17098
17134
  const entities = response.entities;
17099
17135
  const integrity = this.getIntegrityId();
17100
17136
  if (loopIntegrity == integrity && entities) {
17101
- (_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
+ });
17102
17142
  }
17103
17143
  if (this.gatheredIntegrity != integrity) {
17104
17144
  this.gatheredIntegrity = integrity;
@@ -17221,12 +17261,14 @@ var EntityFilterGetter;
17221
17261
  // Controller we can use to abort the request when a new loop starts.
17222
17262
  const controller = this.historicRefreshAbortController = new AbortController();
17223
17263
  let entities = [];
17264
+ let sources = [];
17265
+ let entityTypeSources = [];
17224
17266
  await SharedGetters.Queue.Run("Refreshing historic data in Menu Item that loads Entity Type: " + this.typeIds, async () => {
17225
17267
  var _a;
17226
17268
  if (controller.signal.aborted || !((_a = this.GetMenuItems()) === null || _a === void 0 ? void 0 : _a.length)) {
17227
17269
  return;
17228
17270
  }
17229
- entities = (await Entity$1.GetList({
17271
+ const data = await Entity$1.GetList({
17230
17272
  api: this.api,
17231
17273
  scenario: this.scenario,
17232
17274
  historicKey: this.historicAttrKey,
@@ -17257,7 +17299,10 @@ var EntityFilterGetter;
17257
17299
  noCache: true,
17258
17300
  abortSignal: controller.signal
17259
17301
  }
17260
- })).entities;
17302
+ });
17303
+ entities = data.entities;
17304
+ sources = data.sources;
17305
+ entityTypeSources = data.entityTypeSources;
17261
17306
  });
17262
17307
  // Date changed.
17263
17308
  if (this.historicAttrDateTime != historicAttrDateTime) {
@@ -17271,7 +17316,11 @@ var EntityFilterGetter;
17271
17316
  if (!this.GetMenuItems().length) {
17272
17317
  break;
17273
17318
  }
17274
- (_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
+ });
17275
17324
  }
17276
17325
  }
17277
17326
  catch (e) {
@@ -31661,7 +31710,7 @@ class WidgetViewBar extends Widget.AWidget {
31661
31710
  }
31662
31711
  }
31663
31712
 
31664
- const VERSION = "5.6.2";
31713
+ const VERSION = "5.6.3";
31665
31714
 
31666
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 };
31667
31716
  //# sourceMappingURL=bruce-cesium.es5.js.map