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.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BruceEvent, Cartes, Carto, Entity as Entity$1, Geometry, Tileset, MathUtils, LRUCache, ZoomControl, Style, EntityTag, Calculator, EntityLod, EntityType, ClientFile, ObjectUtils, DelayQueue, BatchedDataGetter, EntityRelationType, EntityCoords, EntityFilterGetter, EntitySource, MenuItem, EntityRelation, ENVIRONMENT, ProjectView, ProjectViewBookmark, ProjectViewTile, ProjectViewLegacyTile, ProgramKey, Camera } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartesian2, Cartographic, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1,
|
|
3
|
+
import { Cartesian2, Cartographic, CallbackProperty, Cartesian3, Color, Rectangle, Math as Math$1, HeightReference, Entity, HorizontalOrigin, VerticalOrigin, ClassificationType, ArcType, PolygonHierarchy, ShadowMode, PolylineGraphics, HeadingPitchRoll, Transforms, ColorBlendMode, Primitive, Cesium3DTileFeature, HeadingPitchRange, SceneMode, Cesium3DTileColorBlendMode, Cesium3DTileStyle, createOsmBuildings, KmlDataSource, createWorldTerrain, EllipsoidTerrainProvider, CesiumTerrainProvider, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, UrlTemplateImageryProvider, TileMapServiceImageryProvider, IonImageryProvider, OrthographicFrustum, JulianDate, NearFarScalar, PolygonPipeline, CesiumInspector, EllipsoidGeodesic, sampleTerrainMostDetailed, Cesium3DTileset, Matrix4, Matrix3, IonResource, ColorMaterialProperty, EasingFunction, GeometryInstance } from 'cesium';
|
|
4
4
|
|
|
5
5
|
var TIME_LAG = 300;
|
|
6
6
|
var POSITION_CHECK_TIMER = 950;
|
|
@@ -549,6 +549,34 @@ var DrawingUtils;
|
|
|
549
549
|
DrawingUtils.EnsurePosHeight = EnsurePosHeight;
|
|
550
550
|
})(DrawingUtils || (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 Entity) {
|
|
563
|
+
return viewer.entities.contains(visual);
|
|
564
|
+
}
|
|
565
|
+
else if (visual instanceof Primitive) {
|
|
566
|
+
return viewer.scene.primitives.contains(visual);
|
|
567
|
+
}
|
|
568
|
+
else if (visual instanceof 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 @@ function applyOpacityToGraphic(viewer, entity, graphicKey, materialKey, opacity)
|
|
|
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 Entity) {
|
|
602
633
|
var processKey = function (graphicKey, materialKey) {
|
|
@@ -626,6 +657,9 @@ function revertAppliedEntityOpacity(viewer, entity) {
|
|
|
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 Entity) {
|
|
631
665
|
var processKey = function (graphicKey, materialKey) {
|
|
@@ -665,7 +699,7 @@ function applyOpacityToEntity(viewer, opacity, entity) {
|
|
|
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) {
|
|
@@ -1972,7 +2006,9 @@ var EntityRenderEngine;
|
|
|
1972
2006
|
})];
|
|
1973
2007
|
case 5:
|
|
1974
2008
|
cEntity = _d.sent();
|
|
1975
|
-
|
|
2009
|
+
if (cEntity) {
|
|
2010
|
+
cEntity._renderGroup = getRenderGroupId(zoomItem, (_c = params.viewer) === null || _c === void 0 ? void 0 : _c.terrainProvider);
|
|
2011
|
+
}
|
|
1976
2012
|
cEntities[entity.Bruce.ID] = cEntity;
|
|
1977
2013
|
_d.label = 6;
|
|
1978
2014
|
case 6:
|
|
@@ -3597,6 +3633,34 @@ var RelationRenderEngine;
|
|
|
3597
3633
|
})(Parabola = RelationRenderEngine.Parabola || (RelationRenderEngine.Parabola = {}));
|
|
3598
3634
|
})(RelationRenderEngine || (RelationRenderEngine = {}));
|
|
3599
3635
|
|
|
3636
|
+
/**
|
|
3637
|
+
* Returns if a given visual is alive and in the scene.
|
|
3638
|
+
* @param viewer
|
|
3639
|
+
* @param visual
|
|
3640
|
+
* @returns
|
|
3641
|
+
*/
|
|
3642
|
+
function isAlive$1(viewer, visual) {
|
|
3643
|
+
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene) || viewer.isDestroyed()) {
|
|
3644
|
+
return false;
|
|
3645
|
+
}
|
|
3646
|
+
if (visual instanceof Entity) {
|
|
3647
|
+
return viewer.entities.contains(visual);
|
|
3648
|
+
}
|
|
3649
|
+
else if (visual instanceof Primitive) {
|
|
3650
|
+
return viewer.scene.primitives.contains(visual);
|
|
3651
|
+
}
|
|
3652
|
+
else if (visual instanceof Cesium3DTileFeature) {
|
|
3653
|
+
var cTileset = visual === null || visual === void 0 ? void 0 : visual.tileset;
|
|
3654
|
+
if (!cTileset) {
|
|
3655
|
+
return false;
|
|
3656
|
+
}
|
|
3657
|
+
if (cTileset.isDestroyed() || !viewer.scene.primitives.contains(cTileset)) {
|
|
3658
|
+
return false;
|
|
3659
|
+
}
|
|
3660
|
+
return true;
|
|
3661
|
+
}
|
|
3662
|
+
return false;
|
|
3663
|
+
}
|
|
3600
3664
|
function removeEntity(viewer, visual) {
|
|
3601
3665
|
unmarkEntity(visual, false);
|
|
3602
3666
|
if (visual instanceof Entity) {
|
|
@@ -3637,6 +3701,9 @@ function updateCEntityShow(viewer, visual, show, ignoreParent) {
|
|
|
3637
3701
|
}
|
|
3638
3702
|
}
|
|
3639
3703
|
function updateEntityShow(viewer, visual, show) {
|
|
3704
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3640
3707
|
if (visual instanceof Entity) {
|
|
3641
3708
|
updateCEntityShow(viewer, visual, show, false);
|
|
3642
3709
|
}
|
|
@@ -3720,6 +3787,9 @@ function unmarkEntity(visual, ignoreParent) {
|
|
|
3720
3787
|
var ORG_COLOR_KEY = "_org_color_";
|
|
3721
3788
|
function select(viewer, visual, color) {
|
|
3722
3789
|
var _a;
|
|
3790
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3791
|
+
return;
|
|
3792
|
+
}
|
|
3723
3793
|
if (!color) {
|
|
3724
3794
|
color = Color.fromAlpha(Color.YELLOW, 0.5);
|
|
3725
3795
|
}
|
|
@@ -3779,6 +3849,9 @@ function select(viewer, visual, color) {
|
|
|
3779
3849
|
}
|
|
3780
3850
|
}
|
|
3781
3851
|
function deselect(viewer, visual) {
|
|
3852
|
+
if (!isAlive$1(viewer, visual)) {
|
|
3853
|
+
return;
|
|
3854
|
+
}
|
|
3782
3855
|
if (visual instanceof Entity) {
|
|
3783
3856
|
var entities = EntityUtils.GatherEntity({
|
|
3784
3857
|
entity: visual
|
|
@@ -4746,7 +4819,7 @@ function colorToCColor$2(color) {
|
|
|
4746
4819
|
* @param cTileset
|
|
4747
4820
|
* @returns
|
|
4748
4821
|
*/
|
|
4749
|
-
function isAlive(viewer, cTileset) {
|
|
4822
|
+
function isAlive$2(viewer, cTileset) {
|
|
4750
4823
|
if (!(viewer === null || viewer === void 0 ? void 0 : viewer.scene)) {
|
|
4751
4824
|
return false;
|
|
4752
4825
|
}
|
|
@@ -4970,7 +5043,7 @@ var TilesetRenderEngine;
|
|
|
4970
5043
|
cTileset_1.readyPromise.then(function () {
|
|
4971
5044
|
var _a, _b, _c, _d;
|
|
4972
5045
|
try {
|
|
4973
|
-
if (!isAlive(params.viewer, cTileset_1)) {
|
|
5046
|
+
if (!isAlive$2(params.viewer, cTileset_1)) {
|
|
4974
5047
|
return;
|
|
4975
5048
|
}
|
|
4976
5049
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset_1);
|
|
@@ -5019,7 +5092,7 @@ var TilesetRenderEngine;
|
|
|
5019
5092
|
cTileset_2.readyPromise.then(function () {
|
|
5020
5093
|
var _a;
|
|
5021
5094
|
try {
|
|
5022
|
-
if (!isAlive(params.viewer, cTileset_2)) {
|
|
5095
|
+
if (!isAlive$2(params.viewer, cTileset_2)) {
|
|
5023
5096
|
return;
|
|
5024
5097
|
}
|
|
5025
5098
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset_2);
|
|
@@ -5097,7 +5170,7 @@ var TilesetRenderEngine;
|
|
|
5097
5170
|
cTileset.readyPromise.then(function () {
|
|
5098
5171
|
var _a;
|
|
5099
5172
|
try {
|
|
5100
|
-
if (!isAlive(viewer, cTileset)) {
|
|
5173
|
+
if (!isAlive$2(viewer, cTileset)) {
|
|
5101
5174
|
return;
|
|
5102
5175
|
}
|
|
5103
5176
|
(_a = GetMemoryWatcher(params.viewer)) === null || _a === void 0 ? void 0 : _a.Watch(cTileset);
|
|
@@ -5583,7 +5656,7 @@ var TilesetRenderEngine;
|
|
|
5583
5656
|
MemoryWatcher.prototype.clean = function () {
|
|
5584
5657
|
var _this = this;
|
|
5585
5658
|
// Remove all dead tilesets.
|
|
5586
|
-
this.watched = this.watched.filter(function (x) { return isAlive(_this.viewer, x); });
|
|
5659
|
+
this.watched = this.watched.filter(function (x) { return isAlive$2(_this.viewer, x); });
|
|
5587
5660
|
// Check if viewer is destroyed.
|
|
5588
5661
|
if (!this.viewer || this.viewer.isDestroyed()) {
|
|
5589
5662
|
this.destroy();
|