From e5bdf2e02090357cbd580d54e6cd2406dd541760 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期五, 21 三月 2025 17:39:30 +0800 Subject: [PATCH] 1. 新增卫星遥测网格热力图计算逻辑(待完成) --- src/main/kotlin/com/flightfeather/uav/biz/satellite/SatelliteGridManage.kt | 52 ++++++++++++++++++++++++---------------------------- 1 files changed, 24 insertions(+), 28 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 bea89eb..bd61d61 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,7 @@ import com.flightfeather.uav.common.utils.MapUtil import com.flightfeather.uav.domain.entity.* +import org.springframework.beans.BeanUtils import kotlin.math.PI import kotlin.math.sqrt @@ -237,12 +238,13 @@ realTimeDataList.forEach { if (it.longitude == null || it.latitude == null) return@forEach - searchGirdIn(it.longitude!!.toDouble() to it.latitude!!.toDouble(), gridCellList)?.let { cell -> - if (!dataMap.containsKey(cell)) { - dataMap[cell] = mutableListOf() + SatelliteGridUtil.searchGirdIn(it.longitude!!.toDouble() to it.latitude!!.toDouble(), gridCellList) + ?.let { cell -> + if (!dataMap.containsKey(cell)) { + dataMap[cell] = mutableListOf() + } + dataMap[cell]?.add(it) } - dataMap[cell]?.add(it) - } } // 缁熻姣忎釜缃戞牸涓殑鍧囧�� @@ -250,11 +252,26 @@ val gridDataDetailList = mutableListOf<GridDataDetail>() dataMap.forEach { (k, v) -> val avgData = v.avg() - val dataDetail = GridDataDetail().apply { + val dataDetail = GridDataDetail() + BeanUtils.copyProperties(avgData, dataDetail) + dataDetail.apply { dataId = gridData?.id groupId = k.groupId cellId = k.cellIndex - pm25 = avgData.pm25 +// 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) @@ -269,27 +286,6 @@ return gridDataDetailList } - /** - * 璁$畻鍧愭爣鐐瑰湪鍝釜鍗槦缃戞牸鍐� - * @date 2025.2.14 - * @param point 鍧愭爣鐐� - * @param gridCellList 鍗槦缃戞牸 - */ - fun searchGirdIn(point: Pair<Double, Double>, gridCellList: List<GridCell?>): GridCell? { - for (i in gridCellList.indices) { - val gridCell = gridCellList[i] ?: continue - val polygon = listOf( - gridCell.point1Lon.toDouble() to gridCell.point1Lat.toDouble(), - gridCell.point2Lon.toDouble() to gridCell.point2Lat.toDouble(), - gridCell.point3Lon.toDouble() to gridCell.point3Lat.toDouble(), - gridCell.point4Lon.toDouble() to gridCell.point4Lat.toDouble(), - ) - if (MapUtil.isPointInPolygon(point, polygon)) { - return gridCell - } - } - return null - } } \ No newline at end of file -- Gitblit v1.9.3