From 5808f76456ca0d40de5074f132b73a5a488e3e13 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 09 Dec 2025 09:12:03 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.1' into test

---
 src/views/layerManagement/components/utils.js |   57 ++++++++++++---------------------------------------------
 1 files changed, 12 insertions(+), 45 deletions(-)

diff --git a/src/views/layerManagement/components/utils.js b/src/views/layerManagement/components/utils.js
index b343230..7001570 100644
--- a/src/views/layerManagement/components/utils.js
+++ b/src/views/layerManagement/components/utils.js
@@ -101,9 +101,7 @@
 	}
 	// 绘制
 	drawTheArea(data){
-		this.whetherToDraw = data
-		console.log('this',this.whetherToDraw);
-		
+		this.whetherToDraw = data		
 	}
 	// 删除测区
 	deleteTheArea(data) {
@@ -113,9 +111,11 @@
 	// 开始绘制
 	startDrawing() {
 		if (!this.whetherToDraw) {
-			console.log('当前不允许绘制,whetherToDraw 为 false');
+		
 			return;
 		  }
+		 
+		  
 		this.drawingMode = true
 		this.curPolygon = new Cesium.PolygonHierarchy()
 
@@ -180,35 +180,7 @@
 	
 		
 	}
-	// 清除不在范围内的点
-	removeLastInvalidPoint() {
-		const posLen = this.curPolygon.positions.length
-		if (posLen === 0) return
 
-		let targetPointId = ''
-		let removeCount = 0
-
-		if (posLen === 2) {
-			removeCount = 2
-			targetPointId = `${DrawPolygon.ENTITY_NAMES.POINT_ID_PREFIX}0`
-		} else if (posLen > 2) {
-			removeCount = 1
-			const pointIndex = posLen - 2
-			targetPointId = `${DrawPolygon.ENTITY_NAMES.POINT_ID_PREFIX}${pointIndex}`
-		}
-
-		this.curPolygon.positions.splice(posLen - removeCount, removeCount)
-
-		const invalidPoint = this.editPolygonPointDataSource.entities.getById(targetPointId)
-		if (invalidPoint) {
-			this.editPolygonPointDataSource.entities.remove(invalidPoint)
-		}
-
-		if (this.curPolygon.positions.length === 0 && this.polygonEntity) {
-			this.editPolygonDataSource.entities.remove(this.polygonEntity)
-			this.polygonEntity = null
-		}
-	}
 	// 添加一个点
 	addPosition(position, isAdd = true) {
 		// 第一个点要重复压入一次,形成动态绘制效果
@@ -239,8 +211,7 @@
 
 		const pickedEntity = this.viewer.scene.pick(movement.position)?.id
 		const isPoint = pickedEntity?.name === DrawPolygon.ENTITY_NAMES.POINT
-console.log('pickedEntity',pickedEntity);
-console.log('isPoint',isPoint);
+
 		if (pickedEntity && isPoint) {
 			this.isDragging = true
 			this.draggedEntity = pickedEntity
@@ -291,9 +262,7 @@
 		// 编辑模式下,拖拽点实时更新
 		if (this.editingMode && this.draggedEntity?.customData) {
 			this.draggedEntity.position = cartesian
-			this.curPolygon.positions[this.draggedEntity?.customData.ind] = cartesian
-			console.log('拖拽');
-			
+			this.curPolygon.positions[this.draggedEntity?.customData.ind] = cartesian			
 		}
 
 		// 绘制模式下,实时更新最后一个点
@@ -328,18 +297,21 @@
 		const isPolygonPoint = pickedAllEntity.find(i => i.id.name === DrawPolygon.ENTITY_NAMES.POINT)
 		const isPolygon = pickedAllEntity.find(i => i.id.name === DrawPolygon.ENTITY_NAMES.POLYGON)
 		if (this.drawingMode && !this.whetherToDraw) {
-			console.log('当前不允许绘制,无法添加点或闭合多边形');
+		
 			return; // 阻断后续绘制逻辑
 		  }
 		// 如果不是绘制模式
 		if (!this.drawingMode) {
 			if (!isPolygon) {
+				
+				
 				this.editingMode = false
 				this.editPolygonPointDataSource.entities.show = false
 				return
 			}
 
 			if (isPolygon) {
+			
 				this.editingMode = true
 				this.editPolygonPointDataSource.entities.show = true
 			}
@@ -449,12 +421,7 @@
 		this.notify('getPolygonPositions', [])
 		this.startDrawing()
 	}
-	// 删除图斑
-	delSpot() {
-		this.removeEntities()
-		this.isPreviewMode = true
-		this.startDrawing()
-	}
+
 	// 删除端点
 	delPoint() {
 		if (this.curPolygon.positions.length <= 3) {
@@ -565,7 +532,7 @@
 		  } else {
 			// 新增:不允许绘制时,确保绘制模式为 false,避免误触发
 			this.drawingMode = false;
-			console.log('当前不允许绘制,初始化事件处理器但不启动绘制');
+		
 		  }
 		
 		let newPosition = positions.map(item => {

--
Gitblit v1.9.3