跳到主要内容

纵截面分析

管线纵截面分析示例。

涉及接口
  1. 设置管线点击事件监听
  2. 高亮管线
  3. 添加Marker
代码示例
mapmostUE.setOnPipelineClickListener(function (val) {

let {location, type} = val;

mapmostUE.removeMarker("LSectionMarker");
mapmostUE.unhighlightPipeline();

let url1 = "http://xxx.xxx.xx.xxx/SIPPipe/SIPPipe/getPipeLineInfo?lng=" + location[0] + "&lat=" + location[1] + "&height=" + location[2] + "&type=" + type;
console.log(url1)
fetch(url1).then(res => res.json()).then(response => {
console.log(response.data)
for (let i = 0; i < response.data.length; i++) {
console.log(response.data[i])
// 高亮查询到的管段
mapmostUE.highlightPipeline(response.data[i])
}
});

// 纵截面不支持查询管点
if (type.indexOf('_point') > -1){
var notyf = new Notyf({
position:{
x:'center',
y:'top'
}
});
notyf.error('纵截面分析不支持查看管点,请重新点选管段')
return;
}

if (type.indexOf('_line') > -1){
type = type.substring(0,type.indexOf('_line'));
} else if (type.indexOf('_point') > -1){
type = type.substring(0,type.indexOf('_point'));
} else {
return;
}
// 管线信息查询接口,返回包括guid,起始点,形状,管径
let url2 = "http://xxx.xxx.xx.xxx/SIPPipe/SIPPipe/getPipeLineInfo?lng=" + location[0] + "&lat=" + location[1] + "&height=" + location[2] + "&type=" + val.type;
console.log(url2)
fetch(url2).then(res => res.json()).then(result => {
console.log(result.data)
for (let i = 0; i < result.data.length; i++) {
// 获取纵截面数据
let getLongiSectionUrl = "http://xxx.xxx.xx.xxx/SIPPipe/SIPPipe/pipelineAnls/getLongiSection?pipeType=" + type + "&guid=" + result.data[i].guid;
console.log(getLongiSectionUrl)
fetch(getLongiSectionUrl).then(res => res.json()).then(response => {
// 添加管段形状和管段类型
response.data.pipeShape = result.data[i].pipeShape
response.data.pipeType = type
console.log(JSON.stringify(response.data))
console.log("http://xxx.xxx.xx.xxx/SIPSD/pipelineAnalysis/LSection.html?data=" + JSON.stringify(response.data))

mapmostUE.addMarker("LSectionMarker",{
"name": "LSection",
"type": "cleanWindow",
"location": [location[0],location[1],location[2]],
"enableAutoFlyTo": false,
"url": "http://xxx.xxx.xx.xxx/SIPSD/pipelineAnalysis/LSection.html?data=" + JSON.stringify(response.data),
// "url": "http://xxx.xxx.xx.xxx/LSection.html?data=" + JSON.stringify(response.data),
"windowWidth": 800, // 默认350
"windowHeight": 500, // 默认150
})

});
}
});

});
效果
show