- createDrainageSide(host) — 종단쪽 이음은 DrainagePanelCallbacks 약속으로만 · setVisible · 켜고 끄는 단추 - 관 보고 만들기를 _Report 로 · DrainagePipeReport 형을 _Panel_Types 에 이름 붙임 · 관 요청 몸통 pipeRequest 하나로 - 시험: 종단 · B06 를 안 가져옴 · 700줄 · 관 보고 셈 · 켜고 끄는 창구 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019BVZd1M6WUf1YEy9gbAE1G
40 lines
2.2 KiB
TypeScript
40 lines
2.2 KiB
TypeScript
/* =============================================================================
|
|
* B05_Profile_UI_Drainage_Report.ts
|
|
* 배수유역 패널이 관 목록이 바뀔 때 밖에 알리는 **관 보고**(`DrainagePipeReport`)를 만든다.
|
|
* `B05_Profile_UI_Drainage_Panel` 에서 떼어냄(700줄 제한) — 셈은 그대로, 상태를 안 든다.
|
|
* ========================================================================== */
|
|
|
|
import type { DetailBasin, PipeSource } from "../B04_PreProcess/B04_PreProcess_Api_Fetch";
|
|
import type { createFacilityStore } from "./B05_Profile_UI_Drainage_Facility";
|
|
import type { DrainagePipeReport } from "./B05_Profile_UI_Drainage_Panel_Types";
|
|
|
|
/** 관마다 담당 유역의 배수 유효직경을 붙인다(±0.5m 매칭). 유역 없는 관은 null.
|
|
* 세월교 검토 유역(bridge_required)도 null — 관 규격을 최대치로 올려 봐야 무의미하고,
|
|
* 그 지점은 세월교·물넘이로 별도 설계한다(임도설치규정 제12조).
|
|
* 시설 종류·구간·부속 옵션·출처(source)도 함께 — 통합 목록·사이드 폼이
|
|
* 이 목록만으로 편집 화면을 채운다(2026-08-17 단일 폼 통합). */
|
|
export function buildPipeReports(
|
|
pipes: ReadonlyArray<{ chainage_m: number; reason?: string }>,
|
|
basins: ReadonlyArray<DetailBasin>,
|
|
facilityStore: ReturnType<typeof createFacilityStore>,
|
|
): DrainagePipeReport[] {
|
|
return pipes.map((pipe) => {
|
|
const chainage = Math.round(pipe.chainage_m * 100) / 100;
|
|
const basin = basins.find((entry) => Math.abs(entry.chainage_m - chainage) < 0.51);
|
|
const attributes = facilityStore.get(chainage);
|
|
return {
|
|
chainage_m: chainage,
|
|
effective_diameter_mm:
|
|
basin && !basin.bridge_required ? (basin.pipe_diameter_mm ?? null) : null,
|
|
// 설계유량은 세월교 검토 유역에도 붙인다 — 물넘이·세월교 단면이 이 값에서 나온다.
|
|
design_flow_m3s: basin?.design_flow_m3s ?? null,
|
|
facility: attributes?.facility ?? "pipe",
|
|
start_m: attributes?.start_m,
|
|
end_m: attributes?.end_m,
|
|
source: (pipe.reason || "user") as PipeSource,
|
|
options: attributes?.options,
|
|
summary_item: attributes?.summary_item,
|
|
};
|
|
});
|
|
}
|