bruce-cesium 3.7.2 → 3.7.4
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 +1032 -266
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1030 -264
- 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 +628 -254
- package/dist/lib/rendering/entity-render-engine.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/utils/cesium-entity-styler.js +115 -5
- package/dist/lib/utils/cesium-entity-styler.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +0 -1
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/cesium-animated-property.d.ts +88 -0
- package/dist/types/rendering/entity-render-engine.d.ts +10 -1
- package/dist/types/utils/cesium-entity-styler.d.ts +5 -0
- package/package.json +1 -1
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.
|
|
@@ -2574,7 +2959,6 @@
|
|
|
2574
2959
|
if (isNaN(roll)) {
|
|
2575
2960
|
roll = 0;
|
|
2576
2961
|
}
|
|
2577
|
-
console.log(tSettings, entity);
|
|
2578
2962
|
matrix4 = entity.worldPosition;
|
|
2579
2963
|
offset = new Cesium.Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
|
|
2580
2964
|
if (entity.worldPivot) //the position from worldMatrix + center of geometry offset
|
|
@@ -4249,7 +4633,7 @@
|
|
|
4249
4633
|
var createCircleBillboard = function (size, colorCss) {
|
|
4250
4634
|
var key = size + "-" + colorCss;
|
|
4251
4635
|
var cacheData = _billboardCache.Get(key);
|
|
4252
|
-
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") {
|
|
4253
4637
|
return cacheData;
|
|
4254
4638
|
}
|
|
4255
4639
|
// Slight padding to avoid corners clipping.
|
|
@@ -4263,7 +4647,7 @@
|
|
|
4263
4647
|
context.fillStyle = colorCss;
|
|
4264
4648
|
context.fill();
|
|
4265
4649
|
var data = {
|
|
4266
|
-
|
|
4650
|
+
canvasDataUri: canvas.toDataURL("image/png"),
|
|
4267
4651
|
colorCss: colorCss,
|
|
4268
4652
|
size: size,
|
|
4269
4653
|
height: canvasSize,
|
|
@@ -4298,7 +4682,7 @@
|
|
|
4298
4682
|
var context = canvas_1.getContext("2d");
|
|
4299
4683
|
context.drawImage(image_1, 0, 0);
|
|
4300
4684
|
var data = {
|
|
4301
|
-
|
|
4685
|
+
canvasDataUri: canvas_1.toDataURL("image/png"),
|
|
4302
4686
|
height: image_1.height
|
|
4303
4687
|
};
|
|
4304
4688
|
res(data);
|
|
@@ -4415,7 +4799,7 @@
|
|
|
4415
4799
|
function Render(params) {
|
|
4416
4800
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4417
4801
|
return __awaiter(this, void 0, void 0, function () {
|
|
4418
|
-
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType,
|
|
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;
|
|
4419
4803
|
return __generator(this, function (_j) {
|
|
4420
4804
|
switch (_j.label) {
|
|
4421
4805
|
case 0:
|
|
@@ -4459,16 +4843,23 @@
|
|
|
4459
4843
|
displayType = bruceModels.ZoomControl.EDisplayType.Geometry;
|
|
4460
4844
|
}
|
|
4461
4845
|
if (displayType != bruceModels.ZoomControl.EDisplayType.Hidden) {
|
|
4462
|
-
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4463
4846
|
existingRego = params.visualRegister.GetRego({
|
|
4464
4847
|
entityId: id,
|
|
4465
4848
|
menuItemId: params.menuItemId
|
|
4466
4849
|
});
|
|
4850
|
+
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4467
4851
|
oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
|
|
4468
4852
|
if (!params.force && newRenderId == oldRenderId && !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale)) {
|
|
4853
|
+
// No sorting category needed. Already rendered the way we want.
|
|
4469
4854
|
cEntities[id] = existingRego.visual;
|
|
4470
4855
|
}
|
|
4471
4856
|
else {
|
|
4857
|
+
// Add so we can re-use the graphic and update it.
|
|
4858
|
+
if (existingRego && newRenderId == oldRenderId) {
|
|
4859
|
+
cEntities[id] = existingRego.visual;
|
|
4860
|
+
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
4861
|
+
existingRego.stale = false;
|
|
4862
|
+
}
|
|
4472
4863
|
if (displayType == bruceModels.ZoomControl.EDisplayType.Model3D) {
|
|
4473
4864
|
models.push(entity);
|
|
4474
4865
|
}
|
|
@@ -4488,7 +4879,7 @@
|
|
|
4488
4879
|
}
|
|
4489
4880
|
}
|
|
4490
4881
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
4491
|
-
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
4882
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
4492
4883
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
4493
4884
|
case 1:
|
|
4494
4885
|
mEntities = _j.sent();
|
|
@@ -4516,7 +4907,7 @@
|
|
|
4516
4907
|
polygons.push(entity);
|
|
4517
4908
|
return [2 /*return*/, "continue"];
|
|
4518
4909
|
}
|
|
4519
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
|
|
4910
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
4520
4911
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
4521
4912
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
4522
4913
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: bruceModels.ObjectUtils.UId() }) });
|
|
@@ -4585,7 +4976,7 @@
|
|
|
4585
4976
|
return [3 /*break*/, 3];
|
|
4586
4977
|
case 6:
|
|
4587
4978
|
if (!(polygons.length > 0)) return [3 /*break*/, 8];
|
|
4588
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
4979
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
4589
4980
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
4590
4981
|
case 7:
|
|
4591
4982
|
pEntities = _j.sent();
|
|
@@ -4602,7 +4993,7 @@
|
|
|
4602
4993
|
_j.label = 8;
|
|
4603
4994
|
case 8:
|
|
4604
4995
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
4605
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
4996
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
4606
4997
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
4607
4998
|
case 9:
|
|
4608
4999
|
pEntities = _j.sent();
|
|
@@ -4619,7 +5010,7 @@
|
|
|
4619
5010
|
_j.label = 10;
|
|
4620
5011
|
case 10:
|
|
4621
5012
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
4622
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
5013
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
4623
5014
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
4624
5015
|
case 11:
|
|
4625
5016
|
pEntities = _j.sent();
|
|
@@ -4683,11 +5074,11 @@
|
|
|
4683
5074
|
}
|
|
4684
5075
|
Point.CreateCircleBillboard = CreateCircleBillboard;
|
|
4685
5076
|
function Render(params) {
|
|
4686
|
-
var _a, _b;
|
|
5077
|
+
var _a, _b, _c, _d;
|
|
4687
5078
|
return __awaiter(this, void 0, void 0, function () {
|
|
4688
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor,
|
|
4689
|
-
return __generator(this, function (
|
|
4690
|
-
switch (
|
|
5079
|
+
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;
|
|
5080
|
+
return __generator(this, function (_e) {
|
|
5081
|
+
switch (_e.label) {
|
|
4691
5082
|
case 0:
|
|
4692
5083
|
entity = params.entity;
|
|
4693
5084
|
style = params.style;
|
|
@@ -4700,6 +5091,27 @@
|
|
|
4700
5091
|
}
|
|
4701
5092
|
cEntity = null;
|
|
4702
5093
|
siblings = [];
|
|
5094
|
+
prepareExistingGraphic = function (cEntity, siblings) {
|
|
5095
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5096
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5097
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5098
|
+
entity: cEntity,
|
|
5099
|
+
});
|
|
5100
|
+
if (parts.length > 1) {
|
|
5101
|
+
// We'll cull all except the allowed number of siblings.
|
|
5102
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5103
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5104
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5105
|
+
var part = parts[i];
|
|
5106
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5107
|
+
params.viewer.entities.remove(part);
|
|
5108
|
+
}
|
|
5109
|
+
}
|
|
5110
|
+
if (cEntity._parentEntity) {
|
|
5111
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5112
|
+
}
|
|
5113
|
+
}
|
|
5114
|
+
};
|
|
4703
5115
|
if (!(type == bruceModels.Style.EPointType.Icon)) return [3 /*break*/, 9];
|
|
4704
5116
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
4705
5117
|
iconUrlRows.forEach(function (row) {
|
|
@@ -4716,36 +5128,36 @@
|
|
|
4716
5128
|
api = params.apiGetter.getApi(metadata.accountId);
|
|
4717
5129
|
return [4 /*yield*/, api.Loading];
|
|
4718
5130
|
case 1:
|
|
4719
|
-
|
|
5131
|
+
_e.sent();
|
|
4720
5132
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4721
5133
|
api: api,
|
|
4722
5134
|
fileId: metadata.fileId,
|
|
4723
5135
|
viaCdn: true
|
|
4724
5136
|
});
|
|
4725
|
-
|
|
5137
|
+
_e.label = 2;
|
|
4726
5138
|
case 2:
|
|
4727
5139
|
if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
|
|
4728
5140
|
return [4 /*yield*/, params.api.Loading];
|
|
4729
5141
|
case 3:
|
|
4730
|
-
|
|
5142
|
+
_e.sent();
|
|
4731
5143
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4732
5144
|
api: params.api,
|
|
4733
5145
|
fileId: style.iconId,
|
|
4734
5146
|
viaCdn: true
|
|
4735
5147
|
});
|
|
4736
|
-
|
|
5148
|
+
_e.label = 4;
|
|
4737
5149
|
case 4:
|
|
4738
5150
|
image = null;
|
|
4739
5151
|
if (!iconUrl) return [3 /*break*/, 8];
|
|
4740
|
-
|
|
5152
|
+
_e.label = 5;
|
|
4741
5153
|
case 5:
|
|
4742
|
-
|
|
5154
|
+
_e.trys.push([5, 7, , 8]);
|
|
4743
5155
|
return [4 /*yield*/, createImageBillboard(iconUrl)];
|
|
4744
5156
|
case 6:
|
|
4745
|
-
image =
|
|
5157
|
+
image = _e.sent();
|
|
4746
5158
|
return [3 /*break*/, 8];
|
|
4747
5159
|
case 7:
|
|
4748
|
-
e_5 =
|
|
5160
|
+
e_5 = _e.sent();
|
|
4749
5161
|
// Expanding the logging here so we can figure out why this is happening.
|
|
4750
5162
|
// 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.
|
|
4751
5163
|
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
@@ -4764,34 +5176,64 @@
|
|
|
4764
5176
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4765
5177
|
if (iconScale > 0) {
|
|
4766
5178
|
bColor = style.iconTintColor ? bruceModels.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
4767
|
-
|
|
5179
|
+
cColor_1 = bColor ? colorToCColor(bColor) : undefined;
|
|
4768
5180
|
heightRef = getHeightRef(style);
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
5181
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5182
|
+
cEntity = new Cesium.Entity({
|
|
5183
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5184
|
+
billboard: {
|
|
5185
|
+
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
5186
|
+
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
5187
|
+
image: image.canvasDataUri,
|
|
5188
|
+
heightReference: getHeightRef(style),
|
|
5189
|
+
scale: iconScale,
|
|
5190
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
5191
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5192
|
+
color: new Cesium.CallbackProperty(function () { return cColor_1; }, true),
|
|
5193
|
+
// Would be great once we have a setting for this.
|
|
5194
|
+
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
5195
|
+
},
|
|
5196
|
+
position: exports.EntityUtils.GetPos({
|
|
5197
|
+
viewer: params.viewer,
|
|
5198
|
+
entity: entity,
|
|
5199
|
+
recordHeightRef: heightRef,
|
|
5200
|
+
returnHeightRef: heightRef
|
|
5201
|
+
}),
|
|
5202
|
+
show: true
|
|
5203
|
+
});
|
|
5204
|
+
}
|
|
5205
|
+
else {
|
|
5206
|
+
prepareExistingGraphic(params.rendered);
|
|
5207
|
+
cEntity = params.rendered;
|
|
5208
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5209
|
+
if (currentImgKey != iconUrl) {
|
|
5210
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(image.canvasDataUri);
|
|
5211
|
+
}
|
|
5212
|
+
cEntity.billboard.scale = new Cesium.ConstantProperty(iconScale);
|
|
5213
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(getHeightRef(style));
|
|
5214
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5215
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5216
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
4784
5217
|
viewer: params.viewer,
|
|
4785
5218
|
entity: entity,
|
|
4786
5219
|
recordHeightRef: heightRef,
|
|
4787
5220
|
returnHeightRef: heightRef
|
|
4788
|
-
})
|
|
4789
|
-
|
|
4790
|
-
|
|
5221
|
+
}));
|
|
5222
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5223
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5224
|
+
color: cColor_1,
|
|
5225
|
+
entity: cEntity,
|
|
5226
|
+
viewer: params.viewer,
|
|
5227
|
+
override: true,
|
|
5228
|
+
requestRender: false
|
|
5229
|
+
});
|
|
5230
|
+
cEntity.show = true;
|
|
5231
|
+
}
|
|
4791
5232
|
cEntity.billboard._billboardSize = image.height;
|
|
5233
|
+
cEntity.billboard._billboardImgKey = iconUrl;
|
|
4792
5234
|
}
|
|
4793
5235
|
}
|
|
4794
|
-
|
|
5236
|
+
_e.label = 9;
|
|
4795
5237
|
case 9:
|
|
4796
5238
|
if (type == bruceModels.Style.EPointType.Cylinder) {
|
|
4797
5239
|
radius = EnsureNumber(bruceModels.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
@@ -4816,46 +5258,97 @@
|
|
|
4816
5258
|
returnHeightRef: heightRef
|
|
4817
5259
|
});
|
|
4818
5260
|
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
semiMajorAxis: radius,
|
|
4823
|
-
semiMinorAxis: radius,
|
|
4824
|
-
material: cFill,
|
|
4825
|
-
outlineWidth: null,
|
|
4826
|
-
extrudedHeight: extrusion.value,
|
|
4827
|
-
heightReference: heightRef,
|
|
4828
|
-
extrudedHeightReference: extrusion.exHeightRef,
|
|
4829
|
-
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
4830
|
-
zIndex: 1,
|
|
4831
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4832
|
-
},
|
|
4833
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
4834
|
-
show: true
|
|
4835
|
-
});
|
|
4836
|
-
if (outline && outlineWidth > 0) {
|
|
4837
|
-
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
4838
|
-
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
4839
|
-
// This way they render in a uniform way.
|
|
4840
|
-
if (!outlineExtrusion.value && extrusion.value) {
|
|
4841
|
-
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
4842
|
-
}
|
|
4843
|
-
siblings.push(new Cesium.Entity({
|
|
5261
|
+
hasOutline = outline && outlineWidth > 0;
|
|
5262
|
+
if (!params.rendered || !params.rendered.ellipse) {
|
|
5263
|
+
cEntity = new Cesium.Entity({
|
|
4844
5264
|
id: bruceModels.ObjectUtils.UId(10),
|
|
4845
5265
|
ellipse: {
|
|
4846
|
-
semiMajorAxis: radius
|
|
4847
|
-
semiMinorAxis: radius
|
|
4848
|
-
material:
|
|
4849
|
-
outlineWidth:
|
|
4850
|
-
extrudedHeight:
|
|
5266
|
+
semiMajorAxis: radius,
|
|
5267
|
+
semiMinorAxis: radius,
|
|
5268
|
+
material: cFill,
|
|
5269
|
+
outlineWidth: null,
|
|
5270
|
+
extrudedHeight: extrusion.value,
|
|
4851
5271
|
heightReference: heightRef,
|
|
4852
|
-
extrudedHeightReference:
|
|
5272
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
4853
5273
|
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
4854
|
-
zIndex:
|
|
5274
|
+
zIndex: 1,
|
|
4855
5275
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4856
5276
|
},
|
|
4857
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
4858
|
-
|
|
5277
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
5278
|
+
show: true
|
|
5279
|
+
});
|
|
5280
|
+
}
|
|
5281
|
+
else {
|
|
5282
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5283
|
+
cEntity = params.rendered;
|
|
5284
|
+
cEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius);
|
|
5285
|
+
cEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius);
|
|
5286
|
+
cEntity.ellipse.outlineWidth = undefined;
|
|
5287
|
+
cEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
5288
|
+
cEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5289
|
+
cEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
5290
|
+
cEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
5291
|
+
cEntity.ellipse.zIndex = new Cesium.ConstantProperty(1);
|
|
5292
|
+
cEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5293
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
|
|
5294
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5295
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5296
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5297
|
+
color: cFill,
|
|
5298
|
+
entity: cEntity,
|
|
5299
|
+
viewer: params.viewer,
|
|
5300
|
+
override: true,
|
|
5301
|
+
requestRender: false
|
|
5302
|
+
});
|
|
5303
|
+
cEntity.show = true;
|
|
5304
|
+
}
|
|
5305
|
+
if (hasOutline) {
|
|
5306
|
+
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
5307
|
+
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
5308
|
+
// This way they render in a uniform way.
|
|
5309
|
+
if (!outlineExtrusion.value && extrusion.value) {
|
|
5310
|
+
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
5311
|
+
}
|
|
5312
|
+
outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5313
|
+
if (outlineEntity && outlineEntity.ellipse) {
|
|
5314
|
+
outlineEntity.ellipse.semiMajorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
5315
|
+
outlineEntity.ellipse.semiMinorAxis = new Cesium.ConstantProperty(radius + outlineWidth);
|
|
5316
|
+
outlineEntity.ellipse.extrudedHeight = new Cesium.ConstantProperty(outlineExtrusion.value);
|
|
5317
|
+
outlineEntity.ellipse.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5318
|
+
outlineEntity.ellipse.extrudedHeightReference = new Cesium.ConstantProperty(outlineExtrusion.exHeightRef);
|
|
5319
|
+
outlineEntity.ellipse.height = new Cesium.ConstantProperty(Cesium.Cartographic.fromCartesian(pos3d).height);
|
|
5320
|
+
outlineEntity.ellipse.zIndex = new Cesium.ConstantProperty(2);
|
|
5321
|
+
outlineEntity.ellipse.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5322
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5323
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5324
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5325
|
+
color: cOutline,
|
|
5326
|
+
entity: outlineEntity,
|
|
5327
|
+
viewer: params.viewer,
|
|
5328
|
+
override: true,
|
|
5329
|
+
requestRender: false
|
|
5330
|
+
});
|
|
5331
|
+
outlineEntity.show = true;
|
|
5332
|
+
}
|
|
5333
|
+
else {
|
|
5334
|
+
outlineEntity = new Cesium.Entity({
|
|
5335
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5336
|
+
ellipse: {
|
|
5337
|
+
semiMajorAxis: radius + outlineWidth,
|
|
5338
|
+
semiMinorAxis: radius + outlineWidth,
|
|
5339
|
+
material: cOutline,
|
|
5340
|
+
outlineWidth: undefined,
|
|
5341
|
+
extrudedHeight: outlineExtrusion.value,
|
|
5342
|
+
heightReference: heightRef,
|
|
5343
|
+
extrudedHeightReference: outlineExtrusion.exHeightRef,
|
|
5344
|
+
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
5345
|
+
zIndex: 2,
|
|
5346
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5347
|
+
},
|
|
5348
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
5349
|
+
});
|
|
5350
|
+
}
|
|
5351
|
+
siblings.push(outlineEntity);
|
|
4859
5352
|
}
|
|
4860
5353
|
}
|
|
4861
5354
|
if (!cEntity) {
|
|
@@ -4872,33 +5365,66 @@
|
|
|
4872
5365
|
heightRef = getHeightRef(style);
|
|
4873
5366
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
4874
5367
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
5368
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5369
|
+
cEntity = new Cesium.Entity({
|
|
5370
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5371
|
+
// point: {
|
|
5372
|
+
// pixelSize: size,
|
|
5373
|
+
// color: cColor,
|
|
5374
|
+
// heightReference: getHeightRef(style),
|
|
5375
|
+
// distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5376
|
+
// },
|
|
5377
|
+
// We are generating a billboard instead of using the point.
|
|
5378
|
+
// This is because points were behaving strangely where they would appear oblong shapes.
|
|
5379
|
+
// This occurred consistently when rendering many icons and points at the same time.
|
|
5380
|
+
billboard: {
|
|
5381
|
+
height: circleBillboard.height,
|
|
5382
|
+
width: circleBillboard.width,
|
|
5383
|
+
image: circleBillboard.canvasDataUri,
|
|
5384
|
+
color: new Cesium.CallbackProperty(function () { return undefined; }, true),
|
|
5385
|
+
heightReference: heightRef,
|
|
5386
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5387
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
|
|
5388
|
+
},
|
|
5389
|
+
position: exports.EntityUtils.GetPos({
|
|
5390
|
+
viewer: params.viewer,
|
|
5391
|
+
entity: entity,
|
|
5392
|
+
recordHeightRef: heightRef,
|
|
5393
|
+
returnHeightRef: heightRef
|
|
5394
|
+
}),
|
|
5395
|
+
show: true
|
|
5396
|
+
});
|
|
5397
|
+
}
|
|
5398
|
+
else {
|
|
5399
|
+
prepareExistingGraphic(params.rendered);
|
|
5400
|
+
cEntity = params.rendered;
|
|
5401
|
+
imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
|
|
5402
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5403
|
+
if (currentImgKey != imgKey) {
|
|
5404
|
+
cEntity.billboard.image = new Cesium.ConstantProperty(circleBillboard.canvasDataUri);
|
|
5405
|
+
}
|
|
5406
|
+
cEntity.billboard.height = new Cesium.ConstantProperty(circleBillboard.height);
|
|
5407
|
+
cEntity.billboard.width = new Cesium.ConstantProperty(circleBillboard.width);
|
|
5408
|
+
cEntity.billboard.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5409
|
+
cEntity.billboard.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5410
|
+
cEntity.billboard.disableDepthTestDistance = new Cesium.ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5411
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
4895
5412
|
viewer: params.viewer,
|
|
4896
5413
|
entity: entity,
|
|
4897
5414
|
recordHeightRef: heightRef,
|
|
4898
5415
|
returnHeightRef: heightRef
|
|
4899
|
-
})
|
|
4900
|
-
|
|
4901
|
-
|
|
5416
|
+
}));
|
|
5417
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5418
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5419
|
+
color: cColor,
|
|
5420
|
+
entity: cEntity,
|
|
5421
|
+
viewer: params.viewer,
|
|
5422
|
+
override: true,
|
|
5423
|
+
requestRender: false
|
|
5424
|
+
});
|
|
5425
|
+
cEntity.show = true;
|
|
5426
|
+
cEntity.billboard._billboardImgKey = imgKey;
|
|
5427
|
+
}
|
|
4902
5428
|
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
4903
5429
|
}
|
|
4904
5430
|
if (cEntity) {
|
|
@@ -4911,16 +5437,16 @@
|
|
|
4911
5437
|
}
|
|
4912
5438
|
Point.Render = Render;
|
|
4913
5439
|
function RenderGroup(params) {
|
|
4914
|
-
var _a, _b, _c;
|
|
5440
|
+
var _a, _b, _c, _d;
|
|
4915
5441
|
return __awaiter(this, void 0, void 0, function () {
|
|
4916
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
4917
|
-
return __generator(this, function (
|
|
4918
|
-
switch (
|
|
5442
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_2;
|
|
5443
|
+
return __generator(this, function (_f) {
|
|
5444
|
+
switch (_f.label) {
|
|
4919
5445
|
case 0:
|
|
4920
5446
|
api = params.apiGetter.getApi();
|
|
4921
5447
|
cEntities = {};
|
|
4922
5448
|
i = 0;
|
|
4923
|
-
|
|
5449
|
+
_f.label = 1;
|
|
4924
5450
|
case 1:
|
|
4925
5451
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
4926
5452
|
entity = params.entities[i];
|
|
@@ -4928,13 +5454,13 @@
|
|
|
4928
5454
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
4929
5455
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
4930
5456
|
case 2:
|
|
4931
|
-
|
|
5457
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
4932
5458
|
return [3 /*break*/, 4];
|
|
4933
5459
|
case 3:
|
|
4934
|
-
|
|
4935
|
-
|
|
5460
|
+
_e = zoomItem.Style;
|
|
5461
|
+
_f.label = 4;
|
|
4936
5462
|
case 4:
|
|
4937
|
-
style =
|
|
5463
|
+
style = _e;
|
|
4938
5464
|
tagIds = entity.Bruce["Layer.ID"];
|
|
4939
5465
|
tags = [];
|
|
4940
5466
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -4943,8 +5469,8 @@
|
|
|
4943
5469
|
tagIds: tagIds
|
|
4944
5470
|
})];
|
|
4945
5471
|
case 5:
|
|
4946
|
-
tags = (
|
|
4947
|
-
|
|
5472
|
+
tags = (_f.sent()).tags;
|
|
5473
|
+
_f.label = 6;
|
|
4948
5474
|
case 6:
|
|
4949
5475
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
4950
5476
|
return [4 /*yield*/, Render({
|
|
@@ -4955,20 +5481,21 @@
|
|
|
4955
5481
|
api: api,
|
|
4956
5482
|
apiGetter: params.apiGetter,
|
|
4957
5483
|
maxDistance: zoomItem.MaxZoom,
|
|
4958
|
-
minDistance: zoomItem.MinZoom
|
|
5484
|
+
minDistance: zoomItem.MinZoom,
|
|
5485
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
4959
5486
|
})];
|
|
4960
5487
|
case 7:
|
|
4961
|
-
cEntity =
|
|
5488
|
+
cEntity = _f.sent();
|
|
4962
5489
|
if (!cEntity) return [3 /*break*/, 9];
|
|
4963
5490
|
return [4 /*yield*/, getName(api, entity)];
|
|
4964
5491
|
case 8:
|
|
4965
|
-
name_2 =
|
|
5492
|
+
name_2 = _f.sent();
|
|
4966
5493
|
cEntity.name = name_2;
|
|
4967
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
4968
|
-
|
|
5494
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5495
|
+
_f.label = 9;
|
|
4969
5496
|
case 9:
|
|
4970
5497
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
4971
|
-
|
|
5498
|
+
_f.label = 10;
|
|
4972
5499
|
case 10:
|
|
4973
5500
|
i++;
|
|
4974
5501
|
return [3 /*break*/, 1];
|
|
@@ -5053,52 +5580,110 @@
|
|
|
5053
5580
|
if (style.drapeOver == "ALL") {
|
|
5054
5581
|
classification = Cesium.ClassificationType.BOTH;
|
|
5055
5582
|
}
|
|
5056
|
-
var cEntity =
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5583
|
+
var cEntity = null;
|
|
5584
|
+
if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
|
|
5585
|
+
(!params.rendered.corridor && units == "m"))) {
|
|
5586
|
+
cEntity = new Cesium.Entity({
|
|
5587
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5588
|
+
polyline: units == "px" ? {
|
|
5589
|
+
positions: posses,
|
|
5590
|
+
material: cColor,
|
|
5591
|
+
width: width,
|
|
5592
|
+
classificationType: classification,
|
|
5593
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
5594
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5595
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
5596
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5597
|
+
} : null,
|
|
5598
|
+
corridor: units == "m" ? {
|
|
5599
|
+
positions: posses,
|
|
5600
|
+
material: cColor,
|
|
5601
|
+
width: width,
|
|
5602
|
+
classificationType: classification,
|
|
5603
|
+
heightReference: heightRef,
|
|
5604
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5605
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5606
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
5607
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
5608
|
+
fill: true
|
|
5609
|
+
} : null,
|
|
5610
|
+
position: exports.EntityUtils.GetPos({
|
|
5611
|
+
viewer: params.viewer,
|
|
5612
|
+
entity: entity,
|
|
5613
|
+
recordHeightRef: heightRef,
|
|
5614
|
+
returnHeightRef: heightRef
|
|
5615
|
+
}),
|
|
5616
|
+
show: true
|
|
5617
|
+
});
|
|
5618
|
+
}
|
|
5619
|
+
else {
|
|
5620
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5621
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5622
|
+
entity: cEntity,
|
|
5623
|
+
});
|
|
5624
|
+
if (parts.length > 1) {
|
|
5625
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
5626
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5627
|
+
var part = parts[i];
|
|
5628
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
5629
|
+
params.viewer.entities.remove(part);
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
cEntity._siblingGraphics = [];
|
|
5633
|
+
if (cEntity._parentEntity) {
|
|
5634
|
+
console.warn("Polyline.Render: Parent entity was not null. This should not happen.");
|
|
5635
|
+
}
|
|
5636
|
+
}
|
|
5637
|
+
cEntity = params.rendered;
|
|
5638
|
+
if (units == "px") {
|
|
5639
|
+
cEntity.polyline.positions = new Cesium.ConstantProperty(posses);
|
|
5640
|
+
cEntity.polyline.width = new Cesium.ConstantProperty(width);
|
|
5641
|
+
cEntity.polyline.classificationType = new Cesium.ConstantProperty(classification);
|
|
5642
|
+
cEntity.polyline.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5643
|
+
cEntity.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
5644
|
+
cEntity.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5645
|
+
cEntity.corridor = undefined;
|
|
5646
|
+
}
|
|
5647
|
+
else {
|
|
5648
|
+
cEntity.corridor.positions = new Cesium.ConstantProperty(posses);
|
|
5649
|
+
cEntity.corridor.width = new Cesium.ConstantProperty(width);
|
|
5650
|
+
cEntity.corridor.classificationType = new Cesium.ConstantProperty(classification);
|
|
5651
|
+
cEntity.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5652
|
+
cEntity.corridor.zIndex = new Cesium.ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5653
|
+
cEntity.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5654
|
+
cEntity.polyline = undefined;
|
|
5655
|
+
}
|
|
5656
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5657
|
+
// WARNING: polyline does not support animation (yet?).
|
|
5658
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5659
|
+
color: cColor,
|
|
5660
|
+
entity: cEntity,
|
|
5661
|
+
viewer: params.viewer,
|
|
5662
|
+
override: true,
|
|
5663
|
+
requestRender: false
|
|
5664
|
+
});
|
|
5665
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
5081
5666
|
viewer: params.viewer,
|
|
5082
5667
|
entity: entity,
|
|
5083
5668
|
recordHeightRef: heightRef,
|
|
5084
5669
|
returnHeightRef: heightRef
|
|
5085
|
-
})
|
|
5086
|
-
show
|
|
5087
|
-
}
|
|
5670
|
+
}));
|
|
5671
|
+
cEntity.show = true;
|
|
5672
|
+
}
|
|
5088
5673
|
return cEntity;
|
|
5089
5674
|
}
|
|
5090
5675
|
Polyline.Render = Render;
|
|
5091
5676
|
function RenderGroup(params) {
|
|
5092
|
-
var _a, _b, _c;
|
|
5677
|
+
var _a, _b, _c, _d;
|
|
5093
5678
|
return __awaiter(this, void 0, void 0, function () {
|
|
5094
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5095
|
-
return __generator(this, function (
|
|
5096
|
-
switch (
|
|
5679
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, lStyle, cEntity, name_3;
|
|
5680
|
+
return __generator(this, function (_f) {
|
|
5681
|
+
switch (_f.label) {
|
|
5097
5682
|
case 0:
|
|
5098
5683
|
api = params.apiGetter.getApi();
|
|
5099
5684
|
cEntities = {};
|
|
5100
5685
|
i = 0;
|
|
5101
|
-
|
|
5686
|
+
_f.label = 1;
|
|
5102
5687
|
case 1:
|
|
5103
5688
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5104
5689
|
entity = params.entities[i];
|
|
@@ -5106,13 +5691,13 @@
|
|
|
5106
5691
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5107
5692
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5108
5693
|
case 2:
|
|
5109
|
-
|
|
5694
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5110
5695
|
return [3 /*break*/, 4];
|
|
5111
5696
|
case 3:
|
|
5112
|
-
|
|
5113
|
-
|
|
5697
|
+
_e = zoomItem.Style;
|
|
5698
|
+
_f.label = 4;
|
|
5114
5699
|
case 4:
|
|
5115
|
-
style =
|
|
5700
|
+
style = _e;
|
|
5116
5701
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5117
5702
|
tags = [];
|
|
5118
5703
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5121,8 +5706,8 @@
|
|
|
5121
5706
|
tagIds: tagIds
|
|
5122
5707
|
})];
|
|
5123
5708
|
case 5:
|
|
5124
|
-
tags = (
|
|
5125
|
-
|
|
5709
|
+
tags = (_f.sent()).tags;
|
|
5710
|
+
_f.label = 6;
|
|
5126
5711
|
case 6:
|
|
5127
5712
|
lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
5128
5713
|
cEntity = Render({
|
|
@@ -5131,16 +5716,17 @@
|
|
|
5131
5716
|
tags: tags,
|
|
5132
5717
|
viewer: params.viewer,
|
|
5133
5718
|
maxDistance: zoomItem.MaxZoom,
|
|
5134
|
-
minDistance: zoomItem.MinZoom
|
|
5719
|
+
minDistance: zoomItem.MinZoom,
|
|
5720
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5135
5721
|
});
|
|
5136
5722
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5137
5723
|
return [4 /*yield*/, getName(api, entity)];
|
|
5138
5724
|
case 7:
|
|
5139
|
-
name_3 =
|
|
5725
|
+
name_3 = _f.sent();
|
|
5140
5726
|
cEntity.name = name_3;
|
|
5141
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
5727
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5142
5728
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5143
|
-
|
|
5729
|
+
_f.label = 8;
|
|
5144
5730
|
case 8:
|
|
5145
5731
|
i++;
|
|
5146
5732
|
return [3 /*break*/, 1];
|
|
@@ -5154,7 +5740,7 @@
|
|
|
5154
5740
|
var Polygon;
|
|
5155
5741
|
(function (Polygon) {
|
|
5156
5742
|
function Render(params) {
|
|
5157
|
-
var _a, _b;
|
|
5743
|
+
var _a, _b, _c, _d;
|
|
5158
5744
|
var entity = params.entity;
|
|
5159
5745
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
5160
5746
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -5211,30 +5797,85 @@
|
|
|
5211
5797
|
if (style.drapeOver == "ALL") {
|
|
5212
5798
|
classification = Cesium.ClassificationType.BOTH;
|
|
5213
5799
|
}
|
|
5214
|
-
var
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5800
|
+
var prepareExistingGraphic = function (cEntity, siblings) {
|
|
5801
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5802
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5803
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
5804
|
+
entity: cEntity,
|
|
5805
|
+
});
|
|
5806
|
+
if (parts.length > 1) {
|
|
5807
|
+
// We'll cull all except the allowed number of siblings.
|
|
5808
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5809
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5810
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5811
|
+
var part = parts[i];
|
|
5812
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5813
|
+
params.viewer.entities.remove(part);
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
if (cEntity._parentEntity) {
|
|
5817
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5818
|
+
}
|
|
5819
|
+
}
|
|
5820
|
+
};
|
|
5821
|
+
var hasOutline = width > 0 && cLineColor;
|
|
5822
|
+
var cEntity = null;
|
|
5823
|
+
if (!params.rendered || !params.rendered.polygon) {
|
|
5824
|
+
cEntity = new Cesium.Entity({
|
|
5825
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5826
|
+
polygon: {
|
|
5827
|
+
hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
|
|
5828
|
+
material: cFillColor,
|
|
5829
|
+
extrudedHeight: extrusion.value,
|
|
5830
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
5831
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
5832
|
+
heightReference: heightRef,
|
|
5833
|
+
classificationType: classification,
|
|
5834
|
+
perPositionHeight: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true,
|
|
5835
|
+
zIndex: zIndex,
|
|
5836
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
|
|
5837
|
+
},
|
|
5838
|
+
position: exports.EntityUtils.GetPos({
|
|
5839
|
+
viewer: params.viewer,
|
|
5840
|
+
entity: entity,
|
|
5841
|
+
recordHeightRef: heightRef,
|
|
5842
|
+
returnHeightRef: heightRef
|
|
5843
|
+
}),
|
|
5844
|
+
show: true
|
|
5845
|
+
});
|
|
5846
|
+
}
|
|
5847
|
+
else {
|
|
5848
|
+
// Polygons can have more siblings for the related hole graphics.
|
|
5849
|
+
// So this is a "good enough" way rather than perfect as it only preserves the outline.
|
|
5850
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5851
|
+
cEntity = params.rendered;
|
|
5852
|
+
cEntity.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })));
|
|
5853
|
+
cEntity.polygon.extrudedHeight = new Cesium.ConstantProperty(extrusion.value);
|
|
5854
|
+
cEntity.polygon.extrudedHeightReference = new Cesium.ConstantProperty(extrusion.exHeightRef);
|
|
5855
|
+
cEntity.polygon.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
5856
|
+
cEntity.polygon.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5857
|
+
cEntity.polygon.classificationType = new Cesium.ConstantProperty(classification);
|
|
5858
|
+
cEntity.polygon.perPositionHeight = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND ? false : true);
|
|
5859
|
+
cEntity.polygon.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
5860
|
+
cEntity.polygon.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
|
|
5861
|
+
cEntity.position = new Cesium.ConstantPositionProperty(exports.EntityUtils.GetPos({
|
|
5229
5862
|
viewer: params.viewer,
|
|
5230
5863
|
entity: entity,
|
|
5231
5864
|
recordHeightRef: heightRef,
|
|
5232
5865
|
returnHeightRef: heightRef
|
|
5233
|
-
})
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5866
|
+
}));
|
|
5867
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5868
|
+
// WARNING: polygon does not support animation (yet?).
|
|
5869
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
5870
|
+
color: cFillColor,
|
|
5871
|
+
entity: cEntity,
|
|
5872
|
+
viewer: params.viewer,
|
|
5873
|
+
override: true,
|
|
5874
|
+
requestRender: false
|
|
5875
|
+
});
|
|
5876
|
+
cEntity.show = true;
|
|
5877
|
+
}
|
|
5878
|
+
if (hasOutline) {
|
|
5238
5879
|
var borderHeight = undefined;
|
|
5239
5880
|
if (heightRef != Cesium.HeightReference.CLAMP_TO_GROUND) {
|
|
5240
5881
|
if (flattenPoints) {
|
|
@@ -5258,33 +5899,62 @@
|
|
|
5258
5899
|
else {
|
|
5259
5900
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
5260
5901
|
}
|
|
5261
|
-
var cEntityBorder =
|
|
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
|
-
|
|
5287
|
-
|
|
5902
|
+
var cEntityBorder = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5903
|
+
cEntity._siblingGraphics = [];
|
|
5904
|
+
if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
|
|
5905
|
+
(!cEntityBorder.corridor && units == "m"))) {
|
|
5906
|
+
cEntityBorder = new Cesium.Entity({
|
|
5907
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
5908
|
+
polyline: units == "px" ? new Cesium.PolylineGraphics({
|
|
5909
|
+
positions: borderPosses,
|
|
5910
|
+
material: cLineColor,
|
|
5911
|
+
width: width,
|
|
5912
|
+
clampToGround: heightRef == Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
5913
|
+
classificationType: Cesium.ClassificationType.TERRAIN,
|
|
5914
|
+
arcType: Cesium.ArcType.GEODESIC,
|
|
5915
|
+
zIndex: zIndex,
|
|
5916
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5917
|
+
}) : null,
|
|
5918
|
+
corridor: units == "m" ? {
|
|
5919
|
+
positions: borderPosses,
|
|
5920
|
+
material: cLineColor,
|
|
5921
|
+
heightReference: heightRef,
|
|
5922
|
+
height: borderHeight,
|
|
5923
|
+
width: width,
|
|
5924
|
+
fill: true,
|
|
5925
|
+
zIndex: zIndex + 1,
|
|
5926
|
+
cornerType: Cesium.CornerType.MITERED,
|
|
5927
|
+
classificationType: classification,
|
|
5928
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5929
|
+
shadows: Cesium.ShadowMode.ENABLED
|
|
5930
|
+
} : null,
|
|
5931
|
+
show: true
|
|
5932
|
+
});
|
|
5933
|
+
}
|
|
5934
|
+
else {
|
|
5935
|
+
if (units == "px") {
|
|
5936
|
+
cEntityBorder.polyline.positions = new Cesium.ConstantProperty(borderPosses);
|
|
5937
|
+
cEntityBorder.polyline.width = new Cesium.ConstantProperty(width);
|
|
5938
|
+
cEntityBorder.polyline.clampToGround = new Cesium.ConstantProperty(heightRef == Cesium.HeightReference.CLAMP_TO_GROUND);
|
|
5939
|
+
cEntityBorder.polyline.classificationType = new Cesium.ConstantProperty(Cesium.ClassificationType.TERRAIN);
|
|
5940
|
+
cEntityBorder.polyline.zIndex = new Cesium.ConstantProperty(zIndex);
|
|
5941
|
+
cEntityBorder.polyline.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5942
|
+
cEntityBorder.polyline.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
5943
|
+
cEntityBorder.corridor = undefined;
|
|
5944
|
+
}
|
|
5945
|
+
else {
|
|
5946
|
+
cEntityBorder.corridor.positions = new Cesium.ConstantProperty(borderPosses);
|
|
5947
|
+
cEntityBorder.corridor.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
5948
|
+
cEntityBorder.corridor.height = new Cesium.ConstantProperty(borderHeight);
|
|
5949
|
+
cEntityBorder.corridor.width = new Cesium.ConstantProperty(width);
|
|
5950
|
+
cEntityBorder.corridor.fill = new Cesium.ConstantProperty(true);
|
|
5951
|
+
cEntityBorder.corridor.zIndex = new Cesium.ConstantProperty(zIndex + 1);
|
|
5952
|
+
cEntityBorder.corridor.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5953
|
+
cEntityBorder.corridor.material = new Cesium.ColorMaterialProperty(cLineColor);
|
|
5954
|
+
cEntityBorder.polyline = undefined;
|
|
5955
|
+
}
|
|
5956
|
+
cEntityBorder.show = true;
|
|
5957
|
+
}
|
|
5288
5958
|
cEntityBorder._parentEntity = cEntity;
|
|
5289
5959
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
5290
5960
|
for (var i = 0; i < holePosses.length; i++) {
|
|
@@ -5321,20 +5991,23 @@
|
|
|
5321
5991
|
cEntityHole._parentEntity = cEntity;
|
|
5322
5992
|
}
|
|
5323
5993
|
}
|
|
5994
|
+
else {
|
|
5995
|
+
cEntity._siblingGraphics = [];
|
|
5996
|
+
}
|
|
5324
5997
|
return cEntity;
|
|
5325
5998
|
}
|
|
5326
5999
|
Polygon.Render = Render;
|
|
5327
6000
|
function RenderGroup(params) {
|
|
5328
|
-
var _a, _b, _c;
|
|
6001
|
+
var _a, _b, _c, _d;
|
|
5329
6002
|
return __awaiter(this, void 0, void 0, function () {
|
|
5330
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5331
|
-
return __generator(this, function (
|
|
5332
|
-
switch (
|
|
6003
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_4;
|
|
6004
|
+
return __generator(this, function (_f) {
|
|
6005
|
+
switch (_f.label) {
|
|
5333
6006
|
case 0:
|
|
5334
6007
|
api = params.apiGetter.getApi();
|
|
5335
6008
|
cEntities = {};
|
|
5336
6009
|
i = 0;
|
|
5337
|
-
|
|
6010
|
+
_f.label = 1;
|
|
5338
6011
|
case 1:
|
|
5339
6012
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5340
6013
|
entity = params.entities[i];
|
|
@@ -5342,13 +6015,13 @@
|
|
|
5342
6015
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5343
6016
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5344
6017
|
case 2:
|
|
5345
|
-
|
|
6018
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5346
6019
|
return [3 /*break*/, 4];
|
|
5347
6020
|
case 3:
|
|
5348
|
-
|
|
5349
|
-
|
|
6021
|
+
_e = zoomItem.Style;
|
|
6022
|
+
_f.label = 4;
|
|
5350
6023
|
case 4:
|
|
5351
|
-
style =
|
|
6024
|
+
style = _e;
|
|
5352
6025
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5353
6026
|
tags = [];
|
|
5354
6027
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5357,8 +6030,8 @@
|
|
|
5357
6030
|
tagIds: tagIds
|
|
5358
6031
|
})];
|
|
5359
6032
|
case 5:
|
|
5360
|
-
tags = (
|
|
5361
|
-
|
|
6033
|
+
tags = (_f.sent()).tags;
|
|
6034
|
+
_f.label = 6;
|
|
5362
6035
|
case 6:
|
|
5363
6036
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
5364
6037
|
cEntity = Render({
|
|
@@ -5367,16 +6040,17 @@
|
|
|
5367
6040
|
tags: tags,
|
|
5368
6041
|
viewer: params.viewer,
|
|
5369
6042
|
maxDistance: zoomItem.MaxZoom,
|
|
5370
|
-
minDistance: zoomItem.MinZoom
|
|
6043
|
+
minDistance: zoomItem.MinZoom,
|
|
6044
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5371
6045
|
});
|
|
5372
6046
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5373
6047
|
return [4 /*yield*/, getName(api, entity)];
|
|
5374
6048
|
case 7:
|
|
5375
|
-
name_4 =
|
|
6049
|
+
name_4 = _f.sent();
|
|
5376
6050
|
cEntity.name = name_4;
|
|
5377
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6051
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5378
6052
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5379
|
-
|
|
6053
|
+
_f.label = 8;
|
|
5380
6054
|
case 8:
|
|
5381
6055
|
i++;
|
|
5382
6056
|
return [3 /*break*/, 1];
|
|
@@ -5440,8 +6114,9 @@
|
|
|
5440
6114
|
color = colorToCColor(bColor);
|
|
5441
6115
|
}
|
|
5442
6116
|
}
|
|
5443
|
-
|
|
5444
|
-
|
|
6117
|
+
/*
|
|
6118
|
+
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
6119
|
+
id: ObjectUtils.UId(10),
|
|
5445
6120
|
model: {
|
|
5446
6121
|
uri: params.lodUrl,
|
|
5447
6122
|
heightReference: heightRef,
|
|
@@ -5449,13 +6124,89 @@
|
|
|
5449
6124
|
shadows: Cesium.ShadowMode.ENABLED,
|
|
5450
6125
|
colorBlendAmount: blendAmount,
|
|
5451
6126
|
colorBlendMode: blendMode,
|
|
5452
|
-
color: color,
|
|
6127
|
+
color: new Cesium.CallbackProperty(() => color, true),
|
|
5453
6128
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5454
6129
|
},
|
|
5455
6130
|
orientation: new Cesium.ConstantProperty(orientation),
|
|
5456
6131
|
position: pos,
|
|
5457
6132
|
show: true
|
|
5458
6133
|
});
|
|
6134
|
+
*/
|
|
6135
|
+
var animateScale = null;
|
|
6136
|
+
var cEntity = params.rendered;
|
|
6137
|
+
if (!cEntity || !cEntity.model) {
|
|
6138
|
+
cEntity = new Cesium.Entity({
|
|
6139
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
6140
|
+
model: {
|
|
6141
|
+
uri: params.lodUrl,
|
|
6142
|
+
heightReference: heightRef,
|
|
6143
|
+
scale: new Cesium.CallbackProperty(function () { return scale * styleScale; }, true),
|
|
6144
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
6145
|
+
colorBlendAmount: blendAmount,
|
|
6146
|
+
colorBlendMode: blendMode,
|
|
6147
|
+
color: new Cesium.CallbackProperty(function () { return color; }, true),
|
|
6148
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
6149
|
+
},
|
|
6150
|
+
orientation: new Cesium.ConstantProperty(orientation),
|
|
6151
|
+
position: pos,
|
|
6152
|
+
show: true
|
|
6153
|
+
});
|
|
6154
|
+
}
|
|
6155
|
+
else {
|
|
6156
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
6157
|
+
var parts = exports.EntityUtils.GatherEntity({
|
|
6158
|
+
entity: cEntity,
|
|
6159
|
+
});
|
|
6160
|
+
if (parts.length > 1) {
|
|
6161
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
6162
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
6163
|
+
var part = parts[i];
|
|
6164
|
+
if (part && part instanceof Cesium.Entity && params.viewer.entities.contains(part)) {
|
|
6165
|
+
params.viewer.entities.remove(part);
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6168
|
+
cEntity._siblingGraphics = [];
|
|
6169
|
+
if (cEntity._parentEntity) {
|
|
6170
|
+
console.warn("Model3d.Render: Parent entity was not null. This should not happen.");
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
var currentUri = getValue$1(params.viewer, cEntity.model.uri);
|
|
6174
|
+
if (currentUri != params.lodUrl) {
|
|
6175
|
+
cEntity.model.uri = new Cesium.ConstantProperty(params.lodUrl);
|
|
6176
|
+
}
|
|
6177
|
+
cEntity.model.heightReference = new Cesium.ConstantProperty(heightRef);
|
|
6178
|
+
cEntity.model.shadows = new Cesium.ConstantProperty(Cesium.ShadowMode.ENABLED);
|
|
6179
|
+
cEntity.model.colorBlendAmount = new Cesium.ConstantProperty(blendAmount);
|
|
6180
|
+
cEntity.model.colorBlendMode = new Cesium.ConstantProperty(blendMode);
|
|
6181
|
+
cEntity.model.distanceDisplayCondition = new Cesium.ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
6182
|
+
cEntity.orientation = new Cesium.ConstantProperty(orientation);
|
|
6183
|
+
cEntity.position = new Cesium.ConstantPositionProperty(pos);
|
|
6184
|
+
// Same file but different scale. We'll animate the scale.
|
|
6185
|
+
var prevClientFileId = cEntity.model._clientFileId;
|
|
6186
|
+
if (prevClientFileId == params.lodClientFileId) {
|
|
6187
|
+
animateScale = new CesiumAnimatedProperty.AnimateNumber({
|
|
6188
|
+
durationMs: 200,
|
|
6189
|
+
value: scale * styleScale,
|
|
6190
|
+
viewer: params.viewer,
|
|
6191
|
+
startValue: cEntity.model.scale,
|
|
6192
|
+
startPaused: true
|
|
6193
|
+
});
|
|
6194
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return animateScale.GetValue(); }, false);
|
|
6195
|
+
}
|
|
6196
|
+
else {
|
|
6197
|
+
cEntity.model.scale = new Cesium.CallbackProperty(function () { return scale * styleScale; }, true);
|
|
6198
|
+
}
|
|
6199
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
6200
|
+
// cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
|
|
6201
|
+
exports.CesiumEntityStyler.SetDefaultColor({
|
|
6202
|
+
color: color,
|
|
6203
|
+
entity: cEntity,
|
|
6204
|
+
viewer: params.viewer,
|
|
6205
|
+
override: true,
|
|
6206
|
+
requestRender: false
|
|
6207
|
+
});
|
|
6208
|
+
cEntity.show = true;
|
|
6209
|
+
}
|
|
5459
6210
|
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
5460
6211
|
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
5461
6212
|
if (!heightProm) {
|
|
@@ -5534,6 +6285,10 @@
|
|
|
5534
6285
|
VisualRegisterCuller.MarkShouldRecheck(params.viewer);
|
|
5535
6286
|
}
|
|
5536
6287
|
}
|
|
6288
|
+
// Rough estimate on when the model is ready in the scene.
|
|
6289
|
+
if (animateScale) {
|
|
6290
|
+
animateScale.Play();
|
|
6291
|
+
}
|
|
5537
6292
|
});
|
|
5538
6293
|
var model = cEntity.model;
|
|
5539
6294
|
model._radiusLoaded = false;
|
|
@@ -5546,16 +6301,16 @@
|
|
|
5546
6301
|
}
|
|
5547
6302
|
Model3d.Render = Render;
|
|
5548
6303
|
function RenderGroup(params) {
|
|
5549
|
-
var _a, _b, _c, _d, _e;
|
|
6304
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5550
6305
|
return __awaiter(this, void 0, void 0, function () {
|
|
5551
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
5552
|
-
return __generator(this, function (
|
|
5553
|
-
switch (
|
|
6306
|
+
var api, cEntities, reqBody, i, entity, zoomItem, style, _g, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
6307
|
+
return __generator(this, function (_h) {
|
|
6308
|
+
switch (_h.label) {
|
|
5554
6309
|
case 0:
|
|
5555
6310
|
api = params.apiGetter.getApi();
|
|
5556
6311
|
return [4 /*yield*/, api.Loading];
|
|
5557
6312
|
case 1:
|
|
5558
|
-
|
|
6313
|
+
_h.sent();
|
|
5559
6314
|
cEntities = {};
|
|
5560
6315
|
reqBody = {
|
|
5561
6316
|
"strict": false,
|
|
@@ -5563,7 +6318,7 @@
|
|
|
5563
6318
|
"Items": []
|
|
5564
6319
|
};
|
|
5565
6320
|
i = 0;
|
|
5566
|
-
|
|
6321
|
+
_h.label = 2;
|
|
5567
6322
|
case 2:
|
|
5568
6323
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5569
6324
|
entity = params.entities[i];
|
|
@@ -5571,13 +6326,13 @@
|
|
|
5571
6326
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
5572
6327
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5573
6328
|
case 3:
|
|
5574
|
-
|
|
6329
|
+
_g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5575
6330
|
return [3 /*break*/, 5];
|
|
5576
6331
|
case 4:
|
|
5577
|
-
|
|
5578
|
-
|
|
6332
|
+
_g = zoomItem.Style;
|
|
6333
|
+
_h.label = 5;
|
|
5579
6334
|
case 5:
|
|
5580
|
-
style =
|
|
6335
|
+
style = _g;
|
|
5581
6336
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5582
6337
|
tags = [];
|
|
5583
6338
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -5586,8 +6341,8 @@
|
|
|
5586
6341
|
tagIds: tagIds
|
|
5587
6342
|
})];
|
|
5588
6343
|
case 6:
|
|
5589
|
-
tags = (
|
|
5590
|
-
|
|
6344
|
+
tags = (_h.sent()).tags;
|
|
6345
|
+
_h.label = 7;
|
|
5591
6346
|
case 7:
|
|
5592
6347
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
5593
6348
|
group = mStyle.lodGroup ? bruceModels.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -5608,7 +6363,7 @@
|
|
|
5608
6363
|
"group": group,
|
|
5609
6364
|
"level": level
|
|
5610
6365
|
});
|
|
5611
|
-
|
|
6366
|
+
_h.label = 8;
|
|
5612
6367
|
case 8:
|
|
5613
6368
|
i++;
|
|
5614
6369
|
return [3 /*break*/, 2];
|
|
@@ -5617,24 +6372,24 @@
|
|
|
5617
6372
|
filter: reqBody
|
|
5618
6373
|
})];
|
|
5619
6374
|
case 10:
|
|
5620
|
-
lodData = (
|
|
6375
|
+
lodData = (_h.sent()).lods;
|
|
5621
6376
|
_loop_2 = function (i) {
|
|
5622
|
-
var entity, zoomItem, style,
|
|
5623
|
-
return __generator(this, function (
|
|
5624
|
-
switch (
|
|
6377
|
+
var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
6378
|
+
return __generator(this, function (_k) {
|
|
6379
|
+
switch (_k.label) {
|
|
5625
6380
|
case 0:
|
|
5626
6381
|
entity = params.entities[i];
|
|
5627
6382
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
5628
6383
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
5629
6384
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5630
6385
|
case 1:
|
|
5631
|
-
|
|
6386
|
+
_j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
5632
6387
|
return [3 /*break*/, 3];
|
|
5633
6388
|
case 2:
|
|
5634
|
-
|
|
5635
|
-
|
|
6389
|
+
_j = zoomItem.Style;
|
|
6390
|
+
_k.label = 3;
|
|
5636
6391
|
case 3:
|
|
5637
|
-
style =
|
|
6392
|
+
style = _j;
|
|
5638
6393
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5639
6394
|
tags = [];
|
|
5640
6395
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -5643,8 +6398,8 @@
|
|
|
5643
6398
|
tagIds: tagIds
|
|
5644
6399
|
})];
|
|
5645
6400
|
case 4:
|
|
5646
|
-
tags = (
|
|
5647
|
-
|
|
6401
|
+
tags = (_k.sent()).tags;
|
|
6402
|
+
_k.label = 5;
|
|
5648
6403
|
case 5:
|
|
5649
6404
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
5650
6405
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -5652,6 +6407,7 @@
|
|
|
5652
6407
|
}
|
|
5653
6408
|
mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
|
|
5654
6409
|
cEntity = Render({
|
|
6410
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
|
|
5655
6411
|
entity: entity,
|
|
5656
6412
|
style: mStyle,
|
|
5657
6413
|
tags: tags,
|
|
@@ -5668,23 +6424,23 @@
|
|
|
5668
6424
|
if (!cEntity) return [3 /*break*/, 7];
|
|
5669
6425
|
return [4 /*yield*/, getName(api, entity)];
|
|
5670
6426
|
case 6:
|
|
5671
|
-
name_5 =
|
|
6427
|
+
name_5 = _k.sent();
|
|
5672
6428
|
cEntity.name = name_5;
|
|
5673
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6429
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
|
|
5674
6430
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5675
|
-
|
|
6431
|
+
_k.label = 7;
|
|
5676
6432
|
case 7: return [2 /*return*/];
|
|
5677
6433
|
}
|
|
5678
6434
|
});
|
|
5679
6435
|
};
|
|
5680
6436
|
i = 0;
|
|
5681
|
-
|
|
6437
|
+
_h.label = 11;
|
|
5682
6438
|
case 11:
|
|
5683
6439
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
5684
6440
|
return [5 /*yield**/, _loop_2(i)];
|
|
5685
6441
|
case 12:
|
|
5686
|
-
|
|
5687
|
-
|
|
6442
|
+
_h.sent();
|
|
6443
|
+
_h.label = 13;
|
|
5688
6444
|
case 13:
|
|
5689
6445
|
i++;
|
|
5690
6446
|
return [3 /*break*/, 11];
|
|
@@ -11759,6 +12515,16 @@
|
|
|
11759
12515
|
};
|
|
11760
12516
|
Styler.prototype.QueueEntities = function (entities, highPriority) {
|
|
11761
12517
|
if (highPriority === void 0) { highPriority = false; }
|
|
12518
|
+
// We set a default colour right away to avoid race conditions at later times.
|
|
12519
|
+
for (var i = 0; i < entities.length; i++) {
|
|
12520
|
+
var entity = entities[i];
|
|
12521
|
+
this.styledEntityIds[entity.entityId] = true;
|
|
12522
|
+
exports.CesiumEntityStyler.BakeDefaultColor({
|
|
12523
|
+
entity: entity.visual,
|
|
12524
|
+
viewer: this.viewer,
|
|
12525
|
+
override: false
|
|
12526
|
+
});
|
|
12527
|
+
}
|
|
11762
12528
|
for (var i = 0; i < entities.length; i++) {
|
|
11763
12529
|
var entity = entities[i];
|
|
11764
12530
|
this.queueTilesetFeatureStyle(entity, highPriority);
|
|
@@ -22515,7 +23281,7 @@
|
|
|
22515
23281
|
ViewRenderEngine.Render = Render;
|
|
22516
23282
|
})(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
|
|
22517
23283
|
|
|
22518
|
-
var VERSION = "3.7.
|
|
23284
|
+
var VERSION = "3.7.4";
|
|
22519
23285
|
|
|
22520
23286
|
exports.VERSION = VERSION;
|
|
22521
23287
|
exports.CesiumParabola = CesiumParabola;
|