bruce-cesium 5.8.4 → 5.8.5
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 +496 -13
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +494 -11
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +1 -1
- package/dist/lib/rendering/render-managers/other/assembly-render-manager.js +208 -0
- package/dist/lib/rendering/render-managers/other/assembly-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js +250 -9
- package/dist/lib/rendering/render-managers/tilesets/tileset-cad-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +35 -0
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +1 -1
- package/dist/types/rendering/render-managers/other/assembly-render-manager.d.ts +60 -0
- package/dist/types/rendering/render-managers/tilesets/tileset-cad-render-manager.d.ts +55 -0
- package/dist/types/rendering/visuals-register.d.ts +18 -0
- package/package.json +1 -1
package/dist/bruce-cesium.es5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource,
|
|
1
|
+
import { BruceEvent, Cartes, Entity as Entity$1, ProjectViewTile, Carto, Geometry, MathUtils, LRUCache, Api, Calculator, ClientFile, EntityTag, EntityType, ObjectUtils, Style, DelayQueue, EntityLod, Bounds, ZoomControl, EntityRelationType, ENVIRONMENT, MenuItem, EntityHistoricData, Tileset, EntityCoords, DataLab, EntitySource, EntityRelation, ProgramKey, ProjectView, ProjectViewBookmark, Camera, ProjectViewLegacyTile, EntityAttachment, EntityAttachmentType, EntityAttribute, AbstractApi, Session } from 'bruce-models';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
|
-
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty,
|
|
3
|
+
import { Cartographic, Cartesian2, Math as Math$1, Cartesian3, CallbackProperty, Color, HeightReference, Rectangle, JulianDate, Entity, DistanceDisplayCondition, ClassificationType, ArcType, CornerType, ShadowMode, ConstantProperty, ConstantPositionProperty, HorizontalOrigin, VerticalOrigin, PolygonHierarchy, PolylineGraphics, ColorMaterialProperty, ColorBlendMode, HeadingPitchRoll, Transforms, Model, SceneMode, Primitive, Cesium3DTileFeature, GeoJsonDataSource, Cesium3DTileStyle, HeadingPitchRange, Ion, Cesium3DTileColorBlendMode, KmlDataSource, Quaternion, Matrix3, Matrix4, SceneTransforms, OrthographicFrustum, EasingFunction, NearFarScalar, EllipsoidTerrainProvider, IonImageryProvider, createWorldImagery, createWorldImageryAsync, BingMapsImageryProvider, BingMapsStyle, MapboxImageryProvider, MapboxStyleImageryProvider, ArcGisMapServerImageryProvider, OpenStreetMapImageryProvider, UrlTemplateImageryProvider, GridImageryProvider, GeographicTilingScheme, ImageryLayer, TileMapServiceImageryProvider, CesiumTerrainProvider, IonResource, Cesium3DTileset, CesiumInspector, defined, ClockRange, EllipsoidGeodesic, sampleTerrainMostDetailed, PolygonPipeline, BoundingSphere, GeometryInstance, ModelGraphics, PolygonGraphics, CorridorGraphics, PointGraphics, BillboardGraphics, EllipseGraphics, PolylineDashMaterialProperty, ScreenSpaceEventHandler, ScreenSpaceEventType, CzmlDataSource, Intersect, Fullscreen } from 'cesium';
|
|
4
4
|
|
|
5
5
|
const TIME_LAG = 300;
|
|
6
6
|
const POSITION_CHECK_TIMER = 950;
|
|
@@ -12274,6 +12274,41 @@ var VisualsRegister;
|
|
|
12274
12274
|
}
|
|
12275
12275
|
return map;
|
|
12276
12276
|
}
|
|
12277
|
+
/**
|
|
12278
|
+
* Gets hierarchy information for a given entity from any render manager.
|
|
12279
|
+
* This is a utility method to get parent/child relationships.
|
|
12280
|
+
* @param entityId The entity ID to get hierarchy info for
|
|
12281
|
+
* @param menuItemId The menu item ID (optional)
|
|
12282
|
+
* @returns Hierarchy information or null if not found
|
|
12283
|
+
*/
|
|
12284
|
+
getHierarchyInfo(entityId, menuItemId) {
|
|
12285
|
+
// Try to find the render manager for this entity
|
|
12286
|
+
const rego = this.GetRego({ entityId, menuItemId });
|
|
12287
|
+
if (!rego) {
|
|
12288
|
+
return null;
|
|
12289
|
+
}
|
|
12290
|
+
// Check if it's a CAD tileset
|
|
12291
|
+
if (rego.tilesetType === "CAD") {
|
|
12292
|
+
// This would need to be implemented in the CAD render manager
|
|
12293
|
+
// For now, return basic info
|
|
12294
|
+
return {
|
|
12295
|
+
parentId: undefined,
|
|
12296
|
+
children: [],
|
|
12297
|
+
path: [entityId]
|
|
12298
|
+
};
|
|
12299
|
+
}
|
|
12300
|
+
// Check if it's an Assembly
|
|
12301
|
+
if (rego.menuItemType === MenuItem.EType.Assembly) {
|
|
12302
|
+
// This would need to be implemented in the Assembly render manager
|
|
12303
|
+
// For now, return basic info
|
|
12304
|
+
return {
|
|
12305
|
+
parentId: undefined,
|
|
12306
|
+
children: [],
|
|
12307
|
+
path: [entityId]
|
|
12308
|
+
};
|
|
12309
|
+
}
|
|
12310
|
+
return null;
|
|
12311
|
+
}
|
|
12277
12312
|
}
|
|
12278
12313
|
VisualsRegister.Register = Register;
|
|
12279
12314
|
})(VisualsRegister || (VisualsRegister = {}));
|
|
@@ -18500,7 +18535,11 @@ var TilesetCadRenderManager;
|
|
|
18500
18535
|
buildModelTreeNodes(modelTree) {
|
|
18501
18536
|
this.treeNodeByGeomId = {};
|
|
18502
18537
|
this.treeNodeByEntityId = {};
|
|
18503
|
-
const
|
|
18538
|
+
const stack = [
|
|
18539
|
+
{ node: modelTree, parentId: null, firstFoundCollapsedBranch: null }
|
|
18540
|
+
];
|
|
18541
|
+
while (stack.length > 0) {
|
|
18542
|
+
const { node, parentId, firstFoundCollapsedBranch } = stack.pop();
|
|
18504
18543
|
if (firstFoundCollapsedBranch) {
|
|
18505
18544
|
this.treeNodeByGeomId[node.geomId] = firstFoundCollapsedBranch;
|
|
18506
18545
|
this.treeNodeByEntityId[node.id] = firstFoundCollapsedBranch;
|
|
@@ -18510,21 +18549,27 @@ var TilesetCadRenderManager;
|
|
|
18510
18549
|
entityId: node.id,
|
|
18511
18550
|
typeId: node.typeId,
|
|
18512
18551
|
name: node.name,
|
|
18513
|
-
geomId: node.geomId
|
|
18552
|
+
geomId: node.geomId,
|
|
18553
|
+
parentId: parentId
|
|
18514
18554
|
};
|
|
18515
18555
|
this.treeNodeByGeomId[node.geomId] = cache;
|
|
18516
18556
|
this.treeNodeByEntityId[node.id] = cache;
|
|
18557
|
+
let newFirstFoundCollapsedBranch = firstFoundCollapsedBranch;
|
|
18517
18558
|
if (!firstFoundCollapsedBranch && node.collapsed) {
|
|
18518
|
-
|
|
18519
|
-
}
|
|
18520
|
-
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18559
|
+
newFirstFoundCollapsedBranch = cache;
|
|
18560
|
+
}
|
|
18561
|
+
// Push children to stack in reverse order to maintain correct traversal
|
|
18562
|
+
if (node.children) {
|
|
18563
|
+
for (let i = node.children.length - 1; i >= 0; i--) {
|
|
18564
|
+
stack.push({
|
|
18565
|
+
node: node.children[i],
|
|
18566
|
+
parentId: node.id,
|
|
18567
|
+
firstFoundCollapsedBranch: newFirstFoundCollapsedBranch
|
|
18568
|
+
});
|
|
18569
|
+
}
|
|
18524
18570
|
}
|
|
18525
18571
|
}
|
|
18526
|
-
}
|
|
18527
|
-
recurse(modelTree, null);
|
|
18572
|
+
}
|
|
18528
18573
|
}
|
|
18529
18574
|
getEntityTypeByPath(path) {
|
|
18530
18575
|
var _a, _b;
|
|
@@ -18543,6 +18588,236 @@ var TilesetCadRenderManager;
|
|
|
18543
18588
|
const node = this.treeNodeByEntityId[entityId] || null;
|
|
18544
18589
|
return node ? node.typeId : null;
|
|
18545
18590
|
}
|
|
18591
|
+
/**
|
|
18592
|
+
* Gets the parent node of a given entity.
|
|
18593
|
+
* @param entityId The entity ID to find the parent for
|
|
18594
|
+
* @returns The parent node or null if no parent exists
|
|
18595
|
+
*/
|
|
18596
|
+
getParentNode(entityId) {
|
|
18597
|
+
var _a, _b;
|
|
18598
|
+
if (this.treeNodeByEntityId == null) {
|
|
18599
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18600
|
+
if (!modelTree) {
|
|
18601
|
+
modelTree = this.modelTree;
|
|
18602
|
+
}
|
|
18603
|
+
if (!modelTree) {
|
|
18604
|
+
return null;
|
|
18605
|
+
}
|
|
18606
|
+
this.buildModelTreeNodes(modelTree);
|
|
18607
|
+
}
|
|
18608
|
+
const node = this.treeNodeByEntityId[entityId];
|
|
18609
|
+
if (node === null || node === void 0 ? void 0 : node.parentId) {
|
|
18610
|
+
return this.treeNodeByEntityId[node.parentId] || null;
|
|
18611
|
+
}
|
|
18612
|
+
return null;
|
|
18613
|
+
}
|
|
18614
|
+
/**
|
|
18615
|
+
* Gets all child nodes of a given entity.
|
|
18616
|
+
* @param entityId The entity ID to find children for
|
|
18617
|
+
* @returns Array of child nodes
|
|
18618
|
+
*/
|
|
18619
|
+
getChildNodes(entityId) {
|
|
18620
|
+
var _a, _b;
|
|
18621
|
+
if (this.treeNodeByEntityId == null) {
|
|
18622
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18623
|
+
if (!modelTree) {
|
|
18624
|
+
modelTree = this.modelTree;
|
|
18625
|
+
}
|
|
18626
|
+
if (!modelTree) {
|
|
18627
|
+
return [];
|
|
18628
|
+
}
|
|
18629
|
+
this.buildModelTreeNodes(modelTree);
|
|
18630
|
+
}
|
|
18631
|
+
const children = [];
|
|
18632
|
+
for (const nodeId in this.treeNodeByEntityId) {
|
|
18633
|
+
const node = this.treeNodeByEntityId[nodeId];
|
|
18634
|
+
if (node.parentId === entityId) {
|
|
18635
|
+
children.push(node);
|
|
18636
|
+
}
|
|
18637
|
+
}
|
|
18638
|
+
return children;
|
|
18639
|
+
}
|
|
18640
|
+
/**
|
|
18641
|
+
* Gets all descendant nodes of a given entity (children, grandchildren, etc.).
|
|
18642
|
+
* @param entityId The entity ID to find descendants for
|
|
18643
|
+
* @returns Array of descendant nodes
|
|
18644
|
+
*/
|
|
18645
|
+
getDescendantNodes(entityId) {
|
|
18646
|
+
var _a, _b;
|
|
18647
|
+
if (this.treeNodeByEntityId == null) {
|
|
18648
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18649
|
+
if (!modelTree) {
|
|
18650
|
+
modelTree = this.modelTree;
|
|
18651
|
+
}
|
|
18652
|
+
if (!modelTree) {
|
|
18653
|
+
return [];
|
|
18654
|
+
}
|
|
18655
|
+
this.buildModelTreeNodes(modelTree);
|
|
18656
|
+
}
|
|
18657
|
+
const descendants = [];
|
|
18658
|
+
const stack = [entityId];
|
|
18659
|
+
// Use iterative approach with a stack instead of recursion
|
|
18660
|
+
while (stack.length > 0) {
|
|
18661
|
+
const currentId = stack.pop();
|
|
18662
|
+
if (!currentId)
|
|
18663
|
+
continue;
|
|
18664
|
+
for (const nodeId in this.treeNodeByEntityId) {
|
|
18665
|
+
const node = this.treeNodeByEntityId[nodeId];
|
|
18666
|
+
if (node.parentId === currentId) {
|
|
18667
|
+
descendants.push(node);
|
|
18668
|
+
stack.push(node.entityId);
|
|
18669
|
+
}
|
|
18670
|
+
}
|
|
18671
|
+
}
|
|
18672
|
+
return descendants;
|
|
18673
|
+
}
|
|
18674
|
+
/**
|
|
18675
|
+
* Gets the root node of the model tree.
|
|
18676
|
+
* @returns The root node or null if no tree exists
|
|
18677
|
+
*/
|
|
18678
|
+
getRootNode() {
|
|
18679
|
+
var _a, _b;
|
|
18680
|
+
if (this.treeNodeByEntityId == null) {
|
|
18681
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18682
|
+
if (!modelTree) {
|
|
18683
|
+
modelTree = this.modelTree;
|
|
18684
|
+
}
|
|
18685
|
+
if (!modelTree) {
|
|
18686
|
+
return null;
|
|
18687
|
+
}
|
|
18688
|
+
this.buildModelTreeNodes(modelTree);
|
|
18689
|
+
}
|
|
18690
|
+
// Find the node with no parent (root node)
|
|
18691
|
+
for (const nodeId in this.treeNodeByEntityId) {
|
|
18692
|
+
const node = this.treeNodeByEntityId[nodeId];
|
|
18693
|
+
if (!node.parentId) {
|
|
18694
|
+
return node;
|
|
18695
|
+
}
|
|
18696
|
+
}
|
|
18697
|
+
return null;
|
|
18698
|
+
}
|
|
18699
|
+
/**
|
|
18700
|
+
* Gets the path from root to a given entity.
|
|
18701
|
+
* @param entityId The entity ID to find the path for
|
|
18702
|
+
* @returns Array of node IDs representing the path from root to the entity
|
|
18703
|
+
*/
|
|
18704
|
+
getNodePath(entityId) {
|
|
18705
|
+
var _a, _b;
|
|
18706
|
+
if (this.treeNodeByEntityId == null) {
|
|
18707
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18708
|
+
if (!modelTree) {
|
|
18709
|
+
modelTree = this.modelTree;
|
|
18710
|
+
}
|
|
18711
|
+
if (!modelTree) {
|
|
18712
|
+
return [];
|
|
18713
|
+
}
|
|
18714
|
+
this.buildModelTreeNodes(modelTree);
|
|
18715
|
+
}
|
|
18716
|
+
const path = [];
|
|
18717
|
+
let currentId = entityId;
|
|
18718
|
+
while (currentId) {
|
|
18719
|
+
const node = this.treeNodeByEntityId[currentId];
|
|
18720
|
+
if (!node) {
|
|
18721
|
+
break;
|
|
18722
|
+
}
|
|
18723
|
+
path.unshift(currentId);
|
|
18724
|
+
currentId = node.parentId;
|
|
18725
|
+
}
|
|
18726
|
+
return path;
|
|
18727
|
+
}
|
|
18728
|
+
/**
|
|
18729
|
+
* Batch operation to get multiple node paths efficiently.
|
|
18730
|
+
* @param entityIds Array of entity IDs to get paths for
|
|
18731
|
+
* @returns Map of entityId to path array
|
|
18732
|
+
*/
|
|
18733
|
+
getNodePathsBatch(entityIds) {
|
|
18734
|
+
var _a, _b;
|
|
18735
|
+
if (this.treeNodeByEntityId == null) {
|
|
18736
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18737
|
+
if (!modelTree) {
|
|
18738
|
+
modelTree = this.modelTree;
|
|
18739
|
+
}
|
|
18740
|
+
if (!modelTree) {
|
|
18741
|
+
return new Map();
|
|
18742
|
+
}
|
|
18743
|
+
this.buildModelTreeNodes(modelTree);
|
|
18744
|
+
}
|
|
18745
|
+
const paths = new Map();
|
|
18746
|
+
for (const entityId of entityIds) {
|
|
18747
|
+
const path = [];
|
|
18748
|
+
let currentId = entityId;
|
|
18749
|
+
while (currentId) {
|
|
18750
|
+
const node = this.treeNodeByEntityId[currentId];
|
|
18751
|
+
if (!node) {
|
|
18752
|
+
break;
|
|
18753
|
+
}
|
|
18754
|
+
path.unshift(currentId);
|
|
18755
|
+
currentId = node.parentId;
|
|
18756
|
+
}
|
|
18757
|
+
paths.set(entityId, path);
|
|
18758
|
+
}
|
|
18759
|
+
return paths;
|
|
18760
|
+
}
|
|
18761
|
+
/**
|
|
18762
|
+
* Batch operation to get multiple parent nodes efficiently.
|
|
18763
|
+
* @param entityIds Array of entity IDs to get parents for
|
|
18764
|
+
* @returns Map of entityId to parent node
|
|
18765
|
+
*/
|
|
18766
|
+
getParentNodesBatch(entityIds) {
|
|
18767
|
+
var _a, _b;
|
|
18768
|
+
if (this.treeNodeByEntityId == null) {
|
|
18769
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18770
|
+
if (!modelTree) {
|
|
18771
|
+
modelTree = this.modelTree;
|
|
18772
|
+
}
|
|
18773
|
+
if (!modelTree) {
|
|
18774
|
+
return new Map();
|
|
18775
|
+
}
|
|
18776
|
+
this.buildModelTreeNodes(modelTree);
|
|
18777
|
+
}
|
|
18778
|
+
const parents = new Map();
|
|
18779
|
+
for (const entityId of entityIds) {
|
|
18780
|
+
const node = this.treeNodeByEntityId[entityId];
|
|
18781
|
+
if (node === null || node === void 0 ? void 0 : node.parentId) {
|
|
18782
|
+
parents.set(entityId, this.treeNodeByEntityId[node.parentId] || null);
|
|
18783
|
+
}
|
|
18784
|
+
else {
|
|
18785
|
+
parents.set(entityId, null);
|
|
18786
|
+
}
|
|
18787
|
+
}
|
|
18788
|
+
return parents;
|
|
18789
|
+
}
|
|
18790
|
+
/**
|
|
18791
|
+
* Batch operation to get multiple child nodes efficiently.
|
|
18792
|
+
* @param entityIds Array of entity IDs to get children for
|
|
18793
|
+
* @returns Map of entityId to array of child nodes
|
|
18794
|
+
*/
|
|
18795
|
+
getChildNodesBatch(entityIds) {
|
|
18796
|
+
var _a, _b;
|
|
18797
|
+
if (this.treeNodeByEntityId == null) {
|
|
18798
|
+
let modelTree = (_b = (_a = this.cTileset) === null || _a === void 0 ? void 0 : _a.extensions) === null || _b === void 0 ? void 0 : _b.modelTree;
|
|
18799
|
+
if (!modelTree) {
|
|
18800
|
+
modelTree = this.modelTree;
|
|
18801
|
+
}
|
|
18802
|
+
if (!modelTree) {
|
|
18803
|
+
return new Map();
|
|
18804
|
+
}
|
|
18805
|
+
this.buildModelTreeNodes(modelTree);
|
|
18806
|
+
}
|
|
18807
|
+
const children = new Map();
|
|
18808
|
+
// Initialize all entityIds with empty arrays
|
|
18809
|
+
for (const entityId of entityIds) {
|
|
18810
|
+
children.set(entityId, []);
|
|
18811
|
+
}
|
|
18812
|
+
// Build a reverse lookup for efficiency
|
|
18813
|
+
for (const nodeId in this.treeNodeByEntityId) {
|
|
18814
|
+
const node = this.treeNodeByEntityId[nodeId];
|
|
18815
|
+
if (node.parentId && children.has(node.parentId)) {
|
|
18816
|
+
children.get(node.parentId).push(node);
|
|
18817
|
+
}
|
|
18818
|
+
}
|
|
18819
|
+
return children;
|
|
18820
|
+
}
|
|
18546
18821
|
Dispose() {
|
|
18547
18822
|
if (this.disposed) {
|
|
18548
18823
|
return;
|
|
@@ -22075,6 +22350,8 @@ var AssemblyRenderManager;
|
|
|
22075
22350
|
this.disposed = false;
|
|
22076
22351
|
// Cache of the hierarchy so that our scene-tree can reference it.
|
|
22077
22352
|
this.hierarchy = null;
|
|
22353
|
+
// Quick look-up of the hierarchy nodes by entity ID.
|
|
22354
|
+
this.hierarchyNodeByEntityId = null;
|
|
22078
22355
|
this.modelSpace = false;
|
|
22079
22356
|
const { viewer, register: visualsManager, getters, item } = params;
|
|
22080
22357
|
this.viewer = viewer;
|
|
@@ -22102,6 +22379,8 @@ var AssemblyRenderManager;
|
|
|
22102
22379
|
if (this.disposed) {
|
|
22103
22380
|
return;
|
|
22104
22381
|
}
|
|
22382
|
+
// Build hierarchy node cache for quick lookups
|
|
22383
|
+
this.buildHierarchyNodes(hierarchy);
|
|
22105
22384
|
const traverseHierarchy = (node, leavesOnly) => {
|
|
22106
22385
|
var _a;
|
|
22107
22386
|
if (node.Children) {
|
|
@@ -22202,6 +22481,210 @@ var AssemblyRenderManager;
|
|
|
22202
22481
|
entityIds = entities.map(x => { var _a; return (_a = x.Bruce) === null || _a === void 0 ? void 0 : _a.ID; });
|
|
22203
22482
|
}
|
|
22204
22483
|
}
|
|
22484
|
+
/**
|
|
22485
|
+
* Builds quick look-up of the hierarchy nodes by entity ID.
|
|
22486
|
+
* @param hierarchy The hierarchy data from the API
|
|
22487
|
+
*/
|
|
22488
|
+
buildHierarchyNodes(hierarchy) {
|
|
22489
|
+
this.hierarchyNodeByEntityId = {};
|
|
22490
|
+
if (!(hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.Root)) {
|
|
22491
|
+
return;
|
|
22492
|
+
}
|
|
22493
|
+
// Use iterative approach with a stack instead of recursion
|
|
22494
|
+
const stack = [
|
|
22495
|
+
{ node: hierarchy.Root, parentId: null }
|
|
22496
|
+
];
|
|
22497
|
+
while (stack.length > 0) {
|
|
22498
|
+
const { node, parentId } = stack.pop();
|
|
22499
|
+
if (node.ID) {
|
|
22500
|
+
const cache = {
|
|
22501
|
+
entityId: node.ID,
|
|
22502
|
+
name: node.Name || node.ID,
|
|
22503
|
+
parentId: parentId
|
|
22504
|
+
};
|
|
22505
|
+
this.hierarchyNodeByEntityId[node.ID] = cache;
|
|
22506
|
+
}
|
|
22507
|
+
// Push children to stack in reverse order to maintain correct traversal
|
|
22508
|
+
if (node.Children) {
|
|
22509
|
+
for (let i = node.Children.length - 1; i >= 0; i--) {
|
|
22510
|
+
stack.push({
|
|
22511
|
+
node: node.Children[i],
|
|
22512
|
+
parentId: node.ID
|
|
22513
|
+
});
|
|
22514
|
+
}
|
|
22515
|
+
}
|
|
22516
|
+
}
|
|
22517
|
+
}
|
|
22518
|
+
/**
|
|
22519
|
+
* Gets the parent node of a given entity.
|
|
22520
|
+
* @param entityId The entity ID to find the parent for
|
|
22521
|
+
* @returns The parent node or null if no parent exists
|
|
22522
|
+
*/
|
|
22523
|
+
getParentNode(entityId) {
|
|
22524
|
+
var _a;
|
|
22525
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22526
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22527
|
+
}
|
|
22528
|
+
const node = (_a = this.hierarchyNodeByEntityId) === null || _a === void 0 ? void 0 : _a[entityId];
|
|
22529
|
+
if (node === null || node === void 0 ? void 0 : node.parentId) {
|
|
22530
|
+
return this.hierarchyNodeByEntityId[node.parentId] || null;
|
|
22531
|
+
}
|
|
22532
|
+
return null;
|
|
22533
|
+
}
|
|
22534
|
+
/**
|
|
22535
|
+
* Gets all child nodes of a given entity.
|
|
22536
|
+
* @param entityId The entity ID to find children for
|
|
22537
|
+
* @returns Array of child nodes
|
|
22538
|
+
*/
|
|
22539
|
+
getChildNodes(entityId) {
|
|
22540
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22541
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22542
|
+
}
|
|
22543
|
+
const children = [];
|
|
22544
|
+
for (const nodeId in this.hierarchyNodeByEntityId) {
|
|
22545
|
+
const node = this.hierarchyNodeByEntityId[nodeId];
|
|
22546
|
+
if (node.parentId === entityId) {
|
|
22547
|
+
children.push(node);
|
|
22548
|
+
}
|
|
22549
|
+
}
|
|
22550
|
+
return children;
|
|
22551
|
+
}
|
|
22552
|
+
/**
|
|
22553
|
+
* Gets all descendant nodes of a given entity (children, grandchildren, etc.).
|
|
22554
|
+
* @param entityId The entity ID to find descendants for
|
|
22555
|
+
* @returns Array of descendant nodes
|
|
22556
|
+
*/
|
|
22557
|
+
getDescendantNodes(entityId) {
|
|
22558
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22559
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22560
|
+
}
|
|
22561
|
+
const descendants = [];
|
|
22562
|
+
const stack = [entityId];
|
|
22563
|
+
// Use iterative approach with a stack instead of recursion
|
|
22564
|
+
while (stack.length > 0) {
|
|
22565
|
+
const currentId = stack.pop();
|
|
22566
|
+
if (!currentId)
|
|
22567
|
+
continue;
|
|
22568
|
+
for (const nodeId in this.hierarchyNodeByEntityId) {
|
|
22569
|
+
const node = this.hierarchyNodeByEntityId[nodeId];
|
|
22570
|
+
if (node.parentId === currentId) {
|
|
22571
|
+
descendants.push(node);
|
|
22572
|
+
stack.push(node.entityId);
|
|
22573
|
+
}
|
|
22574
|
+
}
|
|
22575
|
+
}
|
|
22576
|
+
return descendants;
|
|
22577
|
+
}
|
|
22578
|
+
/**
|
|
22579
|
+
* Gets the root node of the hierarchy.
|
|
22580
|
+
* @returns The root node or null if no hierarchy exists
|
|
22581
|
+
*/
|
|
22582
|
+
getRootNode() {
|
|
22583
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22584
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22585
|
+
}
|
|
22586
|
+
// Find the node with no parent (root node)
|
|
22587
|
+
for (const nodeId in this.hierarchyNodeByEntityId) {
|
|
22588
|
+
const node = this.hierarchyNodeByEntityId[nodeId];
|
|
22589
|
+
if (!node.parentId) {
|
|
22590
|
+
return node;
|
|
22591
|
+
}
|
|
22592
|
+
}
|
|
22593
|
+
return null;
|
|
22594
|
+
}
|
|
22595
|
+
/**
|
|
22596
|
+
* Gets the path from root to a given entity.
|
|
22597
|
+
* @param entityId The entity ID to find the path for
|
|
22598
|
+
* @returns Array of node IDs representing the path from root to the entity
|
|
22599
|
+
*/
|
|
22600
|
+
getNodePath(entityId) {
|
|
22601
|
+
var _a;
|
|
22602
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22603
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22604
|
+
}
|
|
22605
|
+
const path = [];
|
|
22606
|
+
let currentId = entityId;
|
|
22607
|
+
while (currentId) {
|
|
22608
|
+
const node = (_a = this.hierarchyNodeByEntityId) === null || _a === void 0 ? void 0 : _a[currentId];
|
|
22609
|
+
if (!node) {
|
|
22610
|
+
break;
|
|
22611
|
+
}
|
|
22612
|
+
path.unshift(currentId);
|
|
22613
|
+
currentId = node.parentId;
|
|
22614
|
+
}
|
|
22615
|
+
return path;
|
|
22616
|
+
}
|
|
22617
|
+
/**
|
|
22618
|
+
* Batch operation to get multiple node paths efficiently.
|
|
22619
|
+
* @param entityIds Array of entity IDs to get paths for
|
|
22620
|
+
* @returns Map of entityId to path array
|
|
22621
|
+
*/
|
|
22622
|
+
getNodePathsBatch(entityIds) {
|
|
22623
|
+
var _a;
|
|
22624
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22625
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22626
|
+
}
|
|
22627
|
+
const paths = new Map();
|
|
22628
|
+
for (const entityId of entityIds) {
|
|
22629
|
+
const path = [];
|
|
22630
|
+
let currentId = entityId;
|
|
22631
|
+
while (currentId) {
|
|
22632
|
+
const node = (_a = this.hierarchyNodeByEntityId) === null || _a === void 0 ? void 0 : _a[currentId];
|
|
22633
|
+
if (!node) {
|
|
22634
|
+
break;
|
|
22635
|
+
}
|
|
22636
|
+
path.unshift(currentId);
|
|
22637
|
+
currentId = node.parentId;
|
|
22638
|
+
}
|
|
22639
|
+
paths.set(entityId, path);
|
|
22640
|
+
}
|
|
22641
|
+
return paths;
|
|
22642
|
+
}
|
|
22643
|
+
/**
|
|
22644
|
+
* Batch operation to get multiple parent nodes efficiently.
|
|
22645
|
+
* @param entityIds Array of entity IDs to get parents for
|
|
22646
|
+
* @returns Map of entityId to parent node
|
|
22647
|
+
*/
|
|
22648
|
+
getParentNodesBatch(entityIds) {
|
|
22649
|
+
var _a;
|
|
22650
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22651
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22652
|
+
}
|
|
22653
|
+
const parents = new Map();
|
|
22654
|
+
for (const entityId of entityIds) {
|
|
22655
|
+
const node = (_a = this.hierarchyNodeByEntityId) === null || _a === void 0 ? void 0 : _a[entityId];
|
|
22656
|
+
if (node === null || node === void 0 ? void 0 : node.parentId) {
|
|
22657
|
+
parents.set(entityId, this.hierarchyNodeByEntityId[node.parentId] || null);
|
|
22658
|
+
}
|
|
22659
|
+
else {
|
|
22660
|
+
parents.set(entityId, null);
|
|
22661
|
+
}
|
|
22662
|
+
}
|
|
22663
|
+
return parents;
|
|
22664
|
+
}
|
|
22665
|
+
/**
|
|
22666
|
+
* Batch operation to get multiple child nodes efficiently.
|
|
22667
|
+
* @param entityIds Array of entity IDs to get children for
|
|
22668
|
+
* @returns Map of entityId to array of child nodes
|
|
22669
|
+
*/
|
|
22670
|
+
getChildNodesBatch(entityIds) {
|
|
22671
|
+
if (this.hierarchyNodeByEntityId == null && this.hierarchy) {
|
|
22672
|
+
this.buildHierarchyNodes(this.hierarchy);
|
|
22673
|
+
}
|
|
22674
|
+
const children = new Map();
|
|
22675
|
+
// Initialize all entityIds with empty arrays
|
|
22676
|
+
for (const entityId of entityIds) {
|
|
22677
|
+
children.set(entityId, []);
|
|
22678
|
+
}
|
|
22679
|
+
// Build a reverse lookup for efficiency
|
|
22680
|
+
for (const nodeId in this.hierarchyNodeByEntityId) {
|
|
22681
|
+
const node = this.hierarchyNodeByEntityId[nodeId];
|
|
22682
|
+
if (node.parentId && children.has(node.parentId)) {
|
|
22683
|
+
children.get(node.parentId).push(node);
|
|
22684
|
+
}
|
|
22685
|
+
}
|
|
22686
|
+
return children;
|
|
22687
|
+
}
|
|
22205
22688
|
}
|
|
22206
22689
|
AssemblyRenderManager.Manager = Manager;
|
|
22207
22690
|
})(AssemblyRenderManager || (AssemblyRenderManager = {}));
|
|
@@ -32412,7 +32895,7 @@ class WidgetViewBar extends Widget.AWidget {
|
|
|
32412
32895
|
}
|
|
32413
32896
|
}
|
|
32414
32897
|
|
|
32415
|
-
const VERSION = "5.8.
|
|
32898
|
+
const VERSION = "5.8.5";
|
|
32416
32899
|
|
|
32417
32900
|
export { VERSION, CesiumViewMonitor, ViewerUtils, ViewerEventTracker, MenuItemManager, isOutlineChanged, EntityRenderEngine, EntityRenderEnginePoint, EntityRenderEnginePolyline, EntityRenderEnginePolygon, EntityRenderEngineModel3d, MenuItemCreator, VisualsRegister, RenderManager, EntitiesIdsRenderManager, DataLabRenderManager, EntitiesLoadedRenderManager, EntitiesRenderManager, EntityRenderManager, TilesetCadRenderManager, TilesetArbRenderManager, TilesetEntitiesRenderManager, TilesetOsmRenderManager, TilesetPointcloudRenderManager, TilesetGooglePhotosRenderManager, DataSourceStaticKmlManager, GoogleSearchRenderManager, AssemblyRenderManager, RelationsRenderManager, SharedGetters, CesiumParabola, EntityLabel, ViewRenderEngine, TileRenderEngine, TilesetRenderEngine, CESIUM_INSPECTOR_KEY, CESIUM_TIMELINE_KEY, CESIUM_TIMELINE_LIVE_KEY, CESIUM_TIMELINE_LIVE_PADDING_KEY, CESIUM_TIMELINE_INTERVAL_KEY, DEFAULT_LIVE_PADDING_SECONDS, ViewUtils, DrawingUtils, MeasureUtils, EntityUtils, CesiumEntityStyler, CesiumAnimatedProperty, CesiumAnimatedInOut, Draw3dPolygon, Draw3dPolyline, MeasureCreator, Walkthrough, Widget, VIEWER_BOOKMARKS_WIDGET_KEY, WidgetBookmarks, WidgetBranding, WidgetCursorBar, WidgetEmbeddedInfoView, WidgetInfoView, WidgetNavCompass$$1 as WidgetNavCompass, VIEWER_VIEW_BAR_WIDGET_KEY, WidgetViewBar, WidgetControlViewBar, WidgetControlViewBarSearch, VIEWER_LEFT_PANEL_WIDGET_KEY, VIEWER_LEFT_PANEL_CSS_VAR_LEFT, WidgetLeftPanel, WidgetLeftPanelTab, WidgetLeftPanelTabBookmarks };
|
|
32418
32901
|
//# sourceMappingURL=bruce-cesium.es5.js.map
|