Files
Aislo/common_util/common_util_structure_underdrain.ts
T
eomsangdonandClaude Opus 5.5 bbd6254892 feat(구조물표): 322-1 부품 상자 · 표 읽기 — 목록 · 측점 · 카드 이름 · 형상 고르기 · 3D 몸체 · 알약 띠가 종류 키 · 군 글자 · 자리꼴 · managed_by 대신 구조물 표(catalog) 한 줄을 읽음 · 코드 숨김 목록 걷음 · ★ 넷 + 관 공식 한 벌
- 부품 상자 common_util_structure_parts.json(갈래마다 부품 · 읽는 칸 · 자리꼴 · 정본 · 42종 처음값) · 표 읽기 common_util_structure_catalog.ts / .py 짝(정의 반영 ⊕ 처음값 ⊕ 부품 끔) · 거울 시험 test_322_1_catalog_mirror
- 목록: pickGroups 군 차례 = 구조물군 열쇠 · 페이지 거르기 listPick(B05 both · B06 both + b06) · HIDDEN_PICK_GROUPS · HIDDEN_PICK_TYPES · pickable 걷음(옛 대피 셋 asRoad 그대로)
- 측점: structureStationMarks · pipeStationMarks · is_station_planting_type · resolve_extra_stations = 표 횡단도(anchor · span3 · none)
- 카드 이름: cardTitle / card_title 한 공식(빈칸 = 그 종류 정의 기본값) · 표시 이름이 정의 관종도 앎
- 형상: 벽 = shape wall(형태 = 형상칸.form · 물빼기 = 형상칸.weep) · 포장 = shape pavement(「사용 중」 거르기 없앰) · 맹암거 · 사토 · 관 지점 시설 세트 = shape
- 3D 몸체 = 그림 자료 주인 종류의 표 3D 부품 · 알약 띠 = 표 자리꼴 구간(관 지점 시설은 알약만)
- ★1 노출형 · 개거 횡단도 none · ★2 쇄석 화면에서도 포장층 · ★3 기슭막이 표 자리꼴 interval(정의 파일 그대로) · ★4 코드 숨김 10종 list hidden · ★5 관 빈칸 D800 → 정의 기본 D1000
- 옛 시험: 도움 파일 로더 27개가 표 모듈 공용 한 벌(helper_322_catalog_module) 씀 · 기대값 고침(272_1 · b05_extra_stations · roundtrip · 314 · 52_7 · walls 거울 · wall_drain_pipe)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
2026-10-14 15:09:45 +09:00

69 lines
2.7 KiB
TypeScript

/* =============================================================================
* common_util/common_util_structure_underdrain.ts
* 맹암거(cross_underdrain · A군 점형) 제원을 횡단 측점에 얹는다(288-1).
*
* 기준 측점(0.02 m 안) 횡단 dict 에 `underdrain` = 높이 · 경사 — 횡단도가 돌 무늬 형상을 그리고,
* 설계 계산은 그 측점을 측구 없이 지대 낮은 쪽 한 경사로 기울임(`tilted`).
* 파이썬 짝 = `B06_Section/B06_Section_Engine_Tilt.py`(`load_underdrains` · `attach_underdrains`).
* 맹암거 종류 = 구조물 표 형상 underdrain(322-1).
* ========================================================================== */
import { catalogRow } from "./common_util_structure_catalog";
const EDGE_TOLERANCE_M = 0.02;
/** 맹암거 제원 — 높이 · 경사가 비면 null(높이 없으면 형상 없음 · 경사 없으면 표준 횡단경사). */
export interface UnderdrainSpec {
structure_id: string | null;
chainage_m: number;
height_m: number | null;
slope_pct: number | null;
}
export interface UnderdrainInput {
structure_id?: string | null;
type_id: string;
chainage_m?: number | null;
start_m?: number | null;
options?: Record<string, unknown> | null;
}
const positive = (value: unknown): number | null => {
const parsed = value === "" || value === null || value === undefined ? NaN : Number(value);
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
};
/** 구조물 목록의 맹암거 제원(파이썬 `load_underdrains` 짝). */
export function underdrainSpecsFrom(structures: readonly UnderdrainInput[]): UnderdrainSpec[] {
return structures.flatMap((structure) => {
const at = structure.chainage_m ?? structure.start_m;
if (catalogRow(structure.type_id)?.shape !== "underdrain" || typeof at !== "number") return [];
const options = structure.options ?? {};
return [
{
structure_id: structure.structure_id ?? null,
chainage_m: at,
height_m: positive(options.culvert_height_m),
slope_pct: positive(options.culvert_slope_pct),
},
];
});
}
/** 기준 측점 횡단 dict 에 `underdrain` 을 얹는다(옛 값은 걷음) — 얹은 개수(파이썬 `attach_underdrains` 짝). */
export function attachUnderdrainSpecs(
sections: Array<Record<string, unknown>>,
specs: readonly UnderdrainSpec[],
): number {
let attached = 0;
for (const section of sections) {
delete section.underdrain;
const chainage = Number(section.chainage_m);
const hit = specs.find((spec) => Math.abs(spec.chainage_m - chainage) <= EDGE_TOLERANCE_M);
if (!hit) continue;
section.underdrain = { ...hit };
attached += 1;
}
return attached;
}