feiyu02
2025-10-21 eb3dd00b0b7fcda477229d518d250f9c842b790b
src/main/kotlin/com/flightfeather/uav/domain/repository/SceneInfoRep.kt
@@ -4,6 +4,7 @@
import com.flightfeather.uav.domain.entity.SceneInfo
import com.flightfeather.uav.domain.mapper.SceneInfoMapper
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.eunm.SceneType
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
@@ -46,12 +47,16 @@
    /**
     * 根据多边形筛选场景
     * @param polygon 多边形坐标列表,顺序为顺时针或逆时针(要求使用火星坐标系)
     * @param filter 需要过滤掉的场景类型
     * @return 多边形内的场景列表
     */
    fun findByPolygon(polygon: List<Pair<Double, Double>>): List<SceneInfo?> {
    fun findByPolygon(polygon: List<Pair<Double, Double>>, filter: List<SceneType> = emptyList()): List<SceneInfo?> {
        val _filter = filter.map { it.value.toByte() }
        // 计算多边形四至范围
        val bounds = MapUtil.calFourBoundaries(polygon)
        val sceneList = findByCoordinateRange(bounds)
        val sceneList = findByCoordinateRange(bounds).filter {
            filter.isEmpty() || !_filter.contains(it?.typeId)
        }
        // 筛选是否在反向溯源区域多边形内部
        return sceneList.filter { scene ->
            scene ?: false