- 상자 안 칸을 고치면 지금 보기의 목록 고름 길로 이동(횡단 = 측점 카드 · 종단 = 측점선 · 알약) - 같은 칸을 거듭 고치면 스크롤 한 번(다시 그려도 칸 이름으로 셈) - 단 늘림 · [추가]로 상자가 새로 서면 그 상자 강조 - 배관 도수로/돌붙임 컨테이너 max 1 — 하나 있으면 [추가] 숨김 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
201 lines
7.0 KiB
TypeScript
201 lines
7.0 KiB
TypeScript
/* =============================================================================
|
|
* design_structure_pipe.ts
|
|
* 횡단배수 › 배관 명세 — 사용자 구조물 표 01(`docs/raw/구조물정의_표/01_횡단배수_배관.md`) 그대로.
|
|
*
|
|
* 컨테이너 다섯: 관(필수) · 관 보호공(유입)(필수) · 관 보호공(유출)(필수) · 흙막이(선택 · 개수 = 유출
|
|
* 「추가 기슭막이(단)」 · 54-1) · 도수로/돌붙임(선택 · 여러 개). 집수정 = 길이 · 전 · 후 없음(54-1).
|
|
* 구조 · 정본 = 이 명세 · 이름만 정의(M02)에서 바꿈.
|
|
* 저장 키 = pipe_points.json 옛 키 그대로(B06 횡단 · B07 · B08 이 읽는 자리) — 흙막이 값은 옛 「기슭막이」
|
|
* (`inlet_type` · `*_revet_*`)에 둠. 새 키 = 집수정 높이 · 선택 컨테이너(`soil_add_{n}_*` · `chute_add_{n}_*`).
|
|
* 정함(PLAN 52): 유출 형태 = 흙막이 6가지 · 도수로/돌붙임 = 구조만 · 길이 = 전 + 후 맞물림.
|
|
* 계산(관 길이 · 높이 안내)은 `design_structure_pipe_calc`.
|
|
* import = 같은 폴더 명세뿐 — 시험이 이 폴더 파일만 옮겨 돌림.
|
|
* ========================================================================== */
|
|
|
|
import type { SpecChoice, SpecItem, StructureSpec } from "./design_structure_spec";
|
|
import { BOX_SPEC } from "./design_structure_box";
|
|
import { FORD_SPEC } from "./design_structure_ford";
|
|
import { FORD_PAVEMENT_SPEC } from "./design_structure_ford_pavement";
|
|
import { ETC_SPEC, PAVEMENT_SPEC } from "./design_structure_road";
|
|
|
|
const SOIL = "기슭막이"; // 저장 값(옛 키 그대로) — 화면 이름은 흙막이
|
|
const BASIN = "집수정";
|
|
const SOIL_FORMS: SpecChoice[] = [
|
|
{ value: "돌쌓기(찰)", label: "돌 쌓기(찰)" },
|
|
{ value: "돌쌓기(메)", label: "돌 쌓기(메)" },
|
|
{ value: "콘크리트", label: "콘크리트" },
|
|
{ value: "돌망태", label: "돌망태" },
|
|
{ value: "통나무·목재틀", label: "통나무/목재틀" },
|
|
{ value: "바자", label: "바자" },
|
|
];
|
|
const BASIN_FORMS: SpecChoice[] = [
|
|
{ value: "I", label: "I형" },
|
|
{ value: "L", label: "L형" },
|
|
{ value: "U", label: "ㄷ형" },
|
|
];
|
|
|
|
/** 추가 흙막이 기본값(54-36 · 사면안정 흙막이 정의 기본값과 같음) — 필수 보호공 기본값은 정의 파일. */
|
|
const SOIL_ADD_DEFAULTS: Record<string, string> = {
|
|
form: "돌쌓기(찰)",
|
|
length: "10",
|
|
height: "1.5",
|
|
before: "5",
|
|
after: "5",
|
|
};
|
|
|
|
/** 형태 · 길이 · 높이 · 전 · 후 — 필수 보호공은 구조 갈래마다 옛 키 · 선택 흙막이는 인스턴스 키. */
|
|
function guardItems(keys?: Record<string, Record<string, string>>): SpecItem[] {
|
|
const by = (field: string, choices?: Record<string, SpecChoice[]>) =>
|
|
keys
|
|
? {
|
|
item: "structure",
|
|
map: Object.fromEntries(
|
|
// 키 없는 갈래 = 그 구조에 없는 칸(집수정 길이 · 전 · 후) — 가림
|
|
Object.entries(keys)
|
|
.filter(([, k]) => k[field])
|
|
.map(([structure, k]) => [
|
|
structure,
|
|
{ key: k[field], choices: choices?.[structure] },
|
|
]),
|
|
),
|
|
}
|
|
: undefined;
|
|
const items: SpecItem[] = [
|
|
{
|
|
id: "form",
|
|
label: "형태",
|
|
kind: "select",
|
|
choices: SOIL_FORMS,
|
|
by: by("form", { [BASIN]: BASIN_FORMS, [SOIL]: SOIL_FORMS }),
|
|
},
|
|
{ id: "length", label: "길이 (m)", kind: "number", split: "length", step: 1, by: by("length") },
|
|
{ id: "height", label: "높이 (m)", kind: "number", step: 0.1, by: by("height") },
|
|
{
|
|
id: "before",
|
|
label: "기준측점 전 (m)",
|
|
kind: "number",
|
|
split: "before",
|
|
step: 0.5,
|
|
by: by("before"),
|
|
},
|
|
{
|
|
id: "after",
|
|
label: "기준측점 후 (m)",
|
|
kind: "number",
|
|
split: "after",
|
|
step: 0.5,
|
|
by: by("after"),
|
|
},
|
|
];
|
|
return keys ? items : items.map((item) => ({ ...item, default: SOIL_ADD_DEFAULTS[item.id] }));
|
|
}
|
|
|
|
const revetKeys = (side: "inlet" | "outlet"): Record<string, string> => ({
|
|
form: `${side}_revet_form`,
|
|
length: `${side}_revet_length_m`,
|
|
height: `${side}_revet_height_m`,
|
|
before: `${side}_revet_before_m`,
|
|
after: `${side}_revet_after_m`,
|
|
});
|
|
|
|
export const PIPE_SPEC: StructureSpec = {
|
|
typeId: "pipe",
|
|
containers: [
|
|
{
|
|
id: "pipe",
|
|
title: "관",
|
|
required: true,
|
|
link: "grv6lny", // 정의 그룹 「관」(46장) — 집계표 잇기 자리 그대로
|
|
items: [
|
|
{
|
|
id: "diameter",
|
|
label: "관경",
|
|
kind: "select",
|
|
key: "pipe_diameter_mm",
|
|
asNumber: true,
|
|
choices: ["800", "1000", "1200", "1500"].map((v) => ({ value: v, label: v })),
|
|
},
|
|
{ id: "length", label: "관 길이 (m)", kind: "auto" },
|
|
],
|
|
},
|
|
{
|
|
id: "inlet",
|
|
title: "관 보호공 (유입)",
|
|
required: true,
|
|
link: "gnbf9m9",
|
|
items: [
|
|
{
|
|
id: "structure",
|
|
label: "구조",
|
|
kind: "select",
|
|
key: "inlet_type",
|
|
choices: [
|
|
{ value: BASIN, label: "집수정" },
|
|
{ value: SOIL, label: "흙막이", also: { inlet_structure: "revet" } },
|
|
],
|
|
},
|
|
...guardItems({
|
|
[BASIN]: { form: "inlet_structure", height: "inlet_basin_height_m" },
|
|
[SOIL]: revetKeys("inlet"),
|
|
}),
|
|
],
|
|
},
|
|
{
|
|
id: "outlet",
|
|
title: "관 보호공 (유출)",
|
|
required: true,
|
|
link: "g9lq9uk",
|
|
items: [
|
|
{
|
|
id: "structure",
|
|
label: "구조",
|
|
kind: "select",
|
|
key: "outlet_type",
|
|
choices: [{ value: SOIL, label: "흙막이" }],
|
|
},
|
|
...guardItems({ [SOIL]: revetKeys("outlet") }),
|
|
],
|
|
},
|
|
{
|
|
id: "soil_add",
|
|
title: "흙막이",
|
|
required: false,
|
|
prefix: "soil_add",
|
|
link: "gsoiladd",
|
|
// 사면안정 흙막이(표 09 · 54-26)와 같은 칸 — 형태 6 · 길이 · 높이 · 전 · 후 · 구조 고르기 없음(54-30)
|
|
items: guardItems(),
|
|
},
|
|
{
|
|
id: "chute_add",
|
|
title: "도수로/돌붙임",
|
|
required: false,
|
|
prefix: "chute_add",
|
|
link: "gchuteadd",
|
|
max: 1, // 하나만(54-48) — 옛 둘 이상은 보이되 [추가]만 숨김
|
|
items: [
|
|
{
|
|
id: "structure",
|
|
label: "구조",
|
|
kind: "select",
|
|
choices: [
|
|
{ value: "도수로", label: "도수로" },
|
|
{ value: "돌붙임", label: "돌붙임" },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
// 표 01 에 없는 옛 칸 — 화면에서 빼고 값은 남김(지난 정의 값)
|
|
retired: ["pipe_kind", "wing_wall_type", "inlet_basin_form", "inlet_basin_material"],
|
|
};
|
|
|
|
/** 명세로 그리는 종류 — 종류 키 → 명세(표가 오는 대로 더함). */
|
|
export const STRUCTURE_SPECS: Readonly<Record<string, StructureSpec>> = {
|
|
pipe: PIPE_SPEC,
|
|
box_culvert: BOX_SPEC,
|
|
ford_bridge: FORD_SPEC,
|
|
ford_pavement: FORD_PAVEMENT_SPEC,
|
|
pavement_concrete: PAVEMENT_SPEC,
|
|
etc: ETC_SPEC,
|
|
};
|