bruce-cesium 4.9.7 → 4.9.9

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, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, Cesium3DTileset, Matrix4, Matrix3, IonResource, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, 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, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HorizontalOrigin, VerticalOrigin, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, GeoJsonDataSource, Primitive, Cesium3DTileFeature, Cesium3DTileColorBlendMode, HeadingPitchRange, Cesium3DTileStyle, Ion, KmlDataSource, OrthographicFrustum, EasingFunction, NearFarScalar, SceneTransforms, EllipsoidTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, Cesium3DTileset, Matrix4, Matrix3, IonResource, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, BoundingSphere, GeometryInstance, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -5625,6 +5625,7 @@ function shouldRecheck(viewer) {
5625
5625
  * @returns
5626
5626
  */
5627
5627
  function isCullingIgnored(viewer, rego) {
5628
+ var _a;
5628
5629
  if (
5629
5630
  // No rego or visual.
5630
5631
  // This is a safety check to avoid crashes.
@@ -5640,7 +5641,7 @@ function isCullingIgnored(viewer, rego) {
5640
5641
  // Won't touch in case there is special logic.
5641
5642
  rego.collection ||
5642
5643
  // We won't cull historic records as they may be interpolating their locations.
5643
- Boolean(rego.historicAttrKey)) {
5644
+ Boolean((_a = rego.historicLayers) === null || _a === void 0 ? void 0 : _a.length)) {
5644
5645
  return true;
5645
5646
  }
5646
5647
  const visual = rego.visual;
@@ -7627,6 +7628,36 @@ function getHeightRef$3(style, defaultStyle) {
7627
7628
  return heightRef;
7628
7629
  }
7629
7630
 
7631
+ /**
7632
+ * Returns if the historic metadata is different.
7633
+ * @param rego
7634
+ * @param entity
7635
+ */
7636
+ function isHistoricMetadataChanged(rego, entity) {
7637
+ var _a, _b, _c, _d, _e, _f, _g;
7638
+ // Different overlay amount.
7639
+ if (((_a = rego.historicLayers) === null || _a === void 0 ? void 0 : _a.length) != ((_c = (_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.HistoricLayers) === null || _c === void 0 ? void 0 : _c.length)) {
7640
+ return true;
7641
+ }
7642
+ // Both missing. Nothing to compare.
7643
+ else if (!rego.historicLayers && !((_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.HistoricLayers)) {
7644
+ return false;
7645
+ }
7646
+ // One missing. Definitely different.
7647
+ else if (!rego.historicLayers || !((_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.HistoricLayers)) {
7648
+ return true;
7649
+ }
7650
+ // Compare each layer.
7651
+ for (let i = 0; i < rego.historicLayers.length; i++) {
7652
+ if (rego.historicLayers[i].attrKey != ((_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricLayers[i].attrKey)) {
7653
+ return true;
7654
+ }
7655
+ if (rego.historicLayers[i].dateTime != ((_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricLayers[i].dateTime)) {
7656
+ return true;
7657
+ }
7658
+ }
7659
+ return false;
7660
+ }
7630
7661
  var EntityRenderEngine;
7631
7662
  (function (EntityRenderEngine) {
7632
7663
  function GetRenderGroupId(zoomItem) {
@@ -7637,7 +7668,7 @@ var EntityRenderEngine;
7637
7668
  }
7638
7669
  EntityRenderEngine.GetRenderGroupId = GetRenderGroupId;
7639
7670
  async function Render(params) {
7640
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7671
+ var _a, _b, _c, _d, _e, _f;
7641
7672
  const groupRenderParams = {
7642
7673
  apiGetter: params.apiGetter,
7643
7674
  viewer: params.viewer,
@@ -7720,9 +7751,8 @@ var EntityRenderEngine;
7720
7751
  if (!params.force &&
7721
7752
  newRenderId == oldRenderId &&
7722
7753
  !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
7723
- // If historic/scenario metadata is different then it's also stale.
7724
- ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.HistoricDateTime)) &&
7725
- ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.scenario) == ((_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.Scenario))) {
7754
+ !isHistoricMetadataChanged(existingRego, entity) &&
7755
+ ((existingRego === null || existingRego === void 0 ? void 0 : existingRego.scenario) == ((_b = entity.Bruce) === null || _b === void 0 ? void 0 : _b.Scenario))) {
7726
7756
  // No sorting category needed. Already rendered the way we want.
7727
7757
  cEntities.set(id, existingRego.visual);
7728
7758
  }
@@ -7733,11 +7763,9 @@ var EntityRenderEngine;
7733
7763
  // Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
7734
7764
  existingRego.stale = false;
7735
7765
  // Update metadata for the same reason.
7736
- existingRego.historicDateTime = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.HistoricDateTime;
7737
- existingRego.historicAttrKey = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.HistoricAttrKey;
7738
- existingRego.historicLayers = (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.HistoricLayers;
7766
+ existingRego.historicLayers = (_c = entity.Bruce) === null || _c === void 0 ? void 0 : _c.HistoricLayers;
7739
7767
  existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
7740
- existingRego.scenario = (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.Scenario;
7768
+ existingRego.scenario = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.Scenario;
7741
7769
  updated.set(id, true);
7742
7770
  }
7743
7771
  if (displayType == ZoomControl.EDisplayType.Model3D) {
@@ -7750,7 +7778,7 @@ var EntityRenderEngine;
7750
7778
  entity: entity,
7751
7779
  path: ["Bruce", "VectorGeometry"]
7752
7780
  });
7753
- if ((_h = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _h === void 0 ? void 0 : _h.length) {
7781
+ if ((_e = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _e === void 0 ? void 0 : _e.length) {
7754
7782
  multiGeometry.push(entity);
7755
7783
  }
7756
7784
  else {
@@ -7793,7 +7821,7 @@ var EntityRenderEngine;
7793
7821
  entity: entity,
7794
7822
  path: ["Bruce", "VectorGeometry"]
7795
7823
  });
7796
- if (!((_j = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _j === void 0 ? void 0 : _j.length)) {
7824
+ if (!((_f = geometry === null || geometry === void 0 ? void 0 : geometry.MultiGeometry) === null || _f === void 0 ? void 0 : _f.length)) {
7797
7825
  polygons.push(entity);
7798
7826
  continue;
7799
7827
  }
@@ -10004,7 +10032,10 @@ var VisualsRegister;
10004
10032
  if (key !== NO_MENU_ITEM_KEY) {
10005
10033
  const otherState = eStates[key];
10006
10034
  for (const stateKey of keys) {
10007
- delete otherState[stateKey];
10035
+ if (otherState.hasOwnProperty(stateKey)) {
10036
+ changed = true;
10037
+ delete otherState[stateKey];
10038
+ }
10008
10039
  }
10009
10040
  if (isBlankState(otherState)) {
10010
10041
  delete eStates[key];
@@ -12631,7 +12662,7 @@ var EntitiesRenderManager;
12631
12662
  * @returns
12632
12663
  */
12633
12664
  async renderAsIndividuals(entities, force = false) {
12634
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
12665
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12635
12666
  // Entity ID -> historic records array.
12636
12667
  // We load this as extra information when rendering historic records.
12637
12668
  // This way we know what to animate towards as time changes.
@@ -12654,7 +12685,7 @@ var EntitiesRenderManager;
12654
12685
  });
12655
12686
  entitiesHistoric = historicData.recordsByIds;
12656
12687
  // Remove ones with no historicAttrKey and no historic data.
12657
- const toRemoveIds = entities.filter(x => { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricAttrKey) && !entitiesHistoric[x.Bruce.ID]; }).map(x => x.Bruce.ID);
12688
+ const toRemoveIds = entities.filter(x => { var _a, _b; return !((_b = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.HistoricLayers) === null || _b === void 0 ? void 0 : _b.length) && !entitiesHistoric[x.Bruce.ID]; }).map(x => x.Bruce.ID);
12658
12689
  for (let i = 0; i < toRemoveIds.length; i++) {
12659
12690
  const removeId = toRemoveIds[i];
12660
12691
  this.visualsManager.RemoveRegos({
@@ -12731,10 +12762,8 @@ var EntitiesRenderManager;
12731
12762
  overrideShow: wasClustered ? false : null,
12732
12763
  name: cEntity.name,
12733
12764
  cdn: this.item.cdnEnabled,
12734
- historicDateTime: (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricDateTime,
12735
- historicAttrKey: (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.HistoricAttrKey,
12736
- historicLayers: (_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j.HistoricLayers,
12737
- scenario: (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.Scenario
12765
+ historicLayers: (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.HistoricLayers,
12766
+ scenario: (_h = entity.Bruce) === null || _h === void 0 ? void 0 : _h.Scenario
12738
12767
  };
12739
12768
  this.visualsManager.AddRego({
12740
12769
  rego,
@@ -12745,13 +12774,11 @@ var EntitiesRenderManager;
12745
12774
  rego.name = cEntity.name;
12746
12775
  rego.visual = cEntity;
12747
12776
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
12748
- rego.tagIds = ((_l = entity.Bruce) === null || _l === void 0 ? void 0 : _l["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12749
- rego.historicDateTime = (_m = entity.Bruce) === null || _m === void 0 ? void 0 : _m.HistoricDateTime;
12750
- rego.historicAttrKey = (_o = entity.Bruce) === null || _o === void 0 ? void 0 : _o.HistoricAttrKey;
12751
- rego.historicLayers = (_p = entity.Bruce) === null || _p === void 0 ? void 0 : _p.HistoricLayers;
12777
+ rego.tagIds = ((_j = entity.Bruce) === null || _j === void 0 ? void 0 : _j["Layer.ID"]) ? [].concat(entity.Bruce["Layer.ID"]) : [];
12778
+ rego.historicLayers = (_k = entity.Bruce) === null || _k === void 0 ? void 0 : _k.HistoricLayers;
12752
12779
  rego.cdn = this.item.cdnEnabled;
12753
- rego.schemaId = (_q = entity.Bruce) === null || _q === void 0 ? void 0 : _q.SchemaID;
12754
- rego.scenario = (_r = entity.Bruce) === null || _r === void 0 ? void 0 : _r.Scenario;
12780
+ rego.schemaId = (_l = entity.Bruce) === null || _l === void 0 ? void 0 : _l.SchemaID;
12781
+ rego.scenario = (_m = entity.Bruce) === null || _m === void 0 ? void 0 : _m.Scenario;
12755
12782
  // Marked as stale meaning some change was performed that requires a refresh.
12756
12783
  // This usually means a new sibling was added that we need to update.
12757
12784
  if (rego.stale) {
@@ -12781,7 +12808,7 @@ var EntitiesRenderManager;
12781
12808
  menuItemId: this.item.id,
12782
12809
  requestRender: false
12783
12810
  });
12784
- (_s = this.clustering) === null || _s === void 0 ? void 0 : _s.RemoveEntity(id, false);
12811
+ (_o = this.clustering) === null || _o === void 0 ? void 0 : _o.RemoveEntity(id, false);
12785
12812
  }
12786
12813
  }
12787
12814
  this.viewer.scene.requestRender();
@@ -28334,7 +28361,7 @@ class WidgetViewBar extends Widget.AWidget {
28334
28361
  }
28335
28362
  }
28336
28363
 
28337
- const VERSION = "4.9.7";
28364
+ const VERSION = "4.9.9";
28338
28365
 
28339
28366
  export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, 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 };
28340
28367
  //# sourceMappingURL=bruce-cesium.es5.js.map