bruce-cesium 3.0.2 → 3.0.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 +275 -42
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +274 -41
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/entity-render-engine.js +69 -1
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/menu-item-manager.js +2 -2
- package/dist/lib/rendering/menu-item-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/other/{old-relations-render-manager.js → legacy-relations-render-manager.js} +6 -6
- package/dist/lib/rendering/render-managers/other/legacy-relations-render-manager.js.map +1 -0
- package/dist/lib/rendering/view-render-engine.js.map +1 -1
- package/dist/lib/rendering/visual-register-culler.js +219 -34
- package/dist/lib/rendering/visual-register-culler.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/entity-render-engine.d.ts +1 -0
- package/dist/types/rendering/render-managers/other/{old-relations-render-manager.d.ts → legacy-relations-render-manager.d.ts} +3 -3
- package/package.json +2 -2
- package/dist/lib/rendering/render-managers/other/old-relations-render-manager.js.map +0 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -2585,6 +2585,8 @@
|
|
|
2585
2585
|
}
|
|
2586
2586
|
var _fileValidationCache = {};
|
|
2587
2587
|
var _fileHeightCache = {};
|
|
2588
|
+
// Key = url + scale.
|
|
2589
|
+
var _fileRadiusCache = new bruceModels.LRUCache(1000);
|
|
2588
2590
|
/**
|
|
2589
2591
|
* @param min
|
|
2590
2592
|
* @param max
|
|
@@ -2864,7 +2866,9 @@
|
|
|
2864
2866
|
case 4:
|
|
2865
2867
|
rendered = rendered.filter(function (x) { return x != null; });
|
|
2866
2868
|
if (rendered.length) {
|
|
2867
|
-
rootEntity_1 = new Cesium.Entity({
|
|
2869
|
+
rootEntity_1 = new Cesium.Entity({
|
|
2870
|
+
id: bruceModels.ObjectUtils.UId(10)
|
|
2871
|
+
});
|
|
2868
2872
|
rootEntity_1._siblingGraphics = [];
|
|
2869
2873
|
rootEntity_1._renderGroup = getRenderGroupId(zoomItem, (_h = params.viewer) === null || _h === void 0 ? void 0 : _h.terrainProvider);
|
|
2870
2874
|
rootEntity_1._siblingGraphics = rootEntity_1._siblingGraphics.concat(rendered);
|
|
@@ -3078,6 +3082,7 @@
|
|
|
3078
3082
|
if (iconScale > 0) {
|
|
3079
3083
|
heightRef = getHeightRef(style);
|
|
3080
3084
|
cEntity = new Cesium.Entity({
|
|
3085
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3081
3086
|
billboard: {
|
|
3082
3087
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
3083
3088
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
@@ -3126,6 +3131,7 @@
|
|
|
3126
3131
|
});
|
|
3127
3132
|
extrusion = getCylinderExtrusion(entity, params.tags, heightRef, style.CylinderFillExtrusion);
|
|
3128
3133
|
cEntity = new Cesium.Entity({
|
|
3134
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3129
3135
|
ellipse: {
|
|
3130
3136
|
semiMajorAxis: radius,
|
|
3131
3137
|
semiMinorAxis: radius,
|
|
@@ -3149,6 +3155,7 @@
|
|
|
3149
3155
|
outlineExtrusion.exHeightRef = extrusion.exHeightRef;
|
|
3150
3156
|
}
|
|
3151
3157
|
siblings.push(new Cesium.Entity({
|
|
3158
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3152
3159
|
ellipse: {
|
|
3153
3160
|
semiMajorAxis: radius + outlineWidth,
|
|
3154
3161
|
semiMinorAxis: radius + outlineWidth,
|
|
@@ -3179,6 +3186,7 @@
|
|
|
3179
3186
|
heightRef = getHeightRef(style);
|
|
3180
3187
|
circleBillboard = createCircleBillboard(size, cColor.toCssColorString());
|
|
3181
3188
|
cEntity = new Cesium.Entity({
|
|
3189
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3182
3190
|
// point: {
|
|
3183
3191
|
// pixelSize: size,
|
|
3184
3192
|
// color: cColor,
|
|
@@ -3357,6 +3365,7 @@
|
|
|
3357
3365
|
classification = Cesium.ClassificationType.BOTH;
|
|
3358
3366
|
}
|
|
3359
3367
|
var cEntity = new Cesium.Entity({
|
|
3368
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3360
3369
|
polyline: units == "px" ? {
|
|
3361
3370
|
positions: posses,
|
|
3362
3371
|
material: cColor,
|
|
@@ -3514,6 +3523,7 @@
|
|
|
3514
3523
|
classification = Cesium.ClassificationType.BOTH;
|
|
3515
3524
|
}
|
|
3516
3525
|
var cEntity = new Cesium.Entity({
|
|
3526
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3517
3527
|
polygon: {
|
|
3518
3528
|
hierarchy: new Cesium.PolygonHierarchy(posses, holePosses.map(function (x) { return new Cesium.PolygonHierarchy(x); })),
|
|
3519
3529
|
material: cFillColor,
|
|
@@ -3560,6 +3570,7 @@
|
|
|
3560
3570
|
borderPosses = posses.map(function (x) { return x.clone ? x.clone() : __assign({}, x); });
|
|
3561
3571
|
}
|
|
3562
3572
|
var cEntityBorder = new Cesium.Entity({
|
|
3573
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3563
3574
|
polyline: units == "px" ? new Cesium.PolylineGraphics({
|
|
3564
3575
|
positions: borderPosses,
|
|
3565
3576
|
material: cLineColor,
|
|
@@ -3591,6 +3602,7 @@
|
|
|
3591
3602
|
var posses_1 = holePosses[i];
|
|
3592
3603
|
bruceModels.Cartes.CloseRing3(posses_1);
|
|
3593
3604
|
var cEntityHole = new Cesium.Entity({
|
|
3605
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3594
3606
|
polyline: units == "px" ? new Cesium.PolylineGraphics({
|
|
3595
3607
|
positions: posses_1,
|
|
3596
3608
|
material: cLineColor,
|
|
@@ -3739,6 +3751,7 @@
|
|
|
3739
3751
|
}
|
|
3740
3752
|
}
|
|
3741
3753
|
var cEntity = new Cesium.Entity({
|
|
3754
|
+
id: bruceModels.ObjectUtils.UId(10),
|
|
3742
3755
|
model: {
|
|
3743
3756
|
uri: params.lodUrl,
|
|
3744
3757
|
heightReference: heightRef,
|
|
@@ -3753,6 +3766,61 @@
|
|
|
3753
3766
|
position: pos,
|
|
3754
3767
|
show: true
|
|
3755
3768
|
});
|
|
3769
|
+
var fileRadiusKey = "model3d_".concat(params.lodUrl, "_").concat(scale * styleScale, "_radius");
|
|
3770
|
+
var heightProm = _fileRadiusCache.Get(fileRadiusKey);
|
|
3771
|
+
if (!heightProm) {
|
|
3772
|
+
heightProm = new Promise(function (res) {
|
|
3773
|
+
try {
|
|
3774
|
+
// We'll have an async secondary model created for calculating boundaries.
|
|
3775
|
+
// Once calculated we remove it.
|
|
3776
|
+
var modelPrim_1 = Cesium.Model.fromGltf({
|
|
3777
|
+
url: params.lodUrl,
|
|
3778
|
+
asynchronous: true,
|
|
3779
|
+
scale: scale * styleScale
|
|
3780
|
+
});
|
|
3781
|
+
modelPrim_1.readyPromise.then(function (loaded) {
|
|
3782
|
+
var kill = function () {
|
|
3783
|
+
if (params.viewer && !params.viewer.isDestroyed() && params.viewer.scene.primitives.contains(modelPrim_1)) {
|
|
3784
|
+
params.viewer.scene.primitives.remove(modelPrim_1);
|
|
3785
|
+
}
|
|
3786
|
+
if (!modelPrim_1.isDestroyed()) {
|
|
3787
|
+
modelPrim_1.destroy();
|
|
3788
|
+
}
|
|
3789
|
+
};
|
|
3790
|
+
if (!cEntity || !(loaded === null || loaded === void 0 ? void 0 : loaded.boundingSphere)) {
|
|
3791
|
+
kill();
|
|
3792
|
+
res(null);
|
|
3793
|
+
return;
|
|
3794
|
+
}
|
|
3795
|
+
var radius = loaded.boundingSphere.radius;
|
|
3796
|
+
var centerOffset = loaded.boundingSphere.center;
|
|
3797
|
+
if (centerOffset) {
|
|
3798
|
+
// Add the center offset to the radius because I am not good at math.
|
|
3799
|
+
var magnitude = Cesium.Cartesian3.magnitude(centerOffset);
|
|
3800
|
+
radius += magnitude;
|
|
3801
|
+
// Extra padding if the model is super not centered.
|
|
3802
|
+
// I saw some strange boundaries for some bad models.
|
|
3803
|
+
if (magnitude > 100) {
|
|
3804
|
+
radius += 100;
|
|
3805
|
+
}
|
|
3806
|
+
}
|
|
3807
|
+
kill();
|
|
3808
|
+
res(radius);
|
|
3809
|
+
});
|
|
3810
|
+
params.viewer.scene.primitives.add(modelPrim_1);
|
|
3811
|
+
}
|
|
3812
|
+
catch (e) {
|
|
3813
|
+
console.error(e);
|
|
3814
|
+
res(null);
|
|
3815
|
+
}
|
|
3816
|
+
});
|
|
3817
|
+
_fileRadiusCache.Set(fileRadiusKey, heightProm);
|
|
3818
|
+
}
|
|
3819
|
+
heightProm.then(function (radius) {
|
|
3820
|
+
if (model) {
|
|
3821
|
+
model._radius = radius;
|
|
3822
|
+
}
|
|
3823
|
+
});
|
|
3756
3824
|
var model = cEntity.model;
|
|
3757
3825
|
model._clientFileId = params.lodClientFileId;
|
|
3758
3826
|
model._entityScale = {
|
|
@@ -5014,8 +5082,84 @@
|
|
|
5014
5082
|
EntityLabel.GetLabel = GetLabel;
|
|
5015
5083
|
})(exports.EntityLabel || (exports.EntityLabel = {}));
|
|
5016
5084
|
|
|
5017
|
-
|
|
5018
|
-
var
|
|
5085
|
+
var MODEL_MIN_RADIUS = 1;
|
|
5086
|
+
var POINT_MIN_RADIUS = 15;
|
|
5087
|
+
// If a shape has more than this amount of points, we'll avoid checking it because it will take too long.
|
|
5088
|
+
// We will put responsibility on the bookmark creator to view shapes they can see.
|
|
5089
|
+
var DO_NOT_CULL_AT_LEN_POINTS = 5000;
|
|
5090
|
+
// Returns terrain height at a given position.
|
|
5091
|
+
// This will cache the results based on the terrain provider and position.
|
|
5092
|
+
var _terrainCache = new bruceModels.LRUCache(1000);
|
|
5093
|
+
// Positions within this tolerance from each-other will be re-used.
|
|
5094
|
+
var TERRAIN_HEIGHT_TOLERANCE = 500;
|
|
5095
|
+
var getTerrainOffset = function (viewer, pos3d) {
|
|
5096
|
+
var terrain = exports.ViewUtils.GatherTerrainTile({
|
|
5097
|
+
viewer: viewer
|
|
5098
|
+
}).terrain;
|
|
5099
|
+
if (!terrain || terrain.tilesetId == bruceModels.ProjectViewTile.EDefaultTerrain.FlatTerrain) {
|
|
5100
|
+
return 0;
|
|
5101
|
+
}
|
|
5102
|
+
var terrainId = terrain.tilesetId;
|
|
5103
|
+
// Check for existing values within TOLERANCE distance.
|
|
5104
|
+
var keys = Array.from(_terrainCache.Entries());
|
|
5105
|
+
for (var i = 0; i < keys.length; i++) {
|
|
5106
|
+
var _a = keys[i], key_1 = _a[0], offset_1 = _a[1];
|
|
5107
|
+
var _b = key_1.split("_"), terrainId2 = _b[0], x = _b[1], y = _b[2], z = _b[3];
|
|
5108
|
+
if (terrainId2 != terrainId) {
|
|
5109
|
+
continue;
|
|
5110
|
+
}
|
|
5111
|
+
var pos3d2 = new Cesium.Cartesian3(parseFloat(x), parseFloat(y), parseFloat(z));
|
|
5112
|
+
var distance = Cesium.Cartesian3.distance(pos3d, pos3d2);
|
|
5113
|
+
if (distance < TERRAIN_HEIGHT_TOLERANCE) {
|
|
5114
|
+
return offset_1;
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
var key = terrainId + "_" + pos3d.x + "_" + pos3d.y + "_" + pos3d.z;
|
|
5118
|
+
var offset = _terrainCache.Get(key);
|
|
5119
|
+
if (offset == null) {
|
|
5120
|
+
var carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
5121
|
+
var height = 0;
|
|
5122
|
+
try {
|
|
5123
|
+
height = viewer.scene.globe.getHeight(carto);
|
|
5124
|
+
}
|
|
5125
|
+
catch (e) {
|
|
5126
|
+
// Likely out of rendered area.
|
|
5127
|
+
// This means it's not our problem since the user isn't looking there :)
|
|
5128
|
+
}
|
|
5129
|
+
offset = height;
|
|
5130
|
+
_terrainCache.Set(key, offset);
|
|
5131
|
+
}
|
|
5132
|
+
return offset;
|
|
5133
|
+
};
|
|
5134
|
+
/**
|
|
5135
|
+
* Converts given pos3d into a an absolute position.
|
|
5136
|
+
* This means either setting it to terrain height or adding the height offset.
|
|
5137
|
+
* @param viewer
|
|
5138
|
+
* @param heightRef
|
|
5139
|
+
* @param pos3d
|
|
5140
|
+
* @returns
|
|
5141
|
+
*/
|
|
5142
|
+
var adjustPos3d = function (viewer, heightRef, pos3d) {
|
|
5143
|
+
if (heightRef == Cesium.HeightReference.NONE) {
|
|
5144
|
+
return pos3d;
|
|
5145
|
+
}
|
|
5146
|
+
var offset = getTerrainOffset(viewer, pos3d);
|
|
5147
|
+
if (!offset) {
|
|
5148
|
+
return pos3d;
|
|
5149
|
+
}
|
|
5150
|
+
var carto = Cesium.Cartographic.fromCartesian(pos3d);
|
|
5151
|
+
if (heightRef == Cesium.HeightReference.CLAMP_TO_GROUND) {
|
|
5152
|
+
carto.height = offset;
|
|
5153
|
+
}
|
|
5154
|
+
else {
|
|
5155
|
+
carto.height += offset;
|
|
5156
|
+
}
|
|
5157
|
+
var newPos3d = Cesium.Cartographic.toCartesian(carto);
|
|
5158
|
+
if (!(newPos3d === null || newPos3d === void 0 ? void 0 : newPos3d.x)) {
|
|
5159
|
+
return pos3d;
|
|
5160
|
+
}
|
|
5161
|
+
return newPos3d;
|
|
5162
|
+
};
|
|
5019
5163
|
function getValue$2(viewer, obj) {
|
|
5020
5164
|
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
5021
5165
|
return obj.getValue(viewer.scene.lastRenderTime);
|
|
@@ -5031,7 +5175,7 @@
|
|
|
5031
5175
|
viewer: viewer
|
|
5032
5176
|
}).terrain) === null || _a === void 0 ? void 0 : _a.tilesetId) == bruceModels.ProjectViewTile.EDefaultTerrain.FlatTerrain;
|
|
5033
5177
|
}
|
|
5034
|
-
var boundingSphereCache =
|
|
5178
|
+
var boundingSphereCache = new bruceModels.LRUCache(100000);
|
|
5035
5179
|
function getPositionsFromEntity(viewer, entity) {
|
|
5036
5180
|
var positions = [];
|
|
5037
5181
|
var heightRef;
|
|
@@ -5040,59 +5184,94 @@
|
|
|
5040
5184
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5041
5185
|
return null;
|
|
5042
5186
|
}
|
|
5043
|
-
positions.push(pos3d);
|
|
5044
5187
|
heightRef = getValue$2(viewer, entity.billboard.heightReference);
|
|
5188
|
+
pos3d = adjustPos3d(viewer, heightRef, pos3d);
|
|
5189
|
+
positions.push(pos3d);
|
|
5045
5190
|
}
|
|
5046
5191
|
else if (entity.polyline) {
|
|
5047
|
-
|
|
5192
|
+
var posses = getValue$2(viewer, entity.polyline.positions);
|
|
5193
|
+
if (!(posses === null || posses === void 0 ? void 0 : posses.length) || posses.length >= DO_NOT_CULL_AT_LEN_POINTS) {
|
|
5194
|
+
return null;
|
|
5195
|
+
}
|
|
5196
|
+
// Get the first, last, and every forth point.
|
|
5197
|
+
// This is to reduce the amount of points we need to check.
|
|
5198
|
+
if (posses.length > 10) {
|
|
5199
|
+
var first = posses[0];
|
|
5200
|
+
var last = posses[posses.length - 1];
|
|
5201
|
+
var everyForth = posses.filter(function (_, index) { return index % 4 == 0; });
|
|
5202
|
+
posses = [first, last].concat(everyForth);
|
|
5203
|
+
}
|
|
5048
5204
|
heightRef = getValue$2(viewer, entity.polyline.clampToGround) == false ? Cesium.HeightReference.NONE : Cesium.HeightReference.CLAMP_TO_GROUND;
|
|
5205
|
+
for (var i = 0; i < posses.length; i++) {
|
|
5206
|
+
var pos3d = adjustPos3d(viewer, heightRef, posses[i]);
|
|
5207
|
+
positions.push(pos3d);
|
|
5208
|
+
}
|
|
5049
5209
|
}
|
|
5050
5210
|
else if (entity.polygon) {
|
|
5051
5211
|
var hierarchy = getValue$2(viewer, entity.polygon.hierarchy);
|
|
5052
|
-
|
|
5212
|
+
var posses = hierarchy.positions;
|
|
5213
|
+
if (!(posses === null || posses === void 0 ? void 0 : posses.length) || posses.length >= DO_NOT_CULL_AT_LEN_POINTS) {
|
|
5214
|
+
return null;
|
|
5215
|
+
}
|
|
5216
|
+
// Get the first, last, and every forth point.
|
|
5217
|
+
// This is to reduce the amount of points we need to check.
|
|
5218
|
+
if (posses.length > 10) {
|
|
5219
|
+
var first = posses[0];
|
|
5220
|
+
var last = posses[posses.length - 1];
|
|
5221
|
+
var everyForth = posses.filter(function (_, index) { return index % 4 == 0; });
|
|
5222
|
+
posses = [first, last].concat(everyForth);
|
|
5223
|
+
}
|
|
5053
5224
|
heightRef = getValue$2(viewer, entity.polygon.heightReference);
|
|
5225
|
+
for (var i = 0; i < posses.length; i++) {
|
|
5226
|
+
var pos3d = adjustPos3d(viewer, heightRef, posses[i]);
|
|
5227
|
+
positions.push(pos3d);
|
|
5228
|
+
}
|
|
5054
5229
|
}
|
|
5055
5230
|
else if (entity.corridor) {
|
|
5056
|
-
|
|
5231
|
+
var posses = getValue$2(viewer, entity.corridor.positions);
|
|
5232
|
+
if (!(posses === null || posses === void 0 ? void 0 : posses.length) || posses.length >= DO_NOT_CULL_AT_LEN_POINTS) {
|
|
5233
|
+
return null;
|
|
5234
|
+
}
|
|
5235
|
+
// Get the first, last, and every forth point.
|
|
5236
|
+
// This is to reduce the amount of points we need to check.
|
|
5237
|
+
if (posses.length > 10) {
|
|
5238
|
+
var first = posses[0];
|
|
5239
|
+
var last = posses[posses.length - 1];
|
|
5240
|
+
var everyForth = posses.filter(function (_, index) { return index % 4 == 0; });
|
|
5241
|
+
posses = [first, last].concat(everyForth);
|
|
5242
|
+
}
|
|
5243
|
+
heightRef = getValue$2(viewer, entity.corridor.heightReference);
|
|
5244
|
+
for (var i = 0; i < posses.length; i++) {
|
|
5245
|
+
var pos3d = adjustPos3d(viewer, heightRef, posses[i]);
|
|
5246
|
+
positions.push(pos3d);
|
|
5247
|
+
}
|
|
5057
5248
|
}
|
|
5058
5249
|
else if (entity.ellipse) {
|
|
5059
|
-
var
|
|
5060
|
-
if (!(
|
|
5250
|
+
var pos3d = getValue$2(viewer, entity.position);
|
|
5251
|
+
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5061
5252
|
return null;
|
|
5062
5253
|
}
|
|
5063
5254
|
heightRef = getValue$2(viewer, entity.ellipse.heightReference);
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
var rotation = getValue$2(viewer, entity.ellipse.rotation);
|
|
5067
|
-
// More subdivisions means a more accurate ellipse but worse performance.
|
|
5068
|
-
var numberOfSubdivisions = 5;
|
|
5069
|
-
for (var i = 0; i < numberOfSubdivisions; i++) {
|
|
5070
|
-
var theta = i * (2 * Math.PI / numberOfSubdivisions);
|
|
5071
|
-
var x = semiMajorAxis * Math.cos(theta);
|
|
5072
|
-
var y = semiMinorAxis * Math.sin(theta);
|
|
5073
|
-
// Apply rotation.
|
|
5074
|
-
var rotatedX = x * Math.cos(rotation) - y * Math.sin(rotation);
|
|
5075
|
-
var rotatedY = x * Math.sin(rotation) + y * Math.cos(rotation);
|
|
5076
|
-
// Translate by the ellipse's position.
|
|
5077
|
-
var point = new Cesium.Cartesian3(position.x + rotatedX, position.y + rotatedY, position.z);
|
|
5078
|
-
positions.push(point);
|
|
5079
|
-
}
|
|
5255
|
+
pos3d = adjustPos3d(viewer, heightRef, pos3d);
|
|
5256
|
+
positions.push(pos3d);
|
|
5080
5257
|
}
|
|
5081
5258
|
else if (entity.model) {
|
|
5082
5259
|
var pos3d = getValue$2(viewer, entity.position);
|
|
5083
5260
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5084
5261
|
return null;
|
|
5085
5262
|
}
|
|
5086
|
-
positions.push(pos3d);
|
|
5087
5263
|
heightRef = getValue$2(viewer, entity.model.heightReference);
|
|
5264
|
+
pos3d = adjustPos3d(viewer, heightRef, pos3d);
|
|
5265
|
+
positions.push(pos3d);
|
|
5088
5266
|
}
|
|
5089
5267
|
else if (entity.point) {
|
|
5090
5268
|
var pos3d = getValue$2(viewer, entity.position);
|
|
5091
5269
|
if (!(pos3d === null || pos3d === void 0 ? void 0 : pos3d.x)) {
|
|
5092
5270
|
return null;
|
|
5093
5271
|
}
|
|
5094
|
-
positions.push(pos3d);
|
|
5095
5272
|
heightRef = getValue$2(viewer, entity.point.heightReference);
|
|
5273
|
+
pos3d = adjustPos3d(viewer, heightRef, pos3d);
|
|
5274
|
+
positions.push(pos3d);
|
|
5096
5275
|
}
|
|
5097
5276
|
if (!(positions === null || positions === void 0 ? void 0 : positions.length)) {
|
|
5098
5277
|
return;
|
|
@@ -5112,27 +5291,81 @@
|
|
|
5112
5291
|
return Cesium.BoundingSphere.fromPoints(positions);
|
|
5113
5292
|
}
|
|
5114
5293
|
function shouldCullEntity(viewer, cEntity) {
|
|
5294
|
+
var _a, _b;
|
|
5115
5295
|
var camera = viewer.scene.camera;
|
|
5116
5296
|
var boundingSphere;
|
|
5117
|
-
|
|
5118
|
-
|
|
5297
|
+
var terrainId = (_b = (_a = exports.ViewUtils.GatherTerrainTile({
|
|
5298
|
+
viewer: viewer
|
|
5299
|
+
}).terrain) === null || _a === void 0 ? void 0 : _a.tilesetId) !== null && _b !== void 0 ? _b : bruceModels.ProjectViewTile.EDefaultTerrain.FlatTerrain;
|
|
5300
|
+
var cullSphere;
|
|
5301
|
+
var cacheKey = terrainId + cEntity.id;
|
|
5302
|
+
var cacheData = boundingSphereCache.Get(cacheKey);
|
|
5303
|
+
if (cacheData) {
|
|
5304
|
+
boundingSphere = cacheData;
|
|
5119
5305
|
}
|
|
5120
5306
|
else {
|
|
5121
5307
|
var positions = getPositionsFromEntity(viewer, cEntity);
|
|
5122
5308
|
if (positions) {
|
|
5123
5309
|
boundingSphere = computeBoundingSphereFromPositions(positions);
|
|
5124
5310
|
if (cEntity.model) {
|
|
5125
|
-
|
|
5126
|
-
|
|
5311
|
+
var model = cEntity.model;
|
|
5312
|
+
if (model._radius && !isNaN(model._radius)) {
|
|
5313
|
+
boundingSphere.radius = Math.max(model._radius, MODEL_MIN_RADIUS);
|
|
5314
|
+
}
|
|
5315
|
+
else {
|
|
5316
|
+
// Unknown size. Ignoring.
|
|
5317
|
+
boundingSphere = -1;
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
// Check for radius and extrusion.
|
|
5321
|
+
else if (cEntity.ellipse) {
|
|
5322
|
+
var radius = getValue$2(viewer, cEntity.ellipse.semiMajorAxis);
|
|
5323
|
+
var extrusion = getValue$2(viewer, cEntity.ellipse.extrudedHeight);
|
|
5324
|
+
if (extrusion && !isNaN(extrusion)) {
|
|
5325
|
+
if (!radius) {
|
|
5326
|
+
radius = extrusion;
|
|
5327
|
+
}
|
|
5328
|
+
else if (extrusion > radius / 2) {
|
|
5329
|
+
radius = extrusion;
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
if (radius && !isNaN(radius)) {
|
|
5333
|
+
boundingSphere.radius = radius;
|
|
5334
|
+
}
|
|
5335
|
+
}
|
|
5336
|
+
// Check for extrusion.
|
|
5337
|
+
else if (cEntity.polygon) {
|
|
5338
|
+
var extrusion = getValue$2(viewer, cEntity.polygon.extrudedHeight);
|
|
5339
|
+
if (extrusion && !isNaN(extrusion)) {
|
|
5340
|
+
if (!boundingSphere.radius) {
|
|
5341
|
+
boundingSphere.radius = extrusion;
|
|
5342
|
+
}
|
|
5343
|
+
else if (extrusion > boundingSphere.radius / 2) {
|
|
5344
|
+
boundingSphere.radius = extrusion;
|
|
5345
|
+
}
|
|
5346
|
+
}
|
|
5127
5347
|
}
|
|
5128
|
-
|
|
5348
|
+
else if (cEntity.point || cEntity.billboard) {
|
|
5349
|
+
boundingSphere.radius = Math.max(boundingSphere.radius, POINT_MIN_RADIUS);
|
|
5350
|
+
}
|
|
5351
|
+
boundingSphereCache.Set(cacheKey, boundingSphere);
|
|
5352
|
+
}
|
|
5353
|
+
else {
|
|
5354
|
+
boundingSphereCache.Set(cacheKey, -1);
|
|
5129
5355
|
}
|
|
5130
5356
|
}
|
|
5131
|
-
if (!boundingSphere) {
|
|
5357
|
+
if (!boundingSphere || boundingSphere == -1) {
|
|
5132
5358
|
return false;
|
|
5133
5359
|
}
|
|
5134
5360
|
var cullingVolume = camera.frustum.computeCullingVolume(camera.position, camera.direction, camera.up);
|
|
5135
5361
|
var visibility = cullingVolume.computeVisibility(boundingSphere);
|
|
5362
|
+
if (cullSphere) {
|
|
5363
|
+
cullSphere.ellipsoid.material =
|
|
5364
|
+
(visibility == Cesium.Intersect.INSIDE ||
|
|
5365
|
+
visibility == Cesium.Intersect.INTERSECTING) ? Cesium.Color.GREEN.withAlpha(0.1) :
|
|
5366
|
+
Cesium.Color.RED.withAlpha(0.1);
|
|
5367
|
+
viewer.scene.requestRender();
|
|
5368
|
+
}
|
|
5136
5369
|
return visibility !== Cesium.Intersect.INSIDE && visibility !== Cesium.Intersect.INTERSECTING;
|
|
5137
5370
|
}
|
|
5138
5371
|
// Amount of entities to check per interval.
|
|
@@ -5197,7 +5430,7 @@
|
|
|
5197
5430
|
var rego = register.GetRego({
|
|
5198
5431
|
entityId: entityId
|
|
5199
5432
|
});
|
|
5200
|
-
if (!rego || !rego.visual || !(rego.visual instanceof Cesium.Entity)) {
|
|
5433
|
+
if (!rego || !rego.visual || !(rego.visual instanceof Cesium.Entity) || rego.relation != null) {
|
|
5201
5434
|
continue;
|
|
5202
5435
|
}
|
|
5203
5436
|
var parts = exports.EntityUtils.GatherEntity({
|
|
@@ -11990,8 +12223,8 @@
|
|
|
11990
12223
|
* Deprecated relations render manager.
|
|
11991
12224
|
* This follows original navigator logic that renders both up/downstream relationships and ALL relationship types.
|
|
11992
12225
|
*/
|
|
11993
|
-
var
|
|
11994
|
-
(function (
|
|
12226
|
+
var LegacyRelationsRenderManager;
|
|
12227
|
+
(function (LegacyRelationsRenderManager) {
|
|
11995
12228
|
var Manager = /** @class */ (function () {
|
|
11996
12229
|
function Manager(params) {
|
|
11997
12230
|
// If true, this menu item is disposed and should not be used.
|
|
@@ -12292,8 +12525,8 @@
|
|
|
12292
12525
|
};
|
|
12293
12526
|
return Manager;
|
|
12294
12527
|
}());
|
|
12295
|
-
|
|
12296
|
-
})(
|
|
12528
|
+
LegacyRelationsRenderManager.Manager = Manager;
|
|
12529
|
+
})(LegacyRelationsRenderManager || (LegacyRelationsRenderManager = {}));
|
|
12297
12530
|
|
|
12298
12531
|
(function (MenuItemManager) {
|
|
12299
12532
|
var Manager = /** @class */ (function () {
|
|
@@ -12541,7 +12774,7 @@
|
|
|
12541
12774
|
// Deprecated to support a few demos until new one is phased in.
|
|
12542
12775
|
// Use Relationships instead.
|
|
12543
12776
|
case bruceModels.MenuItem.EType.Relations:
|
|
12544
|
-
rItem.renderManager = new
|
|
12777
|
+
rItem.renderManager = new LegacyRelationsRenderManager.Manager({
|
|
12545
12778
|
apiGetter: params.apiGetter,
|
|
12546
12779
|
item: params.item,
|
|
12547
12780
|
register: this.visualsRegister,
|
|
@@ -18152,7 +18385,7 @@
|
|
|
18152
18385
|
ViewerUtils.CreateWidgets = CreateWidgets;
|
|
18153
18386
|
})(exports.ViewerUtils || (exports.ViewerUtils = {}));
|
|
18154
18387
|
|
|
18155
|
-
var VERSION$1 = "3.0.
|
|
18388
|
+
var VERSION$1 = "3.0.4";
|
|
18156
18389
|
|
|
18157
18390
|
exports.VERSION = VERSION$1;
|
|
18158
18391
|
exports.CesiumParabola = CesiumParabola;
|