diff --git a/frontend/src/tabs/prediction/components/RightPanel.tsx b/frontend/src/tabs/prediction/components/RightPanel.tsx index 55d6a37..3f309af 100755 --- a/frontend/src/tabs/prediction/components/RightPanel.tsx +++ b/frontend/src/tabs/prediction/components/RightPanel.tsx @@ -18,11 +18,10 @@ export function RightPanel({ onOpenBacktrack, onOpenRecalc, onOpenReport, detail const [shipExpanded, setShipExpanded] = useState(false) const [insuranceExpanded, setInsuranceExpanded] = useState(false) const [polygonResult, setPolygonResult] = useState<{ areaKm2: number; perimeterKm: number; particleCount: number; hullPoints: number } | null>(null) - const [showCircleInput, setShowCircleInput] = useState(false) - const [circleCenterLat, setCircleCenterLat] = useState('') - const [circleCenterLon, setCircleCenterLon] = useState('') - const [circleRadiusKm, setCircleRadiusKm] = useState('') - const [circleResult, setCircleResult] = useState<{ areaKm2: number; circumferenceKm: number; centerLat: number; centerLon: number; radiusKm: number } | null>(null) + const [analysisTab, setAnalysisTab] = useState<'polygon' | 'circle'>('polygon') + const [circleRadiusNm, setCircleRadiusNm] = useState('5') + const [circleResult, setCircleResult] = useState<{ areaKm2: number; areaNm2: number; circumferenceKm: number; radiusNm: number } | null>(null) + const NM_PRESETS = [1, 3, 5, 10, 15, 20, 30, 50] return (
@@ -50,131 +49,136 @@ export function RightPanel({ onOpenBacktrack, onOpenRecalc, onOpenReport, detail {/* 오염분석 */}
-
+ {/* 탭 버튼 */} +
+ onClick={() => setAnalysisTab('polygon')} + className="flex-1 py-1.5 px-2 rounded text-[10px] font-semibold font-korean cursor-pointer transition-colors" + style={analysisTab === 'polygon' + ? { background: 'rgba(6,182,212,0.12)', border: '1px solid var(--cyan)', color: 'var(--cyan)' } + : { background: 'var(--bg0)', border: '1px solid var(--bd)', color: 'var(--t3)' } + } + >다각형 분석 + onClick={() => setAnalysisTab('circle')} + className="flex-1 py-1.5 px-2 rounded text-[10px] font-semibold font-korean cursor-pointer transition-colors" + style={analysisTab === 'circle' + ? { background: 'rgba(6,182,212,0.12)', border: '1px solid var(--cyan)', color: 'var(--cyan)' } + : { background: 'var(--bg0)', border: '1px solid var(--bd)', color: 'var(--t3)' } + } + >원 분석
- {/* 원 분석 입력 폼 */} - {showCircleInput && ( -
-
⭕ 원 분석 — 중심점 · 반경 입력
-
-
- - setCircleCenterLat(e.target.value)} - placeholder="예: 34.7312" - className="w-full px-2 py-1.5 bg-bg-3 border border-border rounded text-[10px] font-mono text-text-1 outline-none focus:border-[var(--cyan)] transition-colors" - /> -
-
- - setCircleCenterLon(e.target.value)} - placeholder="예: 127.6845" - className="w-full px-2 py-1.5 bg-bg-3 border border-border rounded text-[10px] font-mono text-text-1 outline-none focus:border-[var(--cyan)] transition-colors" - /> -
+ {/* ── 다각형 분석 탭 ── */} + {analysisTab === 'polygon' && ( + <> +

+ 지도에서 다각형 영역을 지정하여 해당 범위 내 오염도를 분석합니다. +

+ + + )} + + {/* ── 원 분석 탭 ── */} + {analysisTab === 'circle' && ( + <> +

+ 반경(NM)을 지정하면 사고지점 기준 원형 영역의 오염도를 분석합니다. +

+ + {/* 반경 선택 (NM) */} +
반경 선택 (NM)
+
+ {NM_PRESETS.map(nm => ( + + ))}
-
- + + {/* 직접 입력 + 분석 실행 */} +
+ 직접 입력 setCircleRadiusKm(e.target.value)} - placeholder="예: 3.0" - className="w-full px-2 py-1.5 bg-bg-3 border border-border rounded text-[10px] font-mono text-text-1 outline-none focus:border-[var(--cyan)] transition-colors" + value={circleRadiusNm} + onChange={e => setCircleRadiusNm(e.target.value)} + className="w-[60px] px-2 py-1.5 bg-bg-3 border border-border rounded text-[10px] font-mono text-text-1 text-center outline-none focus:border-[var(--cyan)] transition-colors" /> + NM +
- -
+ )} {/* 원 분석 결과 */} - {circleResult && ( -
-
⭕ 원 분석 결과
+ {analysisTab === 'circle' && circleResult && ( +
+
⭕ 원 분석 결과 (반경 {circleResult.radiusNm} NM)
-
{circleResult.areaKm2.toFixed(2)}
-
오염 면적 (km²)
+
{circleResult.areaNm2.toFixed(1)}
+
면적 (NM²)
-
{circleResult.circumferenceKm.toFixed(1)}
+
{circleResult.areaKm2.toFixed(1)}
+
면적 (km²)
+
+
+
{circleResult.circumferenceKm.toFixed(1)}
원 둘레 (km)
-
{circleResult.radiusKm.toFixed(1)}
+
{(circleResult.radiusNm * 1.852).toFixed(1)}
반경 (km)
-
-
{circleResult.centerLat.toFixed(4)}°N
-
{circleResult.centerLon.toFixed(4)}°E
-
중심 좌표
-
)} - {polygonResult && ( + {/* 다각형 분석 결과 */} + {analysisTab === 'polygon' && polygonResult && (
📐 Convex Hull 다각형 분석 결과