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.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ProjectViewTile, DelayQueue, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, Bounds, Api, EntityRelationType, ENVIRONMENT, EntityCoords, EntitySource, MenuItem, EntityRelation, ProgramKey, AbstractApi, ProjectViewBookmark, EntityAttachment, EntityAttachmentType, EntityAttribute, ProjectView, ProjectViewLegacyTile, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, DistanceDisplayCondition, NearFarScalar, Model, Entity, HorizontalOrigin, VerticalOrigin, ConstantProperty, ConstantPositionProperty, ClassificationType, ArcType, CornerType, ShadowMode, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, SceneMode, GeoJsonDataSource, Cesium3DTileColorBlendMode, HeadingPitchRange, Ion, Cesium3DTileStyle, KmlDataSource, SceneTransforms, OrthographicFrustum, EasingFunction, Cesium3DTileset, Matrix4, Matrix3, IonResource, EllipsoidTerrainProvider, CesiumInspector, defined, ClockRange, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, CesiumTerrainProvider, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Quaternion, Intersect } from 'cesium';
|
|
4
4
|
|
|
5
5
|
/*! *****************************************************************************
|
|
6
6
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -900,6 +900,282 @@ var DrawingUtils;
|
|
|
900
900
|
DrawingUtils.RaisePos3d = RaisePos3d;
|
|
901
901
|
})(DrawingUtils || (DrawingUtils = {}));
|
|
902
902
|
|
|
903
|
+
function getColor(viewer, obj) {
|
|
904
|
+
var value = null;
|
|
905
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
906
|
+
var date = viewer.scene.lastRenderTime;
|
|
907
|
+
if (!date) {
|
|
908
|
+
date = viewer.clock.currentTime;
|
|
909
|
+
}
|
|
910
|
+
value = obj.getValue(date);
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
value = obj;
|
|
914
|
+
}
|
|
915
|
+
if (value && value instanceof ColorMaterialProperty) {
|
|
916
|
+
value = value.color;
|
|
917
|
+
}
|
|
918
|
+
return value;
|
|
919
|
+
}
|
|
920
|
+
function getNumber(viewer, obj) {
|
|
921
|
+
var value = null;
|
|
922
|
+
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
923
|
+
var date = viewer.scene.lastRenderTime;
|
|
924
|
+
if (!date) {
|
|
925
|
+
date = viewer.clock.currentTime;
|
|
926
|
+
}
|
|
927
|
+
value = obj.getValue(date);
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
value = obj;
|
|
931
|
+
}
|
|
932
|
+
return value;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Returns if a given visual is alive and in the scene.
|
|
936
|
+
* @param viewer
|
|
937
|
+
* @param visual
|
|
938
|
+
* @returns
|
|
939
|
+
*/
|
|
940
|
+
function isFeatureAlive(viewer, feature) {
|
|
941
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
942
|
+
return false;
|
|
943
|
+
}
|
|
944
|
+
var cTileset = feature === null || feature === void 0 ? void 0 : feature.tileset;
|
|
945
|
+
if (!cTileset) {
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
948
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
return true;
|
|
952
|
+
}
|
|
953
|
+
var _lastMark = 0;
|
|
954
|
+
var generateMark = function () {
|
|
955
|
+
_lastMark += 1;
|
|
956
|
+
return _lastMark;
|
|
957
|
+
};
|
|
958
|
+
function setMark(color, mark) {
|
|
959
|
+
color["NEXTSPACE_PROPERTY_MARK"] = mark;
|
|
960
|
+
}
|
|
961
|
+
function assertColorMark(mark, color) {
|
|
962
|
+
return color["NEXTSPACE_PROPERTY_MARK"] == mark;
|
|
963
|
+
}
|
|
964
|
+
var CesiumAnimatedProperty;
|
|
965
|
+
(function (CesiumAnimatedProperty) {
|
|
966
|
+
/**
|
|
967
|
+
* Example:
|
|
968
|
+
* ```
|
|
969
|
+
* const myEntity = null; // Get an Entity from somewhere.
|
|
970
|
+
*
|
|
971
|
+
* const animateColor = new AnimateColor({
|
|
972
|
+
* viewer: viewer,
|
|
973
|
+
* color: Cesium.Color.RED,
|
|
974
|
+
* startColor: myEntity.model.color,
|
|
975
|
+
* type: "LINEAR",
|
|
976
|
+
* durationMs: 1000
|
|
977
|
+
* });
|
|
978
|
+
*
|
|
979
|
+
* myEntity.model.color = new Cesium.CallbackProperty(() => {
|
|
980
|
+
* return animateColor.GetValue();
|
|
981
|
+
* }, false);
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
var AnimateColor = /** @class */ (function () {
|
|
985
|
+
function AnimateColor(params) {
|
|
986
|
+
var _a;
|
|
987
|
+
this.viewer = params.viewer;
|
|
988
|
+
this.color = params.color;
|
|
989
|
+
this.durationMs = params.durationMs;
|
|
990
|
+
this.startColor = getColor(this.viewer, params.startColor);
|
|
991
|
+
if ((_a = this.startColor) === null || _a === void 0 ? void 0 : _a.clone) {
|
|
992
|
+
this.startColor = this.startColor.clone();
|
|
993
|
+
}
|
|
994
|
+
if (!this.startColor) {
|
|
995
|
+
this.startColor = Color.WHITE.clone();
|
|
996
|
+
console.warn("No start color provided. Using WHITE as start color. Animation may not work as expected.");
|
|
997
|
+
}
|
|
998
|
+
this.startTime = new Date();
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Returns the calculated color at the provided time.
|
|
1002
|
+
* @returns
|
|
1003
|
+
*/
|
|
1004
|
+
AnimateColor.prototype.GetColor = function () {
|
|
1005
|
+
var now = new Date();
|
|
1006
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1007
|
+
// Animation over.
|
|
1008
|
+
if (elapsedMs >= this.durationMs) {
|
|
1009
|
+
return this.color;
|
|
1010
|
+
}
|
|
1011
|
+
try {
|
|
1012
|
+
var progress = elapsedMs / this.durationMs;
|
|
1013
|
+
return Color.lerp(this.startColor, this.color, progress, new Color());
|
|
1014
|
+
}
|
|
1015
|
+
catch (e) {
|
|
1016
|
+
console.error(e);
|
|
1017
|
+
}
|
|
1018
|
+
// Failed to calculate color.
|
|
1019
|
+
// We'll just return the target color.
|
|
1020
|
+
return this.color;
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Returns the calculated color as a material property.
|
|
1024
|
+
* @returns
|
|
1025
|
+
*/
|
|
1026
|
+
AnimateColor.prototype.GetMaterial = function () {
|
|
1027
|
+
var color = this.GetColor();
|
|
1028
|
+
return new ColorMaterialProperty(color);
|
|
1029
|
+
};
|
|
1030
|
+
return AnimateColor;
|
|
1031
|
+
}());
|
|
1032
|
+
CesiumAnimatedProperty.AnimateColor = AnimateColor;
|
|
1033
|
+
var AnimateNumber = /** @class */ (function () {
|
|
1034
|
+
function AnimateNumber(params) {
|
|
1035
|
+
this.paused = false;
|
|
1036
|
+
this.paused = Boolean(params.startPaused);
|
|
1037
|
+
this.viewer = params.viewer;
|
|
1038
|
+
this.value = params.value;
|
|
1039
|
+
this.durationMs = params.durationMs;
|
|
1040
|
+
this.startValue = getNumber(this.viewer, params.startValue);
|
|
1041
|
+
if (!this.startValue) {
|
|
1042
|
+
this.startValue = 0;
|
|
1043
|
+
}
|
|
1044
|
+
if (!this.paused) {
|
|
1045
|
+
this.startTime = new Date();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
AnimateNumber.prototype.Play = function () {
|
|
1049
|
+
if (this.paused) {
|
|
1050
|
+
this.paused = false;
|
|
1051
|
+
this.startTime = new Date();
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
AnimateNumber.prototype.GetValue = function () {
|
|
1055
|
+
if (this.paused) {
|
|
1056
|
+
return this.startValue;
|
|
1057
|
+
}
|
|
1058
|
+
var now = new Date();
|
|
1059
|
+
var elapsedMs = now.getTime() - this.startTime.getTime();
|
|
1060
|
+
// Animation over.
|
|
1061
|
+
if (elapsedMs >= this.durationMs) {
|
|
1062
|
+
return this.value;
|
|
1063
|
+
}
|
|
1064
|
+
try {
|
|
1065
|
+
var progress = elapsedMs / this.durationMs;
|
|
1066
|
+
return Math$1.lerp(this.startValue, this.value, progress);
|
|
1067
|
+
}
|
|
1068
|
+
catch (e) {
|
|
1069
|
+
console.error(e);
|
|
1070
|
+
}
|
|
1071
|
+
// Failed to calculate value.
|
|
1072
|
+
// We'll just return the target value.
|
|
1073
|
+
return this.value;
|
|
1074
|
+
};
|
|
1075
|
+
return AnimateNumber;
|
|
1076
|
+
}());
|
|
1077
|
+
CesiumAnimatedProperty.AnimateNumber = AnimateNumber;
|
|
1078
|
+
/**
|
|
1079
|
+
* Animates the color of a feature.
|
|
1080
|
+
* This is handled separately from the AnimateColor class as Tileset features do not support Cesium callback properties.
|
|
1081
|
+
*
|
|
1082
|
+
* Example:
|
|
1083
|
+
* ```
|
|
1084
|
+
* const animateColor = AnimateTFeatureColor({
|
|
1085
|
+
* viewer: viewer,
|
|
1086
|
+
* feature: feature,
|
|
1087
|
+
* color: Cesium.Color.RED,
|
|
1088
|
+
* startColor: feature.color,
|
|
1089
|
+
* durationMs: 1000
|
|
1090
|
+
* });
|
|
1091
|
+
* ```
|
|
1092
|
+
* @param params
|
|
1093
|
+
* @returns
|
|
1094
|
+
*/
|
|
1095
|
+
function AnimateTFeatureColor(params) {
|
|
1096
|
+
var viewer = params.viewer, feature = params.feature, color = params.color, startColor = params.startColor, durationMs = params.durationMs;
|
|
1097
|
+
ClearTFeatureColorAnimation(feature);
|
|
1098
|
+
if (!startColor) {
|
|
1099
|
+
if (feature.color) {
|
|
1100
|
+
startColor = feature.color;
|
|
1101
|
+
if (startColor.clone) {
|
|
1102
|
+
startColor = startColor.clone();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
else {
|
|
1106
|
+
startColor = Color.WHITE.clone();
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
// Don't animate if the colour is the same.
|
|
1110
|
+
var curColor = getColor(viewer, feature.color);
|
|
1111
|
+
if (curColor && Color.WHITE.equals(curColor)) {
|
|
1112
|
+
curColor = null;
|
|
1113
|
+
}
|
|
1114
|
+
var colorTmp = color == null || Color.WHITE.equals(color) ? null : color;
|
|
1115
|
+
if (!curColor && !colorTmp) {
|
|
1116
|
+
return function () { };
|
|
1117
|
+
}
|
|
1118
|
+
else if (curColor && colorTmp && curColor.equals(colorTmp)) {
|
|
1119
|
+
return function () { };
|
|
1120
|
+
}
|
|
1121
|
+
// Marks are used to detect external changes to the feature's color.
|
|
1122
|
+
// If an external change is detected, the animation will stop.
|
|
1123
|
+
var mark = generateMark();
|
|
1124
|
+
setMark(feature.color, mark);
|
|
1125
|
+
setMark(startColor, mark);
|
|
1126
|
+
setMark(color, mark);
|
|
1127
|
+
var startTime = new Date();
|
|
1128
|
+
var removal = viewer.scene.postUpdate.addEventListener(function () {
|
|
1129
|
+
if (!isFeatureAlive(viewer, feature)) {
|
|
1130
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1131
|
+
removal = null;
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
if (!assertColorMark(mark, feature.color)) {
|
|
1135
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1136
|
+
removal = null;
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
var now = new Date();
|
|
1140
|
+
var elapsedMs = now.getTime() - startTime.getTime();
|
|
1141
|
+
// Animation over.
|
|
1142
|
+
if (elapsedMs >= durationMs) {
|
|
1143
|
+
feature.color = color;
|
|
1144
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1145
|
+
removal = null;
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
try {
|
|
1149
|
+
var progress = elapsedMs / durationMs;
|
|
1150
|
+
var newColor = Color.lerp(startColor, color, progress, new Color());
|
|
1151
|
+
setMark(newColor, mark);
|
|
1152
|
+
feature.color = newColor;
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
catch (e) {
|
|
1156
|
+
console.error(e);
|
|
1157
|
+
}
|
|
1158
|
+
// Failed to calculate color.
|
|
1159
|
+
// We'll just set the target color and stop the animation.
|
|
1160
|
+
feature.color = color;
|
|
1161
|
+
});
|
|
1162
|
+
// Return a function to stop the animation.
|
|
1163
|
+
feature["ANIMATED_COLOR_REMOVAL"] = removal;
|
|
1164
|
+
return function () {
|
|
1165
|
+
removal === null || removal === void 0 ? void 0 : removal();
|
|
1166
|
+
removal = null;
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
CesiumAnimatedProperty.AnimateTFeatureColor = AnimateTFeatureColor;
|
|
1170
|
+
function ClearTFeatureColorAnimation(feature) {
|
|
1171
|
+
if (feature && feature["ANIMATED_COLOR_REMOVAL"]) {
|
|
1172
|
+
feature["ANIMATED_COLOR_REMOVAL"]();
|
|
1173
|
+
feature["ANIMATED_COLOR_REMOVAL"] = null;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
CesiumAnimatedProperty.ClearTFeatureColorAnimation = ClearTFeatureColorAnimation;
|
|
1177
|
+
})(CesiumAnimatedProperty || (CesiumAnimatedProperty = {}));
|
|
1178
|
+
|
|
903
1179
|
/**
|
|
904
1180
|
* Returns if a given visual can be styled by this utility.
|
|
905
1181
|
* @param viewer
|
|
@@ -1020,7 +1296,7 @@ function storeColor(viewer, key, color, graphic) {
|
|
|
1020
1296
|
* @param graphic
|
|
1021
1297
|
* @returns
|
|
1022
1298
|
*/
|
|
1023
|
-
function getColor(viewer, key, graphic) {
|
|
1299
|
+
function getColor$1(viewer, key, graphic) {
|
|
1024
1300
|
var color = graphic[getStoreKey(key)];
|
|
1025
1301
|
// If no color is stored for the default color, we'll calculate and store it.
|
|
1026
1302
|
if (!color) {
|
|
@@ -1050,6 +1326,8 @@ function getColor(viewer, key, graphic) {
|
|
|
1050
1326
|
function applyOpacity(viewer, opacity, graphic) {
|
|
1051
1327
|
refreshColor(viewer, graphic, opacity);
|
|
1052
1328
|
}
|
|
1329
|
+
var ANIMATE_COLOR_MS = 200;
|
|
1330
|
+
var ANIMATE_COLOR_HIGHLIGHT_MS = 200;
|
|
1053
1331
|
/**
|
|
1054
1332
|
* Applies a color to a graphic based on the current key states.
|
|
1055
1333
|
* Eg: if the graphic is selected, it will apply the selected color.
|
|
@@ -1058,7 +1336,7 @@ function applyOpacity(viewer, opacity, graphic) {
|
|
|
1058
1336
|
* @param opacity
|
|
1059
1337
|
*/
|
|
1060
1338
|
function refreshColor(viewer, graphic, opacity) {
|
|
1061
|
-
var _a;
|
|
1339
|
+
var _a, _b;
|
|
1062
1340
|
// Calculate what color key we should apply.
|
|
1063
1341
|
var key = "default";
|
|
1064
1342
|
if (getKeyState(graphic, "select")) {
|
|
@@ -1069,11 +1347,12 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1069
1347
|
}
|
|
1070
1348
|
// This ensures that the default color is always stored prior to applying a new color.
|
|
1071
1349
|
if (key != "default") {
|
|
1072
|
-
getColor(viewer, "default", graphic);
|
|
1350
|
+
getColor$1(viewer, "default", graphic);
|
|
1073
1351
|
}
|
|
1074
|
-
var color = (_a = getColor(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Color.WHITE;
|
|
1352
|
+
var color = (_a = getColor$1(viewer, key, graphic)) !== null && _a !== void 0 ? _a : Color.WHITE;
|
|
1075
1353
|
// If we're highlighting and it's selected, don't change the color.
|
|
1076
1354
|
if (key != "highlight" || getKeyState(graphic, "select") == false) {
|
|
1355
|
+
var animateMs = key == "highlight" ? ANIMATE_COLOR_HIGHLIGHT_MS : ANIMATE_COLOR_MS;
|
|
1077
1356
|
color = color.clone();
|
|
1078
1357
|
// Multiply opacity if one is set.
|
|
1079
1358
|
if (opacity != null) {
|
|
@@ -1089,10 +1368,34 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1089
1368
|
}
|
|
1090
1369
|
}
|
|
1091
1370
|
if (graphic instanceof Cesium3DTileFeature) {
|
|
1092
|
-
graphic
|
|
1371
|
+
CesiumAnimatedProperty.ClearTFeatureColorAnimation(graphic);
|
|
1372
|
+
if (key == "default") {
|
|
1373
|
+
graphic.color = color;
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
CesiumAnimatedProperty.AnimateTFeatureColor({
|
|
1377
|
+
color: color.clone(),
|
|
1378
|
+
durationMs: animateMs,
|
|
1379
|
+
feature: graphic,
|
|
1380
|
+
viewer: viewer,
|
|
1381
|
+
startColor: ((_b = graphic.color) === null || _b === void 0 ? void 0 : _b.clone) ? graphic.color.clone() : graphic.color
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1093
1384
|
}
|
|
1094
1385
|
else if (graphic instanceof ModelGraphics) {
|
|
1095
|
-
graphic.color = new ConstantProperty(color);
|
|
1386
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1387
|
+
var animateColor_1 = new CesiumAnimatedProperty.AnimateColor({
|
|
1388
|
+
color: color,
|
|
1389
|
+
durationMs: animateMs,
|
|
1390
|
+
viewer: viewer,
|
|
1391
|
+
startColor: graphic.color
|
|
1392
|
+
});
|
|
1393
|
+
if (graphic.color instanceof CallbackProperty) {
|
|
1394
|
+
graphic.color.setCallback(function () { return animateColor_1.GetColor(); }, false);
|
|
1395
|
+
}
|
|
1396
|
+
else {
|
|
1397
|
+
graphic.color = new CallbackProperty(function () { return animateColor_1.GetColor(); }, false);
|
|
1398
|
+
}
|
|
1096
1399
|
}
|
|
1097
1400
|
else if (graphic instanceof PolygonGraphics) {
|
|
1098
1401
|
graphic.material = new ColorMaterialProperty(color);
|
|
@@ -1104,10 +1407,34 @@ function refreshColor(viewer, graphic, opacity) {
|
|
|
1104
1407
|
graphic.material = new ColorMaterialProperty(color);
|
|
1105
1408
|
}
|
|
1106
1409
|
else if (graphic instanceof PointGraphics) {
|
|
1107
|
-
graphic.color = new ConstantProperty(color);
|
|
1410
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1411
|
+
var animateColor_2 = new CesiumAnimatedProperty.AnimateColor({
|
|
1412
|
+
color: color,
|
|
1413
|
+
durationMs: animateMs,
|
|
1414
|
+
viewer: viewer,
|
|
1415
|
+
startColor: graphic.color
|
|
1416
|
+
});
|
|
1417
|
+
if (graphic.color instanceof CallbackProperty) {
|
|
1418
|
+
graphic.color.setCallback(function () { return animateColor_2.GetColor(); }, false);
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
graphic.color = new CallbackProperty(function () { return animateColor_2.GetColor(); }, false);
|
|
1422
|
+
}
|
|
1108
1423
|
}
|
|
1109
1424
|
else if (graphic instanceof BillboardGraphics) {
|
|
1110
|
-
graphic.color = new ConstantProperty(color);
|
|
1425
|
+
// graphic.color = new Cesium.ConstantProperty(color);
|
|
1426
|
+
var animateColor_3 = new CesiumAnimatedProperty.AnimateColor({
|
|
1427
|
+
color: color,
|
|
1428
|
+
durationMs: animateMs,
|
|
1429
|
+
viewer: viewer,
|
|
1430
|
+
startColor: graphic.color
|
|
1431
|
+
});
|
|
1432
|
+
if (graphic.color instanceof CallbackProperty) {
|
|
1433
|
+
graphic.color.setCallback(function () { return animateColor_3.GetColor(); }, false);
|
|
1434
|
+
}
|
|
1435
|
+
else {
|
|
1436
|
+
graphic.color = new CallbackProperty(function () { return animateColor_3.GetColor(); }, false);
|
|
1437
|
+
}
|
|
1111
1438
|
}
|
|
1112
1439
|
else if (graphic instanceof EllipseGraphics) {
|
|
1113
1440
|
graphic.material = new ColorMaterialProperty(color);
|
|
@@ -1208,6 +1535,64 @@ var CesiumEntityStyler;
|
|
|
1208
1535
|
}
|
|
1209
1536
|
}
|
|
1210
1537
|
CesiumEntityStyler.Refresh = Refresh;
|
|
1538
|
+
function BakeDefaultColor(params) {
|
|
1539
|
+
var viewer = params.viewer, entity = params.entity, override = params.override;
|
|
1540
|
+
if (!entity) {
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
var parts = EntityUtils.GatherEntity({
|
|
1544
|
+
entity: entity
|
|
1545
|
+
});
|
|
1546
|
+
for (var i = 0; i < parts.length; i++) {
|
|
1547
|
+
var part = parts[i];
|
|
1548
|
+
if (!isAlive(viewer, part)) {
|
|
1549
|
+
continue;
|
|
1550
|
+
}
|
|
1551
|
+
// If we're not overriding then we check to ensure a colour is not already set.
|
|
1552
|
+
if (override == false) {
|
|
1553
|
+
var stored = part[getStoreKey("default")];
|
|
1554
|
+
if (stored) {
|
|
1555
|
+
continue;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
if (part instanceof Cesium3DTileFeature) {
|
|
1559
|
+
var opacity = getAppliedOpacity(part);
|
|
1560
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part), part);
|
|
1561
|
+
refreshColor(viewer, part, opacity);
|
|
1562
|
+
}
|
|
1563
|
+
else if (part instanceof Entity) {
|
|
1564
|
+
if (part.billboard) {
|
|
1565
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.billboard), part.billboard);
|
|
1566
|
+
refreshColor(viewer, part.billboard, getAppliedOpacity(part.billboard));
|
|
1567
|
+
}
|
|
1568
|
+
if (part.model) {
|
|
1569
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.model), part.model);
|
|
1570
|
+
refreshColor(viewer, part.model, getAppliedOpacity(part.model));
|
|
1571
|
+
}
|
|
1572
|
+
if (part.polyline) {
|
|
1573
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.polyline), part.polyline);
|
|
1574
|
+
refreshColor(viewer, part.polyline, getAppliedOpacity(part.polyline));
|
|
1575
|
+
}
|
|
1576
|
+
if (part.polygon) {
|
|
1577
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.polygon), part.polygon);
|
|
1578
|
+
refreshColor(viewer, part.polygon, getAppliedOpacity(part.polygon));
|
|
1579
|
+
}
|
|
1580
|
+
if (part.corridor) {
|
|
1581
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.corridor), part.corridor);
|
|
1582
|
+
refreshColor(viewer, part.corridor, getAppliedOpacity(part.corridor));
|
|
1583
|
+
}
|
|
1584
|
+
if (part.point) {
|
|
1585
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.point), part.point);
|
|
1586
|
+
refreshColor(viewer, part.point, getAppliedOpacity(part.point));
|
|
1587
|
+
}
|
|
1588
|
+
if (part.ellipse) {
|
|
1589
|
+
storeColor(viewer, "default", calculateCurColor(viewer, part.ellipse), part.ellipse);
|
|
1590
|
+
refreshColor(viewer, part.ellipse, getAppliedOpacity(part.ellipse));
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
CesiumEntityStyler.BakeDefaultColor = BakeDefaultColor;
|
|
1211
1596
|
/**
|
|
1212
1597
|
* Updates the default colour of a graphic.
|
|
1213
1598
|
* This will not change the graphic's state to use it if the entity is selected/highlighted.
|
|
@@ -2581,7 +2966,6 @@ var EntityUtils;
|
|
|
2581
2966
|
if (isNaN(roll)) {
|
|
2582
2967
|
roll = 0;
|
|
2583
2968
|
}
|
|
2584
|
-
console.log(tSettings, entity);
|
|
2585
2969
|
matrix4 = entity.worldPosition;
|
|
2586
2970
|
offset = new Cartesian3(+matrix4[0][3], +matrix4[1][3], +matrix4[2][3]);
|
|
2587
2971
|
if (entity.worldPivot) //the position from worldMatrix + center of geometry offset
|
|
@@ -4258,7 +4642,7 @@ var POINT_BILLBOARD_PADDING = 1;
|
|
|
4258
4642
|
var createCircleBillboard = function (size, colorCss) {
|
|
4259
4643
|
var key = size + "-" + colorCss;
|
|
4260
4644
|
var cacheData = _billboardCache.Get(key);
|
|
4261
|
-
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.
|
|
4645
|
+
if ((cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) && typeof (cacheData === null || cacheData === void 0 ? void 0 : cacheData.canvasDataUri) == "string") {
|
|
4262
4646
|
return cacheData;
|
|
4263
4647
|
}
|
|
4264
4648
|
// Slight padding to avoid corners clipping.
|
|
@@ -4272,7 +4656,7 @@ var createCircleBillboard = function (size, colorCss) {
|
|
|
4272
4656
|
context.fillStyle = colorCss;
|
|
4273
4657
|
context.fill();
|
|
4274
4658
|
var data = {
|
|
4275
|
-
|
|
4659
|
+
canvasDataUri: canvas.toDataURL("image/png"),
|
|
4276
4660
|
colorCss: colorCss,
|
|
4277
4661
|
size: size,
|
|
4278
4662
|
height: canvasSize,
|
|
@@ -4307,7 +4691,7 @@ var createImageBillboard = function (url) {
|
|
|
4307
4691
|
var context = canvas_1.getContext("2d");
|
|
4308
4692
|
context.drawImage(image_1, 0, 0);
|
|
4309
4693
|
var data = {
|
|
4310
|
-
|
|
4694
|
+
canvasDataUri: canvas_1.toDataURL("image/png"),
|
|
4311
4695
|
height: image_1.height
|
|
4312
4696
|
};
|
|
4313
4697
|
res(data);
|
|
@@ -4425,7 +4809,7 @@ var EntityRenderEngine;
|
|
|
4425
4809
|
function Render(params) {
|
|
4426
4810
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4427
4811
|
return __awaiter(this, void 0, void 0, function () {
|
|
4428
|
-
var groupRenderParams, i, entity, geometry, cEntities, models, multiGeometry, polygons, polylines, points, i, entity, id, zoomItem, displayType,
|
|
4812
|
+
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;
|
|
4429
4813
|
return __generator(this, function (_j) {
|
|
4430
4814
|
switch (_j.label) {
|
|
4431
4815
|
case 0:
|
|
@@ -4469,16 +4853,23 @@ var EntityRenderEngine;
|
|
|
4469
4853
|
displayType = ZoomControl.EDisplayType.Geometry;
|
|
4470
4854
|
}
|
|
4471
4855
|
if (displayType != ZoomControl.EDisplayType.Hidden) {
|
|
4472
|
-
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4473
4856
|
existingRego = params.visualRegister.GetRego({
|
|
4474
4857
|
entityId: id,
|
|
4475
4858
|
menuItemId: params.menuItemId
|
|
4476
4859
|
});
|
|
4860
|
+
newRenderId = getRenderGroupId(zoomItem, (_b = params.viewer) === null || _b === void 0 ? void 0 : _b.terrainProvider);
|
|
4477
4861
|
oldRenderId = (_c = existingRego === null || existingRego === void 0 ? void 0 : existingRego.visual) === null || _c === void 0 ? void 0 : _c._renderGroup;
|
|
4478
4862
|
if (!params.force && newRenderId == oldRenderId && !(existingRego === null || existingRego === void 0 ? void 0 : existingRego.stale)) {
|
|
4863
|
+
// No sorting category needed. Already rendered the way we want.
|
|
4479
4864
|
cEntities[id] = existingRego.visual;
|
|
4480
4865
|
}
|
|
4481
4866
|
else {
|
|
4867
|
+
// Add so we can re-use the graphic and update it.
|
|
4868
|
+
if (existingRego && newRenderId == oldRenderId) {
|
|
4869
|
+
cEntities[id] = existingRego.visual;
|
|
4870
|
+
// Flag as no longer stale as we're unlikely to recreate the rego if we're reusing the graphic.
|
|
4871
|
+
existingRego.stale = false;
|
|
4872
|
+
}
|
|
4482
4873
|
if (displayType == ZoomControl.EDisplayType.Model3D) {
|
|
4483
4874
|
models.push(entity);
|
|
4484
4875
|
}
|
|
@@ -4498,7 +4889,7 @@ var EntityRenderEngine;
|
|
|
4498
4889
|
}
|
|
4499
4890
|
}
|
|
4500
4891
|
if (!(models.length > 0)) return [3 /*break*/, 2];
|
|
4501
|
-
mParams = __assign(__assign({}, groupRenderParams), { entities: models });
|
|
4892
|
+
mParams = __assign(__assign({}, groupRenderParams), { rendered: cEntities, entities: models });
|
|
4502
4893
|
return [4 /*yield*/, Model3d.RenderGroup(mParams)];
|
|
4503
4894
|
case 1:
|
|
4504
4895
|
mEntities = _j.sent();
|
|
@@ -4526,7 +4917,7 @@ var EntityRenderEngine;
|
|
|
4526
4917
|
polygons.push(entity);
|
|
4527
4918
|
return [2 /*return*/, "continue"];
|
|
4528
4919
|
}
|
|
4529
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: [] });
|
|
4920
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: [], rendered: cEntities });
|
|
4530
4921
|
zoomItem = pParams.zoomItems[entity.Bruce.ID];
|
|
4531
4922
|
for (j = 0; j < entity.geometry.MultiGeometry.length; j++) {
|
|
4532
4923
|
subEntity = __assign(__assign({}, entity), { geometry: entity.geometry.MultiGeometry[j], Bruce: __assign(__assign({}, entity.Bruce), { ID: ObjectUtils.UId() }) });
|
|
@@ -4595,7 +4986,7 @@ var EntityRenderEngine;
|
|
|
4595
4986
|
return [3 /*break*/, 3];
|
|
4596
4987
|
case 6:
|
|
4597
4988
|
if (!(polygons.length > 0)) return [3 /*break*/, 8];
|
|
4598
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons });
|
|
4989
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polygons, rendered: cEntities });
|
|
4599
4990
|
return [4 /*yield*/, Polygon.RenderGroup(pParams)];
|
|
4600
4991
|
case 7:
|
|
4601
4992
|
pEntities = _j.sent();
|
|
@@ -4612,7 +5003,7 @@ var EntityRenderEngine;
|
|
|
4612
5003
|
_j.label = 8;
|
|
4613
5004
|
case 8:
|
|
4614
5005
|
if (!(polylines.length > 0)) return [3 /*break*/, 10];
|
|
4615
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines });
|
|
5006
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: polylines, rendered: cEntities });
|
|
4616
5007
|
return [4 /*yield*/, Polyline.RenderGroup(pParams)];
|
|
4617
5008
|
case 9:
|
|
4618
5009
|
pEntities = _j.sent();
|
|
@@ -4629,7 +5020,7 @@ var EntityRenderEngine;
|
|
|
4629
5020
|
_j.label = 10;
|
|
4630
5021
|
case 10:
|
|
4631
5022
|
if (!(points.length > 0)) return [3 /*break*/, 12];
|
|
4632
|
-
pParams = __assign(__assign({}, groupRenderParams), { entities: points });
|
|
5023
|
+
pParams = __assign(__assign({}, groupRenderParams), { entities: points, rendered: cEntities });
|
|
4633
5024
|
return [4 /*yield*/, Point.RenderGroup(pParams)];
|
|
4634
5025
|
case 11:
|
|
4635
5026
|
pEntities = _j.sent();
|
|
@@ -4693,11 +5084,11 @@ var EntityRenderEngine;
|
|
|
4693
5084
|
}
|
|
4694
5085
|
Point.CreateCircleBillboard = CreateCircleBillboard;
|
|
4695
5086
|
function Render(params) {
|
|
4696
|
-
var _a, _b;
|
|
5087
|
+
var _a, _b, _c, _d;
|
|
4697
5088
|
return __awaiter(this, void 0, void 0, function () {
|
|
4698
|
-
var entity, style, type, cEntity, siblings, iconUrlRows, icon, iconUrl, metadata, api, image, e_5, iconScale, disableDepthTest, bColor,
|
|
4699
|
-
return __generator(this, function (
|
|
4700
|
-
switch (
|
|
5089
|
+
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;
|
|
5090
|
+
return __generator(this, function (_e) {
|
|
5091
|
+
switch (_e.label) {
|
|
4701
5092
|
case 0:
|
|
4702
5093
|
entity = params.entity;
|
|
4703
5094
|
style = params.style;
|
|
@@ -4710,6 +5101,27 @@ var EntityRenderEngine;
|
|
|
4710
5101
|
}
|
|
4711
5102
|
cEntity = null;
|
|
4712
5103
|
siblings = [];
|
|
5104
|
+
prepareExistingGraphic = function (cEntity, siblings) {
|
|
5105
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5106
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5107
|
+
var parts = EntityUtils.GatherEntity({
|
|
5108
|
+
entity: cEntity,
|
|
5109
|
+
});
|
|
5110
|
+
if (parts.length > 1) {
|
|
5111
|
+
// We'll cull all except the allowed number of siblings.
|
|
5112
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5113
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5114
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5115
|
+
var part = parts[i];
|
|
5116
|
+
if (part && part instanceof Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5117
|
+
params.viewer.entities.remove(part);
|
|
5118
|
+
}
|
|
5119
|
+
}
|
|
5120
|
+
if (cEntity._parentEntity) {
|
|
5121
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
};
|
|
4713
5125
|
if (!(type == Style.EPointType.Icon)) return [3 /*break*/, 9];
|
|
4714
5126
|
iconUrlRows = style.iconUrl == null ? [] : style.iconUrl;
|
|
4715
5127
|
iconUrlRows.forEach(function (row) {
|
|
@@ -4726,36 +5138,36 @@ var EntityRenderEngine;
|
|
|
4726
5138
|
api = params.apiGetter.getApi(metadata.accountId);
|
|
4727
5139
|
return [4 /*yield*/, api.Loading];
|
|
4728
5140
|
case 1:
|
|
4729
|
-
|
|
5141
|
+
_e.sent();
|
|
4730
5142
|
iconUrl = ClientFile.GetUrl({
|
|
4731
5143
|
api: api,
|
|
4732
5144
|
fileId: metadata.fileId,
|
|
4733
5145
|
viaCdn: true
|
|
4734
5146
|
});
|
|
4735
|
-
|
|
5147
|
+
_e.label = 2;
|
|
4736
5148
|
case 2:
|
|
4737
5149
|
if (!(!iconUrl && style.iconId)) return [3 /*break*/, 4];
|
|
4738
5150
|
return [4 /*yield*/, params.api.Loading];
|
|
4739
5151
|
case 3:
|
|
4740
|
-
|
|
5152
|
+
_e.sent();
|
|
4741
5153
|
iconUrl = ClientFile.GetUrl({
|
|
4742
5154
|
api: params.api,
|
|
4743
5155
|
fileId: style.iconId,
|
|
4744
5156
|
viaCdn: true
|
|
4745
5157
|
});
|
|
4746
|
-
|
|
5158
|
+
_e.label = 4;
|
|
4747
5159
|
case 4:
|
|
4748
5160
|
image = null;
|
|
4749
5161
|
if (!iconUrl) return [3 /*break*/, 8];
|
|
4750
|
-
|
|
5162
|
+
_e.label = 5;
|
|
4751
5163
|
case 5:
|
|
4752
|
-
|
|
5164
|
+
_e.trys.push([5, 7, , 8]);
|
|
4753
5165
|
return [4 /*yield*/, createImageBillboard(iconUrl)];
|
|
4754
5166
|
case 6:
|
|
4755
|
-
image =
|
|
5167
|
+
image = _e.sent();
|
|
4756
5168
|
return [3 /*break*/, 8];
|
|
4757
5169
|
case 7:
|
|
4758
|
-
e_5 =
|
|
5170
|
+
e_5 = _e.sent();
|
|
4759
5171
|
// Expanding the logging here so we can figure out why this is happening.
|
|
4760
5172
|
// 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.
|
|
4761
5173
|
OneTimeError("ENTITY_RENDER_ENGINE_ICON_URL_ERROR_" + iconUrl, {
|
|
@@ -4774,34 +5186,64 @@ var EntityRenderEngine;
|
|
|
4774
5186
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4775
5187
|
if (iconScale > 0) {
|
|
4776
5188
|
bColor = style.iconTintColor ? Calculator.GetColor(style.iconTintColor, entity, params.tags) : null;
|
|
4777
|
-
|
|
5189
|
+
cColor_1 = bColor ? colorToCColor(bColor) : undefined;
|
|
4778
5190
|
heightRef = getHeightRef(style);
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
5191
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5192
|
+
cEntity = new Entity({
|
|
5193
|
+
id: ObjectUtils.UId(10),
|
|
5194
|
+
billboard: {
|
|
5195
|
+
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
5196
|
+
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
5197
|
+
image: image.canvasDataUri,
|
|
5198
|
+
heightReference: getHeightRef(style),
|
|
5199
|
+
scale: iconScale,
|
|
5200
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined,
|
|
5201
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5202
|
+
color: new CallbackProperty(function () { return cColor_1; }, true),
|
|
5203
|
+
// Would be great once we have a setting for this.
|
|
5204
|
+
// translucencyByDistance: getTranslucencyByDistance(params.minDistance, params.maxDistance),
|
|
5205
|
+
},
|
|
5206
|
+
position: EntityUtils.GetPos({
|
|
5207
|
+
viewer: params.viewer,
|
|
5208
|
+
entity: entity,
|
|
5209
|
+
recordHeightRef: heightRef,
|
|
5210
|
+
returnHeightRef: heightRef
|
|
5211
|
+
}),
|
|
5212
|
+
show: true
|
|
5213
|
+
});
|
|
5214
|
+
}
|
|
5215
|
+
else {
|
|
5216
|
+
prepareExistingGraphic(params.rendered);
|
|
5217
|
+
cEntity = params.rendered;
|
|
5218
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5219
|
+
if (currentImgKey != iconUrl) {
|
|
5220
|
+
cEntity.billboard.image = new ConstantProperty(image.canvasDataUri);
|
|
5221
|
+
}
|
|
5222
|
+
cEntity.billboard.scale = new ConstantProperty(iconScale);
|
|
5223
|
+
cEntity.billboard.heightReference = new ConstantProperty(getHeightRef(style));
|
|
5224
|
+
cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5225
|
+
cEntity.billboard.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5226
|
+
cEntity.position = new ConstantPositionProperty(EntityUtils.GetPos({
|
|
4794
5227
|
viewer: params.viewer,
|
|
4795
5228
|
entity: entity,
|
|
4796
5229
|
recordHeightRef: heightRef,
|
|
4797
5230
|
returnHeightRef: heightRef
|
|
4798
|
-
})
|
|
4799
|
-
|
|
4800
|
-
|
|
5231
|
+
}));
|
|
5232
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5233
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5234
|
+
color: cColor_1,
|
|
5235
|
+
entity: cEntity,
|
|
5236
|
+
viewer: params.viewer,
|
|
5237
|
+
override: true,
|
|
5238
|
+
requestRender: false
|
|
5239
|
+
});
|
|
5240
|
+
cEntity.show = true;
|
|
5241
|
+
}
|
|
4801
5242
|
cEntity.billboard._billboardSize = image.height;
|
|
5243
|
+
cEntity.billboard._billboardImgKey = iconUrl;
|
|
4802
5244
|
}
|
|
4803
5245
|
}
|
|
4804
|
-
|
|
5246
|
+
_e.label = 9;
|
|
4805
5247
|
case 9:
|
|
4806
5248
|
if (type == Style.EPointType.Cylinder) {
|
|
4807
5249
|
radius = EnsureNumber(Calculator.GetNumber(style.CylinderRadius, entity, params.tags));
|
|
@@ -4826,46 +5268,97 @@ var EntityRenderEngine;
|
|
|
4826
5268
|
returnHeightRef: heightRef
|
|
4827
5269
|
});
|
|
4828
5270
|
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
semiMajorAxis: radius,
|
|
4833
|
-
semiMinorAxis: radius,
|
|
4834
|
-
material: cFill,
|
|
4835
|
-
outlineWidth: null,
|
|
4836
|
-
extrudedHeight: extrusion.value,
|
|
4837
|
-
heightReference: heightRef,
|
|
4838
|
-
extrudedHeightReference: extrusion.exHeightRef,
|
|
4839
|
-
height: Cartographic.fromCartesian(pos3d).height,
|
|
4840
|
-
zIndex: 1,
|
|
4841
|
-
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4842
|
-
},
|
|
4843
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
4844
|
-
show: true
|
|
4845
|
-
});
|
|
4846
|
-
if (outline && outlineWidth > 0) {
|
|
4847
|
-
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
4848
|
-
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
4849
|
-
// This way they render in a uniform way.
|
|
4850
|
-
if (!outlineExtrusion.value && extrusion.value) {
|
|
4851
|
-
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
4852
|
-
}
|
|
4853
|
-
siblings.push(new Entity({
|
|
5271
|
+
hasOutline = outline && outlineWidth > 0;
|
|
5272
|
+
if (!params.rendered || !params.rendered.ellipse) {
|
|
5273
|
+
cEntity = new Entity({
|
|
4854
5274
|
id: ObjectUtils.UId(10),
|
|
4855
5275
|
ellipse: {
|
|
4856
|
-
semiMajorAxis: radius
|
|
4857
|
-
semiMinorAxis: radius
|
|
4858
|
-
material:
|
|
4859
|
-
outlineWidth:
|
|
4860
|
-
extrudedHeight:
|
|
5276
|
+
semiMajorAxis: radius,
|
|
5277
|
+
semiMinorAxis: radius,
|
|
5278
|
+
material: cFill,
|
|
5279
|
+
outlineWidth: null,
|
|
5280
|
+
extrudedHeight: extrusion.value,
|
|
4861
5281
|
heightReference: heightRef,
|
|
4862
|
-
extrudedHeightReference:
|
|
5282
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
4863
5283
|
height: Cartographic.fromCartesian(pos3d).height,
|
|
4864
|
-
zIndex:
|
|
5284
|
+
zIndex: 1,
|
|
4865
5285
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
4866
5286
|
},
|
|
4867
|
-
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
4868
|
-
|
|
5287
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone(),
|
|
5288
|
+
show: true
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5291
|
+
else {
|
|
5292
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5293
|
+
cEntity = params.rendered;
|
|
5294
|
+
cEntity.ellipse.semiMajorAxis = new ConstantProperty(radius);
|
|
5295
|
+
cEntity.ellipse.semiMinorAxis = new ConstantProperty(radius);
|
|
5296
|
+
cEntity.ellipse.outlineWidth = undefined;
|
|
5297
|
+
cEntity.ellipse.extrudedHeight = new ConstantProperty(extrusion.value);
|
|
5298
|
+
cEntity.ellipse.heightReference = new ConstantProperty(heightRef);
|
|
5299
|
+
cEntity.ellipse.extrudedHeightReference = new ConstantProperty(extrusion.exHeightRef);
|
|
5300
|
+
cEntity.ellipse.height = new ConstantProperty(Cartographic.fromCartesian(pos3d).height);
|
|
5301
|
+
cEntity.ellipse.zIndex = new ConstantProperty(1);
|
|
5302
|
+
cEntity.ellipse.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5303
|
+
cEntity.position = new ConstantPositionProperty(pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone());
|
|
5304
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5305
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5306
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5307
|
+
color: cFill,
|
|
5308
|
+
entity: cEntity,
|
|
5309
|
+
viewer: params.viewer,
|
|
5310
|
+
override: true,
|
|
5311
|
+
requestRender: false
|
|
5312
|
+
});
|
|
5313
|
+
cEntity.show = true;
|
|
5314
|
+
}
|
|
5315
|
+
if (hasOutline) {
|
|
5316
|
+
outlineExtrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderBorderExtrusion);
|
|
5317
|
+
// If this doesn't have its own extrusion, we must make it match the sibling.
|
|
5318
|
+
// This way they render in a uniform way.
|
|
5319
|
+
if (!outlineExtrusion.value && extrusion.value) {
|
|
5320
|
+
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
5321
|
+
}
|
|
5322
|
+
outlineEntity = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5323
|
+
if (outlineEntity && outlineEntity.ellipse) {
|
|
5324
|
+
outlineEntity.ellipse.semiMajorAxis = new ConstantProperty(radius + outlineWidth);
|
|
5325
|
+
outlineEntity.ellipse.semiMinorAxis = new ConstantProperty(radius + outlineWidth);
|
|
5326
|
+
outlineEntity.ellipse.extrudedHeight = new ConstantProperty(outlineExtrusion.value);
|
|
5327
|
+
outlineEntity.ellipse.heightReference = new ConstantProperty(heightRef);
|
|
5328
|
+
outlineEntity.ellipse.extrudedHeightReference = new ConstantProperty(outlineExtrusion.exHeightRef);
|
|
5329
|
+
outlineEntity.ellipse.height = new ConstantProperty(Cartographic.fromCartesian(pos3d).height);
|
|
5330
|
+
outlineEntity.ellipse.zIndex = new ConstantProperty(2);
|
|
5331
|
+
outlineEntity.ellipse.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5332
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5333
|
+
// WARNING: ellipse does not support animation (yet?).
|
|
5334
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5335
|
+
color: cOutline,
|
|
5336
|
+
entity: outlineEntity,
|
|
5337
|
+
viewer: params.viewer,
|
|
5338
|
+
override: true,
|
|
5339
|
+
requestRender: false
|
|
5340
|
+
});
|
|
5341
|
+
outlineEntity.show = true;
|
|
5342
|
+
}
|
|
5343
|
+
else {
|
|
5344
|
+
outlineEntity = new Entity({
|
|
5345
|
+
id: ObjectUtils.UId(10),
|
|
5346
|
+
ellipse: {
|
|
5347
|
+
semiMajorAxis: radius + outlineWidth,
|
|
5348
|
+
semiMinorAxis: radius + outlineWidth,
|
|
5349
|
+
material: cOutline,
|
|
5350
|
+
outlineWidth: undefined,
|
|
5351
|
+
extrudedHeight: outlineExtrusion.value,
|
|
5352
|
+
heightReference: heightRef,
|
|
5353
|
+
extrudedHeightReference: outlineExtrusion.exHeightRef,
|
|
5354
|
+
height: Cartographic.fromCartesian(pos3d).height,
|
|
5355
|
+
zIndex: 2,
|
|
5356
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5357
|
+
},
|
|
5358
|
+
position: pos3d === null || pos3d === void 0 ? void 0 : pos3d.clone()
|
|
5359
|
+
});
|
|
5360
|
+
}
|
|
5361
|
+
siblings.push(outlineEntity);
|
|
4869
5362
|
}
|
|
4870
5363
|
}
|
|
4871
5364
|
if (!cEntity) {
|
|
@@ -4882,33 +5375,66 @@ var EntityRenderEngine;
|
|
|
4882
5375
|
heightRef = getHeightRef(style);
|
|
4883
5376
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
4884
5377
|
disableDepthTest = Boolean(style.renderOnTop);
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
5378
|
+
if (!params.rendered || !params.rendered.billboard) {
|
|
5379
|
+
cEntity = new Entity({
|
|
5380
|
+
id: ObjectUtils.UId(10),
|
|
5381
|
+
// point: {
|
|
5382
|
+
// pixelSize: size,
|
|
5383
|
+
// color: cColor,
|
|
5384
|
+
// heightReference: getHeightRef(style),
|
|
5385
|
+
// distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5386
|
+
// },
|
|
5387
|
+
// We are generating a billboard instead of using the point.
|
|
5388
|
+
// This is because points were behaving strangely where they would appear oblong shapes.
|
|
5389
|
+
// This occurred consistently when rendering many icons and points at the same time.
|
|
5390
|
+
billboard: {
|
|
5391
|
+
height: circleBillboard.height,
|
|
5392
|
+
width: circleBillboard.width,
|
|
5393
|
+
image: circleBillboard.canvasDataUri,
|
|
5394
|
+
color: new CallbackProperty(function () { return undefined; }, true),
|
|
5395
|
+
heightReference: heightRef,
|
|
5396
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance),
|
|
5397
|
+
disableDepthTestDistance: disableDepthTest ? Number.POSITIVE_INFINITY : undefined
|
|
5398
|
+
},
|
|
5399
|
+
position: EntityUtils.GetPos({
|
|
5400
|
+
viewer: params.viewer,
|
|
5401
|
+
entity: entity,
|
|
5402
|
+
recordHeightRef: heightRef,
|
|
5403
|
+
returnHeightRef: heightRef
|
|
5404
|
+
}),
|
|
5405
|
+
show: true
|
|
5406
|
+
});
|
|
5407
|
+
}
|
|
5408
|
+
else {
|
|
5409
|
+
prepareExistingGraphic(params.rendered);
|
|
5410
|
+
cEntity = params.rendered;
|
|
5411
|
+
imgKey = "".concat(size, "-").concat(cColor.toCssColorString());
|
|
5412
|
+
currentImgKey = cEntity.billboard._billboardImgKey;
|
|
5413
|
+
if (currentImgKey != imgKey) {
|
|
5414
|
+
cEntity.billboard.image = new ConstantProperty(circleBillboard.canvasDataUri);
|
|
5415
|
+
}
|
|
5416
|
+
cEntity.billboard.height = new ConstantProperty(circleBillboard.height);
|
|
5417
|
+
cEntity.billboard.width = new ConstantProperty(circleBillboard.width);
|
|
5418
|
+
cEntity.billboard.heightReference = new ConstantProperty(heightRef);
|
|
5419
|
+
cEntity.billboard.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5420
|
+
cEntity.billboard.disableDepthTestDistance = new ConstantProperty(disableDepthTest ? Number.POSITIVE_INFINITY : undefined);
|
|
5421
|
+
cEntity.position = new ConstantPositionProperty(EntityUtils.GetPos({
|
|
4905
5422
|
viewer: params.viewer,
|
|
4906
5423
|
entity: entity,
|
|
4907
5424
|
recordHeightRef: heightRef,
|
|
4908
5425
|
returnHeightRef: heightRef
|
|
4909
|
-
})
|
|
4910
|
-
|
|
4911
|
-
|
|
5426
|
+
}));
|
|
5427
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5428
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5429
|
+
color: cColor,
|
|
5430
|
+
entity: cEntity,
|
|
5431
|
+
viewer: params.viewer,
|
|
5432
|
+
override: true,
|
|
5433
|
+
requestRender: false
|
|
5434
|
+
});
|
|
5435
|
+
cEntity.show = true;
|
|
5436
|
+
cEntity.billboard._billboardImgKey = imgKey;
|
|
5437
|
+
}
|
|
4912
5438
|
cEntity.billboard._billboardSize = Math.ceil(circleBillboard.height / 2);
|
|
4913
5439
|
}
|
|
4914
5440
|
if (cEntity) {
|
|
@@ -4921,16 +5447,16 @@ var EntityRenderEngine;
|
|
|
4921
5447
|
}
|
|
4922
5448
|
Point.Render = Render;
|
|
4923
5449
|
function RenderGroup(params) {
|
|
4924
|
-
var _a, _b, _c;
|
|
5450
|
+
var _a, _b, _c, _d;
|
|
4925
5451
|
return __awaiter(this, void 0, void 0, function () {
|
|
4926
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
4927
|
-
return __generator(this, function (
|
|
4928
|
-
switch (
|
|
5452
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_2;
|
|
5453
|
+
return __generator(this, function (_f) {
|
|
5454
|
+
switch (_f.label) {
|
|
4929
5455
|
case 0:
|
|
4930
5456
|
api = params.apiGetter.getApi();
|
|
4931
5457
|
cEntities = {};
|
|
4932
5458
|
i = 0;
|
|
4933
|
-
|
|
5459
|
+
_f.label = 1;
|
|
4934
5460
|
case 1:
|
|
4935
5461
|
if (!(i < params.entities.length)) return [3 /*break*/, 11];
|
|
4936
5462
|
entity = params.entities[i];
|
|
@@ -4938,13 +5464,13 @@ var EntityRenderEngine;
|
|
|
4938
5464
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
4939
5465
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
4940
5466
|
case 2:
|
|
4941
|
-
|
|
5467
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
4942
5468
|
return [3 /*break*/, 4];
|
|
4943
5469
|
case 3:
|
|
4944
|
-
|
|
4945
|
-
|
|
5470
|
+
_e = zoomItem.Style;
|
|
5471
|
+
_f.label = 4;
|
|
4946
5472
|
case 4:
|
|
4947
|
-
style =
|
|
5473
|
+
style = _e;
|
|
4948
5474
|
tagIds = entity.Bruce["Layer.ID"];
|
|
4949
5475
|
tags = [];
|
|
4950
5476
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -4953,8 +5479,8 @@ var EntityRenderEngine;
|
|
|
4953
5479
|
tagIds: tagIds
|
|
4954
5480
|
})];
|
|
4955
5481
|
case 5:
|
|
4956
|
-
tags = (
|
|
4957
|
-
|
|
5482
|
+
tags = (_f.sent()).tags;
|
|
5483
|
+
_f.label = 6;
|
|
4958
5484
|
case 6:
|
|
4959
5485
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.pointStyle) !== null && _b !== void 0 ? _b : {};
|
|
4960
5486
|
return [4 /*yield*/, Render({
|
|
@@ -4965,20 +5491,21 @@ var EntityRenderEngine;
|
|
|
4965
5491
|
api: api,
|
|
4966
5492
|
apiGetter: params.apiGetter,
|
|
4967
5493
|
maxDistance: zoomItem.MaxZoom,
|
|
4968
|
-
minDistance: zoomItem.MinZoom
|
|
5494
|
+
minDistance: zoomItem.MinZoom,
|
|
5495
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
4969
5496
|
})];
|
|
4970
5497
|
case 7:
|
|
4971
|
-
cEntity =
|
|
5498
|
+
cEntity = _f.sent();
|
|
4972
5499
|
if (!cEntity) return [3 /*break*/, 9];
|
|
4973
5500
|
return [4 /*yield*/, getName(api, entity)];
|
|
4974
5501
|
case 8:
|
|
4975
|
-
name_2 =
|
|
5502
|
+
name_2 = _f.sent();
|
|
4976
5503
|
cEntity.name = name_2;
|
|
4977
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
4978
|
-
|
|
5504
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5505
|
+
_f.label = 9;
|
|
4979
5506
|
case 9:
|
|
4980
5507
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
4981
|
-
|
|
5508
|
+
_f.label = 10;
|
|
4982
5509
|
case 10:
|
|
4983
5510
|
i++;
|
|
4984
5511
|
return [3 /*break*/, 1];
|
|
@@ -5063,52 +5590,110 @@ var EntityRenderEngine;
|
|
|
5063
5590
|
if (style.drapeOver == "ALL") {
|
|
5064
5591
|
classification = ClassificationType.BOTH;
|
|
5065
5592
|
}
|
|
5066
|
-
var cEntity =
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5593
|
+
var cEntity = null;
|
|
5594
|
+
if (!params.rendered || ((!params.rendered.polyline && units == "px") ||
|
|
5595
|
+
(!params.rendered.corridor && units == "m"))) {
|
|
5596
|
+
cEntity = new Entity({
|
|
5597
|
+
id: ObjectUtils.UId(10),
|
|
5598
|
+
polyline: units == "px" ? {
|
|
5599
|
+
positions: posses,
|
|
5600
|
+
material: cColor,
|
|
5601
|
+
width: width,
|
|
5602
|
+
classificationType: classification,
|
|
5603
|
+
arcType: ArcType.GEODESIC,
|
|
5604
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5605
|
+
clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
|
|
5606
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5607
|
+
} : null,
|
|
5608
|
+
corridor: units == "m" ? {
|
|
5609
|
+
positions: posses,
|
|
5610
|
+
material: cColor,
|
|
5611
|
+
width: width,
|
|
5612
|
+
classificationType: classification,
|
|
5613
|
+
heightReference: heightRef,
|
|
5614
|
+
zIndex: getZIndex(style, entity, params.tags),
|
|
5615
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5616
|
+
cornerType: CornerType.MITERED,
|
|
5617
|
+
shadows: ShadowMode.ENABLED,
|
|
5618
|
+
fill: true
|
|
5619
|
+
} : null,
|
|
5620
|
+
position: EntityUtils.GetPos({
|
|
5621
|
+
viewer: params.viewer,
|
|
5622
|
+
entity: entity,
|
|
5623
|
+
recordHeightRef: heightRef,
|
|
5624
|
+
returnHeightRef: heightRef
|
|
5625
|
+
}),
|
|
5626
|
+
show: true
|
|
5627
|
+
});
|
|
5628
|
+
}
|
|
5629
|
+
else {
|
|
5630
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5631
|
+
var parts = EntityUtils.GatherEntity({
|
|
5632
|
+
entity: cEntity,
|
|
5633
|
+
});
|
|
5634
|
+
if (parts.length > 1) {
|
|
5635
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
5636
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5637
|
+
var part = parts[i];
|
|
5638
|
+
if (part && part instanceof Entity && params.viewer.entities.contains(part)) {
|
|
5639
|
+
params.viewer.entities.remove(part);
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
cEntity._siblingGraphics = [];
|
|
5643
|
+
if (cEntity._parentEntity) {
|
|
5644
|
+
console.warn("Polyline.Render: Parent entity was not null. This should not happen.");
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5647
|
+
cEntity = params.rendered;
|
|
5648
|
+
if (units == "px") {
|
|
5649
|
+
cEntity.polyline.positions = new ConstantProperty(posses);
|
|
5650
|
+
cEntity.polyline.width = new ConstantProperty(width);
|
|
5651
|
+
cEntity.polyline.classificationType = new ConstantProperty(classification);
|
|
5652
|
+
cEntity.polyline.zIndex = new ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5653
|
+
cEntity.polyline.clampToGround = new ConstantProperty(heightRef == HeightReference.CLAMP_TO_GROUND);
|
|
5654
|
+
cEntity.polyline.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5655
|
+
cEntity.corridor = undefined;
|
|
5656
|
+
}
|
|
5657
|
+
else {
|
|
5658
|
+
cEntity.corridor.positions = new ConstantProperty(posses);
|
|
5659
|
+
cEntity.corridor.width = new ConstantProperty(width);
|
|
5660
|
+
cEntity.corridor.classificationType = new ConstantProperty(classification);
|
|
5661
|
+
cEntity.corridor.heightReference = new ConstantProperty(heightRef);
|
|
5662
|
+
cEntity.corridor.zIndex = new ConstantProperty(getZIndex(style, entity, params.tags));
|
|
5663
|
+
cEntity.corridor.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5664
|
+
cEntity.polyline = undefined;
|
|
5665
|
+
}
|
|
5666
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5667
|
+
// WARNING: polyline does not support animation (yet?).
|
|
5668
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5669
|
+
color: cColor,
|
|
5670
|
+
entity: cEntity,
|
|
5671
|
+
viewer: params.viewer,
|
|
5672
|
+
override: true,
|
|
5673
|
+
requestRender: false
|
|
5674
|
+
});
|
|
5675
|
+
cEntity.position = new ConstantPositionProperty(EntityUtils.GetPos({
|
|
5091
5676
|
viewer: params.viewer,
|
|
5092
5677
|
entity: entity,
|
|
5093
5678
|
recordHeightRef: heightRef,
|
|
5094
5679
|
returnHeightRef: heightRef
|
|
5095
|
-
})
|
|
5096
|
-
show
|
|
5097
|
-
}
|
|
5680
|
+
}));
|
|
5681
|
+
cEntity.show = true;
|
|
5682
|
+
}
|
|
5098
5683
|
return cEntity;
|
|
5099
5684
|
}
|
|
5100
5685
|
Polyline.Render = Render;
|
|
5101
5686
|
function RenderGroup(params) {
|
|
5102
|
-
var _a, _b, _c;
|
|
5687
|
+
var _a, _b, _c, _d;
|
|
5103
5688
|
return __awaiter(this, void 0, void 0, function () {
|
|
5104
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5105
|
-
return __generator(this, function (
|
|
5106
|
-
switch (
|
|
5689
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, lStyle, cEntity, name_3;
|
|
5690
|
+
return __generator(this, function (_f) {
|
|
5691
|
+
switch (_f.label) {
|
|
5107
5692
|
case 0:
|
|
5108
5693
|
api = params.apiGetter.getApi();
|
|
5109
5694
|
cEntities = {};
|
|
5110
5695
|
i = 0;
|
|
5111
|
-
|
|
5696
|
+
_f.label = 1;
|
|
5112
5697
|
case 1:
|
|
5113
5698
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5114
5699
|
entity = params.entities[i];
|
|
@@ -5116,13 +5701,13 @@ var EntityRenderEngine;
|
|
|
5116
5701
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5117
5702
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5118
5703
|
case 2:
|
|
5119
|
-
|
|
5704
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5120
5705
|
return [3 /*break*/, 4];
|
|
5121
5706
|
case 3:
|
|
5122
|
-
|
|
5123
|
-
|
|
5707
|
+
_e = zoomItem.Style;
|
|
5708
|
+
_f.label = 4;
|
|
5124
5709
|
case 4:
|
|
5125
|
-
style =
|
|
5710
|
+
style = _e;
|
|
5126
5711
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5127
5712
|
tags = [];
|
|
5128
5713
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5131,8 +5716,8 @@ var EntityRenderEngine;
|
|
|
5131
5716
|
tagIds: tagIds
|
|
5132
5717
|
})];
|
|
5133
5718
|
case 5:
|
|
5134
|
-
tags = (
|
|
5135
|
-
|
|
5719
|
+
tags = (_f.sent()).tags;
|
|
5720
|
+
_f.label = 6;
|
|
5136
5721
|
case 6:
|
|
5137
5722
|
lStyle = (_b = style === null || style === void 0 ? void 0 : style.polylineStyle) !== null && _b !== void 0 ? _b : {};
|
|
5138
5723
|
cEntity = Render({
|
|
@@ -5141,16 +5726,17 @@ var EntityRenderEngine;
|
|
|
5141
5726
|
tags: tags,
|
|
5142
5727
|
viewer: params.viewer,
|
|
5143
5728
|
maxDistance: zoomItem.MaxZoom,
|
|
5144
|
-
minDistance: zoomItem.MinZoom
|
|
5729
|
+
minDistance: zoomItem.MinZoom,
|
|
5730
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5145
5731
|
});
|
|
5146
5732
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5147
5733
|
return [4 /*yield*/, getName(api, entity)];
|
|
5148
5734
|
case 7:
|
|
5149
|
-
name_3 =
|
|
5735
|
+
name_3 = _f.sent();
|
|
5150
5736
|
cEntity.name = name_3;
|
|
5151
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
5737
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5152
5738
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5153
|
-
|
|
5739
|
+
_f.label = 8;
|
|
5154
5740
|
case 8:
|
|
5155
5741
|
i++;
|
|
5156
5742
|
return [3 /*break*/, 1];
|
|
@@ -5164,7 +5750,7 @@ var EntityRenderEngine;
|
|
|
5164
5750
|
var Polygon;
|
|
5165
5751
|
(function (Polygon) {
|
|
5166
5752
|
function Render(params) {
|
|
5167
|
-
var _a, _b;
|
|
5753
|
+
var _a, _b, _c, _d;
|
|
5168
5754
|
var entity = params.entity;
|
|
5169
5755
|
var pRings = (_a = entity.geometry) === null || _a === void 0 ? void 0 : _a.Polygon;
|
|
5170
5756
|
if (pRings == null || pRings.length <= 0) {
|
|
@@ -5221,30 +5807,85 @@ var EntityRenderEngine;
|
|
|
5221
5807
|
if (style.drapeOver == "ALL") {
|
|
5222
5808
|
classification = ClassificationType.BOTH;
|
|
5223
5809
|
}
|
|
5224
|
-
var
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5810
|
+
var prepareExistingGraphic = function (cEntity, siblings) {
|
|
5811
|
+
if (siblings === void 0) { siblings = 0; }
|
|
5812
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
5813
|
+
var parts = EntityUtils.GatherEntity({
|
|
5814
|
+
entity: cEntity,
|
|
5815
|
+
});
|
|
5816
|
+
if (parts.length > 1) {
|
|
5817
|
+
// We'll cull all except the allowed number of siblings.
|
|
5818
|
+
cEntity._siblingGraphics = cEntity._siblingGraphics.slice(0, siblings);
|
|
5819
|
+
// We'll remove all that aren't in the allowed (direct) list.
|
|
5820
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
5821
|
+
var part = parts[i];
|
|
5822
|
+
if (part && part instanceof Entity && params.viewer.entities.contains(part) && !cEntity._siblingGraphics.includes(part)) {
|
|
5823
|
+
params.viewer.entities.remove(part);
|
|
5824
|
+
}
|
|
5825
|
+
}
|
|
5826
|
+
if (cEntity._parentEntity) {
|
|
5827
|
+
console.warn("Point.Render: Parent entity was not null. This should not happen.");
|
|
5828
|
+
}
|
|
5829
|
+
}
|
|
5830
|
+
};
|
|
5831
|
+
var hasOutline = width > 0 && cLineColor;
|
|
5832
|
+
var cEntity = null;
|
|
5833
|
+
if (!params.rendered || !params.rendered.polygon) {
|
|
5834
|
+
cEntity = new Entity({
|
|
5835
|
+
id: ObjectUtils.UId(10),
|
|
5836
|
+
polygon: {
|
|
5837
|
+
hierarchy: new PolygonHierarchy(posses, holePosses.map(function (x) { return new PolygonHierarchy(x); })),
|
|
5838
|
+
material: cFillColor,
|
|
5839
|
+
extrudedHeight: extrusion.value,
|
|
5840
|
+
extrudedHeightReference: extrusion.exHeightRef,
|
|
5841
|
+
shadows: ShadowMode.ENABLED,
|
|
5842
|
+
heightReference: heightRef,
|
|
5843
|
+
classificationType: classification,
|
|
5844
|
+
perPositionHeight: heightRef == HeightReference.CLAMP_TO_GROUND ? false : true,
|
|
5845
|
+
zIndex: zIndex,
|
|
5846
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true)
|
|
5847
|
+
},
|
|
5848
|
+
position: EntityUtils.GetPos({
|
|
5849
|
+
viewer: params.viewer,
|
|
5850
|
+
entity: entity,
|
|
5851
|
+
recordHeightRef: heightRef,
|
|
5852
|
+
returnHeightRef: heightRef
|
|
5853
|
+
}),
|
|
5854
|
+
show: true
|
|
5855
|
+
});
|
|
5856
|
+
}
|
|
5857
|
+
else {
|
|
5858
|
+
// Polygons can have more siblings for the related hole graphics.
|
|
5859
|
+
// So this is a "good enough" way rather than perfect as it only preserves the outline.
|
|
5860
|
+
prepareExistingGraphic(params.rendered, hasOutline ? 1 : 0);
|
|
5861
|
+
cEntity = params.rendered;
|
|
5862
|
+
cEntity.polygon.hierarchy = new ConstantProperty(new PolygonHierarchy(posses, holePosses.map(function (x) { return new PolygonHierarchy(x); })));
|
|
5863
|
+
cEntity.polygon.extrudedHeight = new ConstantProperty(extrusion.value);
|
|
5864
|
+
cEntity.polygon.extrudedHeightReference = new ConstantProperty(extrusion.exHeightRef);
|
|
5865
|
+
cEntity.polygon.shadows = new ConstantProperty(ShadowMode.ENABLED);
|
|
5866
|
+
cEntity.polygon.heightReference = new ConstantProperty(heightRef);
|
|
5867
|
+
cEntity.polygon.classificationType = new ConstantProperty(classification);
|
|
5868
|
+
cEntity.polygon.perPositionHeight = new ConstantProperty(heightRef == HeightReference.CLAMP_TO_GROUND ? false : true);
|
|
5869
|
+
cEntity.polygon.zIndex = new ConstantProperty(zIndex);
|
|
5870
|
+
cEntity.polygon.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width <= 0 || !cLineColor || units == "m" ? size : null, true));
|
|
5871
|
+
cEntity.position = new ConstantPositionProperty(EntityUtils.GetPos({
|
|
5239
5872
|
viewer: params.viewer,
|
|
5240
5873
|
entity: entity,
|
|
5241
5874
|
recordHeightRef: heightRef,
|
|
5242
5875
|
returnHeightRef: heightRef
|
|
5243
|
-
})
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5876
|
+
}));
|
|
5877
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
5878
|
+
// WARNING: polygon does not support animation (yet?).
|
|
5879
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
5880
|
+
color: cFillColor,
|
|
5881
|
+
entity: cEntity,
|
|
5882
|
+
viewer: params.viewer,
|
|
5883
|
+
override: true,
|
|
5884
|
+
requestRender: false
|
|
5885
|
+
});
|
|
5886
|
+
cEntity.show = true;
|
|
5887
|
+
}
|
|
5888
|
+
if (hasOutline) {
|
|
5248
5889
|
var borderHeight = undefined;
|
|
5249
5890
|
if (heightRef != HeightReference.CLAMP_TO_GROUND) {
|
|
5250
5891
|
if (flattenPoints) {
|
|
@@ -5268,33 +5909,62 @@ var EntityRenderEngine;
|
|
|
5268
5909
|
else {
|
|
5269
5910
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
5270
5911
|
}
|
|
5271
|
-
var cEntityBorder =
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5912
|
+
var cEntityBorder = (_d = (_c = params.rendered) === null || _c === void 0 ? void 0 : _c._siblingGraphics) === null || _d === void 0 ? void 0 : _d[0];
|
|
5913
|
+
cEntity._siblingGraphics = [];
|
|
5914
|
+
if (!cEntityBorder || ((!cEntityBorder.polyline && units == "px") ||
|
|
5915
|
+
(!cEntityBorder.corridor && units == "m"))) {
|
|
5916
|
+
cEntityBorder = new Entity({
|
|
5917
|
+
id: ObjectUtils.UId(10),
|
|
5918
|
+
polyline: units == "px" ? new PolylineGraphics({
|
|
5919
|
+
positions: borderPosses,
|
|
5920
|
+
material: cLineColor,
|
|
5921
|
+
width: width,
|
|
5922
|
+
clampToGround: heightRef == HeightReference.CLAMP_TO_GROUND,
|
|
5923
|
+
classificationType: ClassificationType.TERRAIN,
|
|
5924
|
+
arcType: ArcType.GEODESIC,
|
|
5925
|
+
zIndex: zIndex,
|
|
5926
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5927
|
+
}) : null,
|
|
5928
|
+
corridor: units == "m" ? {
|
|
5929
|
+
positions: borderPosses,
|
|
5930
|
+
material: cLineColor,
|
|
5931
|
+
heightReference: heightRef,
|
|
5932
|
+
height: borderHeight,
|
|
5933
|
+
width: width,
|
|
5934
|
+
fill: true,
|
|
5935
|
+
zIndex: zIndex + 1,
|
|
5936
|
+
cornerType: CornerType.MITERED,
|
|
5937
|
+
classificationType: classification,
|
|
5938
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance, width),
|
|
5939
|
+
shadows: ShadowMode.ENABLED
|
|
5940
|
+
} : null,
|
|
5941
|
+
show: true
|
|
5942
|
+
});
|
|
5943
|
+
}
|
|
5944
|
+
else {
|
|
5945
|
+
if (units == "px") {
|
|
5946
|
+
cEntityBorder.polyline.positions = new ConstantProperty(borderPosses);
|
|
5947
|
+
cEntityBorder.polyline.width = new ConstantProperty(width);
|
|
5948
|
+
cEntityBorder.polyline.clampToGround = new ConstantProperty(heightRef == HeightReference.CLAMP_TO_GROUND);
|
|
5949
|
+
cEntityBorder.polyline.classificationType = new ConstantProperty(ClassificationType.TERRAIN);
|
|
5950
|
+
cEntityBorder.polyline.zIndex = new ConstantProperty(zIndex);
|
|
5951
|
+
cEntityBorder.polyline.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
5952
|
+
cEntityBorder.polyline.material = new ColorMaterialProperty(cLineColor);
|
|
5953
|
+
cEntityBorder.corridor = undefined;
|
|
5954
|
+
}
|
|
5955
|
+
else {
|
|
5956
|
+
cEntityBorder.corridor.positions = new ConstantProperty(borderPosses);
|
|
5957
|
+
cEntityBorder.corridor.heightReference = new ConstantProperty(heightRef);
|
|
5958
|
+
cEntityBorder.corridor.height = new ConstantProperty(borderHeight);
|
|
5959
|
+
cEntityBorder.corridor.width = new ConstantProperty(width);
|
|
5960
|
+
cEntityBorder.corridor.fill = new ConstantProperty(true);
|
|
5961
|
+
cEntityBorder.corridor.zIndex = new ConstantProperty(zIndex + 1);
|
|
5962
|
+
cEntityBorder.corridor.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance, width));
|
|
5963
|
+
cEntityBorder.corridor.material = new ColorMaterialProperty(cLineColor);
|
|
5964
|
+
cEntityBorder.polyline = undefined;
|
|
5965
|
+
}
|
|
5966
|
+
cEntityBorder.show = true;
|
|
5967
|
+
}
|
|
5298
5968
|
cEntityBorder._parentEntity = cEntity;
|
|
5299
5969
|
cEntity._siblingGraphics.push(cEntityBorder);
|
|
5300
5970
|
for (var i = 0; i < holePosses.length; i++) {
|
|
@@ -5331,20 +6001,23 @@ var EntityRenderEngine;
|
|
|
5331
6001
|
cEntityHole._parentEntity = cEntity;
|
|
5332
6002
|
}
|
|
5333
6003
|
}
|
|
6004
|
+
else {
|
|
6005
|
+
cEntity._siblingGraphics = [];
|
|
6006
|
+
}
|
|
5334
6007
|
return cEntity;
|
|
5335
6008
|
}
|
|
5336
6009
|
Polygon.Render = Render;
|
|
5337
6010
|
function RenderGroup(params) {
|
|
5338
|
-
var _a, _b, _c;
|
|
6011
|
+
var _a, _b, _c, _d;
|
|
5339
6012
|
return __awaiter(this, void 0, void 0, function () {
|
|
5340
|
-
var api, cEntities, i, entity, zoomItem, style,
|
|
5341
|
-
return __generator(this, function (
|
|
5342
|
-
switch (
|
|
6013
|
+
var api, cEntities, i, entity, zoomItem, style, _e, tagIds, tags, pStyle, cEntity, name_4;
|
|
6014
|
+
return __generator(this, function (_f) {
|
|
6015
|
+
switch (_f.label) {
|
|
5343
6016
|
case 0:
|
|
5344
6017
|
api = params.apiGetter.getApi();
|
|
5345
6018
|
cEntities = {};
|
|
5346
6019
|
i = 0;
|
|
5347
|
-
|
|
6020
|
+
_f.label = 1;
|
|
5348
6021
|
case 1:
|
|
5349
6022
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5350
6023
|
entity = params.entities[i];
|
|
@@ -5352,13 +6025,13 @@ var EntityRenderEngine;
|
|
|
5352
6025
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 3];
|
|
5353
6026
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5354
6027
|
case 2:
|
|
5355
|
-
|
|
6028
|
+
_e = (_a = (_f.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5356
6029
|
return [3 /*break*/, 4];
|
|
5357
6030
|
case 3:
|
|
5358
|
-
|
|
5359
|
-
|
|
6031
|
+
_e = zoomItem.Style;
|
|
6032
|
+
_f.label = 4;
|
|
5360
6033
|
case 4:
|
|
5361
|
-
style =
|
|
6034
|
+
style = _e;
|
|
5362
6035
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5363
6036
|
tags = [];
|
|
5364
6037
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 6];
|
|
@@ -5367,8 +6040,8 @@ var EntityRenderEngine;
|
|
|
5367
6040
|
tagIds: tagIds
|
|
5368
6041
|
})];
|
|
5369
6042
|
case 5:
|
|
5370
|
-
tags = (
|
|
5371
|
-
|
|
6043
|
+
tags = (_f.sent()).tags;
|
|
6044
|
+
_f.label = 6;
|
|
5372
6045
|
case 6:
|
|
5373
6046
|
pStyle = (_b = style === null || style === void 0 ? void 0 : style.polygonStyle) !== null && _b !== void 0 ? _b : {};
|
|
5374
6047
|
cEntity = Render({
|
|
@@ -5377,16 +6050,17 @@ var EntityRenderEngine;
|
|
|
5377
6050
|
tags: tags,
|
|
5378
6051
|
viewer: params.viewer,
|
|
5379
6052
|
maxDistance: zoomItem.MaxZoom,
|
|
5380
|
-
minDistance: zoomItem.MinZoom
|
|
6053
|
+
minDistance: zoomItem.MinZoom,
|
|
6054
|
+
rendered: (_c = params.rendered) === null || _c === void 0 ? void 0 : _c[entity.Bruce.ID]
|
|
5381
6055
|
});
|
|
5382
6056
|
if (!cEntity) return [3 /*break*/, 8];
|
|
5383
6057
|
return [4 /*yield*/, getName(api, entity)];
|
|
5384
6058
|
case 7:
|
|
5385
|
-
name_4 =
|
|
6059
|
+
name_4 = _f.sent();
|
|
5386
6060
|
cEntity.name = name_4;
|
|
5387
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6061
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_d = params.viewer) === null || _d === void 0 ? void 0 : _d.terrainProvider);
|
|
5388
6062
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5389
|
-
|
|
6063
|
+
_f.label = 8;
|
|
5390
6064
|
case 8:
|
|
5391
6065
|
i++;
|
|
5392
6066
|
return [3 /*break*/, 1];
|
|
@@ -5450,22 +6124,99 @@ var EntityRenderEngine;
|
|
|
5450
6124
|
color = colorToCColor(bColor);
|
|
5451
6125
|
}
|
|
5452
6126
|
}
|
|
5453
|
-
|
|
6127
|
+
/*
|
|
6128
|
+
const cEntity: ICesiumEntityExt = new Cesium.Entity({
|
|
5454
6129
|
id: ObjectUtils.UId(10),
|
|
5455
6130
|
model: {
|
|
5456
6131
|
uri: params.lodUrl,
|
|
5457
6132
|
heightReference: heightRef,
|
|
5458
6133
|
scale: scale * styleScale,
|
|
5459
|
-
shadows: ShadowMode.ENABLED,
|
|
6134
|
+
shadows: Cesium.ShadowMode.ENABLED,
|
|
5460
6135
|
colorBlendAmount: blendAmount,
|
|
5461
6136
|
colorBlendMode: blendMode,
|
|
5462
|
-
color: color,
|
|
6137
|
+
color: new Cesium.CallbackProperty(() => color, true),
|
|
5463
6138
|
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
5464
6139
|
},
|
|
5465
|
-
orientation: new ConstantProperty(orientation),
|
|
6140
|
+
orientation: new Cesium.ConstantProperty(orientation),
|
|
5466
6141
|
position: pos,
|
|
5467
6142
|
show: true
|
|
5468
6143
|
});
|
|
6144
|
+
*/
|
|
6145
|
+
var animateScale = null;
|
|
6146
|
+
var cEntity = params.rendered;
|
|
6147
|
+
if (!cEntity || !cEntity.model) {
|
|
6148
|
+
cEntity = new Entity({
|
|
6149
|
+
id: ObjectUtils.UId(10),
|
|
6150
|
+
model: {
|
|
6151
|
+
uri: params.lodUrl,
|
|
6152
|
+
heightReference: heightRef,
|
|
6153
|
+
scale: new CallbackProperty(function () { return scale * styleScale; }, true),
|
|
6154
|
+
shadows: ShadowMode.ENABLED,
|
|
6155
|
+
colorBlendAmount: blendAmount,
|
|
6156
|
+
colorBlendMode: blendMode,
|
|
6157
|
+
color: new CallbackProperty(function () { return color; }, true),
|
|
6158
|
+
distanceDisplayCondition: getDisplayCondition(params.minDistance, params.maxDistance)
|
|
6159
|
+
},
|
|
6160
|
+
orientation: new ConstantProperty(orientation),
|
|
6161
|
+
position: pos,
|
|
6162
|
+
show: true
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6165
|
+
else {
|
|
6166
|
+
// Gather entity in case previous version had sibling graphics we no longer need.
|
|
6167
|
+
var parts = EntityUtils.GatherEntity({
|
|
6168
|
+
entity: cEntity,
|
|
6169
|
+
});
|
|
6170
|
+
if (parts.length > 1) {
|
|
6171
|
+
// Kill all expect last part. Last one is the primary entity.
|
|
6172
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
6173
|
+
var part = parts[i];
|
|
6174
|
+
if (part && part instanceof Entity && params.viewer.entities.contains(part)) {
|
|
6175
|
+
params.viewer.entities.remove(part);
|
|
6176
|
+
}
|
|
6177
|
+
}
|
|
6178
|
+
cEntity._siblingGraphics = [];
|
|
6179
|
+
if (cEntity._parentEntity) {
|
|
6180
|
+
console.warn("Model3d.Render: Parent entity was not null. This should not happen.");
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
var currentUri = getValue$1(params.viewer, cEntity.model.uri);
|
|
6184
|
+
if (currentUri != params.lodUrl) {
|
|
6185
|
+
cEntity.model.uri = new ConstantProperty(params.lodUrl);
|
|
6186
|
+
}
|
|
6187
|
+
cEntity.model.heightReference = new ConstantProperty(heightRef);
|
|
6188
|
+
cEntity.model.shadows = new ConstantProperty(ShadowMode.ENABLED);
|
|
6189
|
+
cEntity.model.colorBlendAmount = new ConstantProperty(blendAmount);
|
|
6190
|
+
cEntity.model.colorBlendMode = new ConstantProperty(blendMode);
|
|
6191
|
+
cEntity.model.distanceDisplayCondition = new ConstantProperty(getDisplayCondition(params.minDistance, params.maxDistance));
|
|
6192
|
+
cEntity.orientation = new ConstantProperty(orientation);
|
|
6193
|
+
cEntity.position = new ConstantPositionProperty(pos);
|
|
6194
|
+
// Same file but different scale. We'll animate the scale.
|
|
6195
|
+
var prevClientFileId = cEntity.model._clientFileId;
|
|
6196
|
+
if (prevClientFileId == params.lodClientFileId) {
|
|
6197
|
+
animateScale = new CesiumAnimatedProperty.AnimateNumber({
|
|
6198
|
+
durationMs: 200,
|
|
6199
|
+
value: scale * styleScale,
|
|
6200
|
+
viewer: params.viewer,
|
|
6201
|
+
startValue: cEntity.model.scale,
|
|
6202
|
+
startPaused: true
|
|
6203
|
+
});
|
|
6204
|
+
cEntity.model.scale = new CallbackProperty(function () { return animateScale.GetValue(); }, false);
|
|
6205
|
+
}
|
|
6206
|
+
else {
|
|
6207
|
+
cEntity.model.scale = new CallbackProperty(function () { return scale * styleScale; }, true);
|
|
6208
|
+
}
|
|
6209
|
+
// We'll use "SetDefaultColor" to updating the internal reference and to allow for an animation.
|
|
6210
|
+
// cEntity.model.color = new Cesium.CallbackProperty(() => color, true);
|
|
6211
|
+
CesiumEntityStyler.SetDefaultColor({
|
|
6212
|
+
color: color,
|
|
6213
|
+
entity: cEntity,
|
|
6214
|
+
viewer: params.viewer,
|
|
6215
|
+
override: true,
|
|
6216
|
+
requestRender: false
|
|
6217
|
+
});
|
|
6218
|
+
cEntity.show = true;
|
|
6219
|
+
}
|
|
5469
6220
|
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
5470
6221
|
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
5471
6222
|
if (!heightProm) {
|
|
@@ -5544,6 +6295,10 @@ var EntityRenderEngine;
|
|
|
5544
6295
|
VisualRegisterCuller.MarkShouldRecheck(params.viewer);
|
|
5545
6296
|
}
|
|
5546
6297
|
}
|
|
6298
|
+
// Rough estimate on when the model is ready in the scene.
|
|
6299
|
+
if (animateScale) {
|
|
6300
|
+
animateScale.Play();
|
|
6301
|
+
}
|
|
5547
6302
|
});
|
|
5548
6303
|
var model = cEntity.model;
|
|
5549
6304
|
model._radiusLoaded = false;
|
|
@@ -5556,16 +6311,16 @@ var EntityRenderEngine;
|
|
|
5556
6311
|
}
|
|
5557
6312
|
Model3d.Render = Render;
|
|
5558
6313
|
function RenderGroup(params) {
|
|
5559
|
-
var _a, _b, _c, _d, _e;
|
|
6314
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5560
6315
|
return __awaiter(this, void 0, void 0, function () {
|
|
5561
|
-
var api, cEntities, reqBody, i, entity, zoomItem, style,
|
|
5562
|
-
return __generator(this, function (
|
|
5563
|
-
switch (
|
|
6316
|
+
var api, cEntities, reqBody, i, entity, zoomItem, style, _g, tagIds, tags, mStyle, group, level, catId, lodData, _loop_2, i;
|
|
6317
|
+
return __generator(this, function (_h) {
|
|
6318
|
+
switch (_h.label) {
|
|
5564
6319
|
case 0:
|
|
5565
6320
|
api = params.apiGetter.getApi();
|
|
5566
6321
|
return [4 /*yield*/, api.Loading];
|
|
5567
6322
|
case 1:
|
|
5568
|
-
|
|
6323
|
+
_h.sent();
|
|
5569
6324
|
cEntities = {};
|
|
5570
6325
|
reqBody = {
|
|
5571
6326
|
"strict": false,
|
|
@@ -5573,7 +6328,7 @@ var EntityRenderEngine;
|
|
|
5573
6328
|
"Items": []
|
|
5574
6329
|
};
|
|
5575
6330
|
i = 0;
|
|
5576
|
-
|
|
6331
|
+
_h.label = 2;
|
|
5577
6332
|
case 2:
|
|
5578
6333
|
if (!(i < params.entities.length)) return [3 /*break*/, 9];
|
|
5579
6334
|
entity = params.entities[i];
|
|
@@ -5581,13 +6336,13 @@ var EntityRenderEngine;
|
|
|
5581
6336
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 4];
|
|
5582
6337
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5583
6338
|
case 3:
|
|
5584
|
-
|
|
6339
|
+
_g = (_a = (_h.sent())) === null || _a === void 0 ? void 0 : _a.Settings;
|
|
5585
6340
|
return [3 /*break*/, 5];
|
|
5586
6341
|
case 4:
|
|
5587
|
-
|
|
5588
|
-
|
|
6342
|
+
_g = zoomItem.Style;
|
|
6343
|
+
_h.label = 5;
|
|
5589
6344
|
case 5:
|
|
5590
|
-
style =
|
|
6345
|
+
style = _g;
|
|
5591
6346
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5592
6347
|
tags = [];
|
|
5593
6348
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 7];
|
|
@@ -5596,8 +6351,8 @@ var EntityRenderEngine;
|
|
|
5596
6351
|
tagIds: tagIds
|
|
5597
6352
|
})];
|
|
5598
6353
|
case 6:
|
|
5599
|
-
tags = (
|
|
5600
|
-
|
|
6354
|
+
tags = (_h.sent()).tags;
|
|
6355
|
+
_h.label = 7;
|
|
5601
6356
|
case 7:
|
|
5602
6357
|
mStyle = (_b = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _b !== void 0 ? _b : {};
|
|
5603
6358
|
group = mStyle.lodGroup ? Calculator.GetString(mStyle.lodGroup, entity, tags) : null;
|
|
@@ -5618,7 +6373,7 @@ var EntityRenderEngine;
|
|
|
5618
6373
|
"group": group,
|
|
5619
6374
|
"level": level
|
|
5620
6375
|
});
|
|
5621
|
-
|
|
6376
|
+
_h.label = 8;
|
|
5622
6377
|
case 8:
|
|
5623
6378
|
i++;
|
|
5624
6379
|
return [3 /*break*/, 2];
|
|
@@ -5627,24 +6382,24 @@ var EntityRenderEngine;
|
|
|
5627
6382
|
filter: reqBody
|
|
5628
6383
|
})];
|
|
5629
6384
|
case 10:
|
|
5630
|
-
lodData = (
|
|
6385
|
+
lodData = (_h.sent()).lods;
|
|
5631
6386
|
_loop_2 = function (i) {
|
|
5632
|
-
var entity, zoomItem, style,
|
|
5633
|
-
return __generator(this, function (
|
|
5634
|
-
switch (
|
|
6387
|
+
var entity, zoomItem, style, _j, tagIds, tags, lod, mStyle, cEntity, name_5;
|
|
6388
|
+
return __generator(this, function (_k) {
|
|
6389
|
+
switch (_k.label) {
|
|
5635
6390
|
case 0:
|
|
5636
6391
|
entity = params.entities[i];
|
|
5637
6392
|
zoomItem = params.zoomItems[entity.Bruce.ID];
|
|
5638
6393
|
if (!(zoomItem.StyleID != -1)) return [3 /*break*/, 2];
|
|
5639
6394
|
return [4 /*yield*/, getStyle(api, entity, zoomItem.StyleID)];
|
|
5640
6395
|
case 1:
|
|
5641
|
-
|
|
6396
|
+
_j = (_c = (_k.sent())) === null || _c === void 0 ? void 0 : _c.Settings;
|
|
5642
6397
|
return [3 /*break*/, 3];
|
|
5643
6398
|
case 2:
|
|
5644
|
-
|
|
5645
|
-
|
|
6399
|
+
_j = zoomItem.Style;
|
|
6400
|
+
_k.label = 3;
|
|
5646
6401
|
case 3:
|
|
5647
|
-
style =
|
|
6402
|
+
style = _j;
|
|
5648
6403
|
tagIds = entity.Bruce["Layer.ID"];
|
|
5649
6404
|
tags = [];
|
|
5650
6405
|
if (!(tagIds && tagIds.length > 0)) return [3 /*break*/, 5];
|
|
@@ -5653,8 +6408,8 @@ var EntityRenderEngine;
|
|
|
5653
6408
|
tagIds: tagIds
|
|
5654
6409
|
})];
|
|
5655
6410
|
case 4:
|
|
5656
|
-
tags = (
|
|
5657
|
-
|
|
6411
|
+
tags = (_k.sent()).tags;
|
|
6412
|
+
_k.label = 5;
|
|
5658
6413
|
case 5:
|
|
5659
6414
|
lod = lodData.find(function (x) { return x.entityId == entity.Bruce.ID; });
|
|
5660
6415
|
if (!(lod === null || lod === void 0 ? void 0 : lod.clientFileId)) {
|
|
@@ -5662,6 +6417,7 @@ var EntityRenderEngine;
|
|
|
5662
6417
|
}
|
|
5663
6418
|
mStyle = (_d = style === null || style === void 0 ? void 0 : style.modelStyle) !== null && _d !== void 0 ? _d : {};
|
|
5664
6419
|
cEntity = Render({
|
|
6420
|
+
rendered: (_e = params.rendered) === null || _e === void 0 ? void 0 : _e[entity.Bruce.ID],
|
|
5665
6421
|
entity: entity,
|
|
5666
6422
|
style: mStyle,
|
|
5667
6423
|
tags: tags,
|
|
@@ -5678,23 +6434,23 @@ var EntityRenderEngine;
|
|
|
5678
6434
|
if (!cEntity) return [3 /*break*/, 7];
|
|
5679
6435
|
return [4 /*yield*/, getName(api, entity)];
|
|
5680
6436
|
case 6:
|
|
5681
|
-
name_5 =
|
|
6437
|
+
name_5 = _k.sent();
|
|
5682
6438
|
cEntity.name = name_5;
|
|
5683
|
-
cEntity._renderGroup = getRenderGroupId(zoomItem, (
|
|
6439
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_f = params.viewer) === null || _f === void 0 ? void 0 : _f.terrainProvider);
|
|
5684
6440
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
5685
|
-
|
|
6441
|
+
_k.label = 7;
|
|
5686
6442
|
case 7: return [2 /*return*/];
|
|
5687
6443
|
}
|
|
5688
6444
|
});
|
|
5689
6445
|
};
|
|
5690
6446
|
i = 0;
|
|
5691
|
-
|
|
6447
|
+
_h.label = 11;
|
|
5692
6448
|
case 11:
|
|
5693
6449
|
if (!(i < params.entities.length)) return [3 /*break*/, 14];
|
|
5694
6450
|
return [5 /*yield**/, _loop_2(i)];
|
|
5695
6451
|
case 12:
|
|
5696
|
-
|
|
5697
|
-
|
|
6452
|
+
_h.sent();
|
|
6453
|
+
_h.label = 13;
|
|
5698
6454
|
case 13:
|
|
5699
6455
|
i++;
|
|
5700
6456
|
return [3 /*break*/, 11];
|
|
@@ -11799,6 +12555,16 @@ var TilesetRenderEngine;
|
|
|
11799
12555
|
};
|
|
11800
12556
|
Styler.prototype.QueueEntities = function (entities, highPriority) {
|
|
11801
12557
|
if (highPriority === void 0) { highPriority = false; }
|
|
12558
|
+
// We set a default colour right away to avoid race conditions at later times.
|
|
12559
|
+
for (var i = 0; i < entities.length; i++) {
|
|
12560
|
+
var entity = entities[i];
|
|
12561
|
+
this.styledEntityIds[entity.entityId] = true;
|
|
12562
|
+
CesiumEntityStyler.BakeDefaultColor({
|
|
12563
|
+
entity: entity.visual,
|
|
12564
|
+
viewer: this.viewer,
|
|
12565
|
+
override: false
|
|
12566
|
+
});
|
|
12567
|
+
}
|
|
11802
12568
|
for (var i = 0; i < entities.length; i++) {
|
|
11803
12569
|
var entity = entities[i];
|
|
11804
12570
|
this.queueTilesetFeatureStyle(entity, highPriority);
|
|
@@ -22579,7 +23345,7 @@ var ViewRenderEngine;
|
|
|
22579
23345
|
ViewRenderEngine.Render = Render;
|
|
22580
23346
|
})(ViewRenderEngine || (ViewRenderEngine = {}));
|
|
22581
23347
|
|
|
22582
|
-
var VERSION = "3.7.
|
|
23348
|
+
var VERSION = "3.7.4";
|
|
22583
23349
|
|
|
22584
23350
|
export { VERSION, CesiumViewMonitor, ViewerUtils, MenuItemManager, EntityRenderEngine, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, Draw3dPolygon, Draw3dPolyline };
|
|
22585
23351
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|