- 맞춤 규칙 한 벌 — common_util_structure_station(파이썬 · TS 짝 · 거울 시험) - 입력 — 좌측 폼 칸(1 m 단계 · 친 값만) · 끌기 · 우클릭 · 방향키(1 m 걸음) · 배수유역도 관 · B06 관 옮김 · 추가 - 구간형 시작 · 끝도 정수 m · 일반 측점 = 횡단 상세를 읽을 때 등록 - 서버 자동 배치 · 노선 재투영 자리도 정수 m(확정본은 단추로만) - [정수 맞춤] — 구조물 목록 머리 · 확인 창 · 관은 하나씩 폼 [수정] 길 · 계획고 편집 따라감 · 결과 n건 알림 - 찾는 폭 한 값 — 손으로 적은 0.51 을 PIPE_MATCH_M 으로 - 시험 — test_234_1 새로 · 1 m 걸음 · 정수 입력에 맞춘 기대값 고침(219_1 · station_roundtrip) · 헬퍼 대역 보탬 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3mdb91125mPoC6tpsQx4P
64 lines
2.8 KiB
TypeScript
64 lines
2.8 KiB
TypeScript
/* =============================================================================
|
|
* B05_Profile_UI_Drainage_Ford_Fill.ts
|
|
* 우클릭으로 바로 추가한 세월교 · 물넘이포장의 빈 월류 높이 = 배수유역 재계산이 준 설계유량의
|
|
* 필요 수심(PLAN 126-1 · 폼 쪽 65-4 와 같은 풀이 `fordHeightM`).
|
|
*
|
|
* 기다리는 측점만 채움 · 사용자가 넣은 높이(응답 옵션에 있음)는 안 덮음 · 유량이 아직 없으면 다음
|
|
* 응답까지 기다림. 응답 옵션을 고쳐 두면 보관소(`replaceFromResponse`)가 그 값을 정본으로 받음.
|
|
* ========================================================================== */
|
|
|
|
import {
|
|
FORD_BRIDGE_DEFAULT_WIDTH_M,
|
|
FORD_PAVEMENT_DEFAULT_WIDTH_M,
|
|
} from "@config/config_frontend";
|
|
import { fordHeightM } from "../A00_Common/design/design_structure_ford_calc";
|
|
import { PIPE_MATCH_M } from "../A00_Common/design/design_selection";
|
|
|
|
const FORD_KINDS: Record<string, number> = {
|
|
ford_bridge: FORD_BRIDGE_DEFAULT_WIDTH_M,
|
|
ford_pavement: FORD_PAVEMENT_DEFAULT_WIDTH_M,
|
|
};
|
|
|
|
/** 새로 놓으면 높이를 기다리는 종류 — 높이 칸이 빈 세월교 · 물넘이포장. */
|
|
export function waitsFordHeight(
|
|
facility: string | undefined,
|
|
options?: Record<string, string | number>,
|
|
): boolean {
|
|
return !!facility && facility in FORD_KINDS && options?.ford_height_m === undefined;
|
|
}
|
|
|
|
/** 기다리는 측점의 빈 높이를 채움 — 채운(또는 사용자 값이라 그만 기다릴) 측점은 `pending` 에서 뺌.
|
|
* 채운 것이 있으면 true(세션 초안에 다시 담을 것). */
|
|
export function fillFordHeights(
|
|
points: Array<{
|
|
chainage_m: number;
|
|
facility?: string;
|
|
options?: Record<string, string | number>;
|
|
}>,
|
|
basins: ReadonlyArray<{ chainage_m: number; design_flow_m3s?: number | null }>,
|
|
pending: Set<number>,
|
|
): boolean {
|
|
let filled = false;
|
|
for (const wait of [...pending]) {
|
|
const point = points.find((entry) => Math.abs(entry.chainage_m - wait) < PIPE_MATCH_M);
|
|
if (!point?.facility || !(point.facility in FORD_KINDS)) {
|
|
pending.delete(wait); // 관이 사라졌거나 종류가 바뀜
|
|
continue;
|
|
}
|
|
if (point.options?.ford_height_m !== undefined && point.options.ford_height_m !== "") {
|
|
pending.delete(wait); // 사용자가 넣은 값 — 안 덮음
|
|
continue;
|
|
}
|
|
const flow = basins.find(
|
|
(entry) => Math.abs(entry.chainage_m - point.chainage_m) < PIPE_MATCH_M,
|
|
);
|
|
const width = Number(point.options?.ford_width_m) || FORD_KINDS[point.facility];
|
|
const need = fordHeightM(flow?.design_flow_m3s ?? null, width);
|
|
if (need === null) continue; // 유량 아직 없음 — 다음 응답까지 빈칸
|
|
point.options = { ...point.options, ford_height_m: need };
|
|
pending.delete(wait);
|
|
filled = true;
|
|
}
|
|
return filled;
|
|
}
|