riku
2021-06-30 5353617c7b2135ab00f98d8e05b2f8dfb2e096ed
src/main/kotlin/com/flightfeather/uav/model/epw/EPWModel.kt
@@ -1,7 +1,9 @@
package com.flightfeather.uav.model.epw
import com.flightfeather.uav.domain.entity.Company
import com.flightfeather.uav.lightshare.bean.CompanySOP
import com.flightfeather.uav.lightshare.bean.DataVo
import com.flightfeather.uav.model.*
import com.flightfeather.uav.socket.eunm.FactorType
import java.math.BigDecimal
/**
@@ -9,30 +11,19 @@
 * 根据走航监测数据,结合风速、风向、监测点与企业的相对位置等因素,计算企业对监测区域的影响程度
 * @author riku
 */
class EPWModel {
class EPWModel : BaseModel<DataVo, CompanySOP>() {
//    private val windDirWeight = WindDirWeight()
//    private val windDisWeight = WindDisWeight()
    override var dataPrep: BaseDataPrep<DataVo, CompanySOP> = EPWDataPrep()
    private lateinit var datas: List<DataVo>
    private lateinit var sources: List<Company>
    override var factorTypes: List<FactorType> = WeightType.weightType
    fun execute() {
        datas.forEach d@{d ->
            if (d.lng == null || d.lng == 0.0 || d.lat == null || d.lat == 0.0) {
                return@d
            }
    override var weights: List<BaseWeight<DataVo, CompanySOP>> = listOf(WindDirWeight(), WindDisWeight())
            sources.forEach s@ { s ->
                // 经纬度有效性判断
                if (s.ciLongitude == null || s.ciLongitude == BigDecimal(0) || s.ciLatitude == null || s.ciLatitude == BigDecimal(0)) {
                    return@s
                }
    override var sections: List<BaseSection<DataVo, CompanySOP>> = listOf(TimeSection())
                val p1 = Pair(d.lng!!, d.lat!!)
                val p2 = Pair(s.ciLongitude.toDouble(), s.ciLatitude.toDouble())
//                windDirWeight.getWeight(p1, p2)
            }
        }
    }
    override fun mDataCheck(m: DataVo): Boolean = !(m.lng == null || m.lng == 0.0 || m.lat == null || m.lat == 0.0)
    override fun sopCheck(s: CompanySOP): Boolean =
        !(s.ciLongitude == null || s.ciLongitude == BigDecimal(0) || s.ciLatitude == null || s.ciLatitude == BigDecimal(0))
}