bruce-cesium 2.1.6 → 2.1.7
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 +81 -8
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +80 -7
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine.js +3 -1
- package/dist/lib/rendering/entity-render-engine.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +37 -0
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/lib/utils/entity-utils.js +35 -1
- package/dist/lib/utils/entity-utils.js.map +1 -1
- package/package.json +1 -1
package/dist/bruce-cesium.umd.js
CHANGED
|
@@ -549,6 +549,34 @@
|
|
|
549
549
|
DrawingUtils.EnsurePosHeight = EnsurePosHeight;
|
|
550
550
|
})(exports.DrawingUtils || (exports.DrawingUtils = {}));
|
|
551
551
|
|
|
552
|
+
/**
|
|
553
|
+
* Returns if a given visual is alive and in the scene.
|
|
554
|
+
* @param viewer
|
|
555
|
+
* @param visual
|
|
556
|
+
* @returns
|
|
557
|
+
*/
|
|
558
|
+
function isAlive(viewer, visual) {
|
|
559
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
if (visual instanceof Cesium.Entity) {
|
|
563
|
+
return viewer.entities.contains(visual);
|
|
564
|
+
}
|
|
565
|
+
else if (visual instanceof Cesium.Primitive) {
|
|
566
|
+
return viewer.scene.primitives.contains(visual);
|
|
567
|
+
}
|
|
568
|
+
else if (visual instanceof Cesium.Cesium3DTileFeature) {
|
|
569
|
+
var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
570
|
+
if (!cTileset) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
return true;
|
|
577
|
+
}
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
552
580
|
function traverseEntity(cEntity, arr, ignoreParent) {
|
|
553
581
|
if (cEntity._parentEntity && !ignoreParent) {
|
|
554
582
|
traverseEntity(cEntity._parentEntity, arr, false);
|
|
@@ -597,6 +625,9 @@
|
|
|
597
625
|
}
|
|
598
626
|
}
|
|
599
627
|
function revertAppliedEntityOpacity(viewer, entity) {
|
|
628
|
+
if (!isAlive(viewer, entity)) {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
600
631
|
entity[NEW_OPACITY_KEY] = null;
|
|
601
632
|
if (entity instanceof Cesium.Entity) {
|
|
602
633
|
var processKey = function (graphicKey, materialKey) {
|
|
@@ -626,6 +657,9 @@
|
|
|
626
657
|
}
|
|
627
658
|
}
|
|
628
659
|
function applyOpacityToEntity(viewer, opacity, entity) {
|
|
660
|
+
if (!isAlive(viewer, entity)) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
629
663
|
entity[NEW_OPACITY_KEY] = opacity;
|
|
630
664
|
if (entity instanceof Cesium.Entity) {
|
|
631
665
|
var processKey = function (graphicKey, materialKey) {
|
|
@@ -665,7 +699,7 @@
|
|
|
665
699
|
}
|
|
666
700
|
}
|
|
667
701
|
function findOpacity(entity) {
|
|
668
|
-
return entity[NEW_OPACITY_KEY];
|
|
702
|
+
return entity ? entity[NEW_OPACITY_KEY] : null;
|
|
669
703
|
}
|
|
670
704
|
function GetValue(viewer, obj) {
|
|
671
705
|
if (obj === null || obj === void 0 ? void 0 : obj.getValue) {
|
|
@@ -1969,7 +2003,9 @@
|
|
|
1969
2003
|
})];
|
|
1970
2004
|
case 5:
|
|
1971
2005
|
cEntity = _d.sent();
|
|
1972
|
-
|
|
2006
|
+
if (cEntity) {
|
|
2007
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
|
|
2008
|
+
}
|
|
1973
2009
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1974
2010
|
_d.label = 6;
|
|
1975
2011
|
case 6:
|
|
@@ -3583,6 +3619,34 @@
|
|
|
3583
3619
|
})(Parabola = RelationRenderEngine.Parabola || (RelationRenderEngine.Parabola = {}));
|
|
3584
3620
|
})(RelationRenderEngine || (RelationRenderEngine = {}));
|
|
3585
3621
|
|
|
3622
|
+
/**
|
|
3623
|
+
* Returns if a given visual is alive and in the scene.
|
|
3624
|
+
* @param viewer
|
|
3625
|
+
* @param visual
|
|
3626
|
+
* @returns
|
|
3627
|
+
*/
|
|
3628
|
+
function isAlive$1(viewer, visual) {
|
|
3629
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
3630
|
+
return false;
|
|
3631
|
+
}
|
|
3632
|
+
if (visual instanceof Cesium.Entity) {
|
|
3633
|
+
return viewer.entities.contains(visual);
|
|
3634
|
+
}
|
|
3635
|
+
else if (visual instanceof Cesium.Primitive) {
|
|
3636
|
+
return viewer.scene.primitives.contains(visual);
|
|
3637
|
+
}
|
|
3638
|
+
else if (visual instanceof Cesium.Cesium3DTileFeature) {
|
|
3639
|
+
var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
3640
|
+
if (!cTileset) {
|
|
3641
|
+
return false;
|
|
3642
|
+
}
|
|
3643
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
3644
|
+
return false;
|
|
3645
|
+
}
|
|
3646
|
+
return true;
|
|
3647
|
+
}
|
|
3648
|
+
return false;
|
|
3649
|
+
}
|
|
3586
3650
|
function removeEntity(viewer, visual) {
|
|
3587
3651
|
unmarkEntity(visual, false);
|
|
3588
3652
|
if (visual instanceof Cesium.Entity) {
|
|
@@ -3623,6 +3687,9 @@
|
|
|
3623
3687
|
}
|
|
3624
3688
|
}
|
|
3625
3689
|
function updateEntityShow(viewer, visual, show) {
|
|
3690
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3691
|
+
return;
|
|
3692
|
+
}
|
|
3626
3693
|
if (visual instanceof Cesium.Entity) {
|
|
3627
3694
|
updateCEntityShow(viewer, visual, show, false);
|
|
3628
3695
|
}
|
|
@@ -3706,6 +3773,9 @@
|
|
|
3706
3773
|
var ORG_COLOR_KEY = "_org_color_";
|
|
3707
3774
|
function select(viewer, visual, color) {
|
|
3708
3775
|
var _a;
|
|
3776
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3777
|
+
return;
|
|
3778
|
+
}
|
|
3709
3779
|
if (!color) {
|
|
3710
3780
|
color = Cesium.Color.fromAlpha(Cesium.Color.YELLOW, 0.5);
|
|
3711
3781
|
}
|
|
@@ -3765,6 +3835,9 @@
|
|
|
3765
3835
|
}
|
|
3766
3836
|
}
|
|
3767
3837
|
function deselect(viewer, visual) {
|
|
3838
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3839
|
+
return;
|
|
3840
|
+
}
|
|
3768
3841
|
if (visual instanceof Cesium.Entity) {
|
|
3769
3842
|
var entities = exports.EntityUtils.GatherEntity({
|
|
3770
3843
|
entity: visual
|
|
@@ -4718,7 +4791,7 @@
|
|
|
4718
4791
|
* @param cTileset
|
|
4719
4792
|
* @returns
|
|
4720
4793
|
*/
|
|
4721
|
-
function isAlive(viewer, cTileset) {
|
|
4794
|
+
function isAlive$2(viewer, cTileset) {
|
|
4722
4795
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene)) {
|
|
4723
4796
|
return false;
|
|
4724
4797
|
}
|
|
@@ -4941,7 +5014,7 @@
|
|
|
4941
5014
|
cTileset_1.readyPromise.then(function () {
|
|
4942
5015
|
var _a, _b, _c, _d;
|
|
4943
5016
|
try {
|
|
4944
|
-
if (!isAlive(params.viewer, cTileset_1)) {
|
|
5017
|
+
if (!isAlive$2(params.viewer, cTileset_1)) {
|
|
4945
5018
|
return;
|
|
4946
5019
|
}
|
|
4947
5020
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset_1);
|
|
@@ -4990,7 +5063,7 @@
|
|
|
4990
5063
|
cTileset_2.readyPromise.then(function () {
|
|
4991
5064
|
var _a;
|
|
4992
5065
|
try {
|
|
4993
|
-
if (!isAlive(params.viewer, cTileset_2)) {
|
|
5066
|
+
if (!isAlive$2(params.viewer, cTileset_2)) {
|
|
4994
5067
|
return;
|
|
4995
5068
|
}
|
|
4996
5069
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset_2);
|
|
@@ -5068,7 +5141,7 @@
|
|
|
5068
5141
|
cTileset.readyPromise.then(function () {
|
|
5069
5142
|
var _a;
|
|
5070
5143
|
try {
|
|
5071
|
-
if (!isAlive(viewer, cTileset)) {
|
|
5144
|
+
if (!isAlive$2(viewer, cTileset)) {
|
|
5072
5145
|
return;
|
|
5073
5146
|
}
|
|
5074
5147
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset);
|
|
@@ -5554,7 +5627,7 @@
|
|
|
5554
5627
|
MemoryWatcher.prototype.clean = function () {
|
|
5555
5628
|
var _this = this;
|
|
5556
5629
|
// Remove all dead tilesets.
|
|
5557
|
-
this.watched = this.watched.filter(function (x) { return isAlive(_this.viewer, x); });
|
|
5630
|
+
this.watched = this.watched.filter(function (x) { return isAlive$2(_this.viewer, x); });
|
|
5558
5631
|
// Check if viewer is destroyed.
|
|
5559
5632
|
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
5560
5633
|
this.destroy();
|