From 5ad5f4caf07ec82bc6fb24fc94282e3ad59b3261 Mon Sep 17 00:00:00 2001
From: wangjuncheng <1>
Date: 星期五, 23 五月 2025 15:05:11 +0800
Subject: [PATCH] 1

---
 src/components/menu/flowRate_waterLevel.vue |   58 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/components/menu/flowRate_waterLevel.vue b/src/components/menu/flowRate_waterLevel.vue
index ec7c52e..5c3166b 100644
--- a/src/components/menu/flowRate_waterLevel.vue
+++ b/src/components/menu/flowRate_waterLevel.vue
@@ -58,11 +58,10 @@
 	};
 }
 function addPointToViewer(point, index) {
-	// 纭繚 currentTime 鏈夊悎鐞嗗��
 	const displayTime = currentTime.value || "鏈缃椂闂�";
 
 	// 娣诲姞鏍囩锛堢‘淇濆疄浣撳垱寤烘椂鍖呭惈label灞炴�э級
-	const entity = viewer.entities.add({
+	const labelEntity = viewer.entities.add({
 		position: point.cartesian,
 		label: {
 			text: `娴嬮噺鐐� ${index + 1}\n缁忓害: ${point.longitude.toFixed(6)}\n绾害: ${point.latitude.toFixed(6)}\n鏃堕棿: ${displayTime}`,
@@ -77,42 +76,32 @@
 			backgroundPadding: new Cesium.Cartesian2(10, 10),
 			showBackground: true,
 			scale: 1,
-			distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 璺濆湴闈�5000绫冲唴鏄剧ず
-			pixelOffsetScaleByDistance: new Cesium.NearFarScalar(
-				100,  // Near 璺濈 (鐩告満绂诲湴100绫�)
-				1.0,  // 鍦ㄨ繎澶勶紝鏀惧ぇ鍊嶆暟涓�1.0锛堟甯革級
-				5000, // Far 璺濈 (鐩告満绂诲湴5000绫�)
-				0.3   // 鍦ㄨ繙澶勶紝缂╁皬鍒�0.3鍊�
-			)
+			distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
+			pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3)
 		}
 	});
 
 	// 娣诲姞鍨傜洿绾�
-	viewer.entities.add({
+	const lineEntity = viewer.entities.add({
 		polyline: {
 			positions: [point.cartesian, Cesium.Cartesian3.fromRadians(point.longitude * Math.PI / 180, point.latitude * Math.PI / 180, 0)],
 			width: 2,
 			material: new Cesium.PolylineOutlineMaterialProperty({
-				outlineWidth: 4,
-				outlineColor: Cesium.Color.WHITE
+				color: Cesium.Color.RED.withAlpha(0.8),
+				outlineColor: Cesium.Color.WHITE,
+				outlineWidth: 4
 			}),
-			distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000), // 璺濆湴闈�5000绫冲唴鏄剧ず
-			pixelOffsetScaleByDistance: new Cesium.NearFarScalar(
-				100,  // Near 璺濈 (鐩告満绂诲湴100绫�)
-				1.0,  // 鍦ㄨ繎澶勶紝鏀惧ぇ鍊嶆暟涓�1.0锛堟甯革級
-				5000, // Far 璺濈 (鐩告満绂诲湴5000绫�)
-				0.3   // 鍦ㄨ繙澶勶紝缂╁皬鍒�0.3鍊�
-			)
-
-
+			distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 5000),
+			pixelOffsetScaleByDistance: new Cesium.NearFarScalar(100, 1.0, 5000, 0.3)
 		}
 	});
 
-	// 瀛樺偍鐐圭殑淇℃伅锛堝寘鍚畬鏁寸殑entity寮曠敤锛�
+	// 淇濆瓨 labelEntity 鍜� lineEntity
 	pickedPoints.value.push({
-		entity: entity,
+		labelEntity,
+		lineEntity,
 		longitude: point.longitude,
-		latitude: point.latitude,
+		latitude: point.latitude
 	});
 }
 
@@ -180,8 +169,8 @@
 
 function updateAllLabels() {
 	pickedPoints.value.forEach((pointInfo, index) => {
-		if (pointInfo.entity && pointInfo.entity.label) {
-			pointInfo.entity.label.text =
+		if (pointInfo.labelEntity && pointInfo.labelEntity.label) {
+			pointInfo.labelEntity.label.text =
 				`娴嬮噺鐐� ${index + 1}\n缁忓害: ${pointInfo.longitude.toFixed(6)}\n绾害: ${pointInfo.latitude.toFixed(6)}\n鏃堕棿: ${currentTime.value}`;
 		}
 	});
@@ -193,10 +182,21 @@
 }
 
 function endCalculation() {
-	// ElMessage.success('娓呴櫎鎵�鏈夋祴閲忕偣锛�');
+	// console.log('鐢辨湰鍔熻兘鍒涘缓鐨勬墍鏈� label 鍜� polyline entities:');
+	// pickedPoints.value.forEach((pointInfo, index) => {
+	// 	console.log(`娴嬮噺鐐� ${index + 1}:`);
+	// 	console.log('Label Entity:', pointInfo.labelEntity);
+	// 	console.log('Polyline Entity:', pointInfo.lineEntity);
+	// });
+	// console.log('褰撳墠 Cesium 涓墍鏈夊疄浣撳垪琛�:');
+	// viewer.entities.values.forEach((entity, idx) => {
+	// 	console.log(`瀹炰綋 #${idx}:`, entity);
+	// });
+	pickedPoints.value.forEach(pointInfo => {
+		if (pointInfo.labelEntity) viewer.entities.remove(pointInfo.labelEntity);
+		if (pointInfo.lineEntity) viewer.entities.remove(pointInfo.lineEntity);
+	});
 	pickedPoints.value = [];
-	viewer.entities.removeAll();
-	// currentTime.value = 0;
 }
 defineExpose({
 	endCalculation

--
Gitblit v1.9.3