From bf3bf9ff25ac106b556b2427cc382c8fcca63bff Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 02 七月 2024 17:38:33 +0800
Subject: [PATCH] 1. 新增走航报告自动道路识别模块
---
src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt | 31 +++++++++++++++++++++++++++----
1 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt
index 4a61f24..bb38313 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt
@@ -1,18 +1,41 @@
package com.flightfeather.uav.model.epw
+import com.flightfeather.uav.lightshare.bean.CompanySOP
+import com.flightfeather.uav.lightshare.bean.DataVo
+import com.flightfeather.uav.model.BaseSOP
import com.flightfeather.uav.model.BaseWeight
+import com.flightfeather.uav.socket.eunm.FactorType
+import kotlin.math.abs
+import kotlin.math.max
+import kotlin.math.sqrt
/**
* 椋庨�熻窛绂绘潈閲�
* 鐩戞祴鐐逛笌姹℃煋婧愪箣闂寸殑鐗╃悊璺濈涓庡綋鍓嶉閫熷緱鍑虹殑鏉冮噸
*/
-class WindDisWeight : BaseWeight() {
+class WindDisWeight(var defaultLocation: Pair<Double, Double>?) : BaseWeight<DataVo, BaseSOP>() {
+
+ override val tag: String = "椋庨�熻窛绂绘潈閲�"
override val sectionValues: List<Double> = listOf(2.0, 5.0, 8.0, 12.0, 20.0, 30.0)
+
override val weights: List<Double> = listOf(1.0, 0.8, 0.6, 0.5, 0.3, 0.0)
- fun getWeight(dis: Double, ws: Double): Double {
- val value = dis / ws / 60
- return weightCal(value)
+ override fun onWeightFactor(mData: DataVo, sop: BaseSOP): Double? {
+ val p1 = if (mData.lng == null || mData.lat == null || mData.lng == .0 || mData.lat == .0) defaultLocation else Pair(mData.lng!!, mData.lat!!)
+ p1 ?: return .0
+ val p2 = Pair(sop.ciLongitude!!.toDouble(), sop.ciLatitude!!.toDouble())
+ val ws = mData.getFactorData(FactorType.WIND_SPEED)
+ return if (ws == null) null else getWindSpeed(p1, p2, ws)
+ }
+
+ private fun getWindSpeed(p1: Pair<Double, Double>, p2: Pair<Double, Double>, ws: Double): Double {
+ val dx = p2.first - p1.first
+ val dy = p2.second - p1.second
+ val dis = sqrt(abs(dx * dx) + abs(dy * dy)) * 100
+// println("璺濈锛�$dis")
+ val min = dis * 1000 / max(ws, 1.0) / 60
+// println("璺濈杞负椋庨�熷垎閽熸暟锛�$min")
+ return min
}
}
\ No newline at end of file
--
Gitblit v1.9.3