From d8b9437e7322f9d0351e38cc3a3b5a7bb3e7bb35 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 02 十二月 2021 09:18:51 +0800 Subject: [PATCH] 1. 用电量日分析 --- src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt index 1ede99c..3dbde08 100644 --- a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt +++ b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt @@ -11,7 +11,7 @@ /** * 椋庡悜鏉冮噸 */ -class WindDirWeight : BaseWeight<DataVo, CompanySOP>() { +class WindDirWeight(var defaultLocation: Pair<Double, Double>?) : BaseWeight<DataVo, CompanySOP>() { override val tag: String = "椋庡悜鏉冮噸" @@ -19,8 +19,9 @@ override val weights: List<Double> = listOf(1.0, 0.8, 0.5, 0.2, 0.1) - override fun onWeightFactor(mData: DataVo, sop: CompanySOP): Double? { - val p1 = Pair(mData.lng!!, mData.lat!!) + override fun onWeightFactor(mData: DataVo, sop: CompanySOP): 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 wd = mData.getFactorData(FactorType.WIND_DIRECTION) ?: 0.0 return getAngle(p1, p2, wd) -- Gitblit v1.9.3