From 15f5680b532238290d0adf095a93e5af1c5f1203 Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期五, 07 二月 2025 17:14:57 +0800
Subject: [PATCH] 1.添加显示隐藏取水口、分水房功能 2.完善图例自定义控件功能和显示 3.处理工单添加选择时间功能
---
app/src/main/assets/js/map.js | 71 ++++++++++++++++++++++++++++++++---
1 files changed, 65 insertions(+), 6 deletions(-)
diff --git a/app/src/main/assets/js/map.js b/app/src/main/assets/js/map.js
index 85b3113..bfd0f8d 100644
--- a/app/src/main/assets/js/map.js
+++ b/app/src/main/assets/js/map.js
@@ -27,6 +27,12 @@
let pipeLineList = [];
let currentPipePath = [];
+ // 瀛樺偍鎵�鏈夊彇姘村彛鏍囪鐨勬暟缁�
+ let waterIntakeMarkers = [];
+
+ // 瀛樺偍鎵�鏈夊垎姘存埧鏍囪鐨勬暟缁�
+ let divideMarkers = [];
+
// 灏嗘柟娉曟寕杞藉埌 window 涓�
function mountMethodToWindow() {
window.locationOverLay = locationOverLay;
@@ -46,6 +52,10 @@
window.hideAllPipeLines = hideAllPipeLines;
window.clearAllPipeLines = clearAllPipeLines;
window.addPipeNetwork = addPipeNetwork;
+ window.hideAllWaterIntakes = hideAllWaterIntakes;
+ window.showAllWaterIntakes = showAllWaterIntakes;
+ window.hideAllDivides = hideAllDivides;
+ window.showAllDivides = showAllDivides;
}
@@ -242,19 +252,26 @@
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
}
//鏇存柊浣嶅潗鏍�
@@ -538,6 +555,13 @@
if (isRed) {
lastClickedMarker = marker;
}
+
+ // 灏嗗垎姘存埧鏍囪鍜屾爣绛惧瓨鍌ㄥ埌鏁扮粍涓�
+ divideMarkers.push({
+ marker: marker,
+ label: label
+ });
+
map.addOverLay(label);
map.addOverLay(marker); // 灏嗘爣娉ㄦ坊鍔犲埌鍦板浘涓�
return "addMarker鍔犺浇鎴愬姛 id:" + id
@@ -577,9 +601,44 @@
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);
+ });
+ }
})();
--
Gitblit v1.8.0