import { useState } from 'react' import type { BoomLine, BoomLineCoord, AlgorithmSettings, ContainmentResult } from '@common/types/boomLine' import { generateAIBoomLines, runContainmentAnalysis } from '@common/utils/geo' interface OilBoomSectionProps { expanded: boolean onToggle: () => void boomLines: BoomLine[] onBoomLinesChange: (lines: BoomLine[]) => void oilTrajectory: Array<{ lat: number; lon: number; time: number; particle?: number }> incidentCoord: { lon: number; lat: number } algorithmSettings: AlgorithmSettings onAlgorithmSettingsChange: (settings: AlgorithmSettings) => void isDrawingBoom: boolean onDrawingBoomChange: (drawing: boolean) => void drawingPoints: BoomLineCoord[] onDrawingPointsChange: (points: BoomLineCoord[]) => void containmentResult: ContainmentResult | null onContainmentResultChange: (result: ContainmentResult | null) => void } const DEFAULT_SETTINGS: AlgorithmSettings = { currentOrthogonalCorrection: 15, safetyMarginMinutes: 60, minContainmentEfficiency: 80, waveHeightCorrectionFactor: 1.0, } const OilBoomSection = ({ expanded, onToggle, boomLines, onBoomLinesChange, oilTrajectory, incidentCoord, algorithmSettings, onAlgorithmSettingsChange, onDrawingBoomChange, onDrawingPointsChange, containmentResult, onContainmentResultChange, }: OilBoomSectionProps) => { const [boomPlacementTab, setBoomPlacementTab] = useState<'ai' | 'simulation'>('simulation') const [showResetConfirm, setShowResetConfirm] = useState(false) const hasData = boomLines.length > 0 || containmentResult !== null /** V자형 오일붐 배치 + 차단 시뮬레이션 실행 */ const handleRunSimulation = () => { // 1단계: V자형 오일붐 자동 배치 const lines = generateAIBoomLines( oilTrajectory, { lat: incidentCoord.lat, lon: incidentCoord.lon }, algorithmSettings, ) onBoomLinesChange(lines) // 2단계: 차단 시뮬레이션 실행 const result = runContainmentAnalysis(oilTrajectory, lines) onContainmentResultChange(result) } /** 초기화 (오일펜스만, 확산예측 유지) */ const handleReset = () => { onBoomLinesChange([]) onDrawingBoomChange(false) onDrawingPointsChange([]) onContainmentResultChange(null) onAlgorithmSettingsChange({ ...DEFAULT_SETTINGS }) setShowResetConfirm(false) } return (
확산 궤적을 분석하여 해류 직교 방향 1차 방어선(V형), U형 포위 2차 방어선, 연안 보호 3차 방어선을 자동 배치하고 차단 시뮬레이션을 실행합니다.
{/* 시뮬레이션 결과 */} {containmentResult && containmentResult.totalParticles > 0 && (