refactor(prediction): layerColors 상태를 OilSpillView로 끌어올림
InfoLayerSection 내부 상태였던 layerColors를 OilSpillView에서 관리하도록 변경하여 MapView에 색상 정보를 전달할 수 있도록 함. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
부모
646fa38f39
커밋
fbdf0e9122
@ -1,4 +1,3 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { LayerTree } from '@common/components/layer/LayerTree';
|
import { LayerTree } from '@common/components/layer/LayerTree';
|
||||||
import { useLayerTree } from '@common/hooks/useLayers';
|
import { useLayerTree } from '@common/hooks/useLayers';
|
||||||
import type { Layer } from '@common/services/layerService';
|
import type { Layer } from '@common/services/layerService';
|
||||||
@ -12,6 +11,8 @@ interface InfoLayerSectionProps {
|
|||||||
onLayerOpacityChange: (val: number) => void;
|
onLayerOpacityChange: (val: number) => void;
|
||||||
layerBrightness: number;
|
layerBrightness: number;
|
||||||
onLayerBrightnessChange: (val: number) => void;
|
onLayerBrightnessChange: (val: number) => void;
|
||||||
|
layerColors: Record<string, string>;
|
||||||
|
onLayerColorChange: (layerId: string, color: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const InfoLayerSection = ({
|
const InfoLayerSection = ({
|
||||||
@ -23,12 +24,12 @@ const InfoLayerSection = ({
|
|||||||
onLayerOpacityChange,
|
onLayerOpacityChange,
|
||||||
layerBrightness,
|
layerBrightness,
|
||||||
onLayerBrightnessChange,
|
onLayerBrightnessChange,
|
||||||
|
layerColors,
|
||||||
|
onLayerColorChange,
|
||||||
}: InfoLayerSectionProps) => {
|
}: InfoLayerSectionProps) => {
|
||||||
// API에서 레이어 트리 데이터 가져오기 (관리자 설정 USE_YN='Y' 레이어만 반환)
|
// API에서 레이어 트리 데이터 가져오기 (관리자 설정 USE_YN='Y' 레이어만 반환)
|
||||||
const { data: layerTree, isLoading } = useLayerTree();
|
const { data: layerTree, isLoading } = useLayerTree();
|
||||||
|
|
||||||
const [layerColors, setLayerColors] = useState<Record<string, string>>({});
|
|
||||||
|
|
||||||
// 관리자에서 사용여부가 ON인 레이어만 표시 (정적 폴백 없음)
|
// 관리자에서 사용여부가 ON인 레이어만 표시 (정적 폴백 없음)
|
||||||
const effectiveLayers: Layer[] = layerTree ?? [];
|
const effectiveLayers: Layer[] = layerTree ?? [];
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ const InfoLayerSection = ({
|
|||||||
enabledLayers={enabledLayers}
|
enabledLayers={enabledLayers}
|
||||||
onToggleLayer={onToggleLayer}
|
onToggleLayer={onToggleLayer}
|
||||||
layerColors={layerColors}
|
layerColors={layerColors}
|
||||||
onColorChange={(id, color) => setLayerColors((prev) => ({ ...prev, [id]: color }))}
|
onColorChange={onLayerColorChange}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@ -108,6 +108,8 @@ export function LeftPanel({
|
|||||||
onLayerOpacityChange,
|
onLayerOpacityChange,
|
||||||
layerBrightness,
|
layerBrightness,
|
||||||
onLayerBrightnessChange,
|
onLayerBrightnessChange,
|
||||||
|
layerColors,
|
||||||
|
onLayerColorChange,
|
||||||
sensitiveResources = [],
|
sensitiveResources = [],
|
||||||
onImageAnalysisResult,
|
onImageAnalysisResult,
|
||||||
validationErrors,
|
validationErrors,
|
||||||
@ -345,6 +347,8 @@ export function LeftPanel({
|
|||||||
onLayerOpacityChange={onLayerOpacityChange}
|
onLayerOpacityChange={onLayerOpacityChange}
|
||||||
layerBrightness={layerBrightness}
|
layerBrightness={layerBrightness}
|
||||||
onLayerBrightnessChange={onLayerBrightnessChange}
|
onLayerBrightnessChange={onLayerBrightnessChange}
|
||||||
|
layerColors={layerColors}
|
||||||
|
onLayerColorChange={onLayerColorChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Oil Boom Placement Guide Section */}
|
{/* Oil Boom Placement Guide Section */}
|
||||||
|
|||||||
@ -216,9 +216,10 @@ export function OilSpillView() {
|
|||||||
const [drawingPoints, setDrawingPoints] = useState<BoomLineCoord[]>([]);
|
const [drawingPoints, setDrawingPoints] = useState<BoomLineCoord[]>([]);
|
||||||
const [containmentResult, setContainmentResult] = useState<ContainmentResult | null>(null);
|
const [containmentResult, setContainmentResult] = useState<ContainmentResult | null>(null);
|
||||||
|
|
||||||
// 레이어 스타일 (투명도 / 밝기)
|
// 레이어 스타일 (투명도 / 밝기 / 색상)
|
||||||
const [layerOpacity, setLayerOpacity] = useState(50);
|
const [layerOpacity, setLayerOpacity] = useState(50);
|
||||||
const [layerBrightness, setLayerBrightness] = useState(50);
|
const [layerBrightness, setLayerBrightness] = useState(50);
|
||||||
|
const [layerColors, setLayerColors] = useState<Record<string, string>>({});
|
||||||
|
|
||||||
// 표시 정보 제어
|
// 표시 정보 제어
|
||||||
const [displayControls, setDisplayControls] = useState<DisplayControls>({
|
const [displayControls, setDisplayControls] = useState<DisplayControls>({
|
||||||
@ -1200,6 +1201,8 @@ export function OilSpillView() {
|
|||||||
onLayerOpacityChange={setLayerOpacity}
|
onLayerOpacityChange={setLayerOpacity}
|
||||||
layerBrightness={layerBrightness}
|
layerBrightness={layerBrightness}
|
||||||
onLayerBrightnessChange={setLayerBrightness}
|
onLayerBrightnessChange={setLayerBrightness}
|
||||||
|
layerColors={layerColors}
|
||||||
|
onLayerColorChange={(id, color) => setLayerColors((prev) => ({ ...prev, [id]: color }))}
|
||||||
sensitiveResources={sensitiveResourceCategories}
|
sensitiveResources={sensitiveResourceCategories}
|
||||||
onImageAnalysisResult={handleImageAnalysisResult}
|
onImageAnalysisResult={handleImageAnalysisResult}
|
||||||
validationErrors={validationErrors}
|
validationErrors={validationErrors}
|
||||||
@ -1236,6 +1239,7 @@ export function OilSpillView() {
|
|||||||
drawingPoints={drawingPoints}
|
drawingPoints={drawingPoints}
|
||||||
layerOpacity={layerOpacity}
|
layerOpacity={layerOpacity}
|
||||||
layerBrightness={layerBrightness}
|
layerBrightness={layerBrightness}
|
||||||
|
layerColors={layerColors}
|
||||||
sensitiveResources={sensitiveResources}
|
sensitiveResources={sensitiveResources}
|
||||||
sensitiveResourceGeojson={
|
sensitiveResourceGeojson={
|
||||||
displayControls.showSensitiveResources ? sensitiveResourceGeojson : null
|
displayControls.showSensitiveResources ? sensitiveResourceGeojson : null
|
||||||
|
|||||||
@ -54,6 +54,8 @@ export interface LeftPanelProps {
|
|||||||
onLayerOpacityChange: (val: number) => void;
|
onLayerOpacityChange: (val: number) => void;
|
||||||
layerBrightness: number;
|
layerBrightness: number;
|
||||||
onLayerBrightnessChange: (val: number) => void;
|
onLayerBrightnessChange: (val: number) => void;
|
||||||
|
layerColors: Record<string, string>;
|
||||||
|
onLayerColorChange: (layerId: string, color: string) => void;
|
||||||
// 영향 민감자원
|
// 영향 민감자원
|
||||||
sensitiveResources?: SensitiveResourceCategory[];
|
sensitiveResources?: SensitiveResourceCategory[];
|
||||||
// 이미지 분석 결과 콜백
|
// 이미지 분석 결과 콜백
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user