bruce-cesium 3.7.3 → 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 -265
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +1030 -263
- 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/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.
|
|
@@ -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);
|
|
@@ -4414,7 +4799,7 @@
|
|
|
4414
4799
|
function Render(params) {
|
|
4415
4800
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
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,
|
|
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;
|
|
4418
4803
|
return __generator(this, function (_j) {
|
|
4419
4804
|
switch (_j.label) {
|
|
4420
4805
|
case 0:
|
|
@@ -4458,16 +4843,23 @@
|
|
|
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
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.
|
|
4468
4854
|
cEntities[id] = existingRego.visual;
|
|
4469
4855
|
}
|
|
4470
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
|
+
}
|
|
4471
4863
|
if (displayType == bruceModels.ZoomControl.EDisplayType.Model3D) {
|
|
4472
4864
|
models.push(entity);
|
|
4473
4865
|
}
|
|
@@ -4487,7 +4879,7 @@
|
|
|
4487
4879
|
}
|
|
4488
4880
|
}
|
|
4489
4881
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
4490
|
-
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
4882
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
4491
4883
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
4492
4884
|
case 1:
|
|
4493
4885
|
mEntities = _j.sent();
|
|
@@ -4515,7 +4907,7 @@
|
|
|
4515
4907
|
polygons.push(entity);
|
|
4516
4908
|
return [2 /*return*/, "continue"];
|
|
4517
4909
|
}
|
|
4518
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
|
|
4910
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
4519
4911
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
4520
4912
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
4521
4913
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: bruceModels.ObjectUtils.UId() }) });
|
|
@@ -4584,7 +4976,7 @@
|
|
|
4584
4976
|
return [3 /*break*/, 3];
|
|
4585
4977
|
case 6:
|
|
4586
4978
|
if (!(polygons.length > 0)) return [3 /*break*/, 8];
|
|
4587
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
4979
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
4588
4980
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
4589
4981
|
case 7:
|
|
4590
4982
|
pEntities = _j.sent();
|
|
@@ -4601,7 +4993,7 @@
|
|
|
4601
4993
|
_j.label = 8;
|
|
4602
4994
|
case 8:
|
|
4603
4995
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
4604
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
4996
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
4605
4997
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
4606
4998
|
case 9:
|
|
4607
4999
|
pEntities = _j.sent();
|
|
@@ -4618,7 +5010,7 @@
|
|
|
4618
5010
|
_j.label = 10;
|
|
4619
5011
|
case 10:
|
|
4620
5012
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
4621
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
5013
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
4622
5014
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
4623
5015
|
case 11:
|
|
4624
5016
|
pEntities = _j.sent();
|
|
@@ -4682,11 +5074,11 @@
|
|
|
4682
5074
|
}
|
|
4683
5075
|
Point.CreateCircleBillboard = CreateCircleBillboard;
|
|
4684
5076
|
function Render(params) {
|
|
4685
|
-
var _a, _b;
|
|
5077
|
+
var _a, _b, _c, _d;
|
|
4686
5078
|
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 (
|
|
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) {
|
|
4690
5082
|
case 0:
|
|
4691
5083
|
entity = params.entity;
|
|
4692
5084
|
style = params.style;
|
|
@@ -4699,6 +5091,27 @@
|
|
|
4699
5091
|
}
|
|
4700
5092
|
cEntity = null;
|
|
4701
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
|
+
};
|
|
4702
5115
|
if (!(type == bruceModels.Style.EPointType.Icon)) return [3 /*break*/, 9];
|
|
4703
5116
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
4704
5117
|
iconUrlRows.forEach(function (row) {
|
|
@@ -4715,36 +5128,36 @@
|
|
|
4715
5128
|
api = params.apiGetter.getApi(metadata.accountId);
|
|
4716
5129
|
return [4 /*yield*/, api.Loading];
|
|
4717
5130
|
case 1:
|
|
4718
|
-
|
|
5131
|
+
_e.sent();
|
|
4719
5132
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4720
5133
|
api: api,
|
|
4721
5134
|
fileId: metadata.fileId,
|
|
4722
5135
|
viaCdn: true
|
|
4723
5136
|
});
|
|
4724
|
-
|
|
5137
|
+
_e.label = 2;
|
|
4725
5138
|
case 2:
|
|
4726
5139
|
if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
|
|
4727
5140
|
return [4 /*yield*/, params.api.Loading];
|
|
4728
5141
|
case 3:
|
|
4729
|
-
|
|
5142
|
+
_e.sent();
|
|
4730
5143
|
iconUrl = bruceModels.ClientFile.GetUrl({
|
|
4731
5144
|
api: params.api,
|
|
4732
5145
|
fileId: style.iconId,
|
|
4733
5146
|
viaCdn: true
|
|
4734
5147
|
});
|
|
4735
|
-
|
|
5148
|
+
_e.label = 4;
|
|
4736
5149
|
case 4:
|
|
4737
5150
|
image = null;
|
|
4738
5151
|
if (!iconUrl) return [3 /*break*/, 8];
|
|
4739
|
-
|
|
5152
|
+
_e.label = 5;
|
|
4740
5153
|
case 5:
|
|
4741
|
-
|
|
5154
|
+
_e.trys.push([5, 7, , 8]);
|
|
4742
5155
|
return [4 /*yield*/, createImageBillboard(iconUrl)];
|
|
4743
5156
|
case 6:
|
|
4744
|
-
image =
|
|
5157
|
+
image = _e.sent();
|
|
4745
5158
|
return [3 /*break*/, 8];
|
|
4746
5159
|
case 7:
|
|
4747
|
-
e_5 =
|
|
5160
|
+
e_5 = _e.sent();
|
|
4748
5161
|
// Expanding the logging here so we can figure out why this is happening.
|
|
4749
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.
|
|
4750
5163
|
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
@@ -4763,34 +5176,64 @@
|
|
|
4763
5176
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4764
5177
|
if (iconScale > 0) {
|
|
4765
5178
|
bColor = style.iconTintColor ? bruceModels.Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
4766
|
-
|
|
5179
|
+
cColor_1 = bColor ? colorToCColor(bColor) : undefined;
|
|
4767
5180
|
heightRef = getHeightRef(style);
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
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({
|
|
4783
5217
|
viewer: params.viewer,
|
|
4784
5218
|
entity: entity,
|
|
4785
5219
|
recordHeightRef: heightRef,
|
|
4786
5220
|
returnHeightRef: heightRef
|
|
4787
|
-
})
|
|
4788
|
-
|
|
4789
|
-
|
|
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
|
+
}
|
|
4790
5232
|
cEntity.billboard._billboardSize = image.height;
|
|
5233
|
+
cEntity.billboard._billboardImgKey = iconUrl;
|
|
4791
5234
|
}
|
|
4792
5235
|
}
|
|
4793
|
-
|
|
5236
|
+
_e.label = 9;
|
|
4794
5237
|
case 9:
|
|
4795
5238
|
if (type == bruceModels.Style.EPointType.Cylinder) {
|
|
4796
5239
|
radius = EnsureNumber(bruceModels.Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
@@ -4815,46 +5258,97 @@
|
|
|
4815
5258
|
returnHeightRef: heightRef
|
|
4816
5259
|
});
|
|
4817
5260
|
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({
|
|
5261
|
+
hasOutline = outline && outlineWidth > 0;
|
|
5262
|
+
if (!params.rendered || !params.rendered.ellipse) {
|
|
5263
|
+
cEntity = new Cesium.Entity({
|
|
4843
5264
|
id: bruceModels.ObjectUtils.UId(10),
|
|
4844
5265
|
ellipse: {
|
|
4845
|
-
semiMajorAxis: radius
|
|
4846
|
-
semiMinorAxis: radius
|
|
4847
|
-
material:
|
|
4848
|
-
outlineWidth:
|
|
4849
|
-
extrudedHeight:
|
|
5266
|
+
semiMajorAxis: radius,
|
|
5267
|
+
semiMinorAxis: radius,
|
|
5268
|
+
material: cFill,
|
|
5269
|
+
outlineWidth: null,
|
|
5270
|
+
extrudedHeight: extrusion.value,
|
|
4850
5271
|
heightReference: heightRef,
|
|
4851
|
-
extrudedHeightReference:
|
|
5272
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
4852
5273
|
height: Cesium.Cartographic.fromCartesian(pos3d).height,
|
|
4853
|
-
zIndex:
|
|
5274
|
+
zIndex: 1,
|
|
4854
5275
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4855
5276
|
},
|
|
4856
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
4857
|
-
|
|
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);
|
|
4858
5352
|
}
|
|
4859
5353
|
}
|
|
4860
5354
|
if (!cEntity) {
|
|
@@ -4871,33 +5365,66 @@
|
|
|
4871
5365
|
heightRef = getHeightRef(style);
|
|
4872
5366
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
4873
5367
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
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({
|
|
4894
5412
|
viewer: params.viewer,
|
|
4895
5413
|
entity: entity,
|
|
4896
5414
|
recordHeightRef: heightRef,
|
|
4897
5415
|
returnHeightRef: heightRef
|
|
4898
|
-
})
|
|
4899
|
-
|
|
4900
|
-
|
|
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
|
+
}
|
|
4901
5428
|
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
4902
5429
|
}
|
|
4903
5430
|
if (cEntity) {
|
|
@@ -4910,16 +5437,16 @@
|
|
|
4910
5437
|
}
|
|
4911
5438
|
Point.Render = Render;
|
|
4912
5439
|
function RenderGroup(params) {
|
|
4913
|
-
var _a, _b, _c;
|
|
5440
|
+
var _a, _b, _c, _d;
|
|
4914
5441
|
return __awaiter(this, void 0, void 0, function () {
|
|
4915
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
4916
|
-
return __generator(this, function (
|
|
4917
|
-
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) {
|
|
4918
5445
|
case 0:
|
|
4919
5446
|
api = params.apiGetter.getApi();
|
|
4920
5447
|
cEntities = {};
|
|
4921
5448
|
i = 0;
|
|
4922
|
-
|
|
5449
|
+
_f.label = 1;
|
|
4923
5450
|
case 1:
|
|
4924
5451
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
4925
5452
|
entity = params.entities[i];
|
|
@@ -4927,13 +5454,13 @@
|
|
|
4927
5454
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
4928
5455
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
4929
5456
|
case 2:
|
|
4930
|
-
|
|
5457
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
4931
5458
|
return [3 /*break*/, 4];
|
|
4932
5459
|
case 3:
|
|
4933
|
-
|
|
4934
|
-
|
|
5460
|
+
_e = zoomItem.Style;
|
|
5461
|
+
_f.label = 4;
|
|
4935
5462
|
case 4:
|
|
4936
|
-
style =
|
|
5463
|
+
style = _e;
|
|
4937
5464
|
tagIds = entity.Bruce["Layer.ID"];
|
|
4938
5465
|
tags = [];
|
|
4939
5466
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -4942,8 +5469,8 @@
|
|
|
4942
5469
|
tagIds: tagIds
|
|
4943
5470
|
})];
|
|
4944
5471
|
case 5:
|
|
4945
|
-
tags = (
|
|
4946
|
-
|
|
5472
|
+
tags = (_f.sent()).tags;
|
|
5473
|
+
_f.label = 6;
|
|
4947
5474
|
case 6:
|
|
4948
5475
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
4949
5476
|
return [4 /*yield*/, Render({
|
|
@@ -4954,20 +5481,21 @@
|
|
|
4954
5481
|
api: api,
|
|
4955
5482
|
apiGetter: params.apiGetter,
|
|
4956
5483
|
maxDistance: zoomItem.MaxZoom,
|
|
4957
|
-
minDistance: zoomItem.MinZoom
|
|
5484
|
+
minDistance: zoomItem.MinZoom,
|
|
5485
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
4958
5486
|
})];
|
|
4959
5487
|
case 7:
|
|
4960
|
-
cEntity =
|
|
5488
|
+
cEntity = _f.sent();
|
|
4961
5489
|
if (!cEntity) return [3 /*break*/, 9];
|
|
4962
5490
|
return [4 /*yield*/, getName(api, entity)];
|
|
4963
5491
|
case 8:
|
|
4964
|
-
name_2 =
|
|
5492
|
+
name_2 = _f.sent();
|
|
4965
5493
|
cEntity.name = name_2;
|
|
4966
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
4967
|
-
|
|
5494
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5495
|
+
_f.label = 9;
|
|
4968
5496
|
case 9:
|
|
4969
5497
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
4970
|
-
|
|
5498
|
+
_f.label = 10;
|
|
4971
5499
|
case 10:
|
|
4972
5500
|
i++;
|
|
4973
5501
|
return [3 /*break*/, 1];
|
|
@@ -5052,52 +5580,110 @@
|
|
|
5052
5580
|
if (style.drapeOver == "ALL") {
|
|
5053
5581
|
classification = Cesium.ClassificationType.BOTH;
|
|
5054
5582
|
}
|
|
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
|
-
|
|
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({
|
|
5080
5666
|
viewer: params.viewer,
|
|
5081
5667
|
entity: entity,
|
|
5082
5668
|
recordHeightRef: heightRef,
|
|
5083
5669
|
returnHeightRef: heightRef
|
|
5084
|
-
})
|
|
5085
|
-
show
|
|
5086
|
-
}
|
|
5670
|
+
}));
|
|
5671
|
+
cEntity.show = true;
|
|
5672
|
+
}
|
|
5087
5673
|
return cEntity;
|
|
5088
5674
|
}
|
|
5089
5675
|
Polyline.Render = Render;
|
|
5090
5676
|
function RenderGroup(params) {
|
|
5091
|
-
var _a, _b, _c;
|
|
5677
|
+
var _a, _b, _c, _d;
|
|
5092
5678
|
return __awaiter(this, void 0, void 0, function () {
|
|
5093
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5094
|
-
return __generator(this, function (
|
|
5095
|
-
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) {
|
|
5096
5682
|
case 0:
|
|
5097
5683
|
api = params.apiGetter.getApi();
|
|
5098
5684
|
cEntities = {};
|
|
5099
5685
|
i = 0;
|
|
5100
|
-
|
|
5686
|
+
_f.label = 1;
|
|
5101
5687
|
case 1:
|
|
5102
5688
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5103
5689
|
entity = params.entities[i];
|
|
@@ -5105,13 +5691,13 @@
|
|
|
5105
5691
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5106
5692
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5107
5693
|
case 2:
|
|
5108
|
-
|
|
5694
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5109
5695
|
return [3 /*break*/, 4];
|
|
5110
5696
|
case 3:
|
|
5111
|
-
|
|
5112
|
-
|
|
5697
|
+
_e = zoomItem.Style;
|
|
5698
|
+
_f.label = 4;
|
|
5113
5699
|
case 4:
|
|
5114
|
-
style =
|
|
5700
|
+
style = _e;
|
|
5115
5701
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5116
5702
|
tags = [];
|
|
5117
5703
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5120,8 +5706,8 @@
|
|
|
5120
5706
|
tagIds: tagIds
|
|
5121
5707
|
})];
|
|
5122
5708
|
case 5:
|
|
5123
|
-
tags = (
|
|
5124
|
-
|
|
5709
|
+
tags = (_f.sent()).tags;
|
|
5710
|
+
_f.label = 6;
|
|
5125
5711
|
case 6:
|
|
5126
5712
|
lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
5127
5713
|
cEntity = Render({
|
|
@@ -5130,16 +5716,17 @@
|
|
|
5130
5716
|
tags: tags,
|
|
5131
5717
|
viewer: params.viewer,
|
|
5132
5718
|
maxDistance: zoomItem.MaxZoom,
|
|
5133
|
-
minDistance: zoomItem.MinZoom
|
|
5719
|
+
minDistance: zoomItem.MinZoom,
|
|
5720
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5134
5721
|
});
|
|
5135
5722
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5136
5723
|
return [4 /*yield*/, getName(api, entity)];
|
|
5137
5724
|
case 7:
|
|
5138
|
-
name_3 =
|
|
5725
|
+
name_3 = _f.sent();
|
|
5139
5726
|
cEntity.name = name_3;
|
|
5140
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
5727
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5141
5728
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5142
|
-
|
|
5729
|
+
_f.label = 8;
|
|
5143
5730
|
case 8:
|
|
5144
5731
|
i++;
|
|
5145
5732
|
return [3 /*break*/, 1];
|
|
@@ -5153,7 +5740,7 @@
|
|
|
5153
5740
|
var Polygon;
|
|
5154
5741
|
(function (Polygon) {
|
|
5155
5742
|
function Render(params) {
|
|
5156
|
-
var _a, _b;
|
|
5743
|
+
var _a, _b, _c, _d;
|
|
5157
5744
|
var entity = params.entity;
|
|
5158
5745
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
5159
5746
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -5210,30 +5797,85 @@
|
|
|
5210
5797
|
if (style.drapeOver == "ALL") {
|
|
5211
5798
|
classification = Cesium.ClassificationType.BOTH;
|
|
5212
5799
|
}
|
|
5213
|
-
var
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
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({
|
|
5228
5862
|
viewer: params.viewer,
|
|
5229
5863
|
entity: entity,
|
|
5230
5864
|
recordHeightRef: heightRef,
|
|
5231
5865
|
returnHeightRef: heightRef
|
|
5232
|
-
})
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
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) {
|
|
5237
5879
|
var borderHeight = undefined;
|
|
5238
5880
|
if (heightRef != Cesium.HeightReference.CLAMP_TO_GROUND) {
|
|
5239
5881
|
if (flattenPoints) {
|
|
@@ -5257,33 +5899,62 @@
|
|
|
5257
5899
|
else {
|
|
5258
5900
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
5259
5901
|
}
|
|
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
|
-
|
|
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
|
+
}
|
|
5287
5958
|
cEntityBorder._parentEntity = cEntity;
|
|
5288
5959
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
5289
5960
|
for (var i = 0; i < holePosses.length; i++) {
|
|
@@ -5320,20 +5991,23 @@
|
|
|
5320
5991
|
cEntityHole._parentEntity = cEntity;
|
|
5321
5992
|
}
|
|
5322
5993
|
}
|
|
5994
|
+
else {
|
|
5995
|
+
cEntity._siblingGraphics = [];
|
|
5996
|
+
}
|
|
5323
5997
|
return cEntity;
|
|
5324
5998
|
}
|
|
5325
5999
|
Polygon.Render = Render;
|
|
5326
6000
|
function RenderGroup(params) {
|
|
5327
|
-
var _a, _b, _c;
|
|
6001
|
+
var _a, _b, _c, _d;
|
|
5328
6002
|
return __awaiter(this, void 0, void 0, function () {
|
|
5329
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5330
|
-
return __generator(this, function (
|
|
5331
|
-
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) {
|
|
5332
6006
|
case 0:
|
|
5333
6007
|
api = params.apiGetter.getApi();
|
|
5334
6008
|
cEntities = {};
|
|
5335
6009
|
i = 0;
|
|
5336
|
-
|
|
6010
|
+
_f.label = 1;
|
|
5337
6011
|
case 1:
|
|
5338
6012
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5339
6013
|
entity = params.entities[i];
|
|
@@ -5341,13 +6015,13 @@
|
|
|
5341
6015
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5342
6016
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5343
6017
|
case 2:
|
|
5344
|
-
|
|
6018
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5345
6019
|
return [3 /*break*/, 4];
|
|
5346
6020
|
case 3:
|
|
5347
|
-
|
|
5348
|
-
|
|
6021
|
+
_e = zoomItem.Style;
|
|
6022
|
+
_f.label = 4;
|
|
5349
6023
|
case 4:
|
|
5350
|
-
style =
|
|
6024
|
+
style = _e;
|
|
5351
6025
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5352
6026
|
tags = [];
|
|
5353
6027
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5356,8 +6030,8 @@
|
|
|
5356
6030
|
tagIds: tagIds
|
|
5357
6031
|
})];
|
|
5358
6032
|
case 5:
|
|
5359
|
-
tags = (
|
|
5360
|
-
|
|
6033
|
+
tags = (_f.sent()).tags;
|
|
6034
|
+
_f.label = 6;
|
|
5361
6035
|
case 6:
|
|
5362
6036
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
5363
6037
|
cEntity = Render({
|
|
@@ -5366,16 +6040,17 @@
|
|
|
5366
6040
|
tags: tags,
|
|
5367
6041
|
viewer: params.viewer,
|
|
5368
6042
|
maxDistance: zoomItem.MaxZoom,
|
|
5369
|
-
minDistance: zoomItem.MinZoom
|
|
6043
|
+
minDistance: zoomItem.MinZoom,
|
|
6044
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5370
6045
|
});
|
|
5371
6046
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5372
6047
|
return [4 /*yield*/, getName(api, entity)];
|
|
5373
6048
|
case 7:
|
|
5374
|
-
name_4 =
|
|
6049
|
+
name_4 = _f.sent();
|
|
5375
6050
|
cEntity.name = name_4;
|
|
5376
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6051
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5377
6052
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5378
|
-
|
|
6053
|
+
_f.label = 8;
|
|
5379
6054
|
case 8:
|
|
5380
6055
|
i++;
|
|
5381
6056
|
return [3 /*break*/, 1];
|
|
@@ -5439,8 +6114,9 @@
|
|
|
5439
6114
|
color = colorToCColor(bColor);
|
|
5440
6115
|
}
|
|
5441
6116
|
}
|
|
5442
|
-
|
|
5443
|
-
|
|
6117
|
+
/*
|
|
6118
|
+
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
6119
|
+
id: ObjectUtils.UId(10),
|
|
5444
6120
|
model: {
|
|
5445
6121
|
uri: params.lodUrl,
|
|
5446
6122
|
heightReference: heightRef,
|
|
@@ -5448,13 +6124,89 @@
|
|
|
5448
6124
|
shadows: Cesium.ShadowMode.ENABLED,
|
|
5449
6125
|
colorBlendAmount: blendAmount,
|
|
5450
6126
|
colorBlendMode: blendMode,
|
|
5451
|
-
color: color,
|
|
6127
|
+
color: new Cesium.CallbackProperty(() => color, true),
|
|
5452
6128
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5453
6129
|
},
|
|
5454
6130
|
orientation: new Cesium.ConstantProperty(orientation),
|
|
5455
6131
|
position: pos,
|
|
5456
6132
|
show: true
|
|
5457
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
|
+
}
|
|
5458
6210
|
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
5459
6211
|
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
5460
6212
|
if (!heightProm) {
|
|
@@ -5533,6 +6285,10 @@
|
|
|
5533
6285
|
VisualRegisterCuller.MarkShouldRecheck(params.viewer);
|
|
5534
6286
|
}
|
|
5535
6287
|
}
|
|
6288
|
+
// Rough estimate on when the model is ready in the scene.
|
|
6289
|
+
if (animateScale) {
|
|
6290
|
+
animateScale.Play();
|
|
6291
|
+
}
|
|
5536
6292
|
});
|
|
5537
6293
|
var model = cEntity.model;
|
|
5538
6294
|
model._radiusLoaded = false;
|
|
@@ -5545,16 +6301,16 @@
|
|
|
5545
6301
|
}
|
|
5546
6302
|
Model3d.Render = Render;
|
|
5547
6303
|
function RenderGroup(params) {
|
|
5548
|
-
var _a, _b, _c, _d, _e;
|
|
6304
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5549
6305
|
return __awaiter(this, void 0, void 0, function () {
|
|
5550
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
5551
|
-
return __generator(this, function (
|
|
5552
|
-
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) {
|
|
5553
6309
|
case 0:
|
|
5554
6310
|
api = params.apiGetter.getApi();
|
|
5555
6311
|
return [4 /*yield*/, api.Loading];
|
|
5556
6312
|
case 1:
|
|
5557
|
-
|
|
6313
|
+
_h.sent();
|
|
5558
6314
|
cEntities = {};
|
|
5559
6315
|
reqBody = {
|
|
5560
6316
|
"strict": false,
|
|
@@ -5562,7 +6318,7 @@
|
|
|
5562
6318
|
"Items": []
|
|
5563
6319
|
};
|
|
5564
6320
|
i = 0;
|
|
5565
|
-
|
|
6321
|
+
_h.label = 2;
|
|
5566
6322
|
case 2:
|
|
5567
6323
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5568
6324
|
entity = params.entities[i];
|
|
@@ -5570,13 +6326,13 @@
|
|
|
5570
6326
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
5571
6327
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5572
6328
|
case 3:
|
|
5573
|
-
|
|
6329
|
+
_g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5574
6330
|
return [3 /*break*/, 5];
|
|
5575
6331
|
case 4:
|
|
5576
|
-
|
|
5577
|
-
|
|
6332
|
+
_g = zoomItem.Style;
|
|
6333
|
+
_h.label = 5;
|
|
5578
6334
|
case 5:
|
|
5579
|
-
style =
|
|
6335
|
+
style = _g;
|
|
5580
6336
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5581
6337
|
tags = [];
|
|
5582
6338
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -5585,8 +6341,8 @@
|
|
|
5585
6341
|
tagIds: tagIds
|
|
5586
6342
|
})];
|
|
5587
6343
|
case 6:
|
|
5588
|
-
tags = (
|
|
5589
|
-
|
|
6344
|
+
tags = (_h.sent()).tags;
|
|
6345
|
+
_h.label = 7;
|
|
5590
6346
|
case 7:
|
|
5591
6347
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
5592
6348
|
group = mStyle.lodGroup ? bruceModels.Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -5607,7 +6363,7 @@
|
|
|
5607
6363
|
"group": group,
|
|
5608
6364
|
"level": level
|
|
5609
6365
|
});
|
|
5610
|
-
|
|
6366
|
+
_h.label = 8;
|
|
5611
6367
|
case 8:
|
|
5612
6368
|
i++;
|
|
5613
6369
|
return [3 /*break*/, 2];
|
|
@@ -5616,24 +6372,24 @@
|
|
|
5616
6372
|
filter: reqBody
|
|
5617
6373
|
})];
|
|
5618
6374
|
case 10:
|
|
5619
|
-
lodData = (
|
|
6375
|
+
lodData = (_h.sent()).lods;
|
|
5620
6376
|
_loop_2 = function (i) {
|
|
5621
|
-
var entity, zoomItem, style,
|
|
5622
|
-
return __generator(this, function (
|
|
5623
|
-
switch (
|
|
6377
|
+
var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
6378
|
+
return __generator(this, function (_k) {
|
|
6379
|
+
switch (_k.label) {
|
|
5624
6380
|
case 0:
|
|
5625
6381
|
entity = params.entities[i];
|
|
5626
6382
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
5627
6383
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
5628
6384
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5629
6385
|
case 1:
|
|
5630
|
-
|
|
6386
|
+
_j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
5631
6387
|
return [3 /*break*/, 3];
|
|
5632
6388
|
case 2:
|
|
5633
|
-
|
|
5634
|
-
|
|
6389
|
+
_j = zoomItem.Style;
|
|
6390
|
+
_k.label = 3;
|
|
5635
6391
|
case 3:
|
|
5636
|
-
style =
|
|
6392
|
+
style = _j;
|
|
5637
6393
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5638
6394
|
tags = [];
|
|
5639
6395
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -5642,8 +6398,8 @@
|
|
|
5642
6398
|
tagIds: tagIds
|
|
5643
6399
|
})];
|
|
5644
6400
|
case 4:
|
|
5645
|
-
tags = (
|
|
5646
|
-
|
|
6401
|
+
tags = (_k.sent()).tags;
|
|
6402
|
+
_k.label = 5;
|
|
5647
6403
|
case 5:
|
|
5648
6404
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
5649
6405
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -5651,6 +6407,7 @@
|
|
|
5651
6407
|
}
|
|
5652
6408
|
mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
|
|
5653
6409
|
cEntity = Render({
|
|
6410
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
|
|
5654
6411
|
entity: entity,
|
|
5655
6412
|
style: mStyle,
|
|
5656
6413
|
tags: tags,
|
|
@@ -5667,23 +6424,23 @@
|
|
|
5667
6424
|
if (!cEntity) return [3 /*break*/, 7];
|
|
5668
6425
|
return [4 /*yield*/, getName(api, entity)];
|
|
5669
6426
|
case 6:
|
|
5670
|
-
name_5 =
|
|
6427
|
+
name_5 = _k.sent();
|
|
5671
6428
|
cEntity.name = name_5;
|
|
5672
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6429
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
|
|
5673
6430
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5674
|
-
|
|
6431
|
+
_k.label = 7;
|
|
5675
6432
|
case 7: return [2 /*return*/];
|
|
5676
6433
|
}
|
|
5677
6434
|
});
|
|
5678
6435
|
};
|
|
5679
6436
|
i = 0;
|
|
5680
|
-
|
|
6437
|
+
_h.label = 11;
|
|
5681
6438
|
case 11:
|
|
5682
6439
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
5683
6440
|
return [5 /*yield**/, _loop_2(i)];
|
|
5684
6441
|
case 12:
|
|
5685
|
-
|
|
5686
|
-
|
|
6442
|
+
_h.sent();
|
|
6443
|
+
_h.label = 13;
|
|
5687
6444
|
case 13:
|
|
5688
6445
|
i++;
|
|
5689
6446
|
return [3 /*break*/, 11];
|
|
@@ -11758,6 +12515,16 @@
|
|
|
11758
12515
|
};
|
|
11759
12516
|
Styler.prototype.QueueEntities = function (entities, highPriority) {
|
|
11760
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
|
+
}
|
|
11761
12528
|
for (var i = 0; i < entities.length; i++) {
|
|
11762
12529
|
var entity = entities[i];
|
|
11763
12530
|
this.queueTilesetFeatureStyle(entity, highPriority);
|
|
@@ -22514,7 +23281,7 @@
|
|
|
22514
23281
|
ViewRenderEngine.Render = Render;
|
|
22515
23282
|
})(exports.ViewRenderEngine || (exports.ViewRenderEngine = {}));
|
|
22516
23283
|
|
|
22517
|
-
var VERSION = "3.7.
|
|
23284
|
+
var VERSION = "3.7.4";
|
|
22518
23285
|
|
|
22519
23286
|
exports.VERSION = VERSION;
|
|
22520
23287
|
exports.CesiumParabola = CesiumParabola;
|