From bde043c8fd1a076f44c402dd56c62d401afbfb16 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 27 三月 2025 17:29:48 +0800 Subject: [PATCH] 1. 新增卫星遥测网格热力图计算逻辑 --- src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt | 70 ++++++++++++++++++++++++++++------- 1 files changed, 56 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt b/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt index bd61d61..c201a99 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt @@ -2,6 +2,10 @@ import com.flightfeather.uav.common.utils.MapUtil import com.flightfeather.uav.domain.entity.* +import com.flightfeather.uav.model.underwaygrid.GridCellAndData +import com.flightfeather.uav.model.underwaygrid.GridCellSop +import com.flightfeather.uav.model.underwaygrid.UnderwayGridModel +import com.flightfeather.uav.socket.eunm.FactorType import org.springframework.beans.BeanUtils import kotlin.math.PI import kotlin.math.sqrt @@ -258,20 +262,6 @@ dataId = gridData?.id groupId = k.groupId cellId = k.cellIndex -// no2 = avgData.no2 -// co = avgData.co -// h2s = avgData.h2s -// so2 = avgData.so2 -// o3 = avgData.o3 -// pm25 = avgData.pm25 -// pm10 = avgData.pm10 -// temperature = avgData.temperature -// humidity = avgData.humidity -// voc = avgData.voc -// noi = avgData.noi -// no = avgData.no -// windSpeed -// windDirection rank } gridDataDetailList.add(dataDetail) @@ -286,6 +276,58 @@ return gridDataDetailList } + /** + * 璁$畻鐑姏鍥剧綉鏍硷紝鍗崇綉鏍煎懆杈规墿鏁e奖鍝嶆潈閲嶈绠� + * @param gridDataDetail 缃戞牸鐩戞祴鏁版嵁 + * @param gridCellList 鍖哄煙缃戞牸鏁扮粍 + * @param option 鍖哄煙缃戞牸鍙傛暟淇℃伅 + * @param searchLength 璁$畻鍛ㄨ竟鍏柟鍚戯紙涓婁笅宸﹀彸鍙婂洓涓瑙掞級缃戞牸鐨勯暱搴� + * @return 鍛ㄨ竟缃戞牸鍙婂搴旂殑鐩戞祴鏁版嵁缁撴灉 + */ + fun heatMap( + gridDataDetail: GridDataDetail, gridCellList: List<GridCell?>, + option: GridGroupOption, searchLength: Int, + ): List<GridDataDetail> { + // 鎵惧埌缃戞牸鏁版嵁瀵瑰簲鐨勭綉鏍间俊鎭� + val gridCell = gridCellList.find { it?.cellIndex == gridDataDetail.cellId } + ?: throw IllegalArgumentException("缃戞牸鏁版嵁鍜岀粰瀹氱殑鍖哄煙缃戞牸涓嶅尮閰�") + // 鑾峰彇鍛ㄨ竟缃戞牸 + val surroundGridCellList = + SatelliteGridUtil.searchDiffuseGrid(gridDataDetail.cellId, gridCellList, option, searchLength) + + // 浣跨敤璧拌埅缃戞牸鏉冮噸妯″瀷锛岃绠楀懆杈圭綉鏍肩殑鐩戞祴鏁版嵁鍊� + val underwayGridModel = UnderwayGridModel() + val dataList = listOf(GridCellAndData(gridCell, gridDataDetail)) + val gridCellSopList = surroundGridCellList.map { + GridCellSop( + it, + it.id.toString(), + it.cellIndex.toString(), + it.cellIndex.toString() + ) } + underwayGridModel.execute(dataList, gridCellSopList) + val resMap = underwayGridModel.outputResult() + + // 鏍煎紡鍖栫粨鏋滃苟杩斿洖 + val result = mutableListOf<GridDataDetail>() + gridCellSopList.forEach { + val resGridDataDetail = GridDataDetail().apply { + dataId = gridDataDetail.dataId + groupId = gridDataDetail.groupId + cellId = it.gridCell.cellIndex + } + + val key = "${it.sourceName};${it.index}" + val d = resMap[key] + d?.forEach { (t, u) -> + val avg = u["缁煎悎(${t})"]?.average ?: .0 + resGridDataDetail.setFactorValue(FactorType.getByName(t), avg.toFloat()) + } + result.add(resGridDataDetail) + } + + return result + } } \ No newline at end of file -- Gitblit v1.9.3