From 53857f42f777e2b9753b8f00cce1a60ce3dcb8fd Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期三, 15 十月 2025 22:42:29 +0800
Subject: [PATCH] 2025.10.15 修改高德地图地理逆编码结果,让地理位置信息更加详细
---
src/main/kotlin/com/flightfeather/uav/model/BaseWeight.kt | 40 ++++++++++++++++++++++++++++++++++++----
1 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/model/BaseWeight.kt b/src/main/kotlin/com/flightfeather/uav/model/BaseWeight.kt
index 247845c..82e258b 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/BaseWeight.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/BaseWeight.kt
@@ -1,21 +1,53 @@
package com.flightfeather.uav.model
+import com.flightfeather.uav.lightshare.bean.DataVo
+
/**
* 鏉冮噸
* 鏌愮褰卞搷鍥犵礌鍦ㄤ笉鍚屾儏鍐典笅瀵规煇绉嶇洃娴嬫暟鎹骇鐢熺殑鏉冮噸褰卞搷
*/
-abstract class BaseWeight {
+abstract class BaseWeight <M: BaseMData, S : BaseSOP> {
-// 鍖洪棿闃堝��
+ abstract val tag:String
+
+ // 鍖洪棿闃堝��
abstract val sectionValues: List<Double>
-// 鍖洪棿瀵瑰簲鏉冮噸
+
+ // 鍖洪棿瀵瑰簲鏉冮噸
abstract val weights: List<Double>
+
+ // 涓婃璁$畻鐨勬潈閲嶅��
+ private var lastWeight = -1.0
+
+ // 鏉冮噸鏄惁鍙樺寲
+ var isChange = true
+
+ fun getWeight(mData: M, sop: S): Double? {
+ if (!isChange) {
+ if (lastWeight < 0) {
+ val v = onWeightFactor(mData, sop) ?: return null
+ lastWeight = weightCal(v)
+ }
+// println("$tag: $lastWeight")
+ return lastWeight
+ } else {
+ val v = onWeightFactor(mData, sop) ?: return null
+ lastWeight = weightCal(v)
+// println("$tag: $lastWeight")
+ return lastWeight
+ }
+ }
+
+ /**
+ * 鑾峰彇鏉冮噸鍥犲瓙鍊�
+ */
+ abstract fun onWeightFactor(mData: M, sop: S): Double?
/**
* 鏉冮噸璁$畻
* @param value 褰卞搷鍥犵礌鐨勫��
*/
- fun weightCal(value: Double): Double {
+ private fun weightCal(value: Double): Double {
for (i in sectionValues.indices) {
if (value < sectionValues[i]) {
return weights[i]
--
Gitblit v1.9.3