From dde9027478b772dd60371937413ac2838c4f3bbd Mon Sep 17 00:00:00 2001
From: zuoxiao <470321431@qq.com>
Date: 星期二, 11 二月 2025 09:56:33 +0800
Subject: [PATCH] 1.修改library名称 2.取水口接口相关代码
---
app/src/main/assets/js/map.js | 79 +++++++++++++++++++++++++++++++++++----
1 files changed, 71 insertions(+), 8 deletions(-)
diff --git a/app/src/main/assets/js/map.js b/app/src/main/assets/js/map.js
index 8238d7f..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;
}
@@ -170,6 +180,10 @@
if (lastClickedMarker !== null) {
lastClickedMarker.setIcon(createIcon(CONFIG.IMAGES.MARKER_BLUE));
}
+ if(lastClickedDivide!==null)
+ {
+ lastClickedDivide.setIcon(createIcon(CONFIG.IMAGES.DIVIDE_BLUE));
+ }
if (isShowWaterIntakeDetail || isShowDivideDetail) {
// 鍋囧鏄剧ず浜嗗彇姘村彛璇︽儏鍒欓殣钘忓彇姘村彛璇︽儏
isShowWaterIntakeDetail = false;
@@ -238,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
}
//鏇存柊浣嶅潗鏍�
@@ -475,10 +496,10 @@
function mapMoveEnd(e) {
- debounce(() => {
+
const center = e.target.getCenter();
window.Android.refreshCenter(center.getLng(), center.getLat());
- }, 300);
+
}
// 娣诲姞闃叉姈鍑芥暟
@@ -534,6 +555,13 @@
if (isRed) {
lastClickedMarker = marker;
}
+
+ // 灏嗗垎姘存埧鏍囪鍜屾爣绛惧瓨鍌ㄥ埌鏁扮粍涓�
+ divideMarkers.push({
+ marker: marker,
+ label: label
+ });
+
map.addOverLay(label);
map.addOverLay(marker); // 灏嗘爣娉ㄦ坊鍔犲埌鍦板浘涓�
return "addMarker鍔犺浇鎴愬姛 id:" + id
@@ -573,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