Jtopo三相四线拓扑图

使用jtopo模块绘制三相四线拓扑图埋坑指南

参考网址:https://github.com/winyuan/jtopo_api/blob/master/demo/topo.html

需要在当前的实现上添加相关处理

1.去除现有连线

let links = this.scene.childs.filter(item => item.zIndex === 2);
links.forEach(item => { this.scene.remove(item) })

2.添加新的连线

let color = ['220,220,0', '0,220,0', '220,0,0', '0,0,0']
function addQuadraLink(form, to, color) {
    for (let i = 0; i < color.length; i++) {
        let link = new JTopo.FlexionalLink(nodeA, nodeZ);
        link.strokeColor = color[i];
        link.lineWidth = 2;
        link.bundleGap = 3; // 线条之间的间隔
        link.bundleOffset = 10; // 折线拐角处的长度
        scene.add(link);
    }
}
scene.childs.forEach(item => item.parent !== undefined && addQuadraLink(item, item.parent, 'ABCN'))

3.遗留问题

处理完成之后水平方向的连线会重叠在一起,有待后续处理;

posted @ 2020-06-02 08:27  修宁  阅读(392)  评论(0)    收藏  举报