我想在平面图上的某些节点旁边添加图像,svg甚至创建三个图形。
这是我获取节点{this.props.selected === this.props.name && (
<span className="collection-selected-badge">SELECTED</span>
)}
的位置的方式
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:8051
CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.orgA.example.com:13051
CORE_PEER_GOSSIP_BOOTSTRAP=peer0.orgA.example.com:14051
有没有一种方法可以在节点旁边放置或绘制某些东西?我看过一些与dbId
和function getLeafFragIds(model, leafId) {
const instanceTree = model.getData().instanceTree;
const fragIds = [];
instanceTree.enumNodeFragments( leafId, function( fragId ) {
fragIds.push( fragId );
});
return fragIds;
}
function getComponentGeometry( viewer, dbId ) {
const fragIds = getLeafFragIds( viewer.model, dbId );
let matrixWorld = null;
const meshes = fragIds.map( function( fragId ) {
const renderProxy = viewer.impl.getRenderProxy( viewer.model, fragId );
const geometry = renderProxy.geometry;
const attributes = geometry.attributes;
const positions = geometry.vb ? geometry.vb : attributes.position.array;
const indices = attributes.index.array || geometry.ib;
const stride = geometry.vb ? geometry.vbstride : 3;
const offsets = geometry.offsets;
matrixWorld = matrixWorld || renderProxy.matrixWorld.elements;
return {
positions,
indices,
offsets,
stride
};
});
return {
matrixWorld,
meshes
};
}
相关的代码,但是问题是我不知道如何在节点旁边定义确切位置
如果我们谈论这样的几何图形:
THREE.ImageUtils.loadTexture();
如何定义它在setMaterial()
附近的位置?
谢谢
答案 0 :(得分:0)
您可以通过计算其边界框的中心来获取节点的位置,最简单的方法是使用Viewer的内置单位:
viewer.select(nodeid); //select the target component so the selector knows which component to fit selection bounds
const box = viewer.utilities.getBoundingBox();
const position = box.center();
viewer.select(); //clear selection if necessary