| | |
| | | let pipeLineList = []; |
| | | let currentPipePath = []; |
| | | |
| | | // 存储所有取水口标记的数组 |
| | | let waterIntakeMarkers = []; |
| | | |
| | | // 存储所有分水房标记的数组 |
| | | let divideMarkers = []; |
| | | |
| | | // 将方法挂载到 window 上 |
| | | function mountMethodToWindow() { |
| | | window.locationOverLay = locationOverLay; |
| | |
| | | window.hideAllPipeLines = hideAllPipeLines; |
| | | window.clearAllPipeLines = clearAllPipeLines; |
| | | window.addPipeNetwork = addPipeNetwork; |
| | | window.hideAllWaterIntakes = hideAllWaterIntakes; |
| | | window.showAllWaterIntakes = showAllWaterIntakes; |
| | | window.hideAllDivides = hideAllDivides; |
| | | window.showAllDivides = showAllDivides; |
| | | } |
| | | |
| | | |
| | |
| | | let label = new T.Label({ |
| | | text: `<div style='position:absolute;left:-50%;transform: translateX(-50%);'>${name}<div>`, |
| | | position: marker.getLngLat(), |
| | | offset: new T.Point(0, 8), // 设置标注文字的位置 |
| | | opacity: 1, // 设置文本的显示不透明度(范围0-1) |
| | | offset: new T.Point(0, 8), |
| | | opacity: 1, |
| | | }); |
| | | label.setBorderLine(0); // 设置文本的边框线宽 |
| | | label.setBackgroundColor("transparent"); // 设置文本的背景色(透明色) |
| | | label.setBorderLine(0); |
| | | label.setBackgroundColor("transparent"); |
| | | label.setFontColor("#FFFFFF"); |
| | | label.setFontSize(10); |
| | | marker.label = label; |
| | | if (isRed) { |
| | | lastClickedMarker = marker; |
| | | } |
| | | |
| | | // 将标记和标签存储到数组中 |
| | | waterIntakeMarkers.push({ |
| | | marker: marker, |
| | | label: label |
| | | }); |
| | | |
| | | map.addOverLay(label); |
| | | map.addOverLay(marker); // 将标注添加到地图中 |
| | | map.addOverLay(marker); |
| | | return "addMarker加载成功 id:" + id |
| | | } |
| | | //更新位坐标 |
| | |
| | | if (isRed) { |
| | | lastClickedMarker = marker; |
| | | } |
| | | |
| | | // 将分水房标记和标签存储到数组中 |
| | | divideMarkers.push({ |
| | | marker: marker, |
| | | label: label |
| | | }); |
| | | |
| | | map.addOverLay(label); |
| | | map.addOverLay(marker); // 将标注添加到地图中 |
| | | return "addMarker加载成功 id:" + id |
| | |
| | | window.Android.showDivideDetail(data); |
| | | } |
| | | |
| | | /** |
| | | * 隐藏所有取水口标记 |
| | | */ |
| | | function hideAllWaterIntakes() { |
| | | waterIntakeMarkers.forEach(item => { |
| | | map.removeOverLay(item.marker); |
| | | map.removeOverLay(item.label); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 显示所有取水口标记 |
| | | */ |
| | | function showAllWaterIntakes() { |
| | | waterIntakeMarkers.forEach(item => { |
| | | map.addOverLay(item.marker); |
| | | map.addOverLay(item.label); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 隐藏所有分水房标记 |
| | | */ |
| | | function hideAllDivides() { |
| | | divideMarkers.forEach(item => { |
| | | map.removeOverLay(item.marker); |
| | | map.removeOverLay(item.label); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 显示所有分水房标记 |
| | | */ |
| | | function showAllDivides() { |
| | | divideMarkers.forEach(item => { |
| | | map.addOverLay(item.marker); |
| | | map.addOverLay(item.label); |
| | | }); |
| | | } |
| | | |
| | | })(); |