bruce-cesium 5.4.1 → 5.4.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.
- package/dist/bruce-cesium.es5.js +259 -372
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +257 -370
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/cesium-animated-property.js +2 -2
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-model3d.js +3 -3
- package/dist/lib/rendering/entity-render-engine-model3d.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-point.js +5 -5
- package/dist/lib/rendering/entity-render-engine-point.js.map +1 -1
- package/dist/lib/rendering/getters/batched-data-getter.js +7 -1
- package/dist/lib/rendering/getters/batched-data-getter.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +237 -357
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/cesium-animated-property.d.ts +1 -1
- package/dist/types/rendering/getters/batched-data-getter.d.ts +3 -1
- package/dist/types/rendering/render-managers/entities/entities-ids-render-manager.d.ts +22 -7
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
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, ProjectViewLegacyTile, Camera, 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,
|
|
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, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, KmlDataSource, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, OrthographicFrustum, defined, ClockRange, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, EasingFunction, NearFarScalar, PolygonPipeline, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, BoundingSphere, GeometryInstance, Quaternion, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
|
|
4
4
|
|
|
5
5
|
const TIME_LAG = 300;
|
|
6
6
|
const POSITION_CHECK_TIMER = 950;
|
|
@@ -1367,7 +1367,7 @@ var CesiumAnimatedProperty;
|
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
1369
|
CesiumAnimatedProperty.AnimatePositionSeries = AnimatePositionSeries;
|
|
1370
|
-
function GetSeriesPossesForHistoricEntity(viewer, heightRef, historic) {
|
|
1370
|
+
function GetSeriesPossesForHistoricEntity(viewer, dataHeightRef, heightRef, historic) {
|
|
1371
1371
|
if (!historic || !historic.length) {
|
|
1372
1372
|
return [];
|
|
1373
1373
|
}
|
|
@@ -1390,7 +1390,7 @@ var CesiumAnimatedProperty;
|
|
|
1390
1390
|
const pos3d = EntityUtils.GetPos({
|
|
1391
1391
|
entity: data,
|
|
1392
1392
|
viewer: viewer,
|
|
1393
|
-
recordHeightRef:
|
|
1393
|
+
recordHeightRef: dataHeightRef,
|
|
1394
1394
|
returnHeightRef: heightRef,
|
|
1395
1395
|
allowRendered: false
|
|
1396
1396
|
});
|
|
@@ -4410,7 +4410,7 @@ var EntityRenderEnginePoint;
|
|
|
4410
4410
|
const bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
|
|
4411
4411
|
const cColor = bColor ? ColorToCColor(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
|
|
4412
4412
|
if (cColor.alpha > 0) {
|
|
4413
|
-
const seriesTrackPosses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
4413
|
+
const seriesTrackPosses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
4414
4414
|
seriesTrackPosses.reverse();
|
|
4415
4415
|
let posses = seriesTrackPosses.map(x => x.pos3d);
|
|
4416
4416
|
posses = CullDuplicateCPosses(posses);
|
|
@@ -4491,7 +4491,7 @@ var EntityRenderEnginePoint;
|
|
|
4491
4491
|
});
|
|
4492
4492
|
let position = null;
|
|
4493
4493
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
4494
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
4494
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
4495
4495
|
if (series.length > 1) {
|
|
4496
4496
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
4497
4497
|
posses: series,
|
|
@@ -4555,7 +4555,7 @@ var EntityRenderEnginePoint;
|
|
|
4555
4555
|
cEntity.billboard.width = undefined;
|
|
4556
4556
|
cEntity.billboard.height = undefined;
|
|
4557
4557
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
4558
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
4558
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
4559
4559
|
if (series.length > 1) {
|
|
4560
4560
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
4561
4561
|
posses: series,
|
|
@@ -4809,7 +4809,7 @@ var EntityRenderEnginePoint;
|
|
|
4809
4809
|
});
|
|
4810
4810
|
let position = null;
|
|
4811
4811
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
4812
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
4812
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
4813
4813
|
if (series.length > 1) {
|
|
4814
4814
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
4815
4815
|
posses: series,
|
|
@@ -4878,7 +4878,7 @@ var EntityRenderEnginePoint;
|
|
|
4878
4878
|
cEntity.billboard.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
|
|
4879
4879
|
cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
4880
4880
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
4881
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
4881
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
4882
4882
|
if (series.length > 1) {
|
|
4883
4883
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
4884
4884
|
posses: series,
|
|
@@ -6376,7 +6376,7 @@ var EntityRenderEngineModel3d;
|
|
|
6376
6376
|
const bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, entity, params.tags) : null;
|
|
6377
6377
|
const cColor = bColor ? ColorToCColor(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
|
|
6378
6378
|
if (cColor.alpha > 0) {
|
|
6379
|
-
const seriesTrackPosses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
6379
|
+
const seriesTrackPosses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
6380
6380
|
seriesTrackPosses.reverse();
|
|
6381
6381
|
let posses = seriesTrackPosses.map(x => x.pos3d);
|
|
6382
6382
|
posses = CullDuplicateCPosses(posses);
|
|
@@ -6399,7 +6399,7 @@ var EntityRenderEngineModel3d;
|
|
|
6399
6399
|
});
|
|
6400
6400
|
let position = null;
|
|
6401
6401
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
6402
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
6402
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
6403
6403
|
if (series.length > 1) {
|
|
6404
6404
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
6405
6405
|
posses: series,
|
|
@@ -6475,7 +6475,7 @@ var EntityRenderEngineModel3d;
|
|
|
6475
6475
|
cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
|
|
6476
6476
|
cEntity.model.distanceDisplayCondition = new ConstantProperty(EntityRenderEngine.GetDisplayCondition(params.minDistance, params.maxDistance));
|
|
6477
6477
|
// If we have a series of time-based positions then we'll animate as time changes.
|
|
6478
|
-
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
6478
|
+
const series = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(params.viewer, heightRef, heightRef, params.entityHistoric);
|
|
6479
6479
|
if (series.length > 1) {
|
|
6480
6480
|
animatePosition = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
6481
6481
|
posses: series,
|
|
@@ -13281,14 +13281,16 @@ var BatchedDataGetter;
|
|
|
13281
13281
|
}
|
|
13282
13282
|
return this.onUpdate;
|
|
13283
13283
|
}
|
|
13284
|
-
constructor(data, viewPort, batchSize) {
|
|
13284
|
+
constructor(data, viewPort, batchSize, singleEmit = false) {
|
|
13285
13285
|
this.viewPortRemoval = null;
|
|
13286
13286
|
this.viewRect = null;
|
|
13287
13287
|
this.viewCenter = null;
|
|
13288
13288
|
this.onUpdate = null;
|
|
13289
|
+
this.emitted = false;
|
|
13289
13290
|
this.data = data;
|
|
13290
13291
|
this.viewPort = viewPort;
|
|
13291
13292
|
this.batchSize = batchSize;
|
|
13293
|
+
this.singleEmit = singleEmit;
|
|
13292
13294
|
}
|
|
13293
13295
|
Start() {
|
|
13294
13296
|
this.viewPortRemoval = this.viewPort.Updated().Subscribe(() => {
|
|
@@ -13319,6 +13321,10 @@ var BatchedDataGetter;
|
|
|
13319
13321
|
}
|
|
13320
13322
|
}
|
|
13321
13323
|
startGetterLoop() {
|
|
13324
|
+
if (this.singleEmit && this.emitted) {
|
|
13325
|
+
return;
|
|
13326
|
+
}
|
|
13327
|
+
this.emitted = true;
|
|
13322
13328
|
clearInterval(this.getterInterval);
|
|
13323
13329
|
if (!this.viewRect || !this.viewCenter) {
|
|
13324
13330
|
return;
|
|
@@ -14051,19 +14057,6 @@ var EntitiesLoadedRenderManager;
|
|
|
14051
14057
|
})(EntitiesLoadedRenderManager || (EntitiesLoadedRenderManager = {}));
|
|
14052
14058
|
|
|
14053
14059
|
const BATCH_SIZE$2 = 500;
|
|
14054
|
-
function getValue$4(viewer, obj) {
|
|
14055
|
-
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
14056
|
-
let date = viewer.scene.lastRenderTime;
|
|
14057
|
-
if (!date) {
|
|
14058
|
-
date = viewer.clock.currentTime;
|
|
14059
|
-
}
|
|
14060
|
-
return obj.getValue(date);
|
|
14061
|
-
}
|
|
14062
|
-
return obj;
|
|
14063
|
-
}
|
|
14064
|
-
function colorToCColor$3(color) {
|
|
14065
|
-
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
14066
|
-
}
|
|
14067
14060
|
/**
|
|
14068
14061
|
* Render manager for rendering an array of entity ids.
|
|
14069
14062
|
* This will render them in batches to avoid overloading the viewer.
|
|
@@ -14080,23 +14073,27 @@ var EntitiesIdsRenderManager;
|
|
|
14080
14073
|
this.getterSub = null;
|
|
14081
14074
|
this.disposed = false;
|
|
14082
14075
|
this.renderedEntities = {};
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
//
|
|
14086
|
-
|
|
14076
|
+
// Callback to dispose the monitoring of the viewer's timeline for historic data.
|
|
14077
|
+
this.viewerDateTimeChangeRemoval = null;
|
|
14078
|
+
// Entity ID -> historic information on the Entity.
|
|
14079
|
+
// This helps us manage what needs changing whenever we receive the same Entity update, or when the timeline range changes.
|
|
14080
|
+
this.entitiesHistoric = {};
|
|
14081
|
+
// Queue for renderAsIndividuals to avoid concurrent calls.
|
|
14082
|
+
this.renderQueueActive = false;
|
|
14083
|
+
this.renderQueue = [];
|
|
14084
|
+
this.renderQueueForceFlags = [];
|
|
14087
14085
|
const { viewer, apiGetter, monitor, item, register: visualsManager } = params;
|
|
14088
14086
|
this.viewer = viewer;
|
|
14089
14087
|
this.apiGetter = apiGetter;
|
|
14090
14088
|
this.monitor = monitor;
|
|
14091
14089
|
this.item = item;
|
|
14092
14090
|
this.visualsManager = visualsManager;
|
|
14093
|
-
this.useGeojson = item.renderAsGeojson == true;
|
|
14094
14091
|
if (this.item.enableClustering) {
|
|
14095
14092
|
this.clustering = new PointClustering(visualsManager, this.item.id, (_a = this.item) === null || _a === void 0 ? void 0 : _a.clustering);
|
|
14096
14093
|
}
|
|
14097
14094
|
}
|
|
14098
14095
|
Init() {
|
|
14099
|
-
var _a;
|
|
14096
|
+
var _a, _b, _c;
|
|
14100
14097
|
if (this.disposed) {
|
|
14101
14098
|
throw (new Error("This item is disposed."));
|
|
14102
14099
|
}
|
|
@@ -14116,15 +14113,19 @@ var EntitiesIdsRenderManager;
|
|
|
14116
14113
|
if (this.renderPriority == null) {
|
|
14117
14114
|
this.renderPriority = 2;
|
|
14118
14115
|
}
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
}
|
|
14123
|
-
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2);
|
|
14116
|
+
this.getter = new BatchedDataGetter.Getter(this.item.BruceEntity.EntityIds, this.monitor, BATCH_SIZE$2,
|
|
14117
|
+
// Don't emit the same Entity multiple times.
|
|
14118
|
+
true);
|
|
14124
14119
|
this.getterSub = this.getter.OnUpdate.Subscribe((ids) => {
|
|
14125
14120
|
this.onGetterUpdate(ids);
|
|
14126
14121
|
});
|
|
14127
14122
|
this.getter.Start();
|
|
14123
|
+
if (((_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b.historic) || ((_c = this.item.BruceEntity) === null || _c === void 0 ? void 0 : _c.historicAttrKey)) {
|
|
14124
|
+
this.viewerDateTimeSub();
|
|
14125
|
+
}
|
|
14126
|
+
else {
|
|
14127
|
+
this.viewerDateTimeDispose();
|
|
14128
|
+
}
|
|
14128
14129
|
}
|
|
14129
14130
|
Dispose() {
|
|
14130
14131
|
if (this.disposed) {
|
|
@@ -14142,11 +14143,11 @@ var EntitiesIdsRenderManager;
|
|
|
14142
14143
|
});
|
|
14143
14144
|
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.Dispose();
|
|
14144
14145
|
this.clustering = null;
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
this.
|
|
14146
|
+
this.viewerDateTimeDispose();
|
|
14147
|
+
// Clear render queue when disposed
|
|
14148
|
+
this.renderQueue = [];
|
|
14149
|
+
this.renderQueueForceFlags = [];
|
|
14150
|
+
this.renderQueueActive = false;
|
|
14150
14151
|
}
|
|
14151
14152
|
async ReRender(params) {
|
|
14152
14153
|
let { entityIds, force, entities } = params;
|
|
@@ -14181,10 +14182,6 @@ var EntitiesIdsRenderManager;
|
|
|
14181
14182
|
}
|
|
14182
14183
|
if (CameraZoomSettings === null || CameraZoomSettings === void 0 ? void 0 : CameraZoomSettings.length) {
|
|
14183
14184
|
this.item.CameraZoomSettings = CameraZoomSettings;
|
|
14184
|
-
if (this.renderAsGeojson && this.item.CameraZoomSettings.length > 1) {
|
|
14185
|
-
console.warn("Geojson rendering does not support multiple zoom controls. Only the first one will be used.");
|
|
14186
|
-
this.item.CameraZoomSettings = [this.item.CameraZoomSettings[0]];
|
|
14187
|
-
}
|
|
14188
14185
|
}
|
|
14189
14186
|
if (queueRerender != false) {
|
|
14190
14187
|
const entityIds = Object.keys(this.renderedEntities);
|
|
@@ -14196,15 +14193,25 @@ var EntitiesIdsRenderManager;
|
|
|
14196
14193
|
}
|
|
14197
14194
|
}
|
|
14198
14195
|
async onGetterUpdate(entityIds, force = false) {
|
|
14199
|
-
if (this.disposed || this.viewer.isDestroyed()) {
|
|
14196
|
+
if (this.disposed || this.viewer.isDestroyed() || !(entityIds === null || entityIds === void 0 ? void 0 : entityIds.length)) {
|
|
14200
14197
|
return;
|
|
14201
14198
|
}
|
|
14202
14199
|
try {
|
|
14203
14200
|
const api = this.apiGetter.getApi();
|
|
14201
|
+
let newDateTime = null;
|
|
14202
|
+
if (this.item.BruceEntity.historic || this.item.BruceEntity.historicAttrKey) {
|
|
14203
|
+
newDateTime = JulianDate.toDate(this.viewer.clock.currentTime).toISOString();
|
|
14204
|
+
}
|
|
14204
14205
|
const { entities } = await Entity$1.GetListByIds({
|
|
14205
14206
|
api,
|
|
14206
14207
|
entityIds,
|
|
14207
|
-
|
|
14208
|
+
historicPoint: newDateTime,
|
|
14209
|
+
historicKey: this.item.BruceEntity.historicAttrKey,
|
|
14210
|
+
migrated: true,
|
|
14211
|
+
// If we're taking 5+ minutes to make a query, it's a dud.
|
|
14212
|
+
// This is a timeout imposed on our DB and not external sources.
|
|
14213
|
+
// Honestly could lower down to 30 seconds, but we'll keep it high for now.
|
|
14214
|
+
maxSearchTimeSec: 60 * 5,
|
|
14208
14215
|
});
|
|
14209
14216
|
await this.renderEntities(entities, force);
|
|
14210
14217
|
}
|
|
@@ -14213,347 +14220,82 @@ var EntitiesIdsRenderManager;
|
|
|
14213
14220
|
}
|
|
14214
14221
|
}
|
|
14215
14222
|
async renderEntities(entities, force = false) {
|
|
14216
|
-
if (this.disposed || this.viewer.isDestroyed()) {
|
|
14223
|
+
if (this.disposed || this.viewer.isDestroyed() || !(entities === null || entities === void 0 ? void 0 : entities.length)) {
|
|
14217
14224
|
return;
|
|
14218
14225
|
}
|
|
14219
14226
|
try {
|
|
14220
|
-
|
|
14221
|
-
const zoomItem = this.item.CameraZoomSettings[0];
|
|
14222
|
-
if (zoomItem.DisplayType == ZoomControl.EDisplayType.Point) {
|
|
14223
|
-
// We'll just render these as individuals since we don't support point geojson.
|
|
14224
|
-
await this.renderAsIndividuals(entities, force);
|
|
14225
|
-
}
|
|
14226
|
-
else {
|
|
14227
|
-
await this.renderAsGeojson(entities, force);
|
|
14228
|
-
}
|
|
14229
|
-
}
|
|
14230
|
-
else {
|
|
14231
|
-
await this.renderAsIndividuals(entities, force);
|
|
14232
|
-
}
|
|
14227
|
+
await this.queueRenderAsIndividuals(entities, force);
|
|
14233
14228
|
}
|
|
14234
14229
|
catch (e) {
|
|
14235
14230
|
console.error(e);
|
|
14236
14231
|
}
|
|
14237
14232
|
}
|
|
14238
14233
|
/**
|
|
14239
|
-
*
|
|
14240
|
-
*
|
|
14241
|
-
* @param entities
|
|
14242
|
-
* @param force TODO: This should re-render entities that are already rendered.
|
|
14234
|
+
* Queues a render operation to be processed in sequence.
|
|
14235
|
+
* If an operation is already in progress, this will be added to the queue.
|
|
14243
14236
|
*/
|
|
14244
|
-
async
|
|
14245
|
-
|
|
14246
|
-
entities = entities.filter((entity) => {
|
|
14247
|
-
var _a;
|
|
14248
|
-
return !this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID];
|
|
14249
|
-
});
|
|
14250
|
-
// Mark these as rendered.
|
|
14251
|
-
entities.forEach((entity) => {
|
|
14252
|
-
var _a;
|
|
14253
|
-
this.renderedEntities[(_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID] = true;
|
|
14254
|
-
});
|
|
14255
|
-
// This process only supports a single zoom control item.
|
|
14256
|
-
const zoomItem = this.item.CameraZoomSettings[0];
|
|
14257
|
-
// If we're after 3d models then we'll check if there are LODs and render those as individuals.
|
|
14258
|
-
if (zoomItem.DisplayType == ZoomControl.EDisplayType.Model3D && entities.length) {
|
|
14259
|
-
const { lods } = await EntityLod.GetLods({
|
|
14260
|
-
api: this.apiGetter.getApi(),
|
|
14261
|
-
filter: {
|
|
14262
|
-
externalSources: false,
|
|
14263
|
-
Items: entities.map(x => {
|
|
14264
|
-
var _a, _b;
|
|
14265
|
-
return {
|
|
14266
|
-
entityId: (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID,
|
|
14267
|
-
categoryId: (_b = zoomItem.LODCategoryID) !== null && _b !== void 0 ? _b : "GLB",
|
|
14268
|
-
group: "DEFAULT",
|
|
14269
|
-
level: Number(zoomItem.LODLevel)
|
|
14270
|
-
};
|
|
14271
|
-
}),
|
|
14272
|
-
strict: false
|
|
14273
|
-
}
|
|
14274
|
-
});
|
|
14275
|
-
if (this.disposed) {
|
|
14276
|
-
this.doDispose();
|
|
14277
|
-
return;
|
|
14278
|
-
}
|
|
14279
|
-
const withLods = lods.filter(x => x.entityId && !!x.clientFileId).map(x => x.entityId);
|
|
14280
|
-
const individuals = entities.filter((entity) => {
|
|
14281
|
-
var _a;
|
|
14282
|
-
return withLods.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
14283
|
-
});
|
|
14284
|
-
if (individuals.length) {
|
|
14285
|
-
this.renderAsIndividuals(individuals, force);
|
|
14286
|
-
}
|
|
14287
|
-
// Now we proceed with what is left.
|
|
14288
|
-
entities = entities.filter((entity) => {
|
|
14289
|
-
var _a;
|
|
14290
|
-
return !withLods.includes((_a = entity.Bruce) === null || _a === void 0 ? void 0 : _a.ID);
|
|
14291
|
-
});
|
|
14292
|
-
}
|
|
14293
|
-
if (!entities.length) {
|
|
14237
|
+
async queueRenderAsIndividuals(entities, force = false) {
|
|
14238
|
+
if (this.disposed) {
|
|
14294
14239
|
return;
|
|
14295
14240
|
}
|
|
14296
|
-
|
|
14297
|
-
if (
|
|
14298
|
-
|
|
14299
|
-
|
|
14300
|
-
api: this.apiGetter.getApi(),
|
|
14301
|
-
styleId: zoomItem === null || zoomItem === void 0 ? void 0 : zoomItem.StyleID
|
|
14302
|
-
})).style) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
14303
|
-
}
|
|
14304
|
-
// Probably deleted.
|
|
14305
|
-
catch (e) {
|
|
14306
|
-
console.error(e);
|
|
14307
|
-
}
|
|
14308
|
-
}
|
|
14309
|
-
let entityTypeId = (_b = this.item.BruceEntity) === null || _b === void 0 ? void 0 : _b["EntityType.ID"];
|
|
14310
|
-
if (!entityTypeId) {
|
|
14311
|
-
entityTypeId = (_d = (_c = entities.find(x => { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a["EntityType.ID"]); })) === null || _c === void 0 ? void 0 : _c.Bruce) === null || _d === void 0 ? void 0 : _d["EntityType.ID"];
|
|
14312
|
-
}
|
|
14313
|
-
// Getting type regardless cause it's needed for name calculations.
|
|
14314
|
-
let entityType;
|
|
14315
|
-
if (entityTypeId) {
|
|
14316
|
-
// Try using the Entity Type default if one is specified in the menu item.
|
|
14317
|
-
try {
|
|
14318
|
-
entityType = (_e = (await EntityType.Get({
|
|
14319
|
-
entityTypeId: entityTypeId,
|
|
14320
|
-
api: this.apiGetter.getApi()
|
|
14321
|
-
}))) === null || _e === void 0 ? void 0 : _e.entityType;
|
|
14322
|
-
if (!style && entityType) {
|
|
14323
|
-
if (entityType["DisplaySetting.ID"] && entityType["DisplaySetting.ID"] > 0) {
|
|
14324
|
-
style = (_f = (await Style.Get({
|
|
14325
|
-
api: this.apiGetter.getApi(),
|
|
14326
|
-
styleId: entityType["DisplaySetting.ID"]
|
|
14327
|
-
})).style) === null || _f === void 0 ? void 0 : _f.Settings;
|
|
14328
|
-
}
|
|
14329
|
-
}
|
|
14330
|
-
}
|
|
14331
|
-
catch (e) {
|
|
14332
|
-
console.error(e);
|
|
14333
|
-
}
|
|
14334
|
-
}
|
|
14335
|
-
const pStyle = (_g = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _g !== void 0 ? _g : {};
|
|
14336
|
-
const lStyle = (_h = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _h !== void 0 ? _h : {};
|
|
14337
|
-
const polygonsClamped = ((_j = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _j === void 0 ? void 0 : _j.id) == null ? true : ((_k = pStyle === null || pStyle === void 0 ? void 0 : pStyle.altitudeOption) === null || _k === void 0 ? void 0 : _k.id) == 0;
|
|
14338
|
-
const bFillColor = Calculator.GetColor(pStyle.fillColor, {}, []);
|
|
14339
|
-
const cFillColor = bFillColor ? colorToCColor$3(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
14340
|
-
const bLineColor = Calculator.GetColor(pStyle.lineColor, {}, []);
|
|
14341
|
-
const cLineColor = bLineColor ? colorToCColor$3(bLineColor) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
14342
|
-
let lineWidthPx = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, {}, []) : null;
|
|
14343
|
-
if (lineWidthPx == null) {
|
|
14344
|
-
lineWidthPx = 1;
|
|
14345
|
-
}
|
|
14346
|
-
lineWidthPx = EnsureNumber(lineWidthPx);
|
|
14347
|
-
if (lineWidthPx < 0.01) {
|
|
14348
|
-
lineWidthPx = 0;
|
|
14349
|
-
}
|
|
14350
|
-
lineWidthPx = Math.round(lineWidthPx);
|
|
14351
|
-
const collection = {
|
|
14352
|
-
features: [],
|
|
14353
|
-
type: "FeatureCollection"
|
|
14354
|
-
};
|
|
14355
|
-
for (let i = 0; i < entities.length; i++) {
|
|
14356
|
-
const entity = entities[i];
|
|
14357
|
-
const feature = Geometry.ToGeoJsonFeature({
|
|
14358
|
-
geometry: entity.Bruce.VectorGeometry,
|
|
14359
|
-
noAltitude: polygonsClamped && lineWidthPx <= 0,
|
|
14360
|
-
altitude: lineWidthPx > 0 && polygonsClamped ? 1 : null,
|
|
14361
|
-
properties: {
|
|
14362
|
-
...entity,
|
|
14363
|
-
Bruce: {
|
|
14364
|
-
...entity.Bruce,
|
|
14365
|
-
// Exclude as we just converted it to geojson.
|
|
14366
|
-
VectorGeometry: null
|
|
14367
|
-
}
|
|
14368
|
-
}
|
|
14369
|
-
});
|
|
14370
|
-
if (feature) {
|
|
14371
|
-
collection.features.push(feature);
|
|
14372
|
-
}
|
|
14373
|
-
}
|
|
14374
|
-
// Anything that failed to turn into geojson or points we'll render as individuals.
|
|
14375
|
-
const individuals = entities.filter((entity) => {
|
|
14376
|
-
const feature = collection.features.find(x => { var _a, _b; return ((_b = (_a = x.properties) === null || _a === void 0 ? void 0 : _a.Bruce) === null || _b === void 0 ? void 0 : _b.ID) == entity.Bruce.ID; });
|
|
14377
|
-
if (!feature) {
|
|
14378
|
-
return true;
|
|
14379
|
-
}
|
|
14380
|
-
if (feature.geometry.type == "Point") {
|
|
14381
|
-
return true;
|
|
14382
|
-
}
|
|
14383
|
-
return false;
|
|
14384
|
-
});
|
|
14385
|
-
if (individuals.length) {
|
|
14386
|
-
this.renderAsIndividuals(individuals, force);
|
|
14387
|
-
}
|
|
14388
|
-
// Filter out points (the ones we just rendered as individuals).
|
|
14389
|
-
collection.features = collection.features.filter(x => x.geometry.type != "Point");
|
|
14390
|
-
// If there is nothing to render now, return.
|
|
14391
|
-
if (!collection.features.length) {
|
|
14241
|
+
// If no active render is happening, start processing immediately.
|
|
14242
|
+
if (!this.renderQueueActive) {
|
|
14243
|
+
this.renderQueueActive = true;
|
|
14244
|
+
await this.processRenderQueue(entities, force);
|
|
14392
14245
|
return;
|
|
14393
14246
|
}
|
|
14394
|
-
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14398
|
-
|
|
14399
|
-
|
|
14400
|
-
|
|
14401
|
-
|
|
14247
|
+
// Otherwise, add to the queue.
|
|
14248
|
+
this.renderQueue.push(entities);
|
|
14249
|
+
this.renderQueueForceFlags.push(force);
|
|
14250
|
+
}
|
|
14251
|
+
/**
|
|
14252
|
+
* Processes the render queue, handling one rendering operation at a time.
|
|
14253
|
+
*/
|
|
14254
|
+
async processRenderQueue(initialEntities, initialForce = false) {
|
|
14402
14255
|
if (this.disposed) {
|
|
14403
|
-
this.
|
|
14256
|
+
this.renderQueueActive = false;
|
|
14404
14257
|
return;
|
|
14405
14258
|
}
|
|
14406
|
-
|
|
14407
|
-
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
* @param thing
|
|
14411
|
-
* @param entityId
|
|
14412
|
-
* @param data
|
|
14413
|
-
* @returns
|
|
14414
|
-
*/
|
|
14415
|
-
const applyStyle = (thing, entityId, data) => {
|
|
14416
|
-
if (thing.polygon) {
|
|
14417
|
-
const bFillColor = Calculator.GetColor(pStyle.fillColor, data, []);
|
|
14418
|
-
const cFillColor = bFillColor ? colorToCColor$3(bFillColor) : Color.fromCssColorString("rgba(139, 195, 74, 0.8)");
|
|
14419
|
-
const bLineColor = Calculator.GetColor(pStyle.lineColor, data, []);
|
|
14420
|
-
const cLineColor = bLineColor ? colorToCColor$3(bLineColor) : Color.fromCssColorString("rgba(80, 80, 80, 0.8)");
|
|
14421
|
-
let width = pStyle.lineWidth ? Calculator.GetNumber(pStyle.lineWidth, data, []) : null;
|
|
14422
|
-
if (width == null) {
|
|
14423
|
-
width = 1;
|
|
14424
|
-
}
|
|
14425
|
-
width = EnsureNumber(width);
|
|
14426
|
-
if (width < 0.01) {
|
|
14427
|
-
width = 0;
|
|
14428
|
-
}
|
|
14429
|
-
let curFillColor = getValue$4(this.viewer, thing.polygon.material);
|
|
14430
|
-
if (curFillColor && curFillColor instanceof ColorMaterialProperty) {
|
|
14431
|
-
curFillColor = curFillColor.color;
|
|
14432
|
-
}
|
|
14433
|
-
let curLineColor = getValue$4(this.viewer, thing.polygon.outlineColor);
|
|
14434
|
-
if (curLineColor && curLineColor instanceof ColorMaterialProperty) {
|
|
14435
|
-
curLineColor = curLineColor.color;
|
|
14436
|
-
}
|
|
14437
|
-
const curWidth = getValue$4(this.viewer, thing.polygon.outlineWidth);
|
|
14438
|
-
if ((curFillColor instanceof Color && curFillColor.equals(cFillColor)) &&
|
|
14439
|
-
(curLineColor instanceof Color && curLineColor.equals(cLineColor)) &&
|
|
14440
|
-
curWidth == width) {
|
|
14441
|
-
return;
|
|
14442
|
-
}
|
|
14443
|
-
thing.polygon.material = new ColorMaterialProperty(cFillColor);
|
|
14444
|
-
thing.polygon.outlineColor = new ConstantProperty(cLineColor);
|
|
14445
|
-
thing.polygon.outlineWidth = new ConstantProperty(width);
|
|
14446
|
-
}
|
|
14447
|
-
else if (thing.polyline) {
|
|
14448
|
-
const bColor = lStyle.lineColor ? Calculator.GetColor(lStyle.lineColor, data, []) : null;
|
|
14449
|
-
const cColor = bColor ? colorToCColor$3(bColor) : Color.fromCssColorString("rgba(255, 193, 7, 0.8)");
|
|
14450
|
-
let width = lStyle.lineWidth ? Calculator.GetNumber(lStyle.lineWidth, data, []) : null;
|
|
14451
|
-
if (width == null) {
|
|
14452
|
-
width = 2;
|
|
14453
|
-
}
|
|
14454
|
-
width = EnsureNumber(width);
|
|
14455
|
-
if (width < 0.01) {
|
|
14456
|
-
width = 0;
|
|
14457
|
-
}
|
|
14458
|
-
let curColor = getValue$4(this.viewer, thing.polyline.material);
|
|
14459
|
-
if (curColor && curColor instanceof ColorMaterialProperty) {
|
|
14460
|
-
curColor = curColor.color;
|
|
14461
|
-
}
|
|
14462
|
-
const curWidth = getValue$4(this.viewer, thing.polyline.width);
|
|
14463
|
-
if ((curColor instanceof Color && curColor.equals(cColor)) &&
|
|
14464
|
-
curWidth == width) {
|
|
14465
|
-
return;
|
|
14466
|
-
}
|
|
14467
|
-
thing.polyline.material = new ColorMaterialProperty(cColor);
|
|
14468
|
-
thing.polyline.width = new ConstantProperty(width);
|
|
14469
|
-
}
|
|
14470
|
-
};
|
|
14471
|
-
let toForceUpdate = [];
|
|
14472
|
-
/**
|
|
14473
|
-
* Registers a given cesium entity produced from rendering geojson.
|
|
14474
|
-
* Since one nextspace entity can have multiple cesium entities, there is special logic to group them together.
|
|
14475
|
-
* @param thing
|
|
14476
|
-
* @returns
|
|
14477
|
-
*/
|
|
14478
|
-
const register = (thing) => {
|
|
14479
|
-
var _a, _b, _c, _d;
|
|
14480
|
-
// See if the cesium entity already exists in a group.
|
|
14481
|
-
let group = groups.find((x) => { var _a; return ((_a = x.visual) === null || _a === void 0 ? void 0 : _a.id) == thing.id || x.siblings.find(x => (x === null || x === void 0 ? void 0 : x.id) == thing.id); });
|
|
14482
|
-
if (group) {
|
|
14483
|
-
return;
|
|
14484
|
-
}
|
|
14485
|
-
const metadata = getValue$4(this.viewer, thing === null || thing === void 0 ? void 0 : thing.properties);
|
|
14486
|
-
const entityId = (_a = metadata === null || metadata === void 0 ? void 0 : metadata.Bruce) === null || _a === void 0 ? void 0 : _a.ID;
|
|
14487
|
-
if (!entityId) {
|
|
14259
|
+
try {
|
|
14260
|
+
// Process the initial batch.
|
|
14261
|
+
await this.renderAsIndividuals(initialEntities, initialForce);
|
|
14262
|
+
if (this.disposed) {
|
|
14488
14263
|
return;
|
|
14489
14264
|
}
|
|
14490
|
-
//
|
|
14491
|
-
|
|
14492
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
14497
|
-
|
|
14498
|
-
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14502
|
-
};
|
|
14503
|
-
groups.push(group);
|
|
14504
|
-
applyStyle(thing, entityId, group.data);
|
|
14505
|
-
const rego = {
|
|
14506
|
-
entityId: entityId,
|
|
14507
|
-
menuItemId: this.item.id,
|
|
14508
|
-
menuItemType: this.item.Type,
|
|
14509
|
-
visual: thing,
|
|
14510
|
-
priority: this.renderPriority,
|
|
14511
|
-
entityTypeId: group.entityTypeId,
|
|
14512
|
-
accountId: this.apiGetter.accountId,
|
|
14513
|
-
tagIds: group.tagIds ? [].concat(group.tagIds) : [],
|
|
14514
|
-
name: entityType ? (_d = Entity$1.CalculateName({
|
|
14515
|
-
entity: group.data,
|
|
14516
|
-
type: entityType,
|
|
14517
|
-
defaultToId: false
|
|
14518
|
-
})) !== null && _d !== void 0 ? _d : "Unnamed Entity" : "Unnamed Entity",
|
|
14519
|
-
cdn: this.item.cdnEnabled,
|
|
14520
|
-
collection: source.entities
|
|
14521
|
-
};
|
|
14522
|
-
group.rego = rego;
|
|
14523
|
-
this.visualsManager.AddRego({
|
|
14524
|
-
rego,
|
|
14525
|
-
requestRender: false
|
|
14526
|
-
});
|
|
14527
|
-
}
|
|
14528
|
-
// Found a group. We flag this as a sibling entity of the primary.
|
|
14529
|
-
else {
|
|
14530
|
-
applyStyle(thing, entityId, group.data);
|
|
14531
|
-
group.siblings.push(thing);
|
|
14532
|
-
group.visual._siblingGraphics = group.siblings;
|
|
14533
|
-
thing._parentEntity = group.visual;
|
|
14534
|
-
if (group.rego) {
|
|
14535
|
-
this.visualsManager.RefreshMark({
|
|
14536
|
-
rego: group.rego
|
|
14537
|
-
});
|
|
14538
|
-
if (!toForceUpdate.includes(entityId)) {
|
|
14539
|
-
toForceUpdate.push(entityId);
|
|
14265
|
+
// Process any queued items.
|
|
14266
|
+
while (this.renderQueue.length > 0 && !this.disposed) {
|
|
14267
|
+
// If multiple entities are waiting, combine them to reduce render operations.
|
|
14268
|
+
const allEntities = [];
|
|
14269
|
+
const forces = [];
|
|
14270
|
+
// Collect all pending entities.
|
|
14271
|
+
while (this.renderQueue.length > 0) {
|
|
14272
|
+
const entities = this.renderQueue.shift();
|
|
14273
|
+
const force = this.renderQueueForceFlags.shift();
|
|
14274
|
+
if (entities && entities.length > 0) {
|
|
14275
|
+
allEntities.push(...entities);
|
|
14276
|
+
forces.push(force);
|
|
14540
14277
|
}
|
|
14541
14278
|
}
|
|
14279
|
+
if (allEntities.length > 0) {
|
|
14280
|
+
// If any are forced, we need to force the render.
|
|
14281
|
+
const combinedForce = forces.some(f => f === true);
|
|
14282
|
+
const uniqueEntities = this.deduplicateEntities(allEntities);
|
|
14283
|
+
await this.renderAsIndividuals(uniqueEntities, combinedForce);
|
|
14284
|
+
}
|
|
14542
14285
|
}
|
|
14543
|
-
};
|
|
14544
|
-
const sEntities = source.entities.values;
|
|
14545
|
-
for (let i = 0; i < sEntities.length; i++) {
|
|
14546
|
-
const cEntity = sEntities[i];
|
|
14547
|
-
register(cEntity);
|
|
14548
14286
|
}
|
|
14549
|
-
|
|
14550
|
-
this.
|
|
14551
|
-
entityIds: toForceUpdate,
|
|
14552
|
-
refreshColors: true,
|
|
14553
|
-
requestRender: false
|
|
14554
|
-
});
|
|
14287
|
+
finally {
|
|
14288
|
+
this.renderQueueActive = false;
|
|
14555
14289
|
}
|
|
14556
|
-
|
|
14290
|
+
}
|
|
14291
|
+
deduplicateEntities(entities) {
|
|
14292
|
+
const entityMap = new Map();
|
|
14293
|
+
for (const entity of entities) {
|
|
14294
|
+
if (entity && entity.Bruce && entity.Bruce.ID) {
|
|
14295
|
+
entityMap.set(entity.Bruce.ID, entity);
|
|
14296
|
+
}
|
|
14297
|
+
}
|
|
14298
|
+
return Array.from(entityMap.values());
|
|
14557
14299
|
}
|
|
14558
14300
|
/**
|
|
14559
14301
|
* Our default path.
|
|
@@ -14564,16 +14306,28 @@ var EntitiesIdsRenderManager;
|
|
|
14564
14306
|
*/
|
|
14565
14307
|
async renderAsIndividuals(entities, force = false) {
|
|
14566
14308
|
var _a;
|
|
14309
|
+
if (this.disposed || this.viewer.isDestroyed() || !entities.length) {
|
|
14310
|
+
return;
|
|
14311
|
+
}
|
|
14312
|
+
let entitiesHistoric = {};
|
|
14313
|
+
if ((this.item.BruceEntity.historic || this.item.BruceEntity.historicAttrKey) && entities.length) {
|
|
14314
|
+
entitiesHistoric = await this.getHistoricInfo(entities);
|
|
14315
|
+
}
|
|
14567
14316
|
const { updated, entities: cEntities } = await EntityRenderEngine.Render({
|
|
14568
14317
|
viewer: this.viewer,
|
|
14569
14318
|
apiGetter: this.apiGetter,
|
|
14570
14319
|
entities: entities,
|
|
14571
14320
|
menuItemId: this.item.id,
|
|
14572
14321
|
visualRegister: this.visualsManager,
|
|
14322
|
+
entitiesHistoric: entitiesHistoric,
|
|
14323
|
+
entityHistoricDrawTrack: this.item.historicDrawTrack,
|
|
14573
14324
|
zoomControl: this.item.CameraZoomSettings,
|
|
14574
14325
|
force
|
|
14575
14326
|
});
|
|
14576
14327
|
for (let i = 0; i < entities.length; i++) {
|
|
14328
|
+
if (this.disposed) {
|
|
14329
|
+
break;
|
|
14330
|
+
}
|
|
14577
14331
|
const entity = entities[i];
|
|
14578
14332
|
const id = entity.Bruce.ID;
|
|
14579
14333
|
const cEntity = cEntities.get(id);
|
|
@@ -14622,10 +14376,143 @@ var EntitiesIdsRenderManager;
|
|
|
14622
14376
|
(_a = this.clustering) === null || _a === void 0 ? void 0 : _a.RemoveEntity(id, false);
|
|
14623
14377
|
}
|
|
14624
14378
|
}
|
|
14625
|
-
this.
|
|
14626
|
-
|
|
14627
|
-
this.clustering.
|
|
14379
|
+
if (!this.disposed) {
|
|
14380
|
+
this.viewer.scene.requestRender();
|
|
14381
|
+
if (this.clustering && entities.length) {
|
|
14382
|
+
this.clustering.Update();
|
|
14383
|
+
}
|
|
14384
|
+
}
|
|
14385
|
+
}
|
|
14386
|
+
/**
|
|
14387
|
+
* Returns historic information for the given set of Entities at the current timeline range.
|
|
14388
|
+
* @param entities
|
|
14389
|
+
*/
|
|
14390
|
+
async getHistoricInfo(entities) {
|
|
14391
|
+
const startTmp = JulianDate.toDate(this.viewer.clock.startTime);
|
|
14392
|
+
const stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
|
|
14393
|
+
let rangesToRequest = [{
|
|
14394
|
+
start: startTmp.toISOString(),
|
|
14395
|
+
stop: stopTmp.toISOString()
|
|
14396
|
+
}];
|
|
14397
|
+
// If we already have cached data, determine what ranges we're missing.
|
|
14398
|
+
if (this.lastHistoricMin && this.lastHistoricMax && Object.keys(this.entitiesHistoric).length >= entities.length) {
|
|
14399
|
+
const cachedStart = new Date(this.lastHistoricMin).getTime();
|
|
14400
|
+
const cachedStop = new Date(this.lastHistoricMax).getTime();
|
|
14401
|
+
const newStart = startTmp.getTime();
|
|
14402
|
+
const newStop = stopTmp.getTime();
|
|
14403
|
+
// Complete overlap - we already have all the data.
|
|
14404
|
+
if (newStart >= cachedStart && newStop <= cachedStop) {
|
|
14405
|
+
return this.entitiesHistoric;
|
|
14406
|
+
}
|
|
14407
|
+
// Calculate missing ranges.
|
|
14408
|
+
rangesToRequest = [];
|
|
14409
|
+
// Check if we need data before our cached range.
|
|
14410
|
+
if (newStart < cachedStart) {
|
|
14411
|
+
rangesToRequest.push({
|
|
14412
|
+
start: startTmp.toISOString(),
|
|
14413
|
+
stop: new Date(cachedStart).toISOString()
|
|
14414
|
+
});
|
|
14415
|
+
}
|
|
14416
|
+
// Check if we need data after our cached range.
|
|
14417
|
+
if (newStop > cachedStop) {
|
|
14418
|
+
rangesToRequest.push({
|
|
14419
|
+
start: new Date(cachedStop).toISOString(),
|
|
14420
|
+
stop: stopTmp.toISOString()
|
|
14421
|
+
});
|
|
14422
|
+
}
|
|
14423
|
+
}
|
|
14424
|
+
const entityIds = entities.map(x => x.Bruce.ID);
|
|
14425
|
+
const combined = { ...this.entitiesHistoric };
|
|
14426
|
+
// Make requests for each missing range
|
|
14427
|
+
for (const range of rangesToRequest) {
|
|
14428
|
+
if (this.disposed) {
|
|
14429
|
+
break;
|
|
14430
|
+
}
|
|
14431
|
+
// Add padding to ensure we get all data.
|
|
14432
|
+
const start = new Date(range.start);
|
|
14433
|
+
const stop = new Date(range.stop);
|
|
14434
|
+
start.setSeconds(start.getSeconds() - 1);
|
|
14435
|
+
stop.setSeconds(stop.getSeconds() + 1);
|
|
14436
|
+
const paddedStartStr = start.toISOString();
|
|
14437
|
+
const paddedStopStr = stop.toISOString();
|
|
14438
|
+
const historicData = await EntityHistoricData.GetList({
|
|
14439
|
+
attrKey: this.item.BruceEntity.historicAttrKey,
|
|
14440
|
+
dateTimeFrom: paddedStartStr,
|
|
14441
|
+
dateTimeTo: paddedStopStr,
|
|
14442
|
+
entityIds: entityIds,
|
|
14443
|
+
api: this.apiGetter.getApi()
|
|
14444
|
+
});
|
|
14445
|
+
if (this.disposed) {
|
|
14446
|
+
break;
|
|
14447
|
+
}
|
|
14448
|
+
// Merge the new data with existing data
|
|
14449
|
+
const records = historicData.recordsByIds;
|
|
14450
|
+
const recordsIds = Object.keys(records);
|
|
14451
|
+
for (let i = 0; i < recordsIds.length; i++) {
|
|
14452
|
+
const entityId = recordsIds[i];
|
|
14453
|
+
const latest = records[entityId] || [];
|
|
14454
|
+
const current = combined[entityId] || [];
|
|
14455
|
+
// Use a Map to de-duplicate by timestamp.
|
|
14456
|
+
const tmp = new Map();
|
|
14457
|
+
for (let j = 0; j < current.length; j++) {
|
|
14458
|
+
const record = current[j];
|
|
14459
|
+
const dateTime = new Date(record.dateTime).getTime();
|
|
14460
|
+
tmp.set(dateTime, record);
|
|
14461
|
+
}
|
|
14462
|
+
for (let j = 0; j < latest.length; j++) {
|
|
14463
|
+
const record = latest[j];
|
|
14464
|
+
const dateTime = new Date(record.dateTime).getTime();
|
|
14465
|
+
tmp.set(dateTime, record);
|
|
14466
|
+
}
|
|
14467
|
+
// Convert to array and sort by date.
|
|
14468
|
+
const sorted = Array.from(tmp.values()).sort((a, b) => {
|
|
14469
|
+
return new Date(a.dateTime).getTime() - new Date(b.dateTime).getTime();
|
|
14470
|
+
});
|
|
14471
|
+
combined[entityId] = sorted;
|
|
14472
|
+
}
|
|
14628
14473
|
}
|
|
14474
|
+
if (!this.disposed) {
|
|
14475
|
+
// Update our cache boundaries.
|
|
14476
|
+
this.lastHistoricMin = startTmp.toISOString();
|
|
14477
|
+
this.lastHistoricMax = stopTmp.toISOString();
|
|
14478
|
+
this.entitiesHistoric = combined;
|
|
14479
|
+
}
|
|
14480
|
+
return combined;
|
|
14481
|
+
}
|
|
14482
|
+
viewerDateTimeSub() {
|
|
14483
|
+
var _a, _b;
|
|
14484
|
+
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)) || this.viewerDateTimeChangeRemoval) {
|
|
14485
|
+
return;
|
|
14486
|
+
}
|
|
14487
|
+
const THROTTLE_INTERVAL = 2000;
|
|
14488
|
+
let queue = new DelayQueue(() => {
|
|
14489
|
+
this.onGetterUpdate(Object.keys(this.renderedEntities));
|
|
14490
|
+
}, THROTTLE_INTERVAL, true);
|
|
14491
|
+
let clockTickRemoval;
|
|
14492
|
+
let prevTick = this.viewer.clock.currentTime.toString();
|
|
14493
|
+
clockTickRemoval = this.viewer.clock.onTick.addEventListener(() => {
|
|
14494
|
+
if (this.disposed || this.viewer.isDestroyed()) {
|
|
14495
|
+
return;
|
|
14496
|
+
}
|
|
14497
|
+
const currentTick = this.viewer.clock.currentTime.toString();
|
|
14498
|
+
if (currentTick === prevTick) {
|
|
14499
|
+
return;
|
|
14500
|
+
}
|
|
14501
|
+
queue.Call();
|
|
14502
|
+
});
|
|
14503
|
+
this.viewerDateTimeChangeRemoval = () => {
|
|
14504
|
+
if (clockTickRemoval) {
|
|
14505
|
+
clockTickRemoval();
|
|
14506
|
+
clockTickRemoval = null;
|
|
14507
|
+
}
|
|
14508
|
+
queue.Dispose();
|
|
14509
|
+
queue = null;
|
|
14510
|
+
};
|
|
14511
|
+
}
|
|
14512
|
+
viewerDateTimeDispose() {
|
|
14513
|
+
var _a;
|
|
14514
|
+
(_a = this.viewerDateTimeChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
14515
|
+
this.viewerDateTimeChangeRemoval = null;
|
|
14629
14516
|
}
|
|
14630
14517
|
}
|
|
14631
14518
|
EntitiesIdsRenderManager.Manager = Manager;
|
|
@@ -15769,7 +15656,7 @@ var SharedGetters;
|
|
|
15769
15656
|
})(Queue = SharedGetters.Queue || (SharedGetters.Queue = {}));
|
|
15770
15657
|
})(SharedGetters || (SharedGetters = {}));
|
|
15771
15658
|
|
|
15772
|
-
function colorToCColor$
|
|
15659
|
+
function colorToCColor$3(color) {
|
|
15773
15660
|
return new Color(color.red ? color.red / 255 : 0, color.green ? color.green / 255 : 0, color.blue ? color.blue / 255 : 0, color.alpha);
|
|
15774
15661
|
}
|
|
15775
15662
|
/**
|
|
@@ -17073,7 +16960,7 @@ var TilesetRenderEngine;
|
|
|
17073
16960
|
cColor = Color.WHITE;
|
|
17074
16961
|
}
|
|
17075
16962
|
else {
|
|
17076
|
-
cColor = colorToCColor$
|
|
16963
|
+
cColor = colorToCColor$3(bColor);
|
|
17077
16964
|
}
|
|
17078
16965
|
const override = this.styledEntityIds[entity.entityId] == true;
|
|
17079
16966
|
CesiumEntityStyler.SetDefaultColor({
|
|
@@ -17765,7 +17652,7 @@ var TilesetCadRenderManager;
|
|
|
17765
17652
|
entityIds: [this.rootId],
|
|
17766
17653
|
api: api
|
|
17767
17654
|
});
|
|
17768
|
-
const posses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(this.viewer, HeightReference.NONE, historicData.recordsByIds[this.rootId]);
|
|
17655
|
+
const posses = CesiumAnimatedProperty.GetSeriesPossesForHistoricEntity(this.viewer, HeightReference.NONE, HeightReference.CLAMP_TO_GROUND, historicData.recordsByIds[this.rootId]);
|
|
17769
17656
|
res(posses);
|
|
17770
17657
|
}
|
|
17771
17658
|
catch (e) {
|
|
@@ -30750,7 +30637,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
30750
30637
|
}
|
|
30751
30638
|
}
|
|
30752
30639
|
|
|
30753
|
-
const VERSION = "5.4.
|
|
30640
|
+
const VERSION = "5.4.3";
|
|
30754
30641
|
|
|
30755
30642
|
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, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_FORWARD_KEY, CESIUM_TIMELINE_LIVE_PADDING_BACKWARD_KEY, CESIUM_TIMELINE_INTERVAL_KEY, 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 };
|
|
30756
30643
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|