feiyu02
2025-09-04 707b00a0ca6604c249a110b376ac1e44e408e624
src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt
@@ -1,5 +1,6 @@
package com.flightfeather.uav.domain.repository
import com.flightfeather.uav.common.utils.MapUtil
import com.flightfeather.uav.domain.entity.SceneInfo
import com.flightfeather.uav.domain.mapper.SceneInfoMapper
import com.flightfeather.uav.lightshare.bean.AreaVo
@@ -42,6 +43,23 @@
        })
    }
    /**
     * 根据多边形筛选场景
     * @param polygon 多边形坐标列表,顺序为顺时针或逆时针(要求使用火星坐标系)
     * @return 多边形内的场景列表
     */
    fun findByPolygon(polygon: List<Pair<Double, Double>>): List<SceneInfo?> {
        // 计算多边形四至范围
        val bounds = MapUtil.calFourBoundaries(polygon)
        val sceneList = findByCoordinateRange(bounds)
        // 筛选是否在反向溯源区域多边形内部
        return sceneList.filter { scene ->
            scene ?: false
            val point = scene!!.longitude.toDouble() to scene.latitude.toDouble()
            MapUtil.isPointInPolygon(point, polygon)
        }
    }
    fun findBySceneTypes(sceneTypes: List<Int>): List<SceneInfo?> {
        if (sceneTypes.isEmpty()){
            return emptyList()