From 8c6e742562d0c8647e0ee8deff01a3eb176d677b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 02 九月 2025 17:30:47 +0800
Subject: [PATCH] 2025.9.2 1. 新增走航任务统计功能(待完成)

---
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedArea.kt |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedArea.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedArea.kt
index 563466a..9993a86 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedArea.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedArea.kt
@@ -26,6 +26,8 @@
         windLevelCondition: RTExcWindLevelConfig.WindLevelCondition?,
     ) : this() {
         distanceType = windLevelCondition?.distanceType
+        distanceRange = distanceType?.disRange
+        distanceDes = distanceType?.des
         windLevelCondition?.let { sourceTrace(historyData, exceptionData, config, it) }
     }
 
@@ -39,6 +41,9 @@
 
     // 姹℃煋鍙兘鐨勫彂鐢熻窛绂�
     var distanceType: DistanceType? = null
+
+    var distanceRange: Pair<Double, Double>? = null
+    var distanceDes: String? = null
 
     /**
      * 鍙嶅悜婧簮
@@ -58,7 +63,7 @@
         val pair = avgData.longitude!!.toDouble() to avgData.latitude!!.toDouble()
 
         polygon = calSector(
-            avgData.windDirection!!.toDouble(),
+            avgData.windDirection?.toDouble() ?: .0,
             pair,
             windLevelCondition.distanceType.disRange,
             config.sourceTraceDegOffset
@@ -67,13 +72,19 @@
             MapUtil.wgs84ToGcj02(it)
         }
 
-        closePolygon = closeSourceTrace(historyData, pair)
+        closePolygon = closeSourceTrace(historyData, pair).map {
+            // 灏嗗潗鏍囪浆鎹负gcj02锛堢伀鏄熷潗鏍囩郴锛夛紝鍥犱负姹℃煋婧愬満鏅俊鎭兘涓烘鍧愭爣绯�
+            MapUtil.wgs84ToGcj02(it)
+        }
 
-        try {
-            val address = AMapService.reGeo(pair)
-            this.address = address.district + address.township + address.street
-        } catch (e: Exception) {
-            e.printStackTrace()
+        if (config.isSearchAddress) {
+            try {
+                val address = AMapService.reGeo(MapUtil.wgs84ToGcj02(pair))
+                this.address = address.district + address.township + address.street
+//                Thread.sleep(100)
+            } catch (e: Exception) {
+                e.printStackTrace()
+            }
         }
 
     }
@@ -102,7 +113,7 @@
 //            result.add(center)
             var startDeg = 0
             while (startDeg <= 360) {
-                val p = MapUtil.getPointByLen(center, 50.0, startDeg * PI / 180)
+                val p = MapUtil.getPointByLen(center, distanceRange.second, startDeg * PI / 180)
                 result.add(p)
                 startDeg++
             }
@@ -135,7 +146,7 @@
         val result = mutableListOf<Pair<Double, Double>>()
         var startDeg = 0
         while (startDeg <= 360) {
-            val p = MapUtil.getPointByLen(center, 50.0, startDeg * PI / 180)
+            val p = MapUtil.getPointByLen(center, DistanceType.TYPE1.disRange.second, startDeg * PI / 180)
             result.add(p)
             startDeg++
         }

--
Gitblit v1.9.3