From 718aabb1db80e7efbb2e866ca3ae74bcd264e20a Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期一, 02 六月 2025 08:30:19 +0800 Subject: [PATCH] 1. 新增动态污染溯源新的判定逻辑(待完成) --- src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt index d0e3fd0..2dc6b58 100644 --- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt +++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSource.kt @@ -1,5 +1,11 @@ package com.flightfeather.uav.biz.sourcetrace.model +import com.flightfeather.uav.biz.FactorFilter +import com.flightfeather.uav.common.utils.MapUtil +import com.flightfeather.uav.domain.entity.SceneInfo +import com.flightfeather.uav.domain.repository.SceneInfoRep +import org.springframework.web.context.ContextLoader + /** * 姹℃煋鏉ユ簮 * 绯荤粺鍐呴儴鐨勬薄鏌撳満鏅�佺數瀛愬湴鍥炬悳绱㈠緱鍒扮殑瀹為檯璺璺彛绛夋爣蹇椾俊鎭� @@ -8,5 +14,44 @@ */ class PollutedSource { + /** + * 婧簮娓呭崟鏄剧ず涓庝复杩戠洃娴嬬珯鐐圭殑璺濈锛堝浗鎺с�佸競鎺с�佺綉鏍煎寲鐩戞祴鐐癸級 + * + */ + // 婧簮浼佷笟 + var sceneList:List<SceneInfo?>? = null + + fun searchScenes(pollutedArea: PollutedArea, factor: FactorFilter.SelectedFactor) { + ContextLoader.getCurrentWebApplicationContext()?.getBean(SceneInfoRep::class.java)?.run { + searchScenes(pollutedArea, this, factor) + } + } + + /** + * 鏌ユ壘绯荤粺鍐呴儴婧簮鑼冨洿鍐呯殑姹℃煋浼佷笟 + */ + fun searchScenes(pollutedArea: PollutedArea, sceneInfoRep: SceneInfoRep, factor: FactorFilter.SelectedFactor) { + // Fixme 2025.5.14: 姹℃煋婧愮殑鍧愭爣鏄珮寰峰湴鍥惧潗鏍囩郴锛堢伀鏄熷潗鏍囩郴锛夛紝鑰岃蛋鑸暟鎹槸WGS84鍧愭爣绯� + // 鎸夌収鍖哄煙妫�绱㈠唴閮ㄦ薄鏌撴簮淇℃伅 + // 1. 棣栧厛鎸夌収鍥涜嚦鑼冨洿浠庢暟鎹簱鍒濇绛涢�夋薄鏌撴簮锛岄渶瑕佸厛灏嗗潗鏍囪浆鎹负gcj02锛堢伀鏄熷潗鏍囩郴锛夛紝鍥犱负姹℃煋婧愬満鏅俊鎭兘涓烘鍧愭爣绯� + val polygonTmp = pollutedArea.polygon!!.map { + MapUtil.gcj02ToWgs84(it) + } + val fb = MapUtil.calFourBoundaries(polygonTmp) + val sceneList = sceneInfoRep.findByCoordinateRange(fb) + // 2. 鍐嶇簿纭垽鏂槸鍚﹀湪鍙嶅悜婧簮鍖哄煙澶氳竟褰㈠唴閮� + val result = mutableListOf<SceneInfo>() + sceneList.forEach { + val point = it!!.longitude.toDouble() to it.latitude.toDouble() + if (MapUtil.isPointInPolygon(point, polygonTmp)) { + result.add(it) + } + } + + this.sceneList = result + + TODO("鎸夌収鎵�閫夌洃娴嬪洜瀛愮被鍨嬶紝鍖哄垎姹℃煋婧愮被鍨�") + + } } \ No newline at end of file -- Gitblit v1.9.3