From 6c1e7c5ac983301c34f003415cda2ef7c7e176a6 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 09 一月 2025 17:34:11 +0800
Subject: [PATCH] 1. 新增卫星遥测网格4个顶点坐标计算逻辑

---
 src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt |   49 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
index c17296d..40bfa5a 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
@@ -29,10 +29,7 @@
     // 鍧囧�煎�嶆暟鍙傛暟
     private val xratio = 3
 
-    // 杩炵画鏁版嵁鐨勫悎鐞嗘渶澶у闀垮�嶇巼
-    private val multiplier = 20
-
-    // 闇�瑕佸鐞嗙殑鍥犲瓙绫诲瀷
+    // 闇�瑕佸钩婊戝鐞嗙殑鍥犲瓙绫诲瀷
     private var calTypes = when (deviceType) {
         UWDeviceType.VEHICLE,
         UWDeviceType.UAV,
@@ -41,6 +38,25 @@
         UWDeviceType.GRID -> WeightType.prepFixed
         else -> WeightType.prepFixed
     }
+
+    // 鍙渶瑕佹鏌ヨ寖鍥村拰鍙樺寲骞呭害鐨勫洜瀛愮被鍨�
+    private var rangeTypes = listOf(
+        FactorType.PM25.des,
+        FactorType.PM10.des,
+        FactorType.VOC.des
+    )
+
+    // 鏃犻渶淇鐨勫洜瀛愮被鍨�
+    private var noCalTypes = listOf(
+        FactorType.TEMPERATURE.des,
+        FactorType.HUMIDITY.des,
+        FactorType.LNG.des,
+        FactorType.LAT.des,
+        FactorType.VELOCITY.des,
+        FactorType.TIME.des,
+        FactorType.WIND_DIRECTION.des,
+        FactorType.HEIGHT.des
+    )
 
     private val lastData = mutableListOf<DataVo>()
 
@@ -151,26 +167,27 @@
                         // 鍘婚櫎鏃犳晥鍊肩殑鏍囧噯宸�
                         val std = standardDeviation(avg.first, list, it.factorName)
                         // 鍚堢悊鏈�澶у��
-                        val max = max(avg.first + std * nstd, avg.first + avg.first * xratio)
+                        var maxValue = max(avg.first + std * nstd, avg.first + avg.first * xratio)
+                        maxValue = max(maxValue, FactorType.getRange(it.factorName)?.second ?: .0)
                         // 鍚堢悊鏈�灏忓��
-                        val min = min(avg.first - std * nstd, avg.first / (1 + xratio))
+                        val minValue = min(avg.first - std * nstd, avg.first / (1 + xratio))
 
                         // 鍒ゆ柇鐩戞祴鍥犲瓙鏄惁闇�瑕佽繘琛屽钩婊戝鐞嗭紝
-                        // 鑻ヤ笉闇�瑕侊紝鍒欏垽鏂噺绾ф槸鍚﹀湪鍚堢悊鑼冨洿鍐呬互鍙婂彉鍖栧�嶇巼鏄惁鍦ㄥ悎鐞嗚寖鍥村唴
-                        if (!calTypes.contains(it.factorName)) {
-                            if (isInRange(it) != true || excessiveChange(it) == true) {
-                                // 閲囩敤璁$畻鎵�寰楀潎鍊间唬鏇垮師濮嬪��
-                                it.factorData = avg.first
-                            }
-                        } else {
+                        if (calTypes.contains(it.factorName)) {
                             // 鏁版嵁涓嶅浜庡悎鐞嗚寖鍥村苟涓旀湁鏁堜釜鏁拌揪鏍囨椂锛岄噰鐢ㄨ绠楁墍寰楀潎鍊间唬鏇垮師濮嬪��
                             if (avg.second > max(ncal / 5, 2)
-                                && (it.factorData!! < min || it.factorData!! > max)
+                                && (it.factorData!! < minValue || it.factorData!! > maxValue)
                             ) {
                                 it.factorData = avg.first
                             }
                         }
-
+                        // 鍒ゆ柇閲忕骇鏄惁鍦ㄥ悎鐞嗚寖鍥村唴浠ュ強鍙樺寲鍊嶇巼鏄惁鍦ㄥ悎鐞嗚寖鍥村唴
+                        else if (rangeTypes.contains(it.factorName)) {
+                            if (isInRange(it) != true || excessiveChange(it) == true) {
+                                // 閲囩敤璁$畻鎵�寰楀潎鍊间唬鏇垮師濮嬪��
+                                it.factorData = avg.first
+                            }
+                        }
                     }
                 }
             }
@@ -289,6 +306,6 @@
                 break
             }
         }
-        return m > multiplier
+        return m > FactorType.getMultiplier(airData.factorName)
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3