From d978297ae85b2d7453054e616bbbe87bfabe9cbe Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期一, 12 七月 2021 17:38:09 +0800 Subject: [PATCH] 1. 新增用电量数据查询接口 2. 调整污染权重算法 --- src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt | 5 +++-- 1 files changed, 3 insertions(+), 2 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 c2add4a..2c6864a 100644 --- a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt +++ b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDisWeight.kt @@ -12,7 +12,7 @@ * 椋庨�熻窛绂绘潈閲� * 鐩戞祴鐐逛笌姹℃煋婧愪箣闂寸殑鐗╃悊璺濈涓庡綋鍓嶉閫熷緱鍑虹殑鏉冮噸 */ -class WindDisWeight : BaseWeight<DataVo, CompanySOP>() { +class WindDisWeight(var defaultLocation: Pair<Double, Double>?) : BaseWeight<DataVo, CompanySOP>() { override val tag: String = "椋庨�熻窛绂绘潈閲�" @@ -21,7 +21,8 @@ override val weights: List<Double> = listOf(1.0, 0.8, 0.6, 0.5, 0.3, 0.0) override fun onWeightFactor(mData: DataVo, sop: CompanySOP): Double? { - val p1 = Pair(mData.lng!!, mData.lat!!) + 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) -- Gitblit v1.9.3