-
Notifications
You must be signed in to change notification settings - Fork 573
Description
the url of scenelayer node mesh data:https://xxx/server/rest/services/xxx/SceneLayer/layers/0/nodes/{nodeid}/geometries/0
the url of node info of scenelayer: https://xxx/server/rest/services/xxx/SceneLayer/layers/0/nodes/root
my question is, when i click the scene of sceneView, how to pick up accurate mesh of scenelayer,
the click event codes as follows:
app.view.whenLayerView(sceneLayer).then((sceneLayerView) => {
// 监听点击事件
app.view.on("click", function (event) {
resultMeshs = [];
arcgisMeshs = [];
resultArcgisMeshs = [];
// 清理场景
if (app.webglRenderer && app.webglRenderer.scene) {
disposeScene(app.webglRenderer.scene);
}
app.view.hitTest(event).then((response) => {
// 获取点击的SceneLayer要素
const result = response.results.filter(
(result) => result.graphic.layer === sceneLayer
)[0];
if (!result) return;
console.log(result);
const graphic = result.graphic;
// 高亮选中的图形
const highlightHandle = sceneLayerView.highlight(graphic);
highlightHandles.push(highlightHandle);
// 获取图形的边界信息
sceneLayerView.whenGraphicBounds(graphic).then((bounds) => {
console.log("图形边界:", bounds);
// const targetNodes = getNodeByBox(bounds.boundingBox);
// targetNodes.forEach((node) => {
// getNodeGeometries(node);
// });
// const l = nodePagesInfos.length;
// const nodeInfo = nodePagesInfos[Math.floor(Math.random() * l)];
// const boxGeometry = createGeometryByNode(nodeInfo);
// addTestNodeBound(boxGeometry, nodeInfo.id);
// getNodeGeometries(nodeInfo);
// const boundGeometry = createGeometryFromBounds(bounds.boundingBox);
// addTestNodeBound(boundGeometry);
nodePagesInfos.forEach((node) => {
const boxGeometry = createGeometryByNode(node);
if (geometryEngine.intersect(event.mapPoint, boxGeometry)) {
// if (boxGeometry.contains(boundGeometry)) {
// addTestNodeBound(boxGeometry, node.id);
createAndAddMeshFromOBB(node,node.id);
getNodeGeometries(node);
}
});
// // 如果需要创建一个可视化的几何体来表示这个网格面
// // 可以使用bounds创建一个简单的多边形或者盒子
// const geometryForVisualization = createGeometryFromBounds(bounds.boundingBox);
// app.view.graphics.add(
// createTestBoundsGraphic(geometryForVisualization)
// );
});
});
// 根据点获取节点
// getNodesByPoint(mapPoint);
});
});
but i don't how to pick up the accurate node mesh of scenelayer, i'v tried many methods, but none of them worked, I use the spatial relationship between bounds.boundingBox and node.obb to obtain accurate node information, and I also tried to obtain accurate node information through the correlation between node information and graphic attribute information, all attempts have failed, can you provide me with a feasible solution