From da077bf8841f79ad3301e8a133de6c879e1d52cd Mon Sep 17 00:00:00 2001 From: "jeonghyo.k" Date: Mon, 16 Mar 2026 11:51:48 +0900 Subject: [PATCH] =?UTF-8?q?fix(prediction):=20geo.ts=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20null?= =?UTF-8?q?=20=EC=A2=8C=ED=91=9C=20=EC=B0=B8=EC=A1=B0=20=EC=98=A4=EB=A5=98?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/common/utils/geo.ts | 17 ----------------- .../tabs/prediction/components/OilSpillView.tsx | 5 +++-- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/frontend/src/common/utils/geo.ts b/frontend/src/common/utils/geo.ts index a7d91c6..d955236 100755 --- a/frontend/src/common/utils/geo.ts +++ b/frontend/src/common/utils/geo.ts @@ -299,23 +299,6 @@ export function pointInPolygon( return inside } -/** 다각형 면적 (km²) — Shoelace formula, 구면 보정 포함 */ -export function polygonAreaKm2(polygon: { lat: number; lon: number }[]): number { - if (polygon.length < 3) return 0 - const n = polygon.length - const latCenter = polygon.reduce((s, p) => s + p.lat, 0) / n - const cosLat = Math.cos(latCenter * DEG2RAD) - let area = 0 - for (let i = 0; i < n; i++) { - const j = (i + 1) % n - const x1 = polygon[i].lon * cosLat * EARTH_RADIUS * DEG2RAD / 1000 - const y1 = polygon[i].lat * EARTH_RADIUS * DEG2RAD / 1000 - const x2 = polygon[j].lon * cosLat * EARTH_RADIUS * DEG2RAD / 1000 - const y2 = polygon[j].lat * EARTH_RADIUS * DEG2RAD / 1000 - area += x1 * y2 - x2 * y1 - } - return Math.abs(area) / 2 -} /** 원 면적 (km²) */ export function circleAreaKm2(radiusM: number): number { diff --git a/frontend/src/tabs/prediction/components/OilSpillView.tsx b/frontend/src/tabs/prediction/components/OilSpillView.tsx index 139cc6c..996b7d1 100755 --- a/frontend/src/tabs/prediction/components/OilSpillView.tsx +++ b/frontend/src/tabs/prediction/components/OilSpillView.tsx @@ -207,9 +207,10 @@ export function OilSpillView() { useEffect(() => { if (activeSubTab === 'analysis' && oilTrajectory.length === 0 && !selectedAnalysis) { const models = Array.from(selectedModels.size > 0 ? selectedModels : new Set(['OpenDrift'])) - const demoTrajectory = generateDemoTrajectory(incidentCoord, models, predictionTime) + const coord = incidentCoord ?? { lat: 37.39, lon: 126.64 } + const demoTrajectory = generateDemoTrajectory(coord, models, predictionTime) setOilTrajectory(demoTrajectory) - const demoBooms = generateAIBoomLines(demoTrajectory, incidentCoord, algorithmSettings) + const demoBooms = generateAIBoomLines(demoTrajectory, coord, algorithmSettings) setBoomLines(demoBooms) setSensitiveResources(DEMO_SENSITIVE_RESOURCES) }