feiyu02
2025-01-23 698f8f0f22af4c66581ce284407e986ca036aec6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.flightfeather.uav.lightshare.service.impl
 
import com.flightfeather.uav.biz.satellite.SatelliteGridManage
import com.flightfeather.uav.common.exception.BizException
import com.flightfeather.uav.domain.entity.GridCell
import com.flightfeather.uav.domain.entity.GridGroup
import com.flightfeather.uav.domain.repository.SatelliteGridRep
import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService
import org.springframework.stereotype.Service
 
/**
 * 卫星网格坐标及监测数据二次计算
 * @date 2025/1/15
 * @author feiyu02
 */
@Service
class SatelliteDataCalculateServiceImpl(private val satelliteGridRep: SatelliteGridRep) : SatelliteDataCalculateService {
 
 
    override fun calGridVertex(groupId: Int): List<GridCell?> {
        val cellList = satelliteGridRep.fetchGridCell(groupId)
        val vertexList = SatelliteGridManage.calGridVertex(cellList.map {
            if (it?.longitude == null || it.latitude == null) {
                throw BizException("卫星遥测网格计算顶点坐标点失败,存在中心点坐标为空的情况")
            }
            it.longitude?.toDouble()!! to it.latitude?.toDouble()!!
        })
 
        cellList.forEachIndexed { i, c ->
            val v = vertexList[i]
            c?.point1Lon = v.point1Lon.toBigDecimal()
            c?.point1Lat = v.point1Lat.toBigDecimal()
 
            c?.point2Lon = v.point2Lon.toBigDecimal()
            c?.point2Lat = v.point2Lat.toBigDecimal()
 
            c?.point3Lon = v.point3Lon.toBigDecimal()
            c?.point3Lat = v.point3Lat.toBigDecimal()
 
            c?.point4Lon = v.point4Lon.toBigDecimal()
            c?.point4Lat = v.point4Lat.toBigDecimal()
        }
 
        satelliteGridRep.updateGridCellBatch(cellList)
 
        return cellList
    }
 
    override fun splitGrid(groupId: Int, scale: Int): List<GridCell?> {
        // 检查该网格下该种类的细分网格是否存在,若不存在,则新建
        satelliteGridRep.fetchGridGroup(groupId)
        // 获取具体网格信息
        val cellList = satelliteGridRep.fetchGridCell(groupId)
        // 按照给定的拆分系数进行拆分
//        val subCellList = SatelliteGridManage.splitGrid(cellList, scale)
 
        return emptyList()
    }
}