/* ============================================================================= * map_layer_source.ts * 공용 지도 밖 겹 출처(PLAN 760-1 · 요구 598-4 「받아온 곳의 정보를 표기」) — 켠 겹의 받아온 곳을 범례 맨 아래 한 줄씩. * 받아온 곳 = 서버가 부르는 곳 그대로(브이월드 WFS · 위성 · 산림청 원자료 · 생활안전지도 WMS · 지오빅데이터 …) · * 자체 셈 겹(음영 · 급경사 · 0차곡 · 띠) · 사용자 올림(임도(업로드)) · 자기 지형(등고선 · 세류)은 안 적음. * ========================================================================== */ import type { LegendItem } from "@ui/ui_template_flow_legend"; import { LAYERS, type MapLayerKey } from "./map_layer_list"; /** 받아온 곳 → 겹(차례 = 범례 차례). */ export const LAYER_SOURCES: ReadonlyArray<[string, readonly MapLayerKey[]]> = [ ["브이월드", ["satellite", "cadastral", "zones", "faults", "lineaments"]], ["국토지리정보원 수치지형도", ["water", "road", "building", "place"]], ["산림청", ["nationalRoad", "ecoForest", "soils"]], ["시도 산사태취약지역 현황(공공데이터포털)", ["landslideZones"]], ["환경부 생태자연도(공공데이터포털)", ["ecology"]], ["행정안전부 생활안전지도(공공누리 제4유형)", ["landslide"]], ["한국지질자원연구원 수치지질도 1:50,000(CC BY-NC)", ["geology"]], ]; /** 켠 밖 겹의 출처 줄 — 「출처: 곳 — 겹 · 겹」 · 없으면 빈 것. */ export function sourceRow(on: Record): LegendItem[] { const title = (key: MapLayerKey): string => LAYERS.find((def) => def.key === key)?.title ?? key; return LAYER_SOURCES.flatMap(([where, keys]) => { const shown = keys.filter((key) => on[key]); return shown.length ? [{ label: `출처: ${where} — ${shown.map(title).join(" · ")}`, color: "transparent" }] : []; }); }