bruce-cesium 3.8.1 → 3.8.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 +745 -187
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +743 -185
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/cesium-animated-in-out.js +166 -0
- package/dist/lib/rendering/cesium-animated-in-out.js.map +1 -0
- package/dist/lib/rendering/cesium-animated-property.js +151 -9
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +312 -111
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +43 -21
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +8 -23
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +67 -21
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +3 -0
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/cesium-animated-in-out.d.ts +12 -0
- package/dist/types/rendering/cesium-animated-property.d.ts +55 -5
- package/dist/types/rendering/entity-render-engine.d.ts +7 -1
- package/dist/types/utils/cesium-entity-styler.d.ts +3 -0
- package/dist/types/utils/entity-utils.d.ts +1 -1
- package/package.json +2 -2
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
1
|
+
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityHistoricData, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, SceneMode, GeoJsonDataSource, ColorMaterialProperty, ConstantProperty, Cesium3DTileColorBlendMode, HeadingPitchRange, Entity, Primitive, Cesium3DTileFeature, DistanceDisplayCondition, NearFarScalar, Model, HorizontalOrigin, VerticalOrigin, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorBlendMode, HeadingPitchRoll, Transforms, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, EllipsoidTerrainProvider, CesiumInspector, OrthographicFrustum, defined, ClockRange, EasingFunction, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, PolygonPipeline, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, ScreenSpaceEventHandler, ScreenSpaceEventType, Matrix4, Matrix3, IonResource, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -931,6 +931,20 @@ function getNumber(viewer, obj) {
|
|
|
931
931
|
}
|
|
932
932
|
return value;
|
|
933
933
|
}
|
|
934
|
+
function getPosition(viewer, obj) {
|
|
935
|
+
var value = null;
|
|
936
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
937
|
+
var date = viewer.scene.lastRenderTime;
|
|
938
|
+
if (!date) {
|
|
939
|
+
date = viewer.clock.currentTime;
|
|
940
|
+
}
|
|
941
|
+
value = obj.getValue(date);
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
value = obj;
|
|
945
|
+
}
|
|
946
|
+
return value;
|
|
947
|
+
}
|
|
934
948
|
/**
|
|
935
949
|
* Returns if a given visual is alive and in the scene.
|
|
936
950
|
* @param viewer
|
|
@@ -985,7 +999,7 @@ var CesiumAnimatedProperty;
|
|
|
985
999
|
function AnimateColor(params) {
|
|
986
1000
|
var _a;
|
|
987
1001
|
this.viewer = params.viewer;
|
|
988
|
-
this.
|
|
1002
|
+
this.targetColor = params.targetColor;
|
|
989
1003
|
this.durationMs = params.durationMs;
|
|
990
1004
|
this.startColor = getColor(this.viewer, params.startColor);
|
|
991
1005
|
if ((_a = this.startColor) === null || _a === void 0 ? void 0 : _a.clone) {
|
|
@@ -997,6 +1011,11 @@ var CesiumAnimatedProperty;
|
|
|
997
1011
|
}
|
|
998
1012
|
this.startTime = new Date();
|
|
999
1013
|
}
|
|
1014
|
+
AnimateColor.prototype.IsDone = function () {
|
|
1015
|
+
var now = new Date();
|
|
1016
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1017
|
+
return elapsedMs >= this.durationMs;
|
|
1018
|
+
};
|
|
1000
1019
|
/**
|
|
1001
1020
|
* Returns the calculated color at the provided time.
|
|
1002
1021
|
* @returns
|
|
@@ -1006,18 +1025,18 @@ var CesiumAnimatedProperty;
|
|
|
1006
1025
|
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1007
1026
|
// Animation over.
|
|
1008
1027
|
if (elapsedMs >= this.durationMs) {
|
|
1009
|
-
return this.
|
|
1028
|
+
return this.targetColor;
|
|
1010
1029
|
}
|
|
1011
1030
|
try {
|
|
1012
1031
|
var progress = elapsedMs / this.durationMs;
|
|
1013
|
-
return Color.lerp(this.startColor, this.
|
|
1032
|
+
return Color.lerp(this.startColor, this.targetColor, progress, new Color());
|
|
1014
1033
|
}
|
|
1015
1034
|
catch (e) {
|
|
1016
1035
|
console.error(e);
|
|
1017
1036
|
}
|
|
1018
1037
|
// Failed to calculate color.
|
|
1019
1038
|
// We'll just return the target color.
|
|
1020
|
-
return this.
|
|
1039
|
+
return this.targetColor;
|
|
1021
1040
|
};
|
|
1022
1041
|
/**
|
|
1023
1042
|
* Returns the calculated color as a material property.
|
|
@@ -1035,7 +1054,7 @@ var CesiumAnimatedProperty;
|
|
|
1035
1054
|
this.paused = false;
|
|
1036
1055
|
this.paused = Boolean(params.startPaused);
|
|
1037
1056
|
this.viewer = params.viewer;
|
|
1038
|
-
this.
|
|
1057
|
+
this.targetValue = params.targetValue;
|
|
1039
1058
|
this.durationMs = params.durationMs;
|
|
1040
1059
|
this.startValue = getNumber(this.viewer, params.startValue);
|
|
1041
1060
|
if (!this.startValue) {
|
|
@@ -1059,18 +1078,18 @@ var CesiumAnimatedProperty;
|
|
|
1059
1078
|
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1060
1079
|
// Animation over.
|
|
1061
1080
|
if (elapsedMs >= this.durationMs) {
|
|
1062
|
-
return this.
|
|
1081
|
+
return this.targetValue;
|
|
1063
1082
|
}
|
|
1064
1083
|
try {
|
|
1065
1084
|
var progress = elapsedMs / this.durationMs;
|
|
1066
|
-
return Math$1.lerp(this.startValue, this.
|
|
1085
|
+
return Math$1.lerp(this.startValue, this.targetValue, progress);
|
|
1067
1086
|
}
|
|
1068
1087
|
catch (e) {
|
|
1069
1088
|
console.error(e);
|
|
1070
1089
|
}
|
|
1071
1090
|
// Failed to calculate value.
|
|
1072
1091
|
// We'll just return the target value.
|
|
1073
|
-
return this.
|
|
1092
|
+
return this.targetValue;
|
|
1074
1093
|
};
|
|
1075
1094
|
return AnimateNumber;
|
|
1076
1095
|
}());
|
|
@@ -1093,7 +1112,7 @@ var CesiumAnimatedProperty;
|
|
|
1093
1112
|
* @returns
|
|
1094
1113
|
*/
|
|
1095
1114
|
function AnimateTFeatureColor(params) {
|
|
1096
|
-
var viewer = params.viewer, feature = params.feature, color = params.
|
|
1115
|
+
var viewer = params.viewer, feature = params.feature, color = params.targetColor, startColor = params.startColor, durationMs = params.durationMs, onDone = params.onDone;
|
|
1097
1116
|
ClearTFeatureColorAnimation(feature);
|
|
1098
1117
|
if (!startColor) {
|
|
1099
1118
|
if (feature.color) {
|
|
@@ -1134,6 +1153,7 @@ var CesiumAnimatedProperty;
|
|
|
1134
1153
|
if (!assertColorMark(mark, feature.color)) {
|
|
1135
1154
|
removal === null || removal === void 0 ? void 0 : removal();
|
|
1136
1155
|
removal = null;
|
|
1156
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
1137
1157
|
return;
|
|
1138
1158
|
}
|
|
1139
1159
|
var now = new Date();
|
|
@@ -1143,6 +1163,7 @@ var CesiumAnimatedProperty;
|
|
|
1143
1163
|
feature.color = color;
|
|
1144
1164
|
removal === null || removal === void 0 ? void 0 : removal();
|
|
1145
1165
|
removal = null;
|
|
1166
|
+
onDone === null || onDone === void 0 ? void 0 : onDone();
|
|
1146
1167
|
return;
|
|
1147
1168
|
}
|
|
1148
1169
|
try {
|
|
@@ -1174,6 +1195,127 @@ var CesiumAnimatedProperty;
|
|
|
1174
1195
|
}
|
|
1175
1196
|
}
|
|
1176
1197
|
CesiumAnimatedProperty.ClearTFeatureColorAnimation = ClearTFeatureColorAnimation;
|
|
1198
|
+
var AnimatePosition = /** @class */ (function () {
|
|
1199
|
+
function AnimatePosition(params) {
|
|
1200
|
+
this.viewer = params.viewer;
|
|
1201
|
+
this.targetPos3d = params.targetPos3d;
|
|
1202
|
+
this.durationMs = params.durationMs;
|
|
1203
|
+
this.startPos3d = getPosition(this.viewer, params.startPos3d);
|
|
1204
|
+
if (!this.startPos3d) {
|
|
1205
|
+
this.startPos3d = Cartesian3.clone(this.targetPos3d);
|
|
1206
|
+
}
|
|
1207
|
+
this.startTime = new Date();
|
|
1208
|
+
}
|
|
1209
|
+
AnimatePosition.prototype.GetValue = function () {
|
|
1210
|
+
var now = new Date();
|
|
1211
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1212
|
+
// Animation over.
|
|
1213
|
+
if (elapsedMs >= this.durationMs) {
|
|
1214
|
+
return this.targetPos3d;
|
|
1215
|
+
}
|
|
1216
|
+
try {
|
|
1217
|
+
var progress = elapsedMs / this.durationMs;
|
|
1218
|
+
return Cartesian3.lerp(this.startPos3d, this.targetPos3d, progress, new Cartesian3());
|
|
1219
|
+
}
|
|
1220
|
+
catch (e) {
|
|
1221
|
+
console.error(e);
|
|
1222
|
+
}
|
|
1223
|
+
// Failed to calculate value.
|
|
1224
|
+
// We'll just return the target value.
|
|
1225
|
+
return this.targetPos3d;
|
|
1226
|
+
};
|
|
1227
|
+
return AnimatePosition;
|
|
1228
|
+
}());
|
|
1229
|
+
CesiumAnimatedProperty.AnimatePosition = AnimatePosition;
|
|
1230
|
+
var AnimateHeading = /** @class */ (function () {
|
|
1231
|
+
function AnimateHeading(params) {
|
|
1232
|
+
this.viewer = params.viewer;
|
|
1233
|
+
this.targetHeadingDeg = params.targetHeading;
|
|
1234
|
+
this.durationMs = params.durationMs;
|
|
1235
|
+
this.startHeadingDeg = getNumber(this.viewer, params.startHeading);
|
|
1236
|
+
if (!this.startHeadingDeg) {
|
|
1237
|
+
this.startHeadingDeg = 0;
|
|
1238
|
+
}
|
|
1239
|
+
this.startTime = new Date();
|
|
1240
|
+
}
|
|
1241
|
+
AnimateHeading.prototype.IsDone = function () {
|
|
1242
|
+
var now = new Date();
|
|
1243
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1244
|
+
return elapsedMs >= this.durationMs;
|
|
1245
|
+
};
|
|
1246
|
+
AnimateHeading.prototype.GetValue = function () {
|
|
1247
|
+
var now = new Date();
|
|
1248
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1249
|
+
// Animation over.
|
|
1250
|
+
if (elapsedMs >= this.durationMs) {
|
|
1251
|
+
return this.targetHeadingDeg;
|
|
1252
|
+
}
|
|
1253
|
+
try {
|
|
1254
|
+
var progress = elapsedMs / this.durationMs;
|
|
1255
|
+
return Math$1.lerp(this.startHeadingDeg, this.targetHeadingDeg, progress);
|
|
1256
|
+
}
|
|
1257
|
+
catch (e) {
|
|
1258
|
+
console.error(e);
|
|
1259
|
+
}
|
|
1260
|
+
// Failed to calculate value.
|
|
1261
|
+
// We'll just return the target value.
|
|
1262
|
+
return this.targetHeadingDeg;
|
|
1263
|
+
};
|
|
1264
|
+
return AnimateHeading;
|
|
1265
|
+
}());
|
|
1266
|
+
CesiumAnimatedProperty.AnimateHeading = AnimateHeading;
|
|
1267
|
+
/**
|
|
1268
|
+
* Animates a position from a set of provided positions in time.
|
|
1269
|
+
* This will return a position across the provided positions based on the current time.
|
|
1270
|
+
* If the time exceeds the duration, the last position will be returned.
|
|
1271
|
+
* If the time proceeds the first position, the first position will be returned.
|
|
1272
|
+
*/
|
|
1273
|
+
var AnimatePositionSeries = /** @class */ (function () {
|
|
1274
|
+
function AnimatePositionSeries(params) {
|
|
1275
|
+
this.viewer = params.viewer;
|
|
1276
|
+
this.positions = params.posses;
|
|
1277
|
+
// Order positions by date.
|
|
1278
|
+
this.positions.sort(function (a, b) {
|
|
1279
|
+
return a.dateTime.getTime() - b.dateTime.getTime();
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
AnimatePositionSeries.prototype.GetValue = function () {
|
|
1283
|
+
var now = this.viewer.scene.lastRenderTime;
|
|
1284
|
+
if (!now) {
|
|
1285
|
+
now = this.viewer.clock.currentTime;
|
|
1286
|
+
}
|
|
1287
|
+
var nowTime = JulianDate.toDate(now);
|
|
1288
|
+
// See if we're before the first position.
|
|
1289
|
+
if (nowTime.getTime() <= this.positions[0].dateTime.getTime()) {
|
|
1290
|
+
return this.positions[0].pos3d;
|
|
1291
|
+
}
|
|
1292
|
+
// See if we're after the last position.
|
|
1293
|
+
if (nowTime.getTime() >= this.positions[this.positions.length - 1].dateTime.getTime()) {
|
|
1294
|
+
return this.positions[this.positions.length - 1].pos3d;
|
|
1295
|
+
}
|
|
1296
|
+
// Find the current position.
|
|
1297
|
+
var lastIndex = 0;
|
|
1298
|
+
for (var i = 1; i < this.positions.length; i++) {
|
|
1299
|
+
var pos = this.positions[i];
|
|
1300
|
+
if (nowTime.getTime() >= pos.dateTime.getTime()) {
|
|
1301
|
+
lastIndex = i;
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
break;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
var last = this.positions[lastIndex];
|
|
1308
|
+
// Interpolate the position.
|
|
1309
|
+
var next = this.positions[lastIndex + 1];
|
|
1310
|
+
if (!next) {
|
|
1311
|
+
return last.pos3d;
|
|
1312
|
+
}
|
|
1313
|
+
var progress = (nowTime.getTime() - last.dateTime.getTime()) / (next.dateTime.getTime() - last.dateTime.getTime());
|
|
1314
|
+
return Cartesian3.lerp(last.pos3d, next.pos3d, progress, new Cartesian3());
|
|
1315
|
+
};
|
|
1316
|
+
return AnimatePositionSeries;
|
|
1317
|
+
}());
|
|
1318
|
+
CesiumAnimatedProperty.AnimatePositionSeries = AnimatePositionSeries;
|
|
1177
1319
|
})(CesiumAnimatedProperty || (CesiumAnimatedProperty = {}));
|
|
1178
1320
|
|
|
1179
1321
|
/**
|
|
@@ -1373,7 +1515,7 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1373
1515
|
}
|
|
1374
1516
|
else {
|
|
1375
1517
|
CesiumAnimatedProperty.AnimateTFeatureColor({
|
|
1376
|
-
|
|
1518
|
+
targetColor: color.clone(),
|
|
1377
1519
|
durationMs: animateMs,
|
|
1378
1520
|
feature: graphic,
|
|
1379
1521
|
viewer: viewer,
|
|
@@ -1384,7 +1526,7 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1384
1526
|
else if (graphic instanceof ModelGraphics) {
|
|
1385
1527
|
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1386
1528
|
var animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
1387
|
-
|
|
1529
|
+
targetColor: color,
|
|
1388
1530
|
durationMs: animateMs,
|
|
1389
1531
|
viewer: viewer,
|
|
1390
1532
|
startColor: graphic.color
|
|
@@ -1408,7 +1550,7 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1408
1550
|
else if (graphic instanceof PointGraphics) {
|
|
1409
1551
|
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1410
1552
|
var animateColor_2 = new CesiumAnimatedProperty.AnimateColor({
|
|
1411
|
-
|
|
1553
|
+
targetColor: color,
|
|
1412
1554
|
durationMs: animateMs,
|
|
1413
1555
|
viewer: viewer,
|
|
1414
1556
|
startColor: graphic.color
|
|
@@ -1423,7 +1565,7 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1423
1565
|
else if (graphic instanceof BillboardGraphics) {
|
|
1424
1566
|
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1425
1567
|
var animateColor_3 = new CesiumAnimatedProperty.AnimateColor({
|
|
1426
|
-
|
|
1568
|
+
targetColor: color,
|
|
1427
1569
|
durationMs: animateMs,
|
|
1428
1570
|
viewer: viewer,
|
|
1429
1571
|
startColor: graphic.color
|
|
@@ -1535,10 +1677,32 @@ var CesiumEntityStyler;
|
|
|
1535
1677
|
}
|
|
1536
1678
|
CesiumEntityStyler.Refresh = Refresh;
|
|
1537
1679
|
function BakeDefaultColor(params) {
|
|
1538
|
-
var
|
|
1680
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1681
|
+
var viewer = params.viewer, entity = params.entity, override = params.override, colors = params.colors, refresh = params.refresh;
|
|
1539
1682
|
if (!entity) {
|
|
1540
1683
|
return;
|
|
1541
1684
|
}
|
|
1685
|
+
if (refresh == null) {
|
|
1686
|
+
refresh = true;
|
|
1687
|
+
}
|
|
1688
|
+
var colorMap;
|
|
1689
|
+
if (colors) {
|
|
1690
|
+
if (!(colors instanceof Map)) {
|
|
1691
|
+
var keys = Object.keys(colors);
|
|
1692
|
+
var map = new Map();
|
|
1693
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1694
|
+
var key = keys[i];
|
|
1695
|
+
map.set(key, colors[key]);
|
|
1696
|
+
}
|
|
1697
|
+
colorMap = map;
|
|
1698
|
+
}
|
|
1699
|
+
else {
|
|
1700
|
+
colorMap = colors;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
else {
|
|
1704
|
+
colorMap = new Map();
|
|
1705
|
+
}
|
|
1542
1706
|
var parts = EntityUtils.GatherEntity({
|
|
1543
1707
|
entity: entity
|
|
1544
1708
|
});
|
|
@@ -1556,37 +1720,61 @@ var CesiumEntityStyler;
|
|
|
1556
1720
|
}
|
|
1557
1721
|
if (part instanceof Cesium3DTileFeature) {
|
|
1558
1722
|
var opacity = getAppliedOpacity(part);
|
|
1559
|
-
|
|
1560
|
-
|
|
1723
|
+
var color = (_a = colorMap.get("feature")) !== null && _a !== void 0 ? _a : calculateCurColor(viewer, part);
|
|
1724
|
+
storeColor("default", color, part);
|
|
1725
|
+
if (refresh) {
|
|
1726
|
+
refreshColor(viewer, part, opacity);
|
|
1727
|
+
}
|
|
1561
1728
|
}
|
|
1562
1729
|
else if (part instanceof Entity) {
|
|
1563
1730
|
if (part.billboard) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1731
|
+
var color = (_b = colorMap.get("billboard")) !== null && _b !== void 0 ? _b : calculateCurColor(viewer, part.billboard);
|
|
1732
|
+
storeColor("default", color, part.billboard);
|
|
1733
|
+
if (refresh) {
|
|
1734
|
+
refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
|
|
1735
|
+
}
|
|
1566
1736
|
}
|
|
1567
1737
|
if (part.model) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1738
|
+
var color = (_c = colorMap.get("model")) !== null && _c !== void 0 ? _c : calculateCurColor(viewer, part.model);
|
|
1739
|
+
storeColor("default", color, part.model);
|
|
1740
|
+
if (refresh) {
|
|
1741
|
+
refreshColor(viewer, part.model, getAppliedOpacity(part.model));
|
|
1742
|
+
}
|
|
1570
1743
|
}
|
|
1571
1744
|
if (part.polyline) {
|
|
1572
|
-
|
|
1573
|
-
|
|
1745
|
+
var color = (_d = colorMap.get("polyline")) !== null && _d !== void 0 ? _d : calculateCurColor(viewer, part.polyline);
|
|
1746
|
+
storeColor("default", color, part.polyline);
|
|
1747
|
+
if (refresh) {
|
|
1748
|
+
refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
|
|
1749
|
+
}
|
|
1574
1750
|
}
|
|
1575
1751
|
if (part.polygon) {
|
|
1576
|
-
|
|
1577
|
-
|
|
1752
|
+
var color = (_e = colorMap.get("polygon")) !== null && _e !== void 0 ? _e : calculateCurColor(viewer, part.polygon);
|
|
1753
|
+
storeColor("default", color, part.polygon);
|
|
1754
|
+
if (refresh) {
|
|
1755
|
+
refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
|
|
1756
|
+
}
|
|
1578
1757
|
}
|
|
1579
1758
|
if (part.corridor) {
|
|
1580
|
-
|
|
1581
|
-
|
|
1759
|
+
var color = (_f = colorMap.get("corridor")) !== null && _f !== void 0 ? _f : calculateCurColor(viewer, part.corridor);
|
|
1760
|
+
storeColor("default", color, part.corridor);
|
|
1761
|
+
if (refresh) {
|
|
1762
|
+
refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
|
|
1763
|
+
}
|
|
1582
1764
|
}
|
|
1583
1765
|
if (part.point) {
|
|
1584
|
-
|
|
1585
|
-
|
|
1766
|
+
var color = (_g = colorMap.get("point")) !== null && _g !== void 0 ? _g : calculateCurColor(viewer, part.point);
|
|
1767
|
+
storeColor("default", color, part.point);
|
|
1768
|
+
if (refresh) {
|
|
1769
|
+
refreshColor(viewer, part.point, getAppliedOpacity(part.point));
|
|
1770
|
+
}
|
|
1586
1771
|
}
|
|
1587
1772
|
if (part.ellipse) {
|
|
1588
|
-
|
|
1589
|
-
|
|
1773
|
+
var color = (_h = colorMap.get("ellipse")) !== null && _h !== void 0 ? _h : calculateCurColor(viewer, part.ellipse);
|
|
1774
|
+
storeColor("default", color, part.ellipse);
|
|
1775
|
+
if (refresh) {
|
|
1776
|
+
refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
|
|
1777
|
+
}
|
|
1590
1778
|
}
|
|
1591
1779
|
}
|
|
1592
1780
|
}
|
|
@@ -2119,6 +2307,9 @@ var EntityUtils;
|
|
|
2119
2307
|
if (!paddingAlt) {
|
|
2120
2308
|
paddingAlt = 0;
|
|
2121
2309
|
}
|
|
2310
|
+
if (!Array.isArray(samples)) {
|
|
2311
|
+
samples = [samples];
|
|
2312
|
+
}
|
|
2122
2313
|
MAX_DISTANCE_BETWEEN_SAMPLES = 5000;
|
|
2123
2314
|
MAX_TERRAIN_SAMPLES = 25;
|
|
2124
2315
|
terrainSamples = 0;
|
|
@@ -4803,6 +4994,27 @@ function extractMetadataFromFileUrl(url) {
|
|
|
4803
4994
|
envId: envId
|
|
4804
4995
|
};
|
|
4805
4996
|
}
|
|
4997
|
+
function getSeriesPossesForHistoricEntity(viewer, heightRef, historic) {
|
|
4998
|
+
var series = [];
|
|
4999
|
+
for (var i = 0; i < historic.length; i++) {
|
|
5000
|
+
var item = historic[i];
|
|
5001
|
+
var pos3d = EntityUtils.GetPos({
|
|
5002
|
+
entity: item.data,
|
|
5003
|
+
viewer: viewer,
|
|
5004
|
+
recordHeightRef: heightRef,
|
|
5005
|
+
returnHeightRef: heightRef
|
|
5006
|
+
});
|
|
5007
|
+
var dateTime = new Date(item.dateTime);
|
|
5008
|
+
if (!dateTime || !pos3d || isNaN(pos3d.x) || isNaN(pos3d.y) || isNaN(pos3d.z)) {
|
|
5009
|
+
continue;
|
|
5010
|
+
}
|
|
5011
|
+
series.push({
|
|
5012
|
+
dateTime: dateTime,
|
|
5013
|
+
pos3d: pos3d
|
|
5014
|
+
});
|
|
5015
|
+
}
|
|
5016
|
+
return series;
|
|
5017
|
+
}
|
|
4806
5018
|
var EntityRenderEngine;
|
|
4807
5019
|
(function (EntityRenderEngine) {
|
|
4808
5020
|
function Render(params) {
|
|
@@ -4898,7 +5110,7 @@ var EntityRenderEngine;
|
|
|
4898
5110
|
}
|
|
4899
5111
|
}
|
|
4900
5112
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
4901
|
-
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
5113
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models, entitiesHistoric: params.entitiesHistoric });
|
|
4902
5114
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
4903
5115
|
case 1:
|
|
4904
5116
|
mEntities = _m.sent();
|
|
@@ -4927,6 +5139,7 @@ var EntityRenderEngine;
|
|
|
4927
5139
|
return [2 /*return*/, "continue"];
|
|
4928
5140
|
}
|
|
4929
5141
|
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
5142
|
+
pParams.entitiesHistoric = params.entitiesHistoric;
|
|
4930
5143
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
4931
5144
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
4932
5145
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: ObjectUtils.UId() }) });
|
|
@@ -5029,7 +5242,7 @@ var EntityRenderEngine;
|
|
|
5029
5242
|
_m.label = 10;
|
|
5030
5243
|
case 10:
|
|
5031
5244
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
5032
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
5245
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities, entitiesHistoric: params.entitiesHistoric });
|
|
5033
5246
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
5034
5247
|
case 11:
|
|
5035
5248
|
pEntities = _m.sent();
|
|
@@ -5098,11 +5311,14 @@ var EntityRenderEngine;
|
|
|
5098
5311
|
function Render(params) {
|
|
5099
5312
|
var _a, _b, _c, _d;
|
|
5100
5313
|
return __awaiter(this, void 0, void 0, function () {
|
|
5101
|
-
var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor,
|
|
5314
|
+
var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor, heightRef_1, animateColorIn_1, position, series, animatePosition_1, currentImgKey, series, animatePosition_2, pos3d, prevPos3d, animatePosition_3, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, heightRef_2, circleBillboard, disableDepthTest, animateColorIn_2, position, series, animatePosition_4, imgKey, currentImgKey, series, animatePosition_5, pos3d, prevPos3d, animatePosition_6;
|
|
5102
5315
|
return __generator(this, function (_e) {
|
|
5103
5316
|
switch (_e.label) {
|
|
5104
5317
|
case 0:
|
|
5105
5318
|
entity = params.entity;
|
|
5319
|
+
if (!params.entityHistoric) {
|
|
5320
|
+
params.entityHistoric = [];
|
|
5321
|
+
}
|
|
5106
5322
|
style = params.style;
|
|
5107
5323
|
type = style.Type;
|
|
5108
5324
|
if (type == null) {
|
|
@@ -5198,9 +5414,32 @@ var EntityRenderEngine;
|
|
|
5198
5414
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
5199
5415
|
if (iconScale > 0) {
|
|
5200
5416
|
bColor = style.iconTintColor ? Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
5201
|
-
|
|
5202
|
-
|
|
5417
|
+
cColor = bColor ? colorToCColor(bColor) : Color.WHITE.clone();
|
|
5418
|
+
heightRef_1 = getHeightRef(style);
|
|
5203
5419
|
if (!params.rendered || !params.rendered.billboard) {
|
|
5420
|
+
animateColorIn_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
5421
|
+
durationMs: 200,
|
|
5422
|
+
targetColor: cColor,
|
|
5423
|
+
startColor: cColor.withAlpha(0),
|
|
5424
|
+
viewer: params.viewer
|
|
5425
|
+
});
|
|
5426
|
+
position = null;
|
|
5427
|
+
series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_1, params.entityHistoric);
|
|
5428
|
+
if (series.length > 1) {
|
|
5429
|
+
animatePosition_1 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
5430
|
+
posses: series,
|
|
5431
|
+
viewer: params.viewer
|
|
5432
|
+
});
|
|
5433
|
+
position = new CallbackProperty(function () { return animatePosition_1.GetValue(); }, false);
|
|
5434
|
+
}
|
|
5435
|
+
else {
|
|
5436
|
+
position = new CallbackProperty(function () { return EntityUtils.GetPos({
|
|
5437
|
+
viewer: params.viewer,
|
|
5438
|
+
entity: entity,
|
|
5439
|
+
recordHeightRef: heightRef_1,
|
|
5440
|
+
returnHeightRef: heightRef_1
|
|
5441
|
+
}); }, true);
|
|
5442
|
+
}
|
|
5204
5443
|
cEntity = new Entity({
|
|
5205
5444
|
id: ObjectUtils.UId(10),
|
|
5206
5445
|
billboard: {
|
|
@@ -5211,18 +5450,27 @@ var EntityRenderEngine;
|
|
|
5211
5450
|
scale: iconScale,
|
|
5212
5451
|
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
5213
5452
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5214
|
-
color: new CallbackProperty(function () {
|
|
5453
|
+
color: new CallbackProperty(function () {
|
|
5454
|
+
var color = animateColorIn_1.GetColor();
|
|
5455
|
+
if (animateColorIn_1.IsDone() && (cEntity === null || cEntity === void 0 ? void 0 : cEntity.billboard)) {
|
|
5456
|
+
cEntity.billboard.color = new CallbackProperty(function () { return color; }, true);
|
|
5457
|
+
}
|
|
5458
|
+
return color;
|
|
5459
|
+
}, false),
|
|
5215
5460
|
// Would be great once we have a setting for this.
|
|
5216
5461
|
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
5217
5462
|
},
|
|
5218
|
-
position:
|
|
5219
|
-
viewer: params.viewer,
|
|
5220
|
-
entity: entity,
|
|
5221
|
-
recordHeightRef: heightRef,
|
|
5222
|
-
returnHeightRef: heightRef
|
|
5223
|
-
}),
|
|
5463
|
+
position: position,
|
|
5224
5464
|
show: true
|
|
5225
5465
|
});
|
|
5466
|
+
CesiumEntityStyler.BakeDefaultColor({
|
|
5467
|
+
entity: cEntity,
|
|
5468
|
+
colors: {
|
|
5469
|
+
"billboard": cColor
|
|
5470
|
+
},
|
|
5471
|
+
viewer: params.viewer,
|
|
5472
|
+
refresh: false
|
|
5473
|
+
});
|
|
5226
5474
|
}
|
|
5227
5475
|
else {
|
|
5228
5476
|
prepareExistingGraphic(params.rendered);
|
|
@@ -5235,15 +5483,35 @@ var EntityRenderEngine;
|
|
|
5235
5483
|
cEntity.billboard.heightReference = new ConstantProperty(getHeightRef(style));
|
|
5236
5484
|
cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5237
5485
|
cEntity.billboard.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5486
|
+
series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_1, params.entityHistoric);
|
|
5487
|
+
if (series.length > 1) {
|
|
5488
|
+
animatePosition_2 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
5489
|
+
posses: series,
|
|
5490
|
+
viewer: params.viewer
|
|
5491
|
+
});
|
|
5492
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_2.GetValue(); }, false);
|
|
5493
|
+
}
|
|
5494
|
+
else {
|
|
5495
|
+
pos3d = EntityUtils.GetPos({
|
|
5496
|
+
viewer: params.viewer,
|
|
5497
|
+
entity: entity,
|
|
5498
|
+
recordHeightRef: heightRef_1,
|
|
5499
|
+
returnHeightRef: heightRef_1
|
|
5500
|
+
});
|
|
5501
|
+
prevPos3d = getValue$1(params.viewer, cEntity.position);
|
|
5502
|
+
if (!prevPos3d || !Cartesian3.equals(prevPos3d, pos3d)) {
|
|
5503
|
+
animatePosition_3 = new CesiumAnimatedProperty.AnimatePosition({
|
|
5504
|
+
durationMs: 200,
|
|
5505
|
+
targetPos3d: pos3d,
|
|
5506
|
+
viewer: params.viewer,
|
|
5507
|
+
startPos3d: prevPos3d
|
|
5508
|
+
});
|
|
5509
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_3.GetValue(); }, false);
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5244
5512
|
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5245
5513
|
CesiumEntityStyler.SetDefaultColor({
|
|
5246
|
-
color:
|
|
5514
|
+
color: cColor ? cColor : new Color(),
|
|
5247
5515
|
entity: cEntity,
|
|
5248
5516
|
viewer: params.viewer,
|
|
5249
5517
|
override: true,
|
|
@@ -5384,10 +5652,33 @@ var EntityRenderEngine;
|
|
|
5384
5652
|
if (size <= 0) {
|
|
5385
5653
|
return [2 /*return*/, null];
|
|
5386
5654
|
}
|
|
5387
|
-
|
|
5655
|
+
heightRef_2 = getHeightRef(style);
|
|
5388
5656
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
5389
5657
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
5390
5658
|
if (!params.rendered || !params.rendered.billboard) {
|
|
5659
|
+
animateColorIn_2 = new CesiumAnimatedProperty.AnimateColor({
|
|
5660
|
+
durationMs: 200,
|
|
5661
|
+
targetColor: cColor,
|
|
5662
|
+
startColor: cColor.withAlpha(0),
|
|
5663
|
+
viewer: params.viewer
|
|
5664
|
+
});
|
|
5665
|
+
position = null;
|
|
5666
|
+
series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_2, params.entityHistoric);
|
|
5667
|
+
if (series.length > 1) {
|
|
5668
|
+
animatePosition_4 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
5669
|
+
posses: series,
|
|
5670
|
+
viewer: params.viewer
|
|
5671
|
+
});
|
|
5672
|
+
position = new CallbackProperty(function () { return animatePosition_4.GetValue(); }, false);
|
|
5673
|
+
}
|
|
5674
|
+
else {
|
|
5675
|
+
position = new CallbackProperty(function () { return EntityUtils.GetPos({
|
|
5676
|
+
viewer: params.viewer,
|
|
5677
|
+
entity: entity,
|
|
5678
|
+
recordHeightRef: heightRef_2,
|
|
5679
|
+
returnHeightRef: heightRef_2
|
|
5680
|
+
}); }, true);
|
|
5681
|
+
}
|
|
5391
5682
|
cEntity = new Entity({
|
|
5392
5683
|
id: ObjectUtils.UId(10),
|
|
5393
5684
|
// point: {
|
|
@@ -5403,19 +5694,28 @@ var EntityRenderEngine;
|
|
|
5403
5694
|
height: circleBillboard.height,
|
|
5404
5695
|
width: circleBillboard.width,
|
|
5405
5696
|
image: circleBillboard.canvasDataUri,
|
|
5406
|
-
color: new CallbackProperty(function () {
|
|
5407
|
-
|
|
5697
|
+
color: new CallbackProperty(function () {
|
|
5698
|
+
var color = animateColorIn_2.GetColor();
|
|
5699
|
+
if (animateColorIn_2.IsDone() && (cEntity === null || cEntity === void 0 ? void 0 : cEntity.billboard)) {
|
|
5700
|
+
cEntity.billboard.color = new CallbackProperty(function () { return color; }, true);
|
|
5701
|
+
}
|
|
5702
|
+
return color;
|
|
5703
|
+
}, false),
|
|
5704
|
+
heightReference: heightRef_2,
|
|
5408
5705
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5409
5706
|
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
|
|
5410
5707
|
},
|
|
5411
|
-
position:
|
|
5412
|
-
viewer: params.viewer,
|
|
5413
|
-
entity: entity,
|
|
5414
|
-
recordHeightRef: heightRef,
|
|
5415
|
-
returnHeightRef: heightRef
|
|
5416
|
-
}),
|
|
5708
|
+
position: position,
|
|
5417
5709
|
show: true
|
|
5418
5710
|
});
|
|
5711
|
+
CesiumEntityStyler.BakeDefaultColor({
|
|
5712
|
+
entity: cEntity,
|
|
5713
|
+
viewer: params.viewer,
|
|
5714
|
+
colors: {
|
|
5715
|
+
"billboard": cColor
|
|
5716
|
+
},
|
|
5717
|
+
refresh: false
|
|
5718
|
+
});
|
|
5419
5719
|
}
|
|
5420
5720
|
else {
|
|
5421
5721
|
prepareExistingGraphic(params.rendered);
|
|
@@ -5427,15 +5727,35 @@ var EntityRenderEngine;
|
|
|
5427
5727
|
}
|
|
5428
5728
|
cEntity.billboard.height = new ConstantProperty(circleBillboard.height);
|
|
5429
5729
|
cEntity.billboard.width = new ConstantProperty(circleBillboard.width);
|
|
5430
|
-
cEntity.billboard.heightReference = new ConstantProperty(
|
|
5730
|
+
cEntity.billboard.heightReference = new ConstantProperty(heightRef_2);
|
|
5431
5731
|
cEntity.billboard.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5432
5732
|
cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5733
|
+
series = getSeriesPossesForHistoricEntity(params.viewer, heightRef_2, params.entityHistoric);
|
|
5734
|
+
if (series.length > 1) {
|
|
5735
|
+
animatePosition_5 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
5736
|
+
posses: series,
|
|
5737
|
+
viewer: params.viewer
|
|
5738
|
+
});
|
|
5739
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_5.GetValue(); }, false);
|
|
5740
|
+
}
|
|
5741
|
+
else {
|
|
5742
|
+
pos3d = EntityUtils.GetPos({
|
|
5743
|
+
viewer: params.viewer,
|
|
5744
|
+
entity: entity,
|
|
5745
|
+
recordHeightRef: heightRef_2,
|
|
5746
|
+
returnHeightRef: heightRef_2
|
|
5747
|
+
});
|
|
5748
|
+
prevPos3d = getValue$1(params.viewer, cEntity.position);
|
|
5749
|
+
if (!prevPos3d || !Cartesian3.equals(prevPos3d, pos3d)) {
|
|
5750
|
+
animatePosition_6 = new CesiumAnimatedProperty.AnimatePosition({
|
|
5751
|
+
durationMs: 200,
|
|
5752
|
+
targetPos3d: pos3d,
|
|
5753
|
+
viewer: params.viewer,
|
|
5754
|
+
startPos3d: prevPos3d
|
|
5755
|
+
});
|
|
5756
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_6.GetValue(); }, false);
|
|
5757
|
+
}
|
|
5758
|
+
}
|
|
5439
5759
|
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5440
5760
|
CesiumEntityStyler.SetDefaultColor({
|
|
5441
5761
|
color: cColor,
|
|
@@ -5459,16 +5779,16 @@ var EntityRenderEngine;
|
|
|
5459
5779
|
}
|
|
5460
5780
|
Point.Render = Render;
|
|
5461
5781
|
function RenderGroup(params) {
|
|
5462
|
-
var _a, _b, _c, _d;
|
|
5782
|
+
var _a, _b, _c, _d, _e;
|
|
5463
5783
|
return __awaiter(this, void 0, void 0, function () {
|
|
5464
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5465
|
-
return __generator(this, function (
|
|
5466
|
-
switch (
|
|
5784
|
+
var api, cEntities, i, entity, zoomItem, style, _f, tagIds, tags, pStyle, cEntity, name_2;
|
|
5785
|
+
return __generator(this, function (_g) {
|
|
5786
|
+
switch (_g.label) {
|
|
5467
5787
|
case 0:
|
|
5468
5788
|
api = params.apiGetter.getApi();
|
|
5469
5789
|
cEntities = new Map();
|
|
5470
5790
|
i = 0;
|
|
5471
|
-
|
|
5791
|
+
_g.label = 1;
|
|
5472
5792
|
case 1:
|
|
5473
5793
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
5474
5794
|
entity = params.entities[i];
|
|
@@ -5476,13 +5796,13 @@ var EntityRenderEngine;
|
|
|
5476
5796
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5477
5797
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5478
5798
|
case 2:
|
|
5479
|
-
|
|
5799
|
+
_f = (_a = (_g.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5480
5800
|
return [3 /*break*/, 4];
|
|
5481
5801
|
case 3:
|
|
5482
|
-
|
|
5483
|
-
|
|
5802
|
+
_f = zoomItem.Style;
|
|
5803
|
+
_g.label = 4;
|
|
5484
5804
|
case 4:
|
|
5485
|
-
style =
|
|
5805
|
+
style = _f;
|
|
5486
5806
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5487
5807
|
tags = [];
|
|
5488
5808
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5491,8 +5811,8 @@ var EntityRenderEngine;
|
|
|
5491
5811
|
tagIds: tagIds
|
|
5492
5812
|
})];
|
|
5493
5813
|
case 5:
|
|
5494
|
-
tags = (
|
|
5495
|
-
|
|
5814
|
+
tags = (_g.sent()).tags;
|
|
5815
|
+
_g.label = 6;
|
|
5496
5816
|
case 6:
|
|
5497
5817
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
5498
5818
|
return [4 /*yield*/, Render({
|
|
@@ -5504,20 +5824,21 @@ var EntityRenderEngine;
|
|
|
5504
5824
|
apiGetter: params.apiGetter,
|
|
5505
5825
|
maxDistance: zoomItem.MaxZoom,
|
|
5506
5826
|
minDistance: zoomItem.MinZoom,
|
|
5507
|
-
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID)
|
|
5827
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c.get(entity.Bruce.ID),
|
|
5828
|
+
entityHistoric: (_d = params.entitiesHistoric) === null || _d === void 0 ? void 0 : _d[entity.Bruce.ID]
|
|
5508
5829
|
})];
|
|
5509
5830
|
case 7:
|
|
5510
|
-
cEntity =
|
|
5831
|
+
cEntity = _g.sent();
|
|
5511
5832
|
if (!cEntity) return [3 /*break*/, 9];
|
|
5512
5833
|
return [4 /*yield*/, getName(api, entity)];
|
|
5513
5834
|
case 8:
|
|
5514
|
-
name_2 =
|
|
5835
|
+
name_2 = _g.sent();
|
|
5515
5836
|
cEntity.name = name_2;
|
|
5516
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
5517
|
-
|
|
5837
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_e = params.viewer) === null || _e === void 0 ? void 0 : _e.terrainProvider);
|
|
5838
|
+
_g.label = 9;
|
|
5518
5839
|
case 9:
|
|
5519
5840
|
cEntities.set(entity.Bruce.ID, cEntity);
|
|
5520
|
-
|
|
5841
|
+
_g.label = 10;
|
|
5521
5842
|
case 10:
|
|
5522
5843
|
i++;
|
|
5523
5844
|
return [3 /*break*/, 1];
|
|
@@ -6088,6 +6409,9 @@ var EntityRenderEngine;
|
|
|
6088
6409
|
function Render(params) {
|
|
6089
6410
|
var _this = this;
|
|
6090
6411
|
var entity = params.entity;
|
|
6412
|
+
if (!params.entityHistoric) {
|
|
6413
|
+
params.entityHistoric = [];
|
|
6414
|
+
}
|
|
6091
6415
|
var transform = entity === null || entity === void 0 ? void 0 : entity.transform;
|
|
6092
6416
|
var heading = EnsureNumber(transform === null || transform === void 0 ? void 0 : transform.heading);
|
|
6093
6417
|
heading = (heading + 90) % 360;
|
|
@@ -6103,20 +6427,18 @@ var EntityRenderEngine;
|
|
|
6103
6427
|
if (styleScale <= 0) {
|
|
6104
6428
|
styleScale = 1;
|
|
6105
6429
|
}
|
|
6106
|
-
var hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
|
|
6107
6430
|
var heightRef = getHeightRef(style, HeightReference.RELATIVE_TO_GROUND);
|
|
6108
|
-
var
|
|
6431
|
+
var pos3d = EntityUtils.GetPos({
|
|
6109
6432
|
viewer: params.viewer,
|
|
6110
6433
|
entity: entity,
|
|
6111
6434
|
recordHeightRef: heightRef,
|
|
6112
6435
|
returnHeightRef: heightRef
|
|
6113
6436
|
});
|
|
6114
6437
|
if (heightRef == HeightReference.CLAMP_TO_GROUND) {
|
|
6115
|
-
var carto = Cartographic.fromCartesian(
|
|
6116
|
-
|
|
6438
|
+
var carto = Cartographic.fromCartesian(pos3d);
|
|
6439
|
+
pos3d = Cartesian3.fromRadians(EnsureNumber(carto.longitude), EnsureNumber(carto.latitude), 0);
|
|
6117
6440
|
heightRef = HeightReference.RELATIVE_TO_GROUND;
|
|
6118
6441
|
}
|
|
6119
|
-
var orientation = Transforms.headingPitchRollQuaternion(pos, hpr);
|
|
6120
6442
|
var blendMode = null;
|
|
6121
6443
|
var blendAmount = null;
|
|
6122
6444
|
var color = null;
|
|
@@ -6136,27 +6458,38 @@ var EntityRenderEngine;
|
|
|
6136
6458
|
color = colorToCColor(bColor);
|
|
6137
6459
|
}
|
|
6138
6460
|
}
|
|
6139
|
-
/*
|
|
6140
|
-
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
6141
|
-
id: ObjectUtils.UId(10),
|
|
6142
|
-
model: {
|
|
6143
|
-
uri: params.lodUrl,
|
|
6144
|
-
heightReference: heightRef,
|
|
6145
|
-
scale: scale * styleScale,
|
|
6146
|
-
shadows: Cesium.ShadowMode.ENABLED,
|
|
6147
|
-
colorBlendAmount: blendAmount,
|
|
6148
|
-
colorBlendMode: blendMode,
|
|
6149
|
-
color: new Cesium.CallbackProperty(() => color, true),
|
|
6150
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
6151
|
-
},
|
|
6152
|
-
orientation: new Cesium.ConstantProperty(orientation),
|
|
6153
|
-
position: pos,
|
|
6154
|
-
show: true
|
|
6155
|
-
});
|
|
6156
|
-
*/
|
|
6157
6461
|
var animateScale = null;
|
|
6158
6462
|
var cEntity = params.rendered;
|
|
6159
6463
|
if (!cEntity || !cEntity.model) {
|
|
6464
|
+
var hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
|
|
6465
|
+
var orientation_1 = Transforms.headingPitchRollQuaternion(pos3d, hpr);
|
|
6466
|
+
if (!color) {
|
|
6467
|
+
color = Color.WHITE.clone();
|
|
6468
|
+
}
|
|
6469
|
+
var animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
6470
|
+
durationMs: 1500,
|
|
6471
|
+
targetColor: color,
|
|
6472
|
+
startColor: color.clone().withAlpha(0.001),
|
|
6473
|
+
viewer: params.viewer
|
|
6474
|
+
});
|
|
6475
|
+
var position = null;
|
|
6476
|
+
// If we have a series of time-based positions then we'll animate as time changes.
|
|
6477
|
+
var series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
6478
|
+
if (series.length > 1) {
|
|
6479
|
+
var animatePosition_7 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
6480
|
+
posses: series,
|
|
6481
|
+
viewer: params.viewer
|
|
6482
|
+
});
|
|
6483
|
+
position = new CallbackProperty(function () { return animatePosition_7.GetValue(); }, false);
|
|
6484
|
+
}
|
|
6485
|
+
else {
|
|
6486
|
+
position = new CallbackProperty(function () { return EntityUtils.GetPos({
|
|
6487
|
+
viewer: params.viewer,
|
|
6488
|
+
entity: entity,
|
|
6489
|
+
recordHeightRef: heightRef,
|
|
6490
|
+
returnHeightRef: heightRef
|
|
6491
|
+
}); }, true);
|
|
6492
|
+
}
|
|
6160
6493
|
cEntity = new Entity({
|
|
6161
6494
|
id: ObjectUtils.UId(10),
|
|
6162
6495
|
model: {
|
|
@@ -6166,17 +6499,27 @@ var EntityRenderEngine;
|
|
|
6166
6499
|
shadows: ShadowMode.ENABLED,
|
|
6167
6500
|
colorBlendAmount: blendAmount,
|
|
6168
6501
|
colorBlendMode: blendMode,
|
|
6169
|
-
color: new CallbackProperty(function () {
|
|
6502
|
+
color: new CallbackProperty(function () {
|
|
6503
|
+
var color = animateColor_1.GetColor();
|
|
6504
|
+
if (animateColor_1.IsDone() && (cEntity === null || cEntity === void 0 ? void 0 : cEntity.model)) {
|
|
6505
|
+
cEntity.model.color = new CallbackProperty(function () { return color; }, true);
|
|
6506
|
+
}
|
|
6507
|
+
return color;
|
|
6508
|
+
}, false),
|
|
6170
6509
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
6171
6510
|
},
|
|
6172
|
-
orientation: new
|
|
6173
|
-
position:
|
|
6511
|
+
orientation: new CallbackProperty(function () { return orientation_1; }, true),
|
|
6512
|
+
position: position,
|
|
6174
6513
|
show: true
|
|
6175
6514
|
});
|
|
6176
6515
|
CesiumEntityStyler.BakeDefaultColor({
|
|
6177
6516
|
entity: cEntity,
|
|
6178
6517
|
viewer: params.viewer,
|
|
6179
|
-
override: true
|
|
6518
|
+
override: true,
|
|
6519
|
+
colors: {
|
|
6520
|
+
"model": color
|
|
6521
|
+
},
|
|
6522
|
+
refresh: false
|
|
6180
6523
|
});
|
|
6181
6524
|
}
|
|
6182
6525
|
else {
|
|
@@ -6206,14 +6549,61 @@ var EntityRenderEngine;
|
|
|
6206
6549
|
cEntity.model.colorBlendAmount = new ConstantProperty(blendAmount);
|
|
6207
6550
|
cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
|
|
6208
6551
|
cEntity.model.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
6209
|
-
|
|
6210
|
-
|
|
6552
|
+
// If we have a series of time-based positions then we'll animate as time changes.
|
|
6553
|
+
var series = getSeriesPossesForHistoricEntity(params.viewer, heightRef, params.entityHistoric);
|
|
6554
|
+
if (series.length > 1) {
|
|
6555
|
+
var animatePosition_8 = new CesiumAnimatedProperty.AnimatePositionSeries({
|
|
6556
|
+
posses: series,
|
|
6557
|
+
viewer: params.viewer
|
|
6558
|
+
});
|
|
6559
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_8.GetValue(); }, false);
|
|
6560
|
+
}
|
|
6561
|
+
else {
|
|
6562
|
+
var prevPos3d = getValue$1(params.viewer, cEntity.position);
|
|
6563
|
+
var posChanged = !prevPos3d || !Cartesian3.equals(prevPos3d, pos3d);
|
|
6564
|
+
var animatePosition_9 = null;
|
|
6565
|
+
if (posChanged) {
|
|
6566
|
+
animatePosition_9 = new CesiumAnimatedProperty.AnimatePosition({
|
|
6567
|
+
durationMs: 200,
|
|
6568
|
+
targetPos3d: pos3d,
|
|
6569
|
+
viewer: params.viewer,
|
|
6570
|
+
startPos3d: prevPos3d
|
|
6571
|
+
});
|
|
6572
|
+
cEntity.position = new CallbackProperty(function () { return animatePosition_9.GetValue(); }, false);
|
|
6573
|
+
}
|
|
6574
|
+
}
|
|
6575
|
+
// cEntity.orientation = new Cesium.ConstantProperty(orientation);
|
|
6576
|
+
var prevHeading = cEntity.model._heading;
|
|
6577
|
+
if (prevHeading == null || prevHeading == heading || isNaN(prevHeading)) {
|
|
6578
|
+
var hpr = new HeadingPitchRoll(Math$1.toRadians(heading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
|
|
6579
|
+
var orient_1 = Transforms.headingPitchRollQuaternion(pos3d, hpr);
|
|
6580
|
+
cEntity.orientation = new CallbackProperty(function () { return orient_1; }, true);
|
|
6581
|
+
}
|
|
6582
|
+
// Animate orientation. We'll calculate the heading based on movement.
|
|
6583
|
+
else {
|
|
6584
|
+
var animateHeading_1 = new CesiumAnimatedProperty.AnimateHeading({
|
|
6585
|
+
durationMs: 200,
|
|
6586
|
+
targetHeading: heading,
|
|
6587
|
+
viewer: params.viewer,
|
|
6588
|
+
startHeading: prevHeading
|
|
6589
|
+
});
|
|
6590
|
+
cEntity.orientation = new CallbackProperty(function () {
|
|
6591
|
+
var calcHeading = animateHeading_1.GetValue();
|
|
6592
|
+
var hpr = new HeadingPitchRoll(Math$1.toRadians(calcHeading), Math$1.toRadians(pitch), Math$1.toRadians(roll));
|
|
6593
|
+
var orient = Transforms.headingPitchRollQuaternion(pos3d, hpr);
|
|
6594
|
+
// We'll stop the costly animation if it's done.
|
|
6595
|
+
if (animateHeading_1.IsDone()) {
|
|
6596
|
+
cEntity.orientation = new ConstantProperty(orient);
|
|
6597
|
+
}
|
|
6598
|
+
return orient;
|
|
6599
|
+
}, false);
|
|
6600
|
+
}
|
|
6211
6601
|
// Same file but different scale. We'll animate the scale.
|
|
6212
6602
|
var prevClientFileId = cEntity.model._clientFileId;
|
|
6213
6603
|
if (prevClientFileId == params.lodClientFileId) {
|
|
6214
6604
|
animateScale = new CesiumAnimatedProperty.AnimateNumber({
|
|
6215
6605
|
durationMs: 200,
|
|
6216
|
-
|
|
6606
|
+
targetValue: scale * styleScale,
|
|
6217
6607
|
viewer: params.viewer,
|
|
6218
6608
|
startValue: cEntity.model.scale,
|
|
6219
6609
|
startPaused: true
|
|
@@ -6324,20 +6714,21 @@ var EntityRenderEngine;
|
|
|
6324
6714
|
record: scale,
|
|
6325
6715
|
style: styleScale
|
|
6326
6716
|
};
|
|
6717
|
+
model._heading = heading;
|
|
6327
6718
|
return cEntity;
|
|
6328
6719
|
}
|
|
6329
6720
|
Model3d.Render = Render;
|
|
6330
6721
|
function RenderGroup(params) {
|
|
6331
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6722
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6332
6723
|
return __awaiter(this, void 0, void 0, function () {
|
|
6333
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
6334
|
-
return __generator(this, function (
|
|
6335
|
-
switch (
|
|
6724
|
+
var api, cEntities, reqBody, i, entity, zoomItem, style, _h, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
6725
|
+
return __generator(this, function (_j) {
|
|
6726
|
+
switch (_j.label) {
|
|
6336
6727
|
case 0:
|
|
6337
6728
|
api = params.apiGetter.getApi();
|
|
6338
6729
|
return [4 /*yield*/, api.Loading];
|
|
6339
6730
|
case 1:
|
|
6340
|
-
|
|
6731
|
+
_j.sent();
|
|
6341
6732
|
cEntities = new Map();
|
|
6342
6733
|
reqBody = {
|
|
6343
6734
|
"strict": false,
|
|
@@ -6345,7 +6736,7 @@ var EntityRenderEngine;
|
|
|
6345
6736
|
"Items": []
|
|
6346
6737
|
};
|
|
6347
6738
|
i = 0;
|
|
6348
|
-
|
|
6739
|
+
_j.label = 2;
|
|
6349
6740
|
case 2:
|
|
6350
6741
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
6351
6742
|
entity = params.entities[i];
|
|
@@ -6353,13 +6744,13 @@ var EntityRenderEngine;
|
|
|
6353
6744
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
6354
6745
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
6355
6746
|
case 3:
|
|
6356
|
-
|
|
6747
|
+
_h = (_a = (_j.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
6357
6748
|
return [3 /*break*/, 5];
|
|
6358
6749
|
case 4:
|
|
6359
|
-
|
|
6360
|
-
|
|
6750
|
+
_h = zoomItem.Style;
|
|
6751
|
+
_j.label = 5;
|
|
6361
6752
|
case 5:
|
|
6362
|
-
style =
|
|
6753
|
+
style = _h;
|
|
6363
6754
|
tagIds = entity.Bruce["Layer.ID"];
|
|
6364
6755
|
tags = [];
|
|
6365
6756
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -6368,8 +6759,8 @@ var EntityRenderEngine;
|
|
|
6368
6759
|
tagIds: tagIds
|
|
6369
6760
|
})];
|
|
6370
6761
|
case 6:
|
|
6371
|
-
tags = (
|
|
6372
|
-
|
|
6762
|
+
tags = (_j.sent()).tags;
|
|
6763
|
+
_j.label = 7;
|
|
6373
6764
|
case 7:
|
|
6374
6765
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
6375
6766
|
group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -6390,7 +6781,7 @@ var EntityRenderEngine;
|
|
|
6390
6781
|
"group": group,
|
|
6391
6782
|
"level": level
|
|
6392
6783
|
});
|
|
6393
|
-
|
|
6784
|
+
_j.label = 8;
|
|
6394
6785
|
case 8:
|
|
6395
6786
|
i++;
|
|
6396
6787
|
return [3 /*break*/, 2];
|
|
@@ -6399,24 +6790,24 @@ var EntityRenderEngine;
|
|
|
6399
6790
|
filter: reqBody
|
|
6400
6791
|
})];
|
|
6401
6792
|
case 10:
|
|
6402
|
-
lodData = (
|
|
6793
|
+
lodData = (_j.sent()).lods;
|
|
6403
6794
|
_loop_2 = function (i) {
|
|
6404
|
-
var entity, zoomItem, style,
|
|
6405
|
-
return __generator(this, function (
|
|
6406
|
-
switch (
|
|
6795
|
+
var entity, zoomItem, style, _k, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
6796
|
+
return __generator(this, function (_l) {
|
|
6797
|
+
switch (_l.label) {
|
|
6407
6798
|
case 0:
|
|
6408
6799
|
entity = params.entities[i];
|
|
6409
6800
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
6410
6801
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
6411
6802
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
6412
6803
|
case 1:
|
|
6413
|
-
|
|
6804
|
+
_k = (_c = (_l.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
6414
6805
|
return [3 /*break*/, 3];
|
|
6415
6806
|
case 2:
|
|
6416
|
-
|
|
6417
|
-
|
|
6807
|
+
_k = zoomItem.Style;
|
|
6808
|
+
_l.label = 3;
|
|
6418
6809
|
case 3:
|
|
6419
|
-
style =
|
|
6810
|
+
style = _k;
|
|
6420
6811
|
tagIds = entity.Bruce["Layer.ID"];
|
|
6421
6812
|
tags = [];
|
|
6422
6813
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -6425,8 +6816,8 @@ var EntityRenderEngine;
|
|
|
6425
6816
|
tagIds: tagIds
|
|
6426
6817
|
})];
|
|
6427
6818
|
case 4:
|
|
6428
|
-
tags = (
|
|
6429
|
-
|
|
6819
|
+
tags = (_l.sent()).tags;
|
|
6820
|
+
_l.label = 5;
|
|
6430
6821
|
case 5:
|
|
6431
6822
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
6432
6823
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -6436,6 +6827,7 @@ var EntityRenderEngine;
|
|
|
6436
6827
|
cEntity = Render({
|
|
6437
6828
|
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e.get(entity.Bruce.ID),
|
|
6438
6829
|
entity: entity,
|
|
6830
|
+
entityHistoric: (_f = params.entitiesHistoric) === null || _f === void 0 ? void 0 : _f[entity.Bruce.ID],
|
|
6439
6831
|
style: mStyle,
|
|
6440
6832
|
tags: tags,
|
|
6441
6833
|
viewer: params.viewer,
|
|
@@ -6451,23 +6843,23 @@ var EntityRenderEngine;
|
|
|
6451
6843
|
if (!cEntity) return [3 /*break*/, 7];
|
|
6452
6844
|
return [4 /*yield*/, getName(api, entity)];
|
|
6453
6845
|
case 6:
|
|
6454
|
-
name_5 =
|
|
6846
|
+
name_5 = _l.sent();
|
|
6455
6847
|
cEntity.name = name_5;
|
|
6456
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6848
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_g = params.viewer) === null || _g === void 0 ? void 0 : _g.terrainProvider);
|
|
6457
6849
|
cEntities.set(entity.Bruce.ID, cEntity);
|
|
6458
|
-
|
|
6850
|
+
_l.label = 7;
|
|
6459
6851
|
case 7: return [2 /*return*/];
|
|
6460
6852
|
}
|
|
6461
6853
|
});
|
|
6462
6854
|
};
|
|
6463
6855
|
i = 0;
|
|
6464
|
-
|
|
6856
|
+
_j.label = 11;
|
|
6465
6857
|
case 11:
|
|
6466
6858
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
6467
6859
|
return [5 /*yield**/, _loop_2(i)];
|
|
6468
6860
|
case 12:
|
|
6469
|
-
|
|
6470
|
-
|
|
6861
|
+
_j.sent();
|
|
6862
|
+
_j.label = 13;
|
|
6471
6863
|
case 13:
|
|
6472
6864
|
i++;
|
|
6473
6865
|
return [3 /*break*/, 11];
|
|
@@ -7694,6 +8086,165 @@ var EntityLabel;
|
|
|
7694
8086
|
EntityLabel.GetLabel = GetLabel;
|
|
7695
8087
|
})(EntityLabel || (EntityLabel = {}));
|
|
7696
8088
|
|
|
8089
|
+
function getColor$2(viewer, obj) {
|
|
8090
|
+
var value = null;
|
|
8091
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
8092
|
+
var date = viewer.scene.lastRenderTime;
|
|
8093
|
+
if (!date) {
|
|
8094
|
+
date = viewer.clock.currentTime;
|
|
8095
|
+
}
|
|
8096
|
+
value = obj.getValue(date);
|
|
8097
|
+
}
|
|
8098
|
+
else {
|
|
8099
|
+
value = obj;
|
|
8100
|
+
}
|
|
8101
|
+
if (value && value instanceof ColorMaterialProperty) {
|
|
8102
|
+
value = value.color;
|
|
8103
|
+
}
|
|
8104
|
+
return value;
|
|
8105
|
+
}
|
|
8106
|
+
var CesiumAnimatedInOut;
|
|
8107
|
+
(function (CesiumAnimatedInOut) {
|
|
8108
|
+
/**
|
|
8109
|
+
* Animates an Entity out of the scene.
|
|
8110
|
+
* Removes it from the scene at the end of the animation.
|
|
8111
|
+
* @param params
|
|
8112
|
+
*/
|
|
8113
|
+
function AnimateOut(params) {
|
|
8114
|
+
var viewer = params.viewer, entity = params.entity;
|
|
8115
|
+
if (entity instanceof Entity) {
|
|
8116
|
+
var pieces = EntityUtils.GatherEntity({
|
|
8117
|
+
entity: entity,
|
|
8118
|
+
});
|
|
8119
|
+
var leaderSet = false;
|
|
8120
|
+
var removed_1 = false;
|
|
8121
|
+
var doRemove_1 = function () {
|
|
8122
|
+
if (removed_1) {
|
|
8123
|
+
return;
|
|
8124
|
+
}
|
|
8125
|
+
removed_1 = true;
|
|
8126
|
+
var removal = viewer.scene.postRender.addEventListener(function () {
|
|
8127
|
+
removal();
|
|
8128
|
+
EntityRenderEngine.Remove({
|
|
8129
|
+
viewer: viewer,
|
|
8130
|
+
entity: entity
|
|
8131
|
+
});
|
|
8132
|
+
});
|
|
8133
|
+
};
|
|
8134
|
+
var _loop_1 = function (i) {
|
|
8135
|
+
var piece = pieces[i];
|
|
8136
|
+
if (piece instanceof Entity) {
|
|
8137
|
+
var animateColor_1;
|
|
8138
|
+
var thing_1;
|
|
8139
|
+
var colorPropKey_1;
|
|
8140
|
+
if (piece.model) {
|
|
8141
|
+
var curColor = getColor$2(viewer, piece.model.color);
|
|
8142
|
+
if (!curColor) {
|
|
8143
|
+
curColor = Color.WHITE.clone();
|
|
8144
|
+
}
|
|
8145
|
+
animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
8146
|
+
durationMs: 500,
|
|
8147
|
+
targetColor: curColor.withAlpha(0.01),
|
|
8148
|
+
startColor: curColor,
|
|
8149
|
+
viewer: viewer
|
|
8150
|
+
});
|
|
8151
|
+
thing_1 = piece.model;
|
|
8152
|
+
colorPropKey_1 = "color";
|
|
8153
|
+
}
|
|
8154
|
+
else if (piece.point) {
|
|
8155
|
+
var curColor = getColor$2(viewer, piece.point.color);
|
|
8156
|
+
if (!curColor) {
|
|
8157
|
+
curColor = Color.WHITE.clone();
|
|
8158
|
+
}
|
|
8159
|
+
animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
8160
|
+
durationMs: 500,
|
|
8161
|
+
targetColor: curColor.withAlpha(0.01),
|
|
8162
|
+
startColor: curColor,
|
|
8163
|
+
viewer: viewer
|
|
8164
|
+
});
|
|
8165
|
+
thing_1 = piece.point;
|
|
8166
|
+
colorPropKey_1 = "color";
|
|
8167
|
+
}
|
|
8168
|
+
else if (piece.billboard) {
|
|
8169
|
+
var curColor = getColor$2(viewer, piece.billboard.color);
|
|
8170
|
+
if (!curColor) {
|
|
8171
|
+
curColor = Color.WHITE.clone();
|
|
8172
|
+
}
|
|
8173
|
+
animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
8174
|
+
durationMs: 200,
|
|
8175
|
+
targetColor: curColor.withAlpha(0.0),
|
|
8176
|
+
startColor: curColor,
|
|
8177
|
+
viewer: viewer
|
|
8178
|
+
});
|
|
8179
|
+
thing_1 = piece.billboard;
|
|
8180
|
+
colorPropKey_1 = "color";
|
|
8181
|
+
}
|
|
8182
|
+
// Other graphic types don't support colour animation.
|
|
8183
|
+
if (thing_1 && colorPropKey_1 && animateColor_1) {
|
|
8184
|
+
var isLeader_1 = !leaderSet;
|
|
8185
|
+
leaderSet = true;
|
|
8186
|
+
var callback = function () {
|
|
8187
|
+
var color = animateColor_1.GetColor();
|
|
8188
|
+
if (isLeader_1 && animateColor_1.IsDone()) {
|
|
8189
|
+
doRemove_1();
|
|
8190
|
+
thing_1[colorPropKey_1] = new ConstantProperty(color);
|
|
8191
|
+
}
|
|
8192
|
+
return color;
|
|
8193
|
+
};
|
|
8194
|
+
if (thing_1[colorPropKey_1] instanceof CallbackProperty) {
|
|
8195
|
+
thing_1[colorPropKey_1].setCallback(callback, false);
|
|
8196
|
+
}
|
|
8197
|
+
else {
|
|
8198
|
+
thing_1[colorPropKey_1] = new CallbackProperty(callback, false);
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
}
|
|
8202
|
+
};
|
|
8203
|
+
for (var i = 0; i < pieces.length; i++) {
|
|
8204
|
+
_loop_1(i);
|
|
8205
|
+
}
|
|
8206
|
+
// Nothing animated, so just remove the entity.
|
|
8207
|
+
if (!leaderSet) {
|
|
8208
|
+
EntityRenderEngine.Remove({
|
|
8209
|
+
viewer: viewer,
|
|
8210
|
+
entity: entity
|
|
8211
|
+
});
|
|
8212
|
+
}
|
|
8213
|
+
}
|
|
8214
|
+
else if (entity instanceof Primitive) {
|
|
8215
|
+
if (viewer.scene.primitives.contains(entity)) {
|
|
8216
|
+
viewer.scene.primitives.remove(entity);
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
8219
|
+
else if (entity instanceof Cesium3DTileFeature) {
|
|
8220
|
+
try {
|
|
8221
|
+
CesiumAnimatedProperty.AnimateTFeatureColor({
|
|
8222
|
+
durationMs: 500,
|
|
8223
|
+
feature: entity,
|
|
8224
|
+
targetColor: Color.WHITE.withAlpha(0.0),
|
|
8225
|
+
startColor: entity.color ? entity.color : Color.WHITE.clone(),
|
|
8226
|
+
viewer: viewer,
|
|
8227
|
+
onDone: function () {
|
|
8228
|
+
var tileset = entity === null || entity === void 0 ? void 0 : entity.tileset;
|
|
8229
|
+
if (tileset && viewer.scene.primitives.contains(tileset)) {
|
|
8230
|
+
entity.show = false;
|
|
8231
|
+
}
|
|
8232
|
+
}
|
|
8233
|
+
});
|
|
8234
|
+
}
|
|
8235
|
+
catch (e) {
|
|
8236
|
+
console.error(e);
|
|
8237
|
+
// If an error occurs, just hide the feature.
|
|
8238
|
+
var tileset = entity === null || entity === void 0 ? void 0 : entity.tileset;
|
|
8239
|
+
if (tileset && viewer.scene.primitives.contains(tileset)) {
|
|
8240
|
+
entity.show = false;
|
|
8241
|
+
}
|
|
8242
|
+
}
|
|
8243
|
+
}
|
|
8244
|
+
}
|
|
8245
|
+
CesiumAnimatedInOut.AnimateOut = AnimateOut;
|
|
8246
|
+
})(CesiumAnimatedInOut || (CesiumAnimatedInOut = {}));
|
|
8247
|
+
|
|
7697
8248
|
/**
|
|
7698
8249
|
* Returns if a given visual is alive and in the scene.
|
|
7699
8250
|
* @param viewer
|
|
@@ -7724,28 +8275,10 @@ function isAlive$1(viewer, visual) {
|
|
|
7724
8275
|
}
|
|
7725
8276
|
function removeEntity(viewer, visual) {
|
|
7726
8277
|
unmarkEntity(visual, false);
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
});
|
|
7732
|
-
}
|
|
7733
|
-
else if (visual instanceof Primitive) {
|
|
7734
|
-
if (viewer.scene.primitives.contains(visual)) {
|
|
7735
|
-
viewer.scene.primitives.remove(visual);
|
|
7736
|
-
}
|
|
7737
|
-
}
|
|
7738
|
-
else if (visual instanceof Cesium3DTileFeature) {
|
|
7739
|
-
try {
|
|
7740
|
-
var tileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
7741
|
-
if (tileset && viewer.scene.primitives.contains(tileset)) {
|
|
7742
|
-
visual.show = false;
|
|
7743
|
-
}
|
|
7744
|
-
}
|
|
7745
|
-
catch (e) {
|
|
7746
|
-
console.error(e);
|
|
7747
|
-
}
|
|
7748
|
-
}
|
|
8278
|
+
CesiumAnimatedInOut.AnimateOut({
|
|
8279
|
+
entity: visual,
|
|
8280
|
+
viewer: viewer
|
|
8281
|
+
});
|
|
7749
8282
|
}
|
|
7750
8283
|
var MAX_SHOW_DEPTH = 10;
|
|
7751
8284
|
function updateCEntityShow(viewer, visual, rego, show, ignoreParent, depth) {
|
|
@@ -8493,6 +9026,7 @@ var VisualsRegister;
|
|
|
8493
9026
|
rego: rego
|
|
8494
9027
|
});
|
|
8495
9028
|
removeEntity(this.viewer, rego.visual);
|
|
9029
|
+
rego.visual = null;
|
|
8496
9030
|
var doesInclude = this.rego[entityId_4].find(function (r) { return r.menuItemId === menuItemId; });
|
|
8497
9031
|
if (doesInclude) {
|
|
8498
9032
|
this.rego[entityId_4] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
|
|
@@ -8524,6 +9058,7 @@ var VisualsRegister;
|
|
|
8524
9058
|
rego: rego
|
|
8525
9059
|
});
|
|
8526
9060
|
removeEntity(this_2.viewer, rego.visual);
|
|
9061
|
+
rego.visual = null;
|
|
8527
9062
|
(_b = this_2.onUpdate) === null || _b === void 0 ? void 0 : _b.Trigger({
|
|
8528
9063
|
type: EVisualUpdateType.Remove,
|
|
8529
9064
|
entityId: rego.entityId,
|
|
@@ -8554,6 +9089,7 @@ var VisualsRegister;
|
|
|
8554
9089
|
rego: rego
|
|
8555
9090
|
});
|
|
8556
9091
|
removeEntity(this.viewer, rego.visual);
|
|
9092
|
+
rego.visual = null;
|
|
8557
9093
|
this.rego[entityId_5] = entityRegos.filter(function (r) { return r.menuItemId !== menuItemId; });
|
|
8558
9094
|
(_c = this.onUpdate) === null || _c === void 0 ? void 0 : _c.Trigger({
|
|
8559
9095
|
type: EVisualUpdateType.Remove,
|
|
@@ -10343,33 +10879,55 @@ var EntitiesRenderManager;
|
|
|
10343
10879
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10344
10880
|
if (force === void 0) { force = false; }
|
|
10345
10881
|
return __awaiter(this, void 0, void 0, function () {
|
|
10346
|
-
var toRemove, i, entity, _k, updated, cEntities, i, entity, id, cEntity, rego, visual, wasClustered, tagIds, rego_1;
|
|
10882
|
+
var entitiesHistoric, toRemove, i, entity, startTmp, stopTmp, startStr, stopStr, historicData, _k, updated, cEntities, i, entity, id, cEntity, rego, visual, wasClustered, tagIds, rego_1;
|
|
10347
10883
|
return __generator(this, function (_l) {
|
|
10348
10884
|
switch (_l.label) {
|
|
10349
10885
|
case 0:
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
requestRender: false
|
|
10358
|
-
});
|
|
10359
|
-
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
|
|
10360
|
-
}
|
|
10361
|
-
entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
|
|
10362
|
-
}
|
|
10363
|
-
return [4 /*yield*/, EntityRenderEngine.Render({
|
|
10364
|
-
viewer: this.viewer,
|
|
10365
|
-
apiGetter: this.apiGetter,
|
|
10366
|
-
entities: entities,
|
|
10886
|
+
entitiesHistoric = {};
|
|
10887
|
+
if (!((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey)) return [3 /*break*/, 2];
|
|
10888
|
+
toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
|
|
10889
|
+
for (i = 0; i < toRemove.length; i++) {
|
|
10890
|
+
entity = toRemove[i];
|
|
10891
|
+
this.visualsManager.RemoveRegos({
|
|
10892
|
+
entityId: entity.Bruce.ID,
|
|
10367
10893
|
menuItemId: this.item.id,
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10894
|
+
requestRender: false
|
|
10895
|
+
});
|
|
10896
|
+
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
|
|
10897
|
+
}
|
|
10898
|
+
entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
|
|
10899
|
+
if (!this.item.historicInterpolation) return [3 /*break*/, 2];
|
|
10900
|
+
if (!entities.length) return [3 /*break*/, 2];
|
|
10901
|
+
startTmp = JulianDate.toDate(this.viewer.clock.startTime);
|
|
10902
|
+
stopTmp = JulianDate.toDate(this.viewer.clock.stopTime);
|
|
10903
|
+
startStr = new Date(startTmp.getTime() - 1000).toISOString();
|
|
10904
|
+
stopStr = new Date(stopTmp.getTime() + 1000).toISOString();
|
|
10905
|
+
return [4 /*yield*/, EntityHistoricData.GetList({
|
|
10906
|
+
attrKey: this.item.BruceEntity.historicAttrKey,
|
|
10907
|
+
dateTimeFrom: startStr,
|
|
10908
|
+
dateTimeTo: stopStr,
|
|
10909
|
+
entityIds: entities.map(function (x) { return x.Bruce.ID; }),
|
|
10910
|
+
api: this.apiGetter.getApi()
|
|
10371
10911
|
})];
|
|
10372
10912
|
case 1:
|
|
10913
|
+
historicData = _l.sent();
|
|
10914
|
+
if (this.disposed) {
|
|
10915
|
+
this.doDispose();
|
|
10916
|
+
return [2 /*return*/];
|
|
10917
|
+
}
|
|
10918
|
+
entitiesHistoric = historicData.recordsByIds;
|
|
10919
|
+
_l.label = 2;
|
|
10920
|
+
case 2: return [4 /*yield*/, EntityRenderEngine.Render({
|
|
10921
|
+
viewer: this.viewer,
|
|
10922
|
+
apiGetter: this.apiGetter,
|
|
10923
|
+
entities: entities,
|
|
10924
|
+
menuItemId: this.item.id,
|
|
10925
|
+
visualRegister: this.visualsManager,
|
|
10926
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
10927
|
+
entitiesHistoric: entitiesHistoric,
|
|
10928
|
+
force: force
|
|
10929
|
+
})];
|
|
10930
|
+
case 3:
|
|
10373
10931
|
_k = _l.sent(), updated = _k.updated, cEntities = _k.entities;
|
|
10374
10932
|
if (this.disposed) {
|
|
10375
10933
|
this.doDispose();
|
|
@@ -23519,7 +24077,7 @@ var ViewRenderEngine;
|
|
|
23519
24077
|
ViewRenderEngine.Render = Render;
|
|
23520
24078
|
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
23521
24079
|
|
|
23522
|
-
var VERSION = "3.8.
|
|
24080
|
+
var VERSION = "3.8.3";
|
|
23523
24081
|
|
|
23524
24082
|
export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, Draw3dPolygon, Draw3dPolyline };
|
|
23525
24083
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|