bruce-cesium 5.9.0 → 5.9.1

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, 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';
3
+ import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, HorizontalOrigin, VerticalOrigin, ConstantProperty, ClassificationType, ConstantPositionProperty, ArcType, CornerType, ShadowMode, ColorBlendMode, HeadingPitchRoll, Transforms, Model, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Cesium3DTileColorBlendMode, Ion, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, Cesium3DTileset, IonResource, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
4
4
 
5
5
  const TIME_LAG = 300;
6
6
  const POSITION_CHECK_TIMER = 950;
@@ -13964,56 +13964,32 @@ var EntitiesRenderManager;
13964
13964
  * @returns
13965
13965
  */
13966
13966
  async renderAsIndividuals(entities, force = false) {
13967
- var _a, _b, _c, _d, _e, _f, _g, _h;
13967
+ var _a, _b, _c, _d, _e, _f;
13968
+ // When live we just want to show the latest pos.
13969
+ // When not live, the user might scroll the timeline and want to see it a fluid animation between points in time.
13970
+ const isLive = ViewUtils.GetTimeDetails({
13971
+ viewer: this.viewer
13972
+ }).isLive;
13968
13973
  // Entity ID -> historic records array.
13969
13974
  // We load this as extra information when rendering historic records.
13970
13975
  // This way we know what to animate towards as time changes.
13971
13976
  let entitiesHistoric = {};
13972
- if ((((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historic) || ((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historicAttrKey)) && entities.length) {
13973
- // Interpolating.
13974
- // We will allow non-historic Entities as long as they have historic data in the range.
13975
- if (this.item.historicInterpolation) {
13976
- // We'll add/remove 1 second to ensure we cover all records.
13977
- const startTmp = JulianDate.toDate(this.viewer.clock.startTime);
13978
- const stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
13979
- const startStr = new Date(startTmp.getTime() - 1000).toISOString();
13980
- const stopStr = new Date(stopTmp.getTime() + 1000).toISOString();
13981
- const historicData = await EntityHistoricData.GetList({
13982
- attrKey: this.item.BruceEntity.historicAttrKey,
13983
- dateTimeFrom: startStr,
13984
- dateTimeTo: stopStr,
13985
- entityIds: entities.map(x => x.Bruce.ID),
13986
- api: this.apiGetter.getApi()
13987
- });
13988
- entitiesHistoric = historicData.recordsByIds;
13989
- // Remove ones with no historicAttrKey and no historic data.
13990
- const toRemoveIds = entities.filter(x => { var _a, _b; return !((_b = (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.Outline) === null || _b === void 0 ? void 0 : _b.length) && !entitiesHistoric[x.Bruce.ID]; }).map(x => x.Bruce.ID);
13991
- for (let i = 0; i < toRemoveIds.length; i++) {
13992
- const removeId = toRemoveIds[i];
13993
- this.visualsManager.RemoveRegos({
13994
- entityId: removeId,
13995
- menuItemId: this.item.id,
13996
- requestRender: false
13997
- });
13998
- (_c = this.clustering) === null || _c === void 0 ? void 0 : _c.RemoveEntity(removeId, false);
13999
- }
14000
- entities = entities.filter(x => !toRemoveIds.includes(x.Bruce.ID));
14001
- }
14002
- // Not interpolating.
14003
- // So we'll see if the Entities have a historic key or not.
14004
- else {
14005
- const toRemoveIds = entities.filter(x => { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.Outline); }).map(x => x.Bruce.ID);
14006
- for (let i = 0; i < toRemoveIds.length; i++) {
14007
- const removeId = toRemoveIds[i];
14008
- this.visualsManager.RemoveRegos({
14009
- entityId: removeId,
14010
- menuItemId: this.item.id,
14011
- requestRender: false
14012
- });
14013
- (_d = this.clustering) === null || _d === void 0 ? void 0 : _d.RemoveEntity(removeId, false);
14014
- }
14015
- entities = entities.filter(x => !toRemoveIds.includes(x.Bruce.ID));
14016
- }
13977
+ const isHistoric = ((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historic) || ((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historicAttrKey);
13978
+ // If we're interpolating then we request additional records to quickly swap between.
13979
+ if (!isLive && isHistoric && entities.length && this.item.historicInterpolation) {
13980
+ // We'll add/remove 1 second to ensure we cover all records.
13981
+ const startTmp = JulianDate.toDate(this.viewer.clock.startTime);
13982
+ const stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
13983
+ const startStr = new Date(startTmp.getTime() - 1000).toISOString();
13984
+ const stopStr = new Date(stopTmp.getTime() + 1000).toISOString();
13985
+ const historicData = await EntityHistoricData.GetList({
13986
+ attrKey: this.item.BruceEntity.historicAttrKey,
13987
+ dateTimeFrom: startStr,
13988
+ dateTimeTo: stopStr,
13989
+ entityIds: entities.map(x => x.Bruce.ID),
13990
+ api: this.apiGetter.getApi()
13991
+ });
13992
+ entitiesHistoric = historicData.recordsByIds;
14017
13993
  }
14018
13994
  if (this.disposed) {
14019
13995
  this.doDispose();
@@ -14048,7 +14024,7 @@ var EntitiesRenderManager;
14048
14024
  menuItemId: this.item.id
14049
14025
  });
14050
14026
  // The baseline data source must be editable.
14051
- const canEdit = !((_e = entity.Bruce.Outline) === null || _e === void 0 ? void 0 : _e.find(x => x.Baseline && !x.Editable));
14027
+ const canEdit = !((_c = entity.Bruce.Outline) === null || _c === void 0 ? void 0 : _c.find(x => x.Baseline && !x.Editable));
14052
14028
  const visual = rego === null || rego === void 0 ? void 0 : rego.visual;
14053
14029
  if (!visual || visual != cEntity) {
14054
14030
  const wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
@@ -14079,9 +14055,9 @@ var EntitiesRenderManager;
14079
14055
  rego.visual = cEntity;
14080
14056
  rego.entityTypeId = entity.Bruce["EntityType.ID"];
14081
14057
  rego.tagIds = entity.Bruce["Layer.ID"] ? [].concat(entity.Bruce["Layer.ID"]) : [];
14082
- rego.outline = (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.Outline;
14058
+ rego.outline = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.Outline;
14083
14059
  rego.cdn = this.item.cdnEnabled;
14084
- rego.schema = (_g = entity.Bruce) === null || _g === void 0 ? void 0 : _g.Schema;
14060
+ rego.schema = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.Schema;
14085
14061
  rego.canEdit = canEdit;
14086
14062
  // Marked as stale meaning some change was performed that requires a refresh.
14087
14063
  // This usually means a new sibling was added that we need to update.
@@ -14112,7 +14088,7 @@ var EntitiesRenderManager;
14112
14088
  menuItemId: this.item.id,
14113
14089
  requestRender: false
14114
14090
  });
14115
- (_h = this.clustering) === null || _h === void 0 ? void 0 : _h.RemoveEntity(id, false);
14091
+ (_f = this.clustering) === null || _f === void 0 ? void 0 : _f.RemoveEntity(id, false);
14116
14092
  }
14117
14093
  }
14118
14094
  this.viewer.scene.requestRender();
@@ -15183,9 +15159,14 @@ var EntitiesIdsRenderManager;
15183
15159
  if (this.disposed || this.viewer.isDestroyed() || !entities.length) {
15184
15160
  return;
15185
15161
  }
15162
+ // When live we just want to show the latest pos.
15163
+ // When not live, the user might scroll the timeline and want to see it a fluid animation between points in time.
15164
+ const isLive = ViewUtils.GetTimeDetails({
15165
+ viewer: this.viewer,
15166
+ }).isLive;
15186
15167
  let entitiesHistoric = {};
15187
15168
  let changed = false;
15188
- if ((this.item.BruceEntity.historic || this.item.BruceEntity.historicAttrKey) && entities.length) {
15169
+ if (!isLive && (this.item.BruceEntity.historic || this.item.BruceEntity.historicAttrKey) && entities.length) {
15189
15170
  const res = await this.getHistoricInfo(entities);
15190
15171
  changed = res[0];
15191
15172
  entitiesHistoric = res[1];
@@ -15687,7 +15668,13 @@ class EntityGatherer {
15687
15668
  tickDelay = null;
15688
15669
  });
15689
15670
  // React to clock changes and request new Entities.
15671
+ let prevTime = null;
15690
15672
  this.hDisposals.push(this.viewer.clock.onTick.addEventListener(() => {
15673
+ const curTime = this.viewer.clock.currentTime.toString();
15674
+ if (curTime === prevTime) {
15675
+ return;
15676
+ }
15677
+ prevTime = curTime;
15691
15678
  if (tickDelay) {
15692
15679
  tickDelay.Call();
15693
15680
  }
@@ -19079,6 +19066,7 @@ var TilesetCadRenderManager;
19079
19066
  return await this.historicPossesLoadingProm;
19080
19067
  };
19081
19068
  // Last known timeline range. Helps us detect changes.
19069
+ let lastTime = this.viewer.clock.currentTime.toString();
19082
19070
  let lastStartTime = this.viewer.clock.startTime.toString();
19083
19071
  let lastStopTime = this.viewer.clock.stopTime.toString();
19084
19072
  let clockTickRemoval;
@@ -19118,9 +19106,11 @@ var TilesetCadRenderManager;
19118
19106
  clockTickRemoval = this.viewer.clock.onTick.addEventListener(() => {
19119
19107
  const startTime = this.viewer.clock.startTime.toString();
19120
19108
  const stopTime = this.viewer.clock.stopTime.toString();
19121
- if (startTime !== lastStartTime || stopTime !== lastStopTime) {
19109
+ const curTime = this.viewer.clock.currentTime.toString();
19110
+ if (startTime !== lastStartTime || stopTime !== lastStopTime || curTime !== lastTime) {
19122
19111
  lastStartTime = startTime;
19123
19112
  lastStopTime = stopTime;
19113
+ lastTime = curTime;
19124
19114
  this.historicAnimation.onRangeChange();
19125
19115
  }
19126
19116
  });
@@ -21556,7 +21546,13 @@ var DataSourceStaticCsvManager;
21556
21546
  if (this.viewer.clock) {
21557
21547
  const pHeadingIndex = pHeaders.findIndex(x => x.toLowerCase().includes("head"));
21558
21548
  let errorsInARow = 0;
21549
+ let prevTime = null;
21559
21550
  const removal = this.viewer.clock.onTick.addEventListener(() => {
21551
+ const curTime = this.viewer.clock.currentTime.toString();
21552
+ if (curTime === prevTime) {
21553
+ return;
21554
+ }
21555
+ prevTime = curTime;
21560
21556
  const vehicle = source.entities.getById(vehicleCesiumId);
21561
21557
  if (vehicle) {
21562
21558
  try {
@@ -33115,7 +33111,7 @@ class WidgetViewBar extends Widget.AWidget {
33115
33111
  }
33116
33112
  }
33117
33113
 
33118
- const VERSION = "5.9.0";
33114
+ const VERSION = "5.9.1";
33119
33115
 
33120
33116
  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 };
33121
33117
  //# sourceMappingURL=bruce-cesium.es5.js.map