bruce-cesium 3.7.3 → 3.7.5
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 +1171 -312
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1169 -310
- 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 +280 -0
- package/dist/lib/rendering/cesium-animated-property.js.map +1 -0
- package/dist/lib/rendering/entity-render-engine.js +660 -278
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/getters/entity-filter-getter.js +69 -2
- package/dist/lib/rendering/getters/entity-filter-getter.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js +2 -1
- package/dist/lib/rendering/render-managers/common/shared-getters.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +37 -20
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/tileset-render-engine.js +10 -0
- package/dist/lib/rendering/tileset-render-engine.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/cesium-entity-styler.js +115 -5
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/cesium-animated-property.d.ts +88 -0
- package/dist/types/rendering/entity-render-engine.d.ts +10 -1
- package/dist/types/rendering/getters/entity-filter-getter.d.ts +15 -1
- package/dist/types/rendering/render-managers/common/shared-getters.d.ts +1 -0
- package/dist/types/rendering/visuals-register.d.ts +2 -0
- package/dist/types/utils/cesium-entity-styler.d.ts +5 -0
- package/package.json +2 -2
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -899,6 +899,282 @@
|
|
|
899
899
|
DrawingUtils.RaisePos3d = RaisePos3d;
|
|
900
900
|
})(exports.DrawingUtils || (exports.DrawingUtils = {}));
|
|
901
901
|
|
|
902
|
+
function getColor(viewer, obj) {
|
|
903
|
+
var value = null;
|
|
904
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
905
|
+
var date = viewer.scene.lastRenderTime;
|
|
906
|
+
if (!date) {
|
|
907
|
+
date = viewer.clock.currentTime;
|
|
908
|
+
}
|
|
909
|
+
value = obj.getValue(date);
|
|
910
|
+
}
|
|
911
|
+
else {
|
|
912
|
+
value = obj;
|
|
913
|
+
}
|
|
914
|
+
if (value && value instanceof Cesium.ColorMaterialProperty) {
|
|
915
|
+
value = value.color;
|
|
916
|
+
}
|
|
917
|
+
return value;
|
|
918
|
+
}
|
|
919
|
+
function getNumber(viewer, obj) {
|
|
920
|
+
var value = null;
|
|
921
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
922
|
+
var date = viewer.scene.lastRenderTime;
|
|
923
|
+
if (!date) {
|
|
924
|
+
date = viewer.clock.currentTime;
|
|
925
|
+
}
|
|
926
|
+
value = obj.getValue(date);
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
value = obj;
|
|
930
|
+
}
|
|
931
|
+
return value;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Returns if a given visual is alive and in the scene.
|
|
935
|
+
* @param viewer
|
|
936
|
+
* @param visual
|
|
937
|
+
* @returns
|
|
938
|
+
*/
|
|
939
|
+
function isFeatureAlive(viewer, feature) {
|
|
940
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
var cTileset = feature === null || feature === void 0 ? void 0 : feature.tileset;
|
|
944
|
+
if (!cTileset) {
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
952
|
+
var _lastMark = 0;
|
|
953
|
+
var generateMark = function () {
|
|
954
|
+
_lastMark += 1;
|
|
955
|
+
return _lastMark;
|
|
956
|
+
};
|
|
957
|
+
function setMark(color, mark) {
|
|
958
|
+
color["NEXTSPACE_PROPERTY_MARK"] = mark;
|
|
959
|
+
}
|
|
960
|
+
function assertColorMark(mark, color) {
|
|
961
|
+
return color["NEXTSPACE_PROPERTY_MARK"] == mark;
|
|
962
|
+
}
|
|
963
|
+
var CesiumAnimatedProperty;
|
|
964
|
+
(function (CesiumAnimatedProperty) {
|
|
965
|
+
/**
|
|
966
|
+
* Example:
|
|
967
|
+
* ```
|
|
968
|
+
* const myEntity = null; // Get an Entity from somewhere.
|
|
969
|
+
*
|
|
970
|
+
* const animateColor = new AnimateColor({
|
|
971
|
+
* viewer: viewer,
|
|
972
|
+
* color: Cesium.Color.RED,
|
|
973
|
+
* startColor: myEntity.model.color,
|
|
974
|
+
* type: "LINEAR",
|
|
975
|
+
* durationMs: 1000
|
|
976
|
+
* });
|
|
977
|
+
*
|
|
978
|
+
* myEntity.model.color = new Cesium.CallbackProperty(() => {
|
|
979
|
+
* return animateColor.GetValue();
|
|
980
|
+
* }, false);
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
var AnimateColor = /** @class */ (function () {
|
|
984
|
+
function AnimateColor(params) {
|
|
985
|
+
var _a;
|
|
986
|
+
this.viewer = params.viewer;
|
|
987
|
+
this.color = params.color;
|
|
988
|
+
this.durationMs = params.durationMs;
|
|
989
|
+
this.startColor = getColor(this.viewer, params.startColor);
|
|
990
|
+
if ((_a = this.startColor) === null || _a === void 0 ? void 0 : _a.clone) {
|
|
991
|
+
this.startColor = this.startColor.clone();
|
|
992
|
+
}
|
|
993
|
+
if (!this.startColor) {
|
|
994
|
+
this.startColor = Cesium.Color.WHITE.clone();
|
|
995
|
+
console.warn("No start color provided. Using WHITE as start color. Animation may not work as expected.");
|
|
996
|
+
}
|
|
997
|
+
this.startTime = new Date();
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Returns the calculated color at the provided time.
|
|
1001
|
+
* @returns
|
|
1002
|
+
*/
|
|
1003
|
+
AnimateColor.prototype.GetColor = function () {
|
|
1004
|
+
var now = new Date();
|
|
1005
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1006
|
+
// Animation over.
|
|
1007
|
+
if (elapsedMs >= this.durationMs) {
|
|
1008
|
+
return this.color;
|
|
1009
|
+
}
|
|
1010
|
+
try {
|
|
1011
|
+
var progress = elapsedMs / this.durationMs;
|
|
1012
|
+
return Cesium.Color.lerp(this.startColor, this.color, progress, new Cesium.Color());
|
|
1013
|
+
}
|
|
1014
|
+
catch (e) {
|
|
1015
|
+
console.error(e);
|
|
1016
|
+
}
|
|
1017
|
+
// Failed to calculate color.
|
|
1018
|
+
// We'll just return the target color.
|
|
1019
|
+
return this.color;
|
|
1020
|
+
};
|
|
1021
|
+
/**
|
|
1022
|
+
* Returns the calculated color as a material property.
|
|
1023
|
+
* @returns
|
|
1024
|
+
*/
|
|
1025
|
+
AnimateColor.prototype.GetMaterial = function () {
|
|
1026
|
+
var color = this.GetColor();
|
|
1027
|
+
return new Cesium.ColorMaterialProperty(color);
|
|
1028
|
+
};
|
|
1029
|
+
return AnimateColor;
|
|
1030
|
+
}());
|
|
1031
|
+
CesiumAnimatedProperty.AnimateColor = AnimateColor;
|
|
1032
|
+
var AnimateNumber = /** @class */ (function () {
|
|
1033
|
+
function AnimateNumber(params) {
|
|
1034
|
+
this.paused = false;
|
|
1035
|
+
this.paused = Boolean(params.startPaused);
|
|
1036
|
+
this.viewer = params.viewer;
|
|
1037
|
+
this.value = params.value;
|
|
1038
|
+
this.durationMs = params.durationMs;
|
|
1039
|
+
this.startValue = getNumber(this.viewer, params.startValue);
|
|
1040
|
+
if (!this.startValue) {
|
|
1041
|
+
this.startValue = 0;
|
|
1042
|
+
}
|
|
1043
|
+
if (!this.paused) {
|
|
1044
|
+
this.startTime = new Date();
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
AnimateNumber.prototype.Play = function () {
|
|
1048
|
+
if (this.paused) {
|
|
1049
|
+
this.paused = false;
|
|
1050
|
+
this.startTime = new Date();
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
AnimateNumber.prototype.GetValue = function () {
|
|
1054
|
+
if (this.paused) {
|
|
1055
|
+
return this.startValue;
|
|
1056
|
+
}
|
|
1057
|
+
var now = new Date();
|
|
1058
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1059
|
+
// Animation over.
|
|
1060
|
+
if (elapsedMs >= this.durationMs) {
|
|
1061
|
+
return this.value;
|
|
1062
|
+
}
|
|
1063
|
+
try {
|
|
1064
|
+
var progress = elapsedMs / this.durationMs;
|
|
1065
|
+
return Cesium.Math.lerp(this.startValue, this.value, progress);
|
|
1066
|
+
}
|
|
1067
|
+
catch (e) {
|
|
1068
|
+
console.error(e);
|
|
1069
|
+
}
|
|
1070
|
+
// Failed to calculate value.
|
|
1071
|
+
// We'll just return the target value.
|
|
1072
|
+
return this.value;
|
|
1073
|
+
};
|
|
1074
|
+
return AnimateNumber;
|
|
1075
|
+
}());
|
|
1076
|
+
CesiumAnimatedProperty.AnimateNumber = AnimateNumber;
|
|
1077
|
+
/**
|
|
1078
|
+
* Animates the color of a feature.
|
|
1079
|
+
* This is handled separately from the AnimateColor class as Tileset features do not support Cesium callback properties.
|
|
1080
|
+
*
|
|
1081
|
+
* Example:
|
|
1082
|
+
* ```
|
|
1083
|
+
* const animateColor = AnimateTFeatureColor({
|
|
1084
|
+
* viewer: viewer,
|
|
1085
|
+
* feature: feature,
|
|
1086
|
+
* color: Cesium.Color.RED,
|
|
1087
|
+
* startColor: feature.color,
|
|
1088
|
+
* durationMs: 1000
|
|
1089
|
+
* });
|
|
1090
|
+
* ```
|
|
1091
|
+
* @param params
|
|
1092
|
+
* @returns
|
|
1093
|
+
*/
|
|
1094
|
+
function AnimateTFeatureColor(params) {
|
|
1095
|
+
var viewer = params.viewer, feature = params.feature, color = params.color, startColor = params.startColor, durationMs = params.durationMs;
|
|
1096
|
+
ClearTFeatureColorAnimation(feature);
|
|
1097
|
+
if (!startColor) {
|
|
1098
|
+
if (feature.color) {
|
|
1099
|
+
startColor = feature.color;
|
|
1100
|
+
if (startColor.clone) {
|
|
1101
|
+
startColor = startColor.clone();
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
startColor = Cesium.Color.WHITE.clone();
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
// Don't animate if the colour is the same.
|
|
1109
|
+
var curColor = getColor(viewer, feature.color);
|
|
1110
|
+
if (curColor && Cesium.Color.WHITE.equals(curColor)) {
|
|
1111
|
+
curColor = null;
|
|
1112
|
+
}
|
|
1113
|
+
var colorTmp = color == null || Cesium.Color.WHITE.equals(color) ? null : color;
|
|
1114
|
+
if (!curColor && !colorTmp) {
|
|
1115
|
+
return function () { };
|
|
1116
|
+
}
|
|
1117
|
+
else if (curColor && colorTmp && curColor.equals(colorTmp)) {
|
|
1118
|
+
return function () { };
|
|
1119
|
+
}
|
|
1120
|
+
// Marks are used to detect external changes to the feature's color.
|
|
1121
|
+
// If an external change is detected, the animation will stop.
|
|
1122
|
+
var mark = generateMark();
|
|
1123
|
+
setMark(feature.color, mark);
|
|
1124
|
+
setMark(startColor, mark);
|
|
1125
|
+
setMark(color, mark);
|
|
1126
|
+
var startTime = new Date();
|
|
1127
|
+
var removal = viewer.scene.postUpdate.addEventListener(function () {
|
|
1128
|
+
if (!isFeatureAlive(viewer, feature)) {
|
|
1129
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1130
|
+
removal = null;
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
if (!assertColorMark(mark, feature.color)) {
|
|
1134
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1135
|
+
removal = null;
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
var now = new Date();
|
|
1139
|
+
var elapsedMs = now.getTime() - startTime.getTime();
|
|
1140
|
+
// Animation over.
|
|
1141
|
+
if (elapsedMs >= durationMs) {
|
|
1142
|
+
feature.color = color;
|
|
1143
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1144
|
+
removal = null;
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
try {
|
|
1148
|
+
var progress = elapsedMs / durationMs;
|
|
1149
|
+
var newColor = Cesium.Color.lerp(startColor, color, progress, new Cesium.Color());
|
|
1150
|
+
setMark(newColor, mark);
|
|
1151
|
+
feature.color = newColor;
|
|
1152
|
+
return;
|
|
1153
|
+
}
|
|
1154
|
+
catch (e) {
|
|
1155
|
+
console.error(e);
|
|
1156
|
+
}
|
|
1157
|
+
// Failed to calculate color.
|
|
1158
|
+
// We'll just set the target color and stop the animation.
|
|
1159
|
+
feature.color = color;
|
|
1160
|
+
});
|
|
1161
|
+
// Return a function to stop the animation.
|
|
1162
|
+
feature["ANIMATED_COLOR_REMOVAL"] = removal;
|
|
1163
|
+
return function () {
|
|
1164
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1165
|
+
removal = null;
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
CesiumAnimatedProperty.AnimateTFeatureColor = AnimateTFeatureColor;
|
|
1169
|
+
function ClearTFeatureColorAnimation(feature) {
|
|
1170
|
+
if (feature && feature["ANIMATED_COLOR_REMOVAL"]) {
|
|
1171
|
+
feature["ANIMATED_COLOR_REMOVAL"]();
|
|
1172
|
+
feature["ANIMATED_COLOR_REMOVAL"] = null;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
CesiumAnimatedProperty.ClearTFeatureColorAnimation = ClearTFeatureColorAnimation;
|
|
1176
|
+
})(CesiumAnimatedProperty || (CesiumAnimatedProperty = {}));
|
|
1177
|
+
|
|
902
1178
|
/**
|
|
903
1179
|
* Returns if a given visual can be styled by this utility.
|
|
904
1180
|
* @param viewer
|
|
@@ -1019,7 +1295,7 @@
|
|
|
1019
1295
|
* @param graphic
|
|
1020
1296
|
* @returns
|
|
1021
1297
|
*/
|
|
1022
|
-
function getColor(viewer, key, graphic) {
|
|
1298
|
+
function getColor$1(viewer, key, graphic) {
|
|
1023
1299
|
var color = graphic[getStoreKey(key)];
|
|
1024
1300
|
// If no color is stored for the default color, we'll calculate and store it.
|
|
1025
1301
|
if (!color) {
|
|
@@ -1049,6 +1325,8 @@
|
|
|
1049
1325
|
function applyOpacity(viewer, opacity, graphic) {
|
|
1050
1326
|
refreshColor(viewer, graphic, opacity);
|
|
1051
1327
|
}
|
|
1328
|
+
var ANIMATE_COLOR_MS = 200;
|
|
1329
|
+
var ANIMATE_COLOR_HIGHLIGHT_MS = 200;
|
|
1052
1330
|
/**
|
|
1053
1331
|
* Applies a color to a graphic based on the current key states.
|
|
1054
1332
|
* Eg: if the graphic is selected, it will apply the selected color.
|
|
@@ -1057,7 +1335,7 @@
|
|
|
1057
1335
|
* @param opacity
|
|
1058
1336
|
*/
|
|
1059
1337
|
function refreshColor(viewer, graphic, opacity) {
|
|
1060
|
-
var _a;
|
|
1338
|
+
var _a, _b;
|
|
1061
1339
|
// Calculate what color key we should apply.
|
|
1062
1340
|
var key = "default";
|
|
1063
1341
|
if (getKeyState(graphic, "select")) {
|
|
@@ -1068,11 +1346,12 @@
|
|
|
1068
1346
|
}
|
|
1069
1347
|
// This ensures that the default color is always stored prior to applying a new color.
|
|
1070
1348
|
if (key != "default") {
|
|
1071
|
-
getColor(viewer, "default", graphic);
|
|
1349
|
+
getColor$1(viewer, "default", graphic);
|
|
1072
1350
|
}
|
|
1073
|
-
var color = (_a = getColor(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Cesium.Color.WHITE;
|
|
1351
|
+
var color = (_a = getColor$1(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Cesium.Color.WHITE;
|
|
1074
1352
|
// If we're highlighting and it's selected, don't change the color.
|
|
1075
1353
|
if (key != "highlight" || getKeyState(graphic, "select") == false) {
|
|
1354
|
+
var animateMs = key == "highlight" ? ANIMATE_COLOR_HIGHLIGHT_MS : ANIMATE_COLOR_MS;
|
|
1076
1355
|
color = color.clone();
|
|
1077
1356
|
// Multiply opacity if one is set.
|
|
1078
1357
|
if (opacity != null) {
|
|
@@ -1088,10 +1367,34 @@
|
|
|
1088
1367
|
}
|
|
1089
1368
|
}
|
|
1090
1369
|
if (graphic instanceof Cesium.Cesium3DTileFeature) {
|
|
1091
|
-
graphic
|
|
1370
|
+
CesiumAnimatedProperty.ClearTFeatureColorAnimation(graphic);
|
|
1371
|
+
if (key == "default") {
|
|
1372
|
+
graphic.color = color;
|
|
1373
|
+
}
|
|
1374
|
+
else {
|
|
1375
|
+
CesiumAnimatedProperty.AnimateTFeatureColor({
|
|
1376
|
+
color: color.clone(),
|
|
1377
|
+
durationMs: animateMs,
|
|
1378
|
+
feature: graphic,
|
|
1379
|
+
viewer: viewer,
|
|
1380
|
+
startColor: ((_b = graphic.color) === null || _b === void 0 ? void 0 : _b.clone) ? graphic.color.clone() : graphic.color
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1092
1383
|
}
|
|
1093
1384
|
else if (graphic instanceof Cesium.ModelGraphics) {
|
|
1094
|
-
graphic.color = new Cesium.ConstantProperty(color);
|
|
1385
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1386
|
+
var animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
1387
|
+
color: color,
|
|
1388
|
+
durationMs: animateMs,
|
|
1389
|
+
viewer: viewer,
|
|
1390
|
+
startColor: graphic.color
|
|
1391
|
+
});
|
|
1392
|
+
if (graphic.color instanceof Cesium.CallbackProperty) {
|
|
1393
|
+
graphic.color.setCallback(function () { return animateColor_1.GetColor(); }, false);
|
|
1394
|
+
}
|
|
1395
|
+
else {
|
|
1396
|
+
graphic.color = new Cesium.CallbackProperty(function () { return animateColor_1.GetColor(); }, false);
|
|
1397
|
+
}
|
|
1095
1398
|
}
|
|
1096
1399
|
else if (graphic instanceof Cesium.PolygonGraphics) {
|
|
1097
1400
|
graphic.material = new Cesium.ColorMaterialProperty(color);
|
|
@@ -1103,10 +1406,34 @@
|
|
|
1103
1406
|
graphic.material = new Cesium.ColorMaterialProperty(color);
|
|
1104
1407
|
}
|
|
1105
1408
|
else if (graphic instanceof Cesium.PointGraphics) {
|
|
1106
|
-
graphic.color = new Cesium.ConstantProperty(color);
|
|
1409
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1410
|
+
var animateColor_2 = new CesiumAnimatedProperty.AnimateColor({
|
|
1411
|
+
color: color,
|
|
1412
|
+
durationMs: animateMs,
|
|
1413
|
+
viewer: viewer,
|
|
1414
|
+
startColor: graphic.color
|
|
1415
|
+
});
|
|
1416
|
+
if (graphic.color instanceof Cesium.CallbackProperty) {
|
|
1417
|
+
graphic.color.setCallback(function () { return animateColor_2.GetColor(); }, false);
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
graphic.color = new Cesium.CallbackProperty(function () { return animateColor_2.GetColor(); }, false);
|
|
1421
|
+
}
|
|
1107
1422
|
}
|
|
1108
1423
|
else if (graphic instanceof Cesium.BillboardGraphics) {
|
|
1109
|
-
graphic.color = new Cesium.ConstantProperty(color);
|
|
1424
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1425
|
+
var animateColor_3 = new CesiumAnimatedProperty.AnimateColor({
|
|
1426
|
+
color: color,
|
|
1427
|
+
durationMs: animateMs,
|
|
1428
|
+
viewer: viewer,
|
|
1429
|
+
startColor: graphic.color
|
|
1430
|
+
});
|
|
1431
|
+
if (graphic.color instanceof Cesium.CallbackProperty) {
|
|
1432
|
+
graphic.color.setCallback(function () { return animateColor_3.GetColor(); }, false);
|
|
1433
|
+
}
|
|
1434
|
+
else {
|
|
1435
|
+
graphic.color = new Cesium.CallbackProperty(function () { return animateColor_3.GetColor(); }, false);
|
|
1436
|
+
}
|
|
1110
1437
|
}
|
|
1111
1438
|
else if (graphic instanceof Cesium.EllipseGraphics) {
|
|
1112
1439
|
graphic.material = new Cesium.ColorMaterialProperty(color);
|
|
@@ -1202,6 +1529,64 @@
|
|
|
1202
1529
|
}
|
|
1203
1530
|
}
|
|
1204
1531
|
CesiumEntityStyler.Refresh = Refresh;
|
|
1532
|
+
function BakeDefaultColor(params) {
|
|
1533
|
+
var viewer = params.viewer, entity = params.entity, override = params.override;
|
|
1534
|
+
if (!entity) {
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
1538
|
+
entity: entity
|
|
1539
|
+
});
|
|
1540
|
+
for (var i = 0; i < parts.length; i++) {
|
|
1541
|
+
var part = parts[i];
|
|
1542
|
+
if (!isAlive(viewer, part)) {
|
|
1543
|
+
continue;
|
|
1544
|
+
}
|
|
1545
|
+
// If we're not overriding then we check to ensure a colour is not already set.
|
|
1546
|
+
if (override == false) {
|
|
1547
|
+
var stored = part[getStoreKey("default")];
|
|
1548
|
+
if (stored) {
|
|
1549
|
+
continue;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
if (part instanceof Cesium.Cesium3DTileFeature) {
|
|
1553
|
+
var opacity = getAppliedOpacity(part);
|
|
1554
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part), part);
|
|
1555
|
+
refreshColor(viewer, part, opacity);
|
|
1556
|
+
}
|
|
1557
|
+
else if (part instanceof Cesium.Entity) {
|
|
1558
|
+
if (part.billboard) {
|
|
1559
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.billboard), part.billboard);
|
|
1560
|
+
refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
|
|
1561
|
+
}
|
|
1562
|
+
if (part.model) {
|
|
1563
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.model), part.model);
|
|
1564
|
+
refreshColor(viewer, part.model, getAppliedOpacity(part.model));
|
|
1565
|
+
}
|
|
1566
|
+
if (part.polyline) {
|
|
1567
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.polyline), part.polyline);
|
|
1568
|
+
refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
|
|
1569
|
+
}
|
|
1570
|
+
if (part.polygon) {
|
|
1571
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.polygon), part.polygon);
|
|
1572
|
+
refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
|
|
1573
|
+
}
|
|
1574
|
+
if (part.corridor) {
|
|
1575
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.corridor), part.corridor);
|
|
1576
|
+
refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
|
|
1577
|
+
}
|
|
1578
|
+
if (part.point) {
|
|
1579
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.point), part.point);
|
|
1580
|
+
refreshColor(viewer, part.point, getAppliedOpacity(part.point));
|
|
1581
|
+
}
|
|
1582
|
+
if (part.ellipse) {
|
|
1583
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.ellipse), part.ellipse);
|
|
1584
|
+
refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
CesiumEntityStyler.BakeDefaultColor = BakeDefaultColor;
|
|
1205
1590
|
/**
|
|
1206
1591
|
* Updates the default colour of a graphic.
|
|
1207
1592
|
* This will not change the graphic's state to use it if the entity is selected/highlighted.
|
|
@@ -4248,7 +4633,7 @@
|
|
|
4248
4633
|
var createCircleBillboard = function (size, colorCss) {
|
|
4249
4634
|
var key = size + "-" + colorCss;
|
|
4250
4635
|
var cacheData = _billboardCache.Get(key);
|
|
4251
|
-
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.
|
|
4636
|
+
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) && typeof (cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) == "string") {
|
|
4252
4637
|
return cacheData;
|
|
4253
4638
|
}
|
|
4254
4639
|
// Slight padding to avoid corners clipping.
|
|
@@ -4262,7 +4647,7 @@
|
|
|
4262
4647
|
context.fillStyle = colorCss;
|
|
4263
4648
|
context.fill();
|
|
4264
4649
|
var data = {
|
|
4265
|
-
|
|
4650
|
+
canvasDataUri: canvas.toDataURL("image/png"),
|
|
4266
4651
|
colorCss: colorCss,
|
|
4267
4652
|
size: size,
|
|
4268
4653
|
height: canvasSize,
|
|
@@ -4297,7 +4682,7 @@
|
|
|
4297
4682
|
var context = canvas_1.getContext("2d");
|
|
4298
4683
|
context.drawImage(image_1, 0, 0);
|
|
4299
4684
|
var data = {
|
|
4300
|
-
|
|
4685
|
+
canvasDataUri: canvas_1.toDataURL("image/png"),
|
|
4301
4686
|
height: image_1.height
|
|
4302
4687
|
};
|
|
4303
4688
|
res(data);
|
|
@@ -4412,11 +4797,11 @@
|
|
|
4412
4797
|
}
|
|
4413
4798
|
(function (EntityRenderEngine) {
|
|
4414
4799
|
function Render(params) {
|
|
4415
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4800
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4416
4801
|
return __awaiter(this, void 0, void 0, function () {
|
|
4417
|
-
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType,
|
|
4418
|
-
return __generator(this, function (
|
|
4419
|
-
switch (
|
|
4802
|
+
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType, existingRego, newRenderId, oldRenderId, mParams, mEntities, i, entity, id, cEntity, _loop_1, i, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity, pParams, pEntities, i, entity, cEntity;
|
|
4803
|
+
return __generator(this, function (_m) {
|
|
4804
|
+
switch (_m.label) {
|
|
4420
4805
|
case 0:
|
|
4421
4806
|
groupRenderParams = {
|
|
4422
4807
|
apiGetter: params.apiGetter,
|
|
@@ -4458,21 +4843,36 @@
|
|
|
4458
4843
|
displayType = bruceModels.ZoomControl.EDisplayType.Geometry;
|
|
4459
4844
|
}
|
|
4460
4845
|
if (displayType != bruceModels.ZoomControl.EDisplayType.Hidden) {
|
|
4461
|
-
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4462
4846
|
existingRego = params.visualRegister.GetRego({
|
|
4463
4847
|
entityId: id,
|
|
4464
4848
|
menuItemId: params.menuItemId
|
|
4465
4849
|
});
|
|
4850
|
+
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4466
4851
|
oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
|
|
4467
|
-
if (!params.force &&
|
|
4852
|
+
if (!params.force &&
|
|
4853
|
+
newRenderId == oldRenderId &&
|
|
4854
|
+
!(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale) &&
|
|
4855
|
+
// If historic metadata is different then it's also stale.
|
|
4856
|
+
((existingRego === null || existingRego === void 0 ? void 0 : existingRego.historicDateTime) == ((_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d.historicDateTime))) {
|
|
4857
|
+
// No sorting category needed. Already rendered the way we want.
|
|
4468
4858
|
cEntities[id] = existingRego.visual;
|
|
4469
4859
|
}
|
|
4470
4860
|
else {
|
|
4861
|
+
// Add so we can re-use the graphic and update it.
|
|
4862
|
+
if (existingRego && newRenderId == oldRenderId) {
|
|
4863
|
+
cEntities[id] = existingRego.visual;
|
|
4864
|
+
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
4865
|
+
existingRego.stale = false;
|
|
4866
|
+
// Update metadata for the same reason.
|
|
4867
|
+
existingRego.historicDateTime = (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime;
|
|
4868
|
+
existingRego.historicAttrKey = (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey;
|
|
4869
|
+
existingRego.entityTypeId = entity.Bruce["EntityType.ID"];
|
|
4870
|
+
}
|
|
4471
4871
|
if (displayType == bruceModels.ZoomControl.EDisplayType.Model3D) {
|
|
4472
4872
|
models.push(entity);
|
|
4473
4873
|
}
|
|
4474
4874
|
else if (displayType == bruceModels.ZoomControl.EDisplayType.Geometry) {
|
|
4475
|
-
if ((
|
|
4875
|
+
if ((_h = (_g = entity.geometry) === null || _g === void 0 ? void 0 : _g.MultiGeometry) === null || _h === void 0 ? void 0 : _h.length) {
|
|
4476
4876
|
multiGeometry.push(entity);
|
|
4477
4877
|
}
|
|
4478
4878
|
else {
|
|
@@ -4487,10 +4887,10 @@
|
|
|
4487
4887
|
}
|
|
4488
4888
|
}
|
|
4489
4889
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
4490
|
-
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
4890
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
4491
4891
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
4492
4892
|
case 1:
|
|
4493
|
-
mEntities =
|
|
4893
|
+
mEntities = _m.sent();
|
|
4494
4894
|
for (i = 0; i < mParams.entities.length; i++) {
|
|
4495
4895
|
entity = mParams.entities[i];
|
|
4496
4896
|
id = entity.Bruce.ID;
|
|
@@ -4502,20 +4902,20 @@
|
|
|
4502
4902
|
multiGeometry.push(entity);
|
|
4503
4903
|
}
|
|
4504
4904
|
}
|
|
4505
|
-
|
|
4905
|
+
_m.label = 2;
|
|
4506
4906
|
case 2:
|
|
4507
4907
|
if (!(multiGeometry.length > 0)) return [3 /*break*/, 6];
|
|
4508
4908
|
_loop_1 = function (i) {
|
|
4509
4909
|
var entity, pParams, zoomItem, j, subEntity, cPoly, rendered, cLines, cPoints, rootEntity_1, firstEntity;
|
|
4510
|
-
return __generator(this, function (
|
|
4511
|
-
switch (
|
|
4910
|
+
return __generator(this, function (_o) {
|
|
4911
|
+
switch (_o.label) {
|
|
4512
4912
|
case 0:
|
|
4513
4913
|
entity = multiGeometry[i];
|
|
4514
|
-
if (!((
|
|
4914
|
+
if (!((_k = (_j = entity.geometry) === null || _j === void 0 ? void 0 : _j.MultiGeometry) === null || _k === void 0 ? void 0 : _k.length)) {
|
|
4515
4915
|
polygons.push(entity);
|
|
4516
4916
|
return [2 /*return*/, "continue"];
|
|
4517
4917
|
}
|
|
4518
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
|
|
4918
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
4519
4919
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
4520
4920
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
4521
4921
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: bruceModels.ObjectUtils.UId() }) });
|
|
@@ -4524,7 +4924,7 @@
|
|
|
4524
4924
|
}
|
|
4525
4925
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
4526
4926
|
case 1:
|
|
4527
|
-
cPoly =
|
|
4927
|
+
cPoly = _o.sent();
|
|
4528
4928
|
Object.keys(cPoly).forEach(function (key) {
|
|
4529
4929
|
if (cPoly[key]) {
|
|
4530
4930
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -4533,7 +4933,7 @@
|
|
|
4533
4933
|
rendered = Object.values(cPoly);
|
|
4534
4934
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
4535
4935
|
case 2:
|
|
4536
|
-
cLines =
|
|
4936
|
+
cLines = _o.sent();
|
|
4537
4937
|
Object.keys(cLines).forEach(function (key) {
|
|
4538
4938
|
if (cLines[key]) {
|
|
4539
4939
|
pParams.entities = pParams.entities.filter(function (e) { return e.Bruce.ID != key; });
|
|
@@ -4543,9 +4943,9 @@
|
|
|
4543
4943
|
if (!!rendered.length) return [3 /*break*/, 4];
|
|
4544
4944
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
4545
4945
|
case 3:
|
|
4546
|
-
cPoints =
|
|
4946
|
+
cPoints = _o.sent();
|
|
4547
4947
|
rendered = rendered.concat(Object.values(cPoints));
|
|
4548
|
-
|
|
4948
|
+
_o.label = 4;
|
|
4549
4949
|
case 4:
|
|
4550
4950
|
rendered = rendered.filter(function (x) { return x != null; });
|
|
4551
4951
|
if (rendered.length) {
|
|
@@ -4553,7 +4953,7 @@
|
|
|
4553
4953
|
id: bruceModels.ObjectUtils.UId(10)
|
|
4554
4954
|
});
|
|
4555
4955
|
rootEntity_1._siblingGraphics = [];
|
|
4556
|
-
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (
|
|
4956
|
+
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_l = params.viewer) === null || _l === void 0 ? void 0 : _l.terrainProvider);
|
|
4557
4957
|
rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
|
|
4558
4958
|
cEntities[entity.Bruce.ID] = rootEntity_1;
|
|
4559
4959
|
firstEntity = rendered[0];
|
|
@@ -4572,22 +4972,22 @@
|
|
|
4572
4972
|
});
|
|
4573
4973
|
};
|
|
4574
4974
|
i = 0;
|
|
4575
|
-
|
|
4975
|
+
_m.label = 3;
|
|
4576
4976
|
case 3:
|
|
4577
4977
|
if (!(i < multiGeometry.length)) return [3 /*break*/, 6];
|
|
4578
4978
|
return [5 /*yield**/, _loop_1(i)];
|
|
4579
4979
|
case 4:
|
|
4580
|
-
|
|
4581
|
-
|
|
4980
|
+
_m.sent();
|
|
4981
|
+
_m.label = 5;
|
|
4582
4982
|
case 5:
|
|
4583
4983
|
i++;
|
|
4584
4984
|
return [3 /*break*/, 3];
|
|
4585
4985
|
case 6:
|
|
4586
4986
|
if (!(polygons.length > 0)) return [3 /*break*/, 8];
|
|
4587
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
4987
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
4588
4988
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
4589
4989
|
case 7:
|
|
4590
|
-
pEntities =
|
|
4990
|
+
pEntities = _m.sent();
|
|
4591
4991
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
4592
4992
|
entity = pParams.entities[i];
|
|
4593
4993
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -4598,13 +4998,13 @@
|
|
|
4598
4998
|
polylines.push(entity);
|
|
4599
4999
|
}
|
|
4600
5000
|
}
|
|
4601
|
-
|
|
5001
|
+
_m.label = 8;
|
|
4602
5002
|
case 8:
|
|
4603
5003
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
4604
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
5004
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
4605
5005
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
4606
5006
|
case 9:
|
|
4607
|
-
pEntities =
|
|
5007
|
+
pEntities = _m.sent();
|
|
4608
5008
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
4609
5009
|
entity = pParams.entities[i];
|
|
4610
5010
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -4615,13 +5015,13 @@
|
|
|
4615
5015
|
points.push(entity);
|
|
4616
5016
|
}
|
|
4617
5017
|
}
|
|
4618
|
-
|
|
5018
|
+
_m.label = 10;
|
|
4619
5019
|
case 10:
|
|
4620
5020
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
4621
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
5021
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
4622
5022
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
4623
5023
|
case 11:
|
|
4624
|
-
pEntities =
|
|
5024
|
+
pEntities = _m.sent();
|
|
4625
5025
|
for (i = 0; i < pParams.entities.length; i++) {
|
|
4626
5026
|
entity = pParams.entities[i];
|
|
4627
5027
|
cEntity = pEntities[entity.Bruce.ID];
|
|
@@ -4629,7 +5029,7 @@
|
|
|
4629
5029
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
4630
5030
|
}
|
|
4631
5031
|
}
|
|
4632
|
-
|
|
5032
|
+
_m.label = 12;
|
|
4633
5033
|
case 12: return [2 /*return*/, cEntities];
|
|
4634
5034
|
}
|
|
4635
5035
|
});
|
|
@@ -4682,11 +5082,11 @@
|
|
|
4682
5082
|
}
|
|
4683
5083
|
Point.CreateCircleBillboard = CreateCircleBillboard;
|
|
4684
5084
|
function Render(params) {
|
|
4685
|
-
var _a, _b;
|
|
5085
|
+
var _a, _b, _c, _d;
|
|
4686
5086
|
return __awaiter(this, void 0, void 0, function () {
|
|
4687
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor,
|
|
4688
|
-
return __generator(this, function (
|
|
4689
|
-
switch (
|
|
5087
|
+
var entity, style, type, cEntity, siblings, prepareExistingGraphic, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor, cColor_1, heightRef, currentImgKey, radius, bFill, cFill, outline, cOutline, outlineWidth, bOutline, heightRef, pos3d, extrusion, hasOutline, outlineExtrusion, outlineEntity, bColor, cColor, size, heightRef, circleBillboard, disableDepthTest, imgKey, currentImgKey;
|
|
5088
|
+
return __generator(this, function (_e) {
|
|
5089
|
+
switch (_e.label) {
|
|
4690
5090
|
case 0:
|
|
4691
5091
|
entity = params.entity;
|
|
4692
5092
|
style = params.style;
|
|
@@ -4699,6 +5099,27 @@
|
|
|
4699
5099
|
}
|
|
4700
5100
|
cEntity = null;
|
|
4701
5101
|
siblings = [];
|
|
5102
|
+
prepareExistingGraphic = function (cEntity, siblings) {
|
|
5103
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5104
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5105
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5106
|
+
entity: cEntity,
|
|
5107
|
+
});
|
|
5108
|
+
if (parts.length > 1) {
|
|
5109
|
+
// We'll cull all except the allowed number of siblings.
|
|
5110
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5111
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5112
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5113
|
+
var part = parts[i];
|
|
5114
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5115
|
+
params.viewer.entities.remove(part);
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
if (cEntity._parentEntity) {
|
|
5119
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5120
|
+
}
|
|
5121
|
+
}
|
|
5122
|
+
};
|
|
4702
5123
|
if (!(type == bruceModels.Style.EPointType.Icon)) return [3 /*break*/, 9];
|
|
4703
5124
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
4704
5125
|
iconUrlRows.forEach(function (row) {
|
|
@@ -4715,36 +5136,36 @@
|
|
|
4715
5136
|
api = params.apiGetter.getApi(metadata.accountId);
|
|
4716
5137
|
return [4 /*yield*/, api.Loading];
|
|
4717
5138
|
case 1:
|
|
4718
|
-
|
|
5139
|
+
_e.sent();
|
|
4719
5140
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4720
5141
|
api: api,
|
|
4721
5142
|
fileId: metadata.fileId,
|
|
4722
5143
|
viaCdn: true
|
|
4723
5144
|
});
|
|
4724
|
-
|
|
5145
|
+
_e.label = 2;
|
|
4725
5146
|
case 2:
|
|
4726
5147
|
if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
|
|
4727
5148
|
return [4 /*yield*/, params.api.Loading];
|
|
4728
5149
|
case 3:
|
|
4729
|
-
|
|
5150
|
+
_e.sent();
|
|
4730
5151
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4731
5152
|
api: params.api,
|
|
4732
5153
|
fileId: style.iconId,
|
|
4733
5154
|
viaCdn: true
|
|
4734
5155
|
});
|
|
4735
|
-
|
|
5156
|
+
_e.label = 4;
|
|
4736
5157
|
case 4:
|
|
4737
5158
|
image = null;
|
|
4738
5159
|
if (!iconUrl) return [3 /*break*/, 8];
|
|
4739
|
-
|
|
5160
|
+
_e.label = 5;
|
|
4740
5161
|
case 5:
|
|
4741
|
-
|
|
5162
|
+
_e.trys.push([5, 7, , 8]);
|
|
4742
5163
|
return [4 /*yield*/, createImageBillboard(iconUrl)];
|
|
4743
5164
|
case 6:
|
|
4744
|
-
image =
|
|
5165
|
+
image = _e.sent();
|
|
4745
5166
|
return [3 /*break*/, 8];
|
|
4746
5167
|
case 7:
|
|
4747
|
-
e_5 =
|
|
5168
|
+
e_5 = _e.sent();
|
|
4748
5169
|
// Expanding the logging here so we can figure out why this is happening.
|
|
4749
5170
|
// Most of the time the file is missing but we're getting some strange errors so I am including logging on the API settings as well.
|
|
4750
5171
|
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
@@ -4763,34 +5184,64 @@
|
|
|
4763
5184
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4764
5185
|
if (iconScale > 0) {
|
|
4765
5186
|
bColor = style.iconTintColor ? bruceModels.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
4766
|
-
|
|
5187
|
+
cColor_1 = bColor ? colorToCColor(bColor) : undefined;
|
|
4767
5188
|
heightRef = getHeightRef(style);
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
5189
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5190
|
+
cEntity = new Cesium.Entity({
|
|
5191
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5192
|
+
billboard: {
|
|
5193
|
+
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
5194
|
+
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
5195
|
+
image: image.canvasDataUri,
|
|
5196
|
+
heightReference: getHeightRef(style),
|
|
5197
|
+
scale: iconScale,
|
|
5198
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
5199
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5200
|
+
color: new Cesium.CallbackProperty(function () { return cColor_1; }, true),
|
|
5201
|
+
// Would be great once we have a setting for this.
|
|
5202
|
+
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
5203
|
+
},
|
|
5204
|
+
position: exports.EntityUtils.GetPos({
|
|
5205
|
+
viewer: params.viewer,
|
|
5206
|
+
entity: entity,
|
|
5207
|
+
recordHeightRef: heightRef,
|
|
5208
|
+
returnHeightRef: heightRef
|
|
5209
|
+
}),
|
|
5210
|
+
show: true
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5213
|
+
else {
|
|
5214
|
+
prepareExistingGraphic(params.rendered);
|
|
5215
|
+
cEntity = params.rendered;
|
|
5216
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5217
|
+
if (currentImgKey != iconUrl) {
|
|
5218
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(image.canvasDataUri);
|
|
5219
|
+
}
|
|
5220
|
+
cEntity.billboard.scale = new Cesium.ConstantProperty(iconScale);
|
|
5221
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(getHeightRef(style));
|
|
5222
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5223
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5224
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
4783
5225
|
viewer: params.viewer,
|
|
4784
5226
|
entity: entity,
|
|
4785
5227
|
recordHeightRef: heightRef,
|
|
4786
5228
|
returnHeightRef: heightRef
|
|
4787
|
-
})
|
|
4788
|
-
|
|
4789
|
-
|
|
5229
|
+
}));
|
|
5230
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5231
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5232
|
+
color: cColor_1,
|
|
5233
|
+
entity: cEntity,
|
|
5234
|
+
viewer: params.viewer,
|
|
5235
|
+
override: true,
|
|
5236
|
+
requestRender: false
|
|
5237
|
+
});
|
|
5238
|
+
cEntity.show = true;
|
|
5239
|
+
}
|
|
4790
5240
|
cEntity.billboard._billboardSize = image.height;
|
|
5241
|
+
cEntity.billboard._billboardImgKey = iconUrl;
|
|
4791
5242
|
}
|
|
4792
5243
|
}
|
|
4793
|
-
|
|
5244
|
+
_e.label = 9;
|
|
4794
5245
|
case 9:
|
|
4795
5246
|
if (type == bruceModels.Style.EPointType.Cylinder) {
|
|
4796
5247
|
radius = EnsureNumber(bruceModels.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
@@ -4815,46 +5266,97 @@
|
|
|
4815
5266
|
returnHeightRef: heightRef
|
|
4816
5267
|
});
|
|
4817
5268
|
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
semiMajorAxis: radius,
|
|
4822
|
-
semiMinorAxis: radius,
|
|
4823
|
-
material: cFill,
|
|
4824
|
-
outlineWidth: null,
|
|
4825
|
-
extrudedHeight: extrusion.value,
|
|
4826
|
-
heightReference: heightRef,
|
|
4827
|
-
extrudedHeightReference: extrusion.exHeightRef,
|
|
4828
|
-
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
4829
|
-
zIndex: 1,
|
|
4830
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4831
|
-
},
|
|
4832
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
4833
|
-
show: true
|
|
4834
|
-
});
|
|
4835
|
-
if (outline && outlineWidth > 0) {
|
|
4836
|
-
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
4837
|
-
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
4838
|
-
// This way they render in a uniform way.
|
|
4839
|
-
if (!outlineExtrusion.value && extrusion.value) {
|
|
4840
|
-
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
4841
|
-
}
|
|
4842
|
-
siblings.push(new Cesium.Entity({
|
|
5269
|
+
hasOutline = outline && outlineWidth > 0;
|
|
5270
|
+
if (!params.rendered || !params.rendered.ellipse) {
|
|
5271
|
+
cEntity = new Cesium.Entity({
|
|
4843
5272
|
id: bruceModels.ObjectUtils.UId(10),
|
|
4844
5273
|
ellipse: {
|
|
4845
|
-
semiMajorAxis: radius
|
|
4846
|
-
semiMinorAxis: radius
|
|
4847
|
-
material:
|
|
4848
|
-
outlineWidth:
|
|
4849
|
-
extrudedHeight:
|
|
5274
|
+
semiMajorAxis: radius,
|
|
5275
|
+
semiMinorAxis: radius,
|
|
5276
|
+
material: cFill,
|
|
5277
|
+
outlineWidth: null,
|
|
5278
|
+
extrudedHeight: extrusion.value,
|
|
4850
5279
|
heightReference: heightRef,
|
|
4851
|
-
extrudedHeightReference:
|
|
5280
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
4852
5281
|
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
4853
|
-
zIndex:
|
|
5282
|
+
zIndex: 1,
|
|
4854
5283
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4855
5284
|
},
|
|
4856
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
4857
|
-
|
|
5285
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
5286
|
+
show: true
|
|
5287
|
+
});
|
|
5288
|
+
}
|
|
5289
|
+
else {
|
|
5290
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5291
|
+
cEntity = params.rendered;
|
|
5292
|
+
cEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius);
|
|
5293
|
+
cEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius);
|
|
5294
|
+
cEntity.ellipse.outlineWidth = undefined;
|
|
5295
|
+
cEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
5296
|
+
cEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5297
|
+
cEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
5298
|
+
cEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
5299
|
+
cEntity.ellipse.zIndex = new Cesium.ConstantProperty(1);
|
|
5300
|
+
cEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5301
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
|
|
5302
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5303
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5304
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5305
|
+
color: cFill,
|
|
5306
|
+
entity: cEntity,
|
|
5307
|
+
viewer: params.viewer,
|
|
5308
|
+
override: true,
|
|
5309
|
+
requestRender: false
|
|
5310
|
+
});
|
|
5311
|
+
cEntity.show = true;
|
|
5312
|
+
}
|
|
5313
|
+
if (hasOutline) {
|
|
5314
|
+
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
5315
|
+
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
5316
|
+
// This way they render in a uniform way.
|
|
5317
|
+
if (!outlineExtrusion.value && extrusion.value) {
|
|
5318
|
+
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
5319
|
+
}
|
|
5320
|
+
outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5321
|
+
if (outlineEntity && outlineEntity.ellipse) {
|
|
5322
|
+
outlineEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
5323
|
+
outlineEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
5324
|
+
outlineEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(outlineExtrusion.value);
|
|
5325
|
+
outlineEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5326
|
+
outlineEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(outlineExtrusion.exHeightRef);
|
|
5327
|
+
outlineEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
5328
|
+
outlineEntity.ellipse.zIndex = new Cesium.ConstantProperty(2);
|
|
5329
|
+
outlineEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5330
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5331
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5332
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5333
|
+
color: cOutline,
|
|
5334
|
+
entity: outlineEntity,
|
|
5335
|
+
viewer: params.viewer,
|
|
5336
|
+
override: true,
|
|
5337
|
+
requestRender: false
|
|
5338
|
+
});
|
|
5339
|
+
outlineEntity.show = true;
|
|
5340
|
+
}
|
|
5341
|
+
else {
|
|
5342
|
+
outlineEntity = new Cesium.Entity({
|
|
5343
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5344
|
+
ellipse: {
|
|
5345
|
+
semiMajorAxis: radius + outlineWidth,
|
|
5346
|
+
semiMinorAxis: radius + outlineWidth,
|
|
5347
|
+
material: cOutline,
|
|
5348
|
+
outlineWidth: undefined,
|
|
5349
|
+
extrudedHeight: outlineExtrusion.value,
|
|
5350
|
+
heightReference: heightRef,
|
|
5351
|
+
extrudedHeightReference: outlineExtrusion.exHeightRef,
|
|
5352
|
+
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
5353
|
+
zIndex: 2,
|
|
5354
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5355
|
+
},
|
|
5356
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
5357
|
+
});
|
|
5358
|
+
}
|
|
5359
|
+
siblings.push(outlineEntity);
|
|
4858
5360
|
}
|
|
4859
5361
|
}
|
|
4860
5362
|
if (!cEntity) {
|
|
@@ -4871,33 +5373,66 @@
|
|
|
4871
5373
|
heightRef = getHeightRef(style);
|
|
4872
5374
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
4873
5375
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
5376
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5377
|
+
cEntity = new Cesium.Entity({
|
|
5378
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5379
|
+
// point: {
|
|
5380
|
+
// pixelSize: size,
|
|
5381
|
+
// color: cColor,
|
|
5382
|
+
// heightReference: getHeightRef(style),
|
|
5383
|
+
// distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5384
|
+
// },
|
|
5385
|
+
// We are generating a billboard instead of using the point.
|
|
5386
|
+
// This is because points were behaving strangely where they would appear oblong shapes.
|
|
5387
|
+
// This occurred consistently when rendering many icons and points at the same time.
|
|
5388
|
+
billboard: {
|
|
5389
|
+
height: circleBillboard.height,
|
|
5390
|
+
width: circleBillboard.width,
|
|
5391
|
+
image: circleBillboard.canvasDataUri,
|
|
5392
|
+
color: new Cesium.CallbackProperty(function () { return undefined; }, true),
|
|
5393
|
+
heightReference: heightRef,
|
|
5394
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5395
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
|
|
5396
|
+
},
|
|
5397
|
+
position: exports.EntityUtils.GetPos({
|
|
5398
|
+
viewer: params.viewer,
|
|
5399
|
+
entity: entity,
|
|
5400
|
+
recordHeightRef: heightRef,
|
|
5401
|
+
returnHeightRef: heightRef
|
|
5402
|
+
}),
|
|
5403
|
+
show: true
|
|
5404
|
+
});
|
|
5405
|
+
}
|
|
5406
|
+
else {
|
|
5407
|
+
prepareExistingGraphic(params.rendered);
|
|
5408
|
+
cEntity = params.rendered;
|
|
5409
|
+
imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
|
|
5410
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5411
|
+
if (currentImgKey != imgKey) {
|
|
5412
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(circleBillboard.canvasDataUri);
|
|
5413
|
+
}
|
|
5414
|
+
cEntity.billboard.height = new Cesium.ConstantProperty(circleBillboard.height);
|
|
5415
|
+
cEntity.billboard.width = new Cesium.ConstantProperty(circleBillboard.width);
|
|
5416
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5417
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5418
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5419
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
4894
5420
|
viewer: params.viewer,
|
|
4895
5421
|
entity: entity,
|
|
4896
5422
|
recordHeightRef: heightRef,
|
|
4897
5423
|
returnHeightRef: heightRef
|
|
4898
|
-
})
|
|
4899
|
-
|
|
4900
|
-
|
|
5424
|
+
}));
|
|
5425
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5426
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5427
|
+
color: cColor,
|
|
5428
|
+
entity: cEntity,
|
|
5429
|
+
viewer: params.viewer,
|
|
5430
|
+
override: true,
|
|
5431
|
+
requestRender: false
|
|
5432
|
+
});
|
|
5433
|
+
cEntity.show = true;
|
|
5434
|
+
cEntity.billboard._billboardImgKey = imgKey;
|
|
5435
|
+
}
|
|
4901
5436
|
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
4902
5437
|
}
|
|
4903
5438
|
if (cEntity) {
|
|
@@ -4910,16 +5445,16 @@
|
|
|
4910
5445
|
}
|
|
4911
5446
|
Point.Render = Render;
|
|
4912
5447
|
function RenderGroup(params) {
|
|
4913
|
-
var _a, _b, _c;
|
|
5448
|
+
var _a, _b, _c, _d;
|
|
4914
5449
|
return __awaiter(this, void 0, void 0, function () {
|
|
4915
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
4916
|
-
return __generator(this, function (
|
|
4917
|
-
switch (
|
|
5450
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_2;
|
|
5451
|
+
return __generator(this, function (_f) {
|
|
5452
|
+
switch (_f.label) {
|
|
4918
5453
|
case 0:
|
|
4919
5454
|
api = params.apiGetter.getApi();
|
|
4920
5455
|
cEntities = {};
|
|
4921
5456
|
i = 0;
|
|
4922
|
-
|
|
5457
|
+
_f.label = 1;
|
|
4923
5458
|
case 1:
|
|
4924
5459
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
4925
5460
|
entity = params.entities[i];
|
|
@@ -4927,13 +5462,13 @@
|
|
|
4927
5462
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
4928
5463
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
4929
5464
|
case 2:
|
|
4930
|
-
|
|
5465
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
4931
5466
|
return [3 /*break*/, 4];
|
|
4932
5467
|
case 3:
|
|
4933
|
-
|
|
4934
|
-
|
|
5468
|
+
_e = zoomItem.Style;
|
|
5469
|
+
_f.label = 4;
|
|
4935
5470
|
case 4:
|
|
4936
|
-
style =
|
|
5471
|
+
style = _e;
|
|
4937
5472
|
tagIds = entity.Bruce["Layer.ID"];
|
|
4938
5473
|
tags = [];
|
|
4939
5474
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -4942,8 +5477,8 @@
|
|
|
4942
5477
|
tagIds: tagIds
|
|
4943
5478
|
})];
|
|
4944
5479
|
case 5:
|
|
4945
|
-
tags = (
|
|
4946
|
-
|
|
5480
|
+
tags = (_f.sent()).tags;
|
|
5481
|
+
_f.label = 6;
|
|
4947
5482
|
case 6:
|
|
4948
5483
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
4949
5484
|
return [4 /*yield*/, Render({
|
|
@@ -4954,20 +5489,21 @@
|
|
|
4954
5489
|
api: api,
|
|
4955
5490
|
apiGetter: params.apiGetter,
|
|
4956
5491
|
maxDistance: zoomItem.MaxZoom,
|
|
4957
|
-
minDistance: zoomItem.MinZoom
|
|
5492
|
+
minDistance: zoomItem.MinZoom,
|
|
5493
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
4958
5494
|
})];
|
|
4959
5495
|
case 7:
|
|
4960
|
-
cEntity =
|
|
5496
|
+
cEntity = _f.sent();
|
|
4961
5497
|
if (!cEntity) return [3 /*break*/, 9];
|
|
4962
5498
|
return [4 /*yield*/, getName(api, entity)];
|
|
4963
5499
|
case 8:
|
|
4964
|
-
name_2 =
|
|
5500
|
+
name_2 = _f.sent();
|
|
4965
5501
|
cEntity.name = name_2;
|
|
4966
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
4967
|
-
|
|
5502
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5503
|
+
_f.label = 9;
|
|
4968
5504
|
case 9:
|
|
4969
5505
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
4970
|
-
|
|
5506
|
+
_f.label = 10;
|
|
4971
5507
|
case 10:
|
|
4972
5508
|
i++;
|
|
4973
5509
|
return [3 /*break*/, 1];
|
|
@@ -5052,52 +5588,110 @@
|
|
|
5052
5588
|
if (style.drapeOver == "ALL") {
|
|
5053
5589
|
classification = Cesium.ClassificationType.BOTH;
|
|
5054
5590
|
}
|
|
5055
|
-
var cEntity =
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5591
|
+
var cEntity = null;
|
|
5592
|
+
if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
|
|
5593
|
+
(!params.rendered.corridor && units == "m"))) {
|
|
5594
|
+
cEntity = new Cesium.Entity({
|
|
5595
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5596
|
+
polyline: units == "px" ? {
|
|
5597
|
+
positions: posses,
|
|
5598
|
+
material: cColor,
|
|
5599
|
+
width: width,
|
|
5600
|
+
classificationType: classification,
|
|
5601
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
5602
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5603
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
5604
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5605
|
+
} : null,
|
|
5606
|
+
corridor: units == "m" ? {
|
|
5607
|
+
positions: posses,
|
|
5608
|
+
material: cColor,
|
|
5609
|
+
width: width,
|
|
5610
|
+
classificationType: classification,
|
|
5611
|
+
heightReference: heightRef,
|
|
5612
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5613
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5614
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
5615
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
5616
|
+
fill: true
|
|
5617
|
+
} : null,
|
|
5618
|
+
position: exports.EntityUtils.GetPos({
|
|
5619
|
+
viewer: params.viewer,
|
|
5620
|
+
entity: entity,
|
|
5621
|
+
recordHeightRef: heightRef,
|
|
5622
|
+
returnHeightRef: heightRef
|
|
5623
|
+
}),
|
|
5624
|
+
show: true
|
|
5625
|
+
});
|
|
5626
|
+
}
|
|
5627
|
+
else {
|
|
5628
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5629
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5630
|
+
entity: cEntity,
|
|
5631
|
+
});
|
|
5632
|
+
if (parts.length > 1) {
|
|
5633
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
5634
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5635
|
+
var part = parts[i];
|
|
5636
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
5637
|
+
params.viewer.entities.remove(part);
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
cEntity._siblingGraphics = [];
|
|
5641
|
+
if (cEntity._parentEntity) {
|
|
5642
|
+
console.warn("Polyline.Render: Parent entity was not null. This should not happen.");
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
cEntity = params.rendered;
|
|
5646
|
+
if (units == "px") {
|
|
5647
|
+
cEntity.polyline.positions = new Cesium.ConstantProperty(posses);
|
|
5648
|
+
cEntity.polyline.width = new Cesium.ConstantProperty(width);
|
|
5649
|
+
cEntity.polyline.classificationType = new Cesium.ConstantProperty(classification);
|
|
5650
|
+
cEntity.polyline.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5651
|
+
cEntity.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
5652
|
+
cEntity.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5653
|
+
cEntity.corridor = undefined;
|
|
5654
|
+
}
|
|
5655
|
+
else {
|
|
5656
|
+
cEntity.corridor.positions = new Cesium.ConstantProperty(posses);
|
|
5657
|
+
cEntity.corridor.width = new Cesium.ConstantProperty(width);
|
|
5658
|
+
cEntity.corridor.classificationType = new Cesium.ConstantProperty(classification);
|
|
5659
|
+
cEntity.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5660
|
+
cEntity.corridor.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5661
|
+
cEntity.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5662
|
+
cEntity.polyline = undefined;
|
|
5663
|
+
}
|
|
5664
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5665
|
+
// WARNING: polyline does not support animation (yet?).
|
|
5666
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5667
|
+
color: cColor,
|
|
5668
|
+
entity: cEntity,
|
|
5669
|
+
viewer: params.viewer,
|
|
5670
|
+
override: true,
|
|
5671
|
+
requestRender: false
|
|
5672
|
+
});
|
|
5673
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
5080
5674
|
viewer: params.viewer,
|
|
5081
5675
|
entity: entity,
|
|
5082
5676
|
recordHeightRef: heightRef,
|
|
5083
5677
|
returnHeightRef: heightRef
|
|
5084
|
-
})
|
|
5085
|
-
show
|
|
5086
|
-
}
|
|
5678
|
+
}));
|
|
5679
|
+
cEntity.show = true;
|
|
5680
|
+
}
|
|
5087
5681
|
return cEntity;
|
|
5088
5682
|
}
|
|
5089
5683
|
Polyline.Render = Render;
|
|
5090
5684
|
function RenderGroup(params) {
|
|
5091
|
-
var _a, _b, _c;
|
|
5685
|
+
var _a, _b, _c, _d;
|
|
5092
5686
|
return __awaiter(this, void 0, void 0, function () {
|
|
5093
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5094
|
-
return __generator(this, function (
|
|
5095
|
-
switch (
|
|
5687
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, lStyle, cEntity, name_3;
|
|
5688
|
+
return __generator(this, function (_f) {
|
|
5689
|
+
switch (_f.label) {
|
|
5096
5690
|
case 0:
|
|
5097
5691
|
api = params.apiGetter.getApi();
|
|
5098
5692
|
cEntities = {};
|
|
5099
5693
|
i = 0;
|
|
5100
|
-
|
|
5694
|
+
_f.label = 1;
|
|
5101
5695
|
case 1:
|
|
5102
5696
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5103
5697
|
entity = params.entities[i];
|
|
@@ -5105,13 +5699,13 @@
|
|
|
5105
5699
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5106
5700
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5107
5701
|
case 2:
|
|
5108
|
-
|
|
5702
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5109
5703
|
return [3 /*break*/, 4];
|
|
5110
5704
|
case 3:
|
|
5111
|
-
|
|
5112
|
-
|
|
5705
|
+
_e = zoomItem.Style;
|
|
5706
|
+
_f.label = 4;
|
|
5113
5707
|
case 4:
|
|
5114
|
-
style =
|
|
5708
|
+
style = _e;
|
|
5115
5709
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5116
5710
|
tags = [];
|
|
5117
5711
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5120,8 +5714,8 @@
|
|
|
5120
5714
|
tagIds: tagIds
|
|
5121
5715
|
})];
|
|
5122
5716
|
case 5:
|
|
5123
|
-
tags = (
|
|
5124
|
-
|
|
5717
|
+
tags = (_f.sent()).tags;
|
|
5718
|
+
_f.label = 6;
|
|
5125
5719
|
case 6:
|
|
5126
5720
|
lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
5127
5721
|
cEntity = Render({
|
|
@@ -5130,16 +5724,17 @@
|
|
|
5130
5724
|
tags: tags,
|
|
5131
5725
|
viewer: params.viewer,
|
|
5132
5726
|
maxDistance: zoomItem.MaxZoom,
|
|
5133
|
-
minDistance: zoomItem.MinZoom
|
|
5727
|
+
minDistance: zoomItem.MinZoom,
|
|
5728
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5134
5729
|
});
|
|
5135
5730
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5136
5731
|
return [4 /*yield*/, getName(api, entity)];
|
|
5137
5732
|
case 7:
|
|
5138
|
-
name_3 =
|
|
5733
|
+
name_3 = _f.sent();
|
|
5139
5734
|
cEntity.name = name_3;
|
|
5140
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
5735
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5141
5736
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5142
|
-
|
|
5737
|
+
_f.label = 8;
|
|
5143
5738
|
case 8:
|
|
5144
5739
|
i++;
|
|
5145
5740
|
return [3 /*break*/, 1];
|
|
@@ -5153,7 +5748,7 @@
|
|
|
5153
5748
|
var Polygon;
|
|
5154
5749
|
(function (Polygon) {
|
|
5155
5750
|
function Render(params) {
|
|
5156
|
-
var _a, _b;
|
|
5751
|
+
var _a, _b, _c, _d;
|
|
5157
5752
|
var entity = params.entity;
|
|
5158
5753
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
5159
5754
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -5210,30 +5805,85 @@
|
|
|
5210
5805
|
if (style.drapeOver == "ALL") {
|
|
5211
5806
|
classification = Cesium.ClassificationType.BOTH;
|
|
5212
5807
|
}
|
|
5213
|
-
var
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5808
|
+
var prepareExistingGraphic = function (cEntity, siblings) {
|
|
5809
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5810
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5811
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5812
|
+
entity: cEntity,
|
|
5813
|
+
});
|
|
5814
|
+
if (parts.length > 1) {
|
|
5815
|
+
// We'll cull all except the allowed number of siblings.
|
|
5816
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5817
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5818
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5819
|
+
var part = parts[i];
|
|
5820
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5821
|
+
params.viewer.entities.remove(part);
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
if (cEntity._parentEntity) {
|
|
5825
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5828
|
+
};
|
|
5829
|
+
var hasOutline = width > 0 && cLineColor;
|
|
5830
|
+
var cEntity = null;
|
|
5831
|
+
if (!params.rendered || !params.rendered.polygon) {
|
|
5832
|
+
cEntity = new Cesium.Entity({
|
|
5833
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5834
|
+
polygon: {
|
|
5835
|
+
hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
|
|
5836
|
+
material: cFillColor,
|
|
5837
|
+
extrudedHeight: extrusion.value,
|
|
5838
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
5839
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
5840
|
+
heightReference: heightRef,
|
|
5841
|
+
classificationType: classification,
|
|
5842
|
+
perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
|
|
5843
|
+
zIndex: zIndex,
|
|
5844
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
|
|
5845
|
+
},
|
|
5846
|
+
position: exports.EntityUtils.GetPos({
|
|
5847
|
+
viewer: params.viewer,
|
|
5848
|
+
entity: entity,
|
|
5849
|
+
recordHeightRef: heightRef,
|
|
5850
|
+
returnHeightRef: heightRef
|
|
5851
|
+
}),
|
|
5852
|
+
show: true
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5855
|
+
else {
|
|
5856
|
+
// Polygons can have more siblings for the related hole graphics.
|
|
5857
|
+
// So this is a "good enough" way rather than perfect as it only preserves the outline.
|
|
5858
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5859
|
+
cEntity = params.rendered;
|
|
5860
|
+
cEntity.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })));
|
|
5861
|
+
cEntity.polygon.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
5862
|
+
cEntity.polygon.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
5863
|
+
cEntity.polygon.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
5864
|
+
cEntity.polygon.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5865
|
+
cEntity.polygon.classificationType = new Cesium.ConstantProperty(classification);
|
|
5866
|
+
cEntity.polygon.perPositionHeight = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true);
|
|
5867
|
+
cEntity.polygon.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
5868
|
+
cEntity.polygon.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
|
|
5869
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
5228
5870
|
viewer: params.viewer,
|
|
5229
5871
|
entity: entity,
|
|
5230
5872
|
recordHeightRef: heightRef,
|
|
5231
5873
|
returnHeightRef: heightRef
|
|
5232
|
-
})
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5874
|
+
}));
|
|
5875
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5876
|
+
// WARNING: polygon does not support animation (yet?).
|
|
5877
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5878
|
+
color: cFillColor,
|
|
5879
|
+
entity: cEntity,
|
|
5880
|
+
viewer: params.viewer,
|
|
5881
|
+
override: true,
|
|
5882
|
+
requestRender: false
|
|
5883
|
+
});
|
|
5884
|
+
cEntity.show = true;
|
|
5885
|
+
}
|
|
5886
|
+
if (hasOutline) {
|
|
5237
5887
|
var borderHeight = undefined;
|
|
5238
5888
|
if (heightRef != Cesium.HeightReference.CLAMP_TO_GROUND) {
|
|
5239
5889
|
if (flattenPoints) {
|
|
@@ -5257,33 +5907,62 @@
|
|
|
5257
5907
|
else {
|
|
5258
5908
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
5259
5909
|
}
|
|
5260
|
-
var cEntityBorder =
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5910
|
+
var cEntityBorder = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5911
|
+
cEntity._siblingGraphics = [];
|
|
5912
|
+
if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
|
|
5913
|
+
(!cEntityBorder.corridor && units == "m"))) {
|
|
5914
|
+
cEntityBorder = new Cesium.Entity({
|
|
5915
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5916
|
+
polyline: units == "px" ? new Cesium.PolylineGraphics({
|
|
5917
|
+
positions: borderPosses,
|
|
5918
|
+
material: cLineColor,
|
|
5919
|
+
width: width,
|
|
5920
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
5921
|
+
classificationType: Cesium.ClassificationType.TERRAIN,
|
|
5922
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
5923
|
+
zIndex: zIndex,
|
|
5924
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5925
|
+
}) : null,
|
|
5926
|
+
corridor: units == "m" ? {
|
|
5927
|
+
positions: borderPosses,
|
|
5928
|
+
material: cLineColor,
|
|
5929
|
+
heightReference: heightRef,
|
|
5930
|
+
height: borderHeight,
|
|
5931
|
+
width: width,
|
|
5932
|
+
fill: true,
|
|
5933
|
+
zIndex: zIndex + 1,
|
|
5934
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
5935
|
+
classificationType: classification,
|
|
5936
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5937
|
+
shadows: Cesium.ShadowMode.ENABLED
|
|
5938
|
+
} : null,
|
|
5939
|
+
show: true
|
|
5940
|
+
});
|
|
5941
|
+
}
|
|
5942
|
+
else {
|
|
5943
|
+
if (units == "px") {
|
|
5944
|
+
cEntityBorder.polyline.positions = new Cesium.ConstantProperty(borderPosses);
|
|
5945
|
+
cEntityBorder.polyline.width = new Cesium.ConstantProperty(width);
|
|
5946
|
+
cEntityBorder.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
5947
|
+
cEntityBorder.polyline.classificationType = new Cesium.ConstantProperty(Cesium.ClassificationType.TERRAIN);
|
|
5948
|
+
cEntityBorder.polyline.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
5949
|
+
cEntityBorder.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5950
|
+
cEntityBorder.polyline.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
5951
|
+
cEntityBorder.corridor = undefined;
|
|
5952
|
+
}
|
|
5953
|
+
else {
|
|
5954
|
+
cEntityBorder.corridor.positions = new Cesium.ConstantProperty(borderPosses);
|
|
5955
|
+
cEntityBorder.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5956
|
+
cEntityBorder.corridor.height = new Cesium.ConstantProperty(borderHeight);
|
|
5957
|
+
cEntityBorder.corridor.width = new Cesium.ConstantProperty(width);
|
|
5958
|
+
cEntityBorder.corridor.fill = new Cesium.ConstantProperty(true);
|
|
5959
|
+
cEntityBorder.corridor.zIndex = new Cesium.ConstantProperty(zIndex + 1);
|
|
5960
|
+
cEntityBorder.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5961
|
+
cEntityBorder.corridor.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
5962
|
+
cEntityBorder.polyline = undefined;
|
|
5963
|
+
}
|
|
5964
|
+
cEntityBorder.show = true;
|
|
5965
|
+
}
|
|
5287
5966
|
cEntityBorder._parentEntity = cEntity;
|
|
5288
5967
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
5289
5968
|
for (var i = 0; i < holePosses.length; i++) {
|
|
@@ -5320,20 +5999,23 @@
|
|
|
5320
5999
|
cEntityHole._parentEntity = cEntity;
|
|
5321
6000
|
}
|
|
5322
6001
|
}
|
|
6002
|
+
else {
|
|
6003
|
+
cEntity._siblingGraphics = [];
|
|
6004
|
+
}
|
|
5323
6005
|
return cEntity;
|
|
5324
6006
|
}
|
|
5325
6007
|
Polygon.Render = Render;
|
|
5326
6008
|
function RenderGroup(params) {
|
|
5327
|
-
var _a, _b, _c;
|
|
6009
|
+
var _a, _b, _c, _d;
|
|
5328
6010
|
return __awaiter(this, void 0, void 0, function () {
|
|
5329
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5330
|
-
return __generator(this, function (
|
|
5331
|
-
switch (
|
|
6011
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_4;
|
|
6012
|
+
return __generator(this, function (_f) {
|
|
6013
|
+
switch (_f.label) {
|
|
5332
6014
|
case 0:
|
|
5333
6015
|
api = params.apiGetter.getApi();
|
|
5334
6016
|
cEntities = {};
|
|
5335
6017
|
i = 0;
|
|
5336
|
-
|
|
6018
|
+
_f.label = 1;
|
|
5337
6019
|
case 1:
|
|
5338
6020
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5339
6021
|
entity = params.entities[i];
|
|
@@ -5341,13 +6023,13 @@
|
|
|
5341
6023
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5342
6024
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5343
6025
|
case 2:
|
|
5344
|
-
|
|
6026
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5345
6027
|
return [3 /*break*/, 4];
|
|
5346
6028
|
case 3:
|
|
5347
|
-
|
|
5348
|
-
|
|
6029
|
+
_e = zoomItem.Style;
|
|
6030
|
+
_f.label = 4;
|
|
5349
6031
|
case 4:
|
|
5350
|
-
style =
|
|
6032
|
+
style = _e;
|
|
5351
6033
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5352
6034
|
tags = [];
|
|
5353
6035
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5356,8 +6038,8 @@
|
|
|
5356
6038
|
tagIds: tagIds
|
|
5357
6039
|
})];
|
|
5358
6040
|
case 5:
|
|
5359
|
-
tags = (
|
|
5360
|
-
|
|
6041
|
+
tags = (_f.sent()).tags;
|
|
6042
|
+
_f.label = 6;
|
|
5361
6043
|
case 6:
|
|
5362
6044
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
5363
6045
|
cEntity = Render({
|
|
@@ -5366,16 +6048,17 @@
|
|
|
5366
6048
|
tags: tags,
|
|
5367
6049
|
viewer: params.viewer,
|
|
5368
6050
|
maxDistance: zoomItem.MaxZoom,
|
|
5369
|
-
minDistance: zoomItem.MinZoom
|
|
6051
|
+
minDistance: zoomItem.MinZoom,
|
|
6052
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5370
6053
|
});
|
|
5371
6054
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5372
6055
|
return [4 /*yield*/, getName(api, entity)];
|
|
5373
6056
|
case 7:
|
|
5374
|
-
name_4 =
|
|
6057
|
+
name_4 = _f.sent();
|
|
5375
6058
|
cEntity.name = name_4;
|
|
5376
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6059
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5377
6060
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5378
|
-
|
|
6061
|
+
_f.label = 8;
|
|
5379
6062
|
case 8:
|
|
5380
6063
|
i++;
|
|
5381
6064
|
return [3 /*break*/, 1];
|
|
@@ -5439,8 +6122,9 @@
|
|
|
5439
6122
|
color = colorToCColor(bColor);
|
|
5440
6123
|
}
|
|
5441
6124
|
}
|
|
5442
|
-
|
|
5443
|
-
|
|
6125
|
+
/*
|
|
6126
|
+
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
6127
|
+
id: ObjectUtils.UId(10),
|
|
5444
6128
|
model: {
|
|
5445
6129
|
uri: params.lodUrl,
|
|
5446
6130
|
heightReference: heightRef,
|
|
@@ -5448,13 +6132,89 @@
|
|
|
5448
6132
|
shadows: Cesium.ShadowMode.ENABLED,
|
|
5449
6133
|
colorBlendAmount: blendAmount,
|
|
5450
6134
|
colorBlendMode: blendMode,
|
|
5451
|
-
color: color,
|
|
6135
|
+
color: new Cesium.CallbackProperty(() => color, true),
|
|
5452
6136
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5453
6137
|
},
|
|
5454
6138
|
orientation: new Cesium.ConstantProperty(orientation),
|
|
5455
6139
|
position: pos,
|
|
5456
6140
|
show: true
|
|
5457
6141
|
});
|
|
6142
|
+
*/
|
|
6143
|
+
var animateScale = null;
|
|
6144
|
+
var cEntity = params.rendered;
|
|
6145
|
+
if (!cEntity || !cEntity.model) {
|
|
6146
|
+
cEntity = new Cesium.Entity({
|
|
6147
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
6148
|
+
model: {
|
|
6149
|
+
uri: params.lodUrl,
|
|
6150
|
+
heightReference: heightRef,
|
|
6151
|
+
scale: new Cesium.CallbackProperty(function () { return scale * styleScale; }, true),
|
|
6152
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
6153
|
+
colorBlendAmount: blendAmount,
|
|
6154
|
+
colorBlendMode: blendMode,
|
|
6155
|
+
color: new Cesium.CallbackProperty(function () { return color; }, true),
|
|
6156
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
6157
|
+
},
|
|
6158
|
+
orientation: new Cesium.ConstantProperty(orientation),
|
|
6159
|
+
position: pos,
|
|
6160
|
+
show: true
|
|
6161
|
+
});
|
|
6162
|
+
}
|
|
6163
|
+
else {
|
|
6164
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
6165
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
6166
|
+
entity: cEntity,
|
|
6167
|
+
});
|
|
6168
|
+
if (parts.length > 1) {
|
|
6169
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
6170
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
6171
|
+
var part = parts[i];
|
|
6172
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
6173
|
+
params.viewer.entities.remove(part);
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6176
|
+
cEntity._siblingGraphics = [];
|
|
6177
|
+
if (cEntity._parentEntity) {
|
|
6178
|
+
console.warn("Model3d.Render: Parent entity was not null. This should not happen.");
|
|
6179
|
+
}
|
|
6180
|
+
}
|
|
6181
|
+
var currentUri = getValue$1(params.viewer, cEntity.model.uri);
|
|
6182
|
+
if (currentUri != params.lodUrl) {
|
|
6183
|
+
cEntity.model.uri = new Cesium.ConstantProperty(params.lodUrl);
|
|
6184
|
+
}
|
|
6185
|
+
cEntity.model.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
6186
|
+
cEntity.model.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
6187
|
+
cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
|
|
6188
|
+
cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
|
|
6189
|
+
cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
6190
|
+
cEntity.orientation = new Cesium.ConstantProperty(orientation);
|
|
6191
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos);
|
|
6192
|
+
// Same file but different scale. We'll animate the scale.
|
|
6193
|
+
var prevClientFileId = cEntity.model._clientFileId;
|
|
6194
|
+
if (prevClientFileId == params.lodClientFileId) {
|
|
6195
|
+
animateScale = new CesiumAnimatedProperty.AnimateNumber({
|
|
6196
|
+
durationMs: 200,
|
|
6197
|
+
value: scale * styleScale,
|
|
6198
|
+
viewer: params.viewer,
|
|
6199
|
+
startValue: cEntity.model.scale,
|
|
6200
|
+
startPaused: true
|
|
6201
|
+
});
|
|
6202
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return animateScale.GetValue(); }, false);
|
|
6203
|
+
}
|
|
6204
|
+
else {
|
|
6205
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return scale * styleScale; }, true);
|
|
6206
|
+
}
|
|
6207
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
6208
|
+
// cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
|
|
6209
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
6210
|
+
color: color,
|
|
6211
|
+
entity: cEntity,
|
|
6212
|
+
viewer: params.viewer,
|
|
6213
|
+
override: true,
|
|
6214
|
+
requestRender: false
|
|
6215
|
+
});
|
|
6216
|
+
cEntity.show = true;
|
|
6217
|
+
}
|
|
5458
6218
|
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
5459
6219
|
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
5460
6220
|
if (!heightProm) {
|
|
@@ -5533,6 +6293,10 @@
|
|
|
5533
6293
|
VisualRegisterCuller.MarkShouldRecheck(params.viewer);
|
|
5534
6294
|
}
|
|
5535
6295
|
}
|
|
6296
|
+
// Rough estimate on when the model is ready in the scene.
|
|
6297
|
+
if (animateScale) {
|
|
6298
|
+
animateScale.Play();
|
|
6299
|
+
}
|
|
5536
6300
|
});
|
|
5537
6301
|
var model = cEntity.model;
|
|
5538
6302
|
model._radiusLoaded = false;
|
|
@@ -5545,16 +6309,16 @@
|
|
|
5545
6309
|
}
|
|
5546
6310
|
Model3d.Render = Render;
|
|
5547
6311
|
function RenderGroup(params) {
|
|
5548
|
-
var _a, _b, _c, _d, _e;
|
|
6312
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5549
6313
|
return __awaiter(this, void 0, void 0, function () {
|
|
5550
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
5551
|
-
return __generator(this, function (
|
|
5552
|
-
switch (
|
|
6314
|
+
var api, cEntities, reqBody, i, entity, zoomItem, style, _g, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
6315
|
+
return __generator(this, function (_h) {
|
|
6316
|
+
switch (_h.label) {
|
|
5553
6317
|
case 0:
|
|
5554
6318
|
api = params.apiGetter.getApi();
|
|
5555
6319
|
return [4 /*yield*/, api.Loading];
|
|
5556
6320
|
case 1:
|
|
5557
|
-
|
|
6321
|
+
_h.sent();
|
|
5558
6322
|
cEntities = {};
|
|
5559
6323
|
reqBody = {
|
|
5560
6324
|
"strict": false,
|
|
@@ -5562,7 +6326,7 @@
|
|
|
5562
6326
|
"Items": []
|
|
5563
6327
|
};
|
|
5564
6328
|
i = 0;
|
|
5565
|
-
|
|
6329
|
+
_h.label = 2;
|
|
5566
6330
|
case 2:
|
|
5567
6331
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5568
6332
|
entity = params.entities[i];
|
|
@@ -5570,13 +6334,13 @@
|
|
|
5570
6334
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
5571
6335
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5572
6336
|
case 3:
|
|
5573
|
-
|
|
6337
|
+
_g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5574
6338
|
return [3 /*break*/, 5];
|
|
5575
6339
|
case 4:
|
|
5576
|
-
|
|
5577
|
-
|
|
6340
|
+
_g = zoomItem.Style;
|
|
6341
|
+
_h.label = 5;
|
|
5578
6342
|
case 5:
|
|
5579
|
-
style =
|
|
6343
|
+
style = _g;
|
|
5580
6344
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5581
6345
|
tags = [];
|
|
5582
6346
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -5585,8 +6349,8 @@
|
|
|
5585
6349
|
tagIds: tagIds
|
|
5586
6350
|
})];
|
|
5587
6351
|
case 6:
|
|
5588
|
-
tags = (
|
|
5589
|
-
|
|
6352
|
+
tags = (_h.sent()).tags;
|
|
6353
|
+
_h.label = 7;
|
|
5590
6354
|
case 7:
|
|
5591
6355
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
5592
6356
|
group = mStyle.lodGroup ? bruceModels.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -5607,7 +6371,7 @@
|
|
|
5607
6371
|
"group": group,
|
|
5608
6372
|
"level": level
|
|
5609
6373
|
});
|
|
5610
|
-
|
|
6374
|
+
_h.label = 8;
|
|
5611
6375
|
case 8:
|
|
5612
6376
|
i++;
|
|
5613
6377
|
return [3 /*break*/, 2];
|
|
@@ -5616,24 +6380,24 @@
|
|
|
5616
6380
|
filter: reqBody
|
|
5617
6381
|
})];
|
|
5618
6382
|
case 10:
|
|
5619
|
-
lodData = (
|
|
6383
|
+
lodData = (_h.sent()).lods;
|
|
5620
6384
|
_loop_2 = function (i) {
|
|
5621
|
-
var entity, zoomItem, style,
|
|
5622
|
-
return __generator(this, function (
|
|
5623
|
-
switch (
|
|
6385
|
+
var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
6386
|
+
return __generator(this, function (_k) {
|
|
6387
|
+
switch (_k.label) {
|
|
5624
6388
|
case 0:
|
|
5625
6389
|
entity = params.entities[i];
|
|
5626
6390
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
5627
6391
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
5628
6392
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5629
6393
|
case 1:
|
|
5630
|
-
|
|
6394
|
+
_j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
5631
6395
|
return [3 /*break*/, 3];
|
|
5632
6396
|
case 2:
|
|
5633
|
-
|
|
5634
|
-
|
|
6397
|
+
_j = zoomItem.Style;
|
|
6398
|
+
_k.label = 3;
|
|
5635
6399
|
case 3:
|
|
5636
|
-
style =
|
|
6400
|
+
style = _j;
|
|
5637
6401
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5638
6402
|
tags = [];
|
|
5639
6403
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -5642,8 +6406,8 @@
|
|
|
5642
6406
|
tagIds: tagIds
|
|
5643
6407
|
})];
|
|
5644
6408
|
case 4:
|
|
5645
|
-
tags = (
|
|
5646
|
-
|
|
6409
|
+
tags = (_k.sent()).tags;
|
|
6410
|
+
_k.label = 5;
|
|
5647
6411
|
case 5:
|
|
5648
6412
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
5649
6413
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -5651,6 +6415,7 @@
|
|
|
5651
6415
|
}
|
|
5652
6416
|
mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
|
|
5653
6417
|
cEntity = Render({
|
|
6418
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
|
|
5654
6419
|
entity: entity,
|
|
5655
6420
|
style: mStyle,
|
|
5656
6421
|
tags: tags,
|
|
@@ -5667,23 +6432,23 @@
|
|
|
5667
6432
|
if (!cEntity) return [3 /*break*/, 7];
|
|
5668
6433
|
return [4 /*yield*/, getName(api, entity)];
|
|
5669
6434
|
case 6:
|
|
5670
|
-
name_5 =
|
|
6435
|
+
name_5 = _k.sent();
|
|
5671
6436
|
cEntity.name = name_5;
|
|
5672
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6437
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
|
|
5673
6438
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5674
|
-
|
|
6439
|
+
_k.label = 7;
|
|
5675
6440
|
case 7: return [2 /*return*/];
|
|
5676
6441
|
}
|
|
5677
6442
|
});
|
|
5678
6443
|
};
|
|
5679
6444
|
i = 0;
|
|
5680
|
-
|
|
6445
|
+
_h.label = 11;
|
|
5681
6446
|
case 11:
|
|
5682
6447
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
5683
6448
|
return [5 /*yield**/, _loop_2(i)];
|
|
5684
6449
|
case 12:
|
|
5685
|
-
|
|
5686
|
-
|
|
6450
|
+
_h.sent();
|
|
6451
|
+
_h.label = 13;
|
|
5687
6452
|
case 13:
|
|
5688
6453
|
i++;
|
|
5689
6454
|
return [3 /*break*/, 11];
|
|
@@ -8973,7 +9738,8 @@
|
|
|
8973
9738
|
// So for multiple tags we'll manually sort on UI end...
|
|
8974
9739
|
tagIds: (tagsToRender === null || tagsToRender === void 0 ? void 0 : tagsToRender.length) ? tagsToRender : [],
|
|
8975
9740
|
debugShowBounds: Boolean(window === null || window === void 0 ? void 0 : window.ENTITIES_RENDER_MANAGER_SHOW_BOUNDS),
|
|
8976
|
-
cdn: this.item.cdnEnabled
|
|
9741
|
+
cdn: this.item.cdnEnabled,
|
|
9742
|
+
historicAttrKey: this.item.BruceEntity.historicAttrKey
|
|
8977
9743
|
});
|
|
8978
9744
|
var minMax = exports.RenderManager.GetZoomMinMax({
|
|
8979
9745
|
zoomControl: this.item.CameraZoomSettings
|
|
@@ -9535,23 +10301,37 @@
|
|
|
9535
10301
|
* @returns
|
|
9536
10302
|
*/
|
|
9537
10303
|
Manager.prototype.renderAsIndividuals = function (entities, force) {
|
|
9538
|
-
var _a, _b, _c;
|
|
10304
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
9539
10305
|
if (force === void 0) { force = false; }
|
|
9540
10306
|
return __awaiter(this, void 0, void 0, function () {
|
|
9541
|
-
var cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
|
|
9542
|
-
return __generator(this, function (
|
|
9543
|
-
switch (
|
|
9544
|
-
case 0:
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
10307
|
+
var toRemove, i, entity, cEntities, i, entity, id, cEntity, visual, wasClustered, tagIds, rego;
|
|
10308
|
+
return __generator(this, function (_h) {
|
|
10309
|
+
switch (_h.label) {
|
|
10310
|
+
case 0:
|
|
10311
|
+
if ((_a = this.item.BruceEntity) === null || _a === void 0 ? void 0 : _a.historicAttrKey) {
|
|
10312
|
+
toRemove = entities.filter(function (x) { var _a; return !((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
|
|
10313
|
+
for (i = 0; i < toRemove.length; i++) {
|
|
10314
|
+
entity = toRemove[i];
|
|
10315
|
+
this.visualsManager.RemoveRegos({
|
|
10316
|
+
entityId: entity.Bruce.ID,
|
|
10317
|
+
menuItemId: this.item.id,
|
|
10318
|
+
requestRender: false
|
|
10319
|
+
});
|
|
10320
|
+
(_b = this.clustering) === null || _b === void 0 ? void 0 : _b.RemoveEntity(entity.Bruce.ID, false);
|
|
10321
|
+
}
|
|
10322
|
+
entities = entities.filter(function (x) { var _a; return !!((_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.historicAttrKey); });
|
|
10323
|
+
}
|
|
10324
|
+
return [4 /*yield*/, exports.EntityRenderEngine.Render({
|
|
10325
|
+
viewer: this.viewer,
|
|
10326
|
+
apiGetter: this.apiGetter,
|
|
10327
|
+
entities: entities,
|
|
10328
|
+
menuItemId: this.item.id,
|
|
10329
|
+
visualRegister: this.visualsManager,
|
|
10330
|
+
zoomControl: this.item.CameraZoomSettings,
|
|
10331
|
+
force: force
|
|
10332
|
+
})];
|
|
9553
10333
|
case 1:
|
|
9554
|
-
cEntities =
|
|
10334
|
+
cEntities = _h.sent();
|
|
9555
10335
|
if (this.disposed) {
|
|
9556
10336
|
this.doDispose();
|
|
9557
10337
|
return [2 /*return*/];
|
|
@@ -9562,13 +10342,13 @@
|
|
|
9562
10342
|
cEntity = cEntities[id];
|
|
9563
10343
|
this.renderedEntities[id] = !!cEntity;
|
|
9564
10344
|
if (cEntity) {
|
|
9565
|
-
visual = (
|
|
10345
|
+
visual = (_c = this.visualsManager.GetRego({
|
|
9566
10346
|
entityId: id,
|
|
9567
10347
|
menuItemId: this.item.id
|
|
9568
|
-
})) === null ||
|
|
10348
|
+
})) === null || _c === void 0 ? void 0 : _c.visual;
|
|
9569
10349
|
if (!visual || visual != cEntity) {
|
|
9570
10350
|
wasClustered = this.clustering ? this.clustering.AddEntity(id, cEntity, false) : false;
|
|
9571
|
-
tagIds = (
|
|
10351
|
+
tagIds = (_d = entity.Bruce) === null || _d === void 0 ? void 0 : _d["Layer.ID"];
|
|
9572
10352
|
rego = {
|
|
9573
10353
|
entityId: id,
|
|
9574
10354
|
menuItemId: this.item.id,
|
|
@@ -9579,7 +10359,9 @@
|
|
|
9579
10359
|
tagIds: tagIds ? [].concat(tagIds) : [],
|
|
9580
10360
|
overrideShow: wasClustered ? false : null,
|
|
9581
10361
|
name: cEntity.name,
|
|
9582
|
-
cdn: this.item.cdnEnabled
|
|
10362
|
+
cdn: this.item.cdnEnabled,
|
|
10363
|
+
historicDateTime: (_e = entity.Bruce) === null || _e === void 0 ? void 0 : _e.historicDateTime,
|
|
10364
|
+
historicAttrKey: (_f = entity.Bruce) === null || _f === void 0 ? void 0 : _f.historicAttrKey
|
|
9583
10365
|
};
|
|
9584
10366
|
this.visualsManager.AddRego({
|
|
9585
10367
|
rego: rego,
|
|
@@ -9593,7 +10375,7 @@
|
|
|
9593
10375
|
menuItemId: this.item.id,
|
|
9594
10376
|
requestRender: false
|
|
9595
10377
|
});
|
|
9596
|
-
(
|
|
10378
|
+
(_g = this.clustering) === null || _g === void 0 ? void 0 : _g.RemoveEntity(id, false);
|
|
9597
10379
|
}
|
|
9598
10380
|
}
|
|
9599
10381
|
this.viewer.scene.requestRender();
|
|
@@ -11758,6 +12540,16 @@
|
|
|
11758
12540
|
};
|
|
11759
12541
|
Styler.prototype.QueueEntities = function (entities, highPriority) {
|
|
11760
12542
|
if (highPriority === void 0) { highPriority = false; }
|
|
12543
|
+
// We set a default colour right away to avoid race conditions at later times.
|
|
12544
|
+
for (var i = 0; i < entities.length; i++) {
|
|
12545
|
+
var entity = entities[i];
|
|
12546
|
+
this.styledEntityIds[entity.entityId] = true;
|
|
12547
|
+
exports.CesiumEntityStyler.BakeDefaultColor({
|
|
12548
|
+
entity: entity.visual,
|
|
12549
|
+
viewer: this.viewer,
|
|
12550
|
+
override: false
|
|
12551
|
+
});
|
|
12552
|
+
}
|
|
11761
12553
|
for (var i = 0; i < entities.length; i++) {
|
|
11762
12554
|
var entity = entities[i];
|
|
11763
12555
|
this.queueTilesetFeatureStyle(entity, highPriority);
|
|
@@ -12784,12 +13576,13 @@
|
|
|
12784
13576
|
EStatus["Loading"] = "LOADING";
|
|
12785
13577
|
})(EStatus = EntityFilterGetter.EStatus || (EntityFilterGetter.EStatus = {}));
|
|
12786
13578
|
var Getter = /** @class */ (function () {
|
|
12787
|
-
function Getter(api, viewPort, typeId, batchSize, attrFilter, viaCdn) {
|
|
13579
|
+
function Getter(api, viewer, viewPort, typeId, batchSize, attrFilter, historicAttrKey, viaCdn) {
|
|
12788
13580
|
this.onUpdate = null;
|
|
12789
13581
|
this.LastStateUpdates = {};
|
|
12790
13582
|
this.onStateUpdate = null;
|
|
12791
13583
|
this.onScanUpdate = null;
|
|
12792
13584
|
this.viewPortChangeRemoval = null;
|
|
13585
|
+
this.viewerDateTimeChangeRemoval = null;
|
|
12793
13586
|
this.cells = null;
|
|
12794
13587
|
this.registeredItems = {};
|
|
12795
13588
|
this.getterLoopId = 0;
|
|
@@ -12800,10 +13593,12 @@
|
|
|
12800
13593
|
this.viewCenter = null;
|
|
12801
13594
|
this.api = api;
|
|
12802
13595
|
this.typeId = typeId;
|
|
13596
|
+
this.historicAttrKey = historicAttrKey;
|
|
12803
13597
|
this.viaCdn = Boolean(viaCdn);
|
|
12804
13598
|
this.batchSize = isNaN(batchSize) ? 300 : batchSize;
|
|
12805
13599
|
this.viewPort = viewPort;
|
|
12806
13600
|
this.attrFilter = attrFilter;
|
|
13601
|
+
this.viewer = viewer;
|
|
12807
13602
|
this.updateBounds();
|
|
12808
13603
|
}
|
|
12809
13604
|
Object.defineProperty(Getter.prototype, "OnUpdate", {
|
|
@@ -12842,7 +13637,14 @@
|
|
|
12842
13637
|
* @returns
|
|
12843
13638
|
*/
|
|
12844
13639
|
Getter.prototype.getIntegrityId = function () {
|
|
12845
|
-
|
|
13640
|
+
var integrity = this.tagIds == null ? "" : this.tagIds.join();
|
|
13641
|
+
if (this.historicAttrKey) {
|
|
13642
|
+
integrity += this.historicAttrKey;
|
|
13643
|
+
if (this.historicAttrDateTime) {
|
|
13644
|
+
integrity += this.historicAttrDateTime;
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13647
|
+
return integrity;
|
|
12846
13648
|
};
|
|
12847
13649
|
Getter.prototype.viewAreaSub = function () {
|
|
12848
13650
|
var _this = this;
|
|
@@ -12855,6 +13657,57 @@
|
|
|
12855
13657
|
Getter.prototype.viewAreaDispose = function () {
|
|
12856
13658
|
var _a;
|
|
12857
13659
|
(_a = this.viewPortChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
13660
|
+
this.viewPortChangeRemoval = null;
|
|
13661
|
+
};
|
|
13662
|
+
/**
|
|
13663
|
+
* Monitors the Cesium viewer and updates the historic data filter values.
|
|
13664
|
+
* If there is no historic attr set, this will do nothing.
|
|
13665
|
+
*/
|
|
13666
|
+
Getter.prototype.viewerDateTimeSub = function () {
|
|
13667
|
+
var _this = this;
|
|
13668
|
+
this.viewerDateTimeDispose();
|
|
13669
|
+
if (!this.historicAttrKey) {
|
|
13670
|
+
return;
|
|
13671
|
+
}
|
|
13672
|
+
var delayQueue = new bruceModels.DelayQueue(function () {
|
|
13673
|
+
var current = _this.getIntegrityId();
|
|
13674
|
+
_this.updateHistoricDateTime();
|
|
13675
|
+
if (current != _this.getIntegrityId()) {
|
|
13676
|
+
_this.updateState();
|
|
13677
|
+
}
|
|
13678
|
+
}, 250);
|
|
13679
|
+
var postUpdateRemoval = this.viewer.scene.postUpdate.addEventListener(function () {
|
|
13680
|
+
if (delayQueue) {
|
|
13681
|
+
delayQueue.Call();
|
|
13682
|
+
}
|
|
13683
|
+
});
|
|
13684
|
+
this.viewerDateTimeChangeRemoval = function () {
|
|
13685
|
+
delayQueue === null || delayQueue === void 0 ? void 0 : delayQueue.Dispose();
|
|
13686
|
+
postUpdateRemoval === null || postUpdateRemoval === void 0 ? void 0 : postUpdateRemoval();
|
|
13687
|
+
delayQueue = null;
|
|
13688
|
+
postUpdateRemoval = null;
|
|
13689
|
+
};
|
|
13690
|
+
};
|
|
13691
|
+
Getter.prototype.updateHistoricDateTime = function () {
|
|
13692
|
+
var newDateTime = Cesium.JulianDate.toDate(this.viewer.clock.currentTime);
|
|
13693
|
+
// Has previous value. Let's compare.
|
|
13694
|
+
if (this.historicAttrDateTime) {
|
|
13695
|
+
var oldDateTime = new Date(this.historicAttrDateTime);
|
|
13696
|
+
// Change must be at least 0.1 seconds.
|
|
13697
|
+
// TODO: This is just a random value I picked. We may need to make a setting or refine this.
|
|
13698
|
+
if (Math.abs(newDateTime.getTime() - oldDateTime.getTime()) < 100) {
|
|
13699
|
+
return;
|
|
13700
|
+
}
|
|
13701
|
+
}
|
|
13702
|
+
this.historicAttrDateTime = newDateTime.toISOString();
|
|
13703
|
+
// Set min/max to be the value increased/decreased by 1 minute.
|
|
13704
|
+
this.historicAttrDateTimeMin = new Date(newDateTime.getTime() - 60000).toISOString();
|
|
13705
|
+
this.historicAttrDateTimeMax = new Date(newDateTime.getTime() + 60000).toISOString();
|
|
13706
|
+
};
|
|
13707
|
+
Getter.prototype.viewerDateTimeDispose = function () {
|
|
13708
|
+
var _a;
|
|
13709
|
+
(_a = this.viewerDateTimeChangeRemoval) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
13710
|
+
this.viewerDateTimeChangeRemoval = null;
|
|
12858
13711
|
};
|
|
12859
13712
|
Getter.prototype.GetMenuItems = function () {
|
|
12860
13713
|
return Object.keys(this.registeredItems);
|
|
@@ -12914,8 +13767,10 @@
|
|
|
12914
13767
|
this.minHeight = minHeight;
|
|
12915
13768
|
this.maxHeight = maxHeight;
|
|
12916
13769
|
this.updateBounds();
|
|
13770
|
+
this.updateHistoricDateTime();
|
|
12917
13771
|
this.startGetterLoop();
|
|
12918
13772
|
this.viewAreaSub();
|
|
13773
|
+
this.viewerDateTimeSub();
|
|
12919
13774
|
}
|
|
12920
13775
|
else {
|
|
12921
13776
|
this.getterLoopId += 1;
|
|
@@ -13011,6 +13866,9 @@
|
|
|
13011
13866
|
_j.trys.push([8, 10, , 11]);
|
|
13012
13867
|
return [4 /*yield*/, bruceModels.Entity.GetList({
|
|
13013
13868
|
api: this.api,
|
|
13869
|
+
historicKey: this.historicAttrKey,
|
|
13870
|
+
historicFrom: this.historicAttrKey ? this.historicAttrDateTimeMin : null,
|
|
13871
|
+
historicTo: this.historicAttrKey ? this.historicAttrDateTimeMax : null,
|
|
13014
13872
|
filter: {
|
|
13015
13873
|
pageSize: PAGE_SIZE,
|
|
13016
13874
|
pageIndex: curCell.FetchPageIndex,
|
|
@@ -13108,6 +13966,7 @@
|
|
|
13108
13966
|
cacheKey += params.batchSize;
|
|
13109
13967
|
cacheKey += String(params.cdn);
|
|
13110
13968
|
cacheKey += JSON.stringify(params.tagIds ? params.tagIds : []);
|
|
13969
|
+
cacheKey += params.historicAttrKey ? params.historicAttrKey : "";
|
|
13111
13970
|
// This could potentially crash, but if it crashes here then it would crash during API request anyways.
|
|
13112
13971
|
cacheKey += JSON.stringify(params.attrFilter ? params.attrFilter : {});
|
|
13113
13972
|
return cacheKey;
|
|
@@ -13122,7 +13981,7 @@
|
|
|
13122
13981
|
var cacheKey = createFilterGetterCacheKey(params);
|
|
13123
13982
|
var getter = this.data[cacheKey];
|
|
13124
13983
|
if (!getter) {
|
|
13125
|
-
getter = new EntityFilterGetter.Getter(params.api, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.cdn);
|
|
13984
|
+
getter = new EntityFilterGetter.Getter(params.api, params.viewer, params.monitor, params.typeId, params.batchSize, params.attrFilter, params.historicAttrKey, params.cdn);
|
|
13126
13985
|
this.data[cacheKey] = getter;
|
|
13127
13986
|
/**
|
|
13128
13987
|
* Debug option.
|
|
@@ -22514,7 +23373,7 @@
|
|
|
22514
23373
|
ViewRenderEngine.Render = Render;
|
|
22515
23374
|
})(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
|
|
22516
23375
|
|
|
22517
|
-
var VERSION = "3.7.
|
|
23376
|
+
var VERSION = "3.7.5";
|
|
22518
23377
|
|
|
22519
23378
|
exports.VERSION = VERSION;
|
|
22520
23379
|
exports.CesiumParabola = CesiumParabola;
|