- 측점 계획 planStations(TS) ↔ plan_stations(py): 관 · 구조물 + 구조물 표 → 측점 · 역할 · 카드 이름 · 덮는 구조물 id · 빈칸 경고(형상 부품 필수 칸) · 같은 m 하나(이름 = 관 먼저 · 앞선 것) - 서버 resolve_extra_stations = 계획(같은 자리 한 번 · 옛 「마지막 이름」 걷음) · _stale_marks = 자리 + 이름(종류 · 관 공식 · 정의 판 이름) - 카드 목록(Section_Drafts) = 계획 이름 · 일반 측점 자리(regular)에 새로 놓은 구조물 = 그 자리 구조물 없는 사본에 이름 칩 · 관 그림 · 벽 · 포장(219 흠) - B05 종단 · 3D 측점 = 계획(design_structure_status.plannedIrregular) · 배수유역도로 관 자리 되먹임 끊음 - B06 종단 띠 = 계획(관만 → 모든 종류 · 관 구간도 넘김) - 고름: followMovedPipe — 고른 관을 옮기면 고름도 새 자리(B05 폼 · 종단 끌기 · B06 옮김) - 부품 상자 형상 「필수 칸」(관경 · 벽 높이 · 맹암거 높이 · 물넘이 높이 · 기슭막이 높이) - 시험: test_322_3_plan_mirror(거울 · 규칙 · 서버 공급자 · 낡음) · test_322_3_flow(흐름 일곱 + 고름 따라감) · 272_1 = 같은 자리 한 번 · 318 도움 파일 표 모듈 한 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
48 lines
2.4 KiB
TypeScript
48 lines
2.4 KiB
TypeScript
/* =============================================================================
|
|
* A00_Common/design/design_structure_status.ts
|
|
* 구조물 현황 한 벌(322-3) — 저장분 둘(관 `pipe_points.json` · 구조물 `structures.json`) + 초안 둘(세션)
|
|
* → 한 목록(초안이 있으면 초안 · 없으면 저장분 · 종류마다 따로) · 측점 계획 한 벌(`planStations`) →
|
|
* 종단 측점 목록(B05 종단 · 3D 막대 · B06 종단 띠가 같은 꼴).
|
|
*
|
|
* 구조물 id = 구조물은 structure_id · 관은 자리 이름 `pipe-{누가거리 2자리}`(파일 모양 그대로 · 저장 안 함).
|
|
* ========================================================================== */
|
|
|
|
import type { IrregularStation } from "../../B05_Profile/B05_Profile_UI_IrregularStations";
|
|
import type { PlannedStation } from "../../common_util/common_util_structure_station";
|
|
|
|
/** 현황 — 종류마다 초안이 앞섬(초안 null = 만진 적 없음 · 빈 목록 = 다 지움). */
|
|
export function structureStatus<P, S>(
|
|
saved: readonly [ReadonlyArray<P>, ReadonlyArray<S>],
|
|
drafts: readonly [ReadonlyArray<P> | null, ReadonlyArray<S> | null],
|
|
): { pipes: P[]; structures: S[] } {
|
|
return { pipes: [...(drafts[0] ?? saved[0])], structures: [...(drafts[1] ?? saved[1])] };
|
|
}
|
|
|
|
/** 관 id(현황 · 알약 · 고름이 같은 값) — 자리 이름. */
|
|
export const pipeId = (chainageM: number): string => `pipe-${chainageM.toFixed(2)}`;
|
|
|
|
/**
|
|
* 측점 계획 → 종단 측점(측점번호 · 잔여거리 = 간격 기준) — 기준 측점 id = 첫 주인 id(관 = `pipe-…` ·
|
|
* 구조물 = structure_id) · 시작 · 끝 = `{id}:{역할}`(옮겨도 계획고 편집이 따라감 · 272) · 관 기준 측점 =
|
|
* 「배관」 꼴(관 끌기 · 지우기 길).
|
|
*/
|
|
export function plannedIrregular(
|
|
planned: ReadonlyArray<PlannedStation>,
|
|
intervalM: number,
|
|
): IrregularStation[] {
|
|
const interval = intervalM > 0 ? intervalM : 20;
|
|
return planned.map((station) => {
|
|
const owner = station.owners[0];
|
|
const pipe = owner.startsWith("pipe-") && station.role === "anchor";
|
|
const number = Math.floor(station.chainage_m / interval);
|
|
return {
|
|
id: station.role === "anchor" ? owner : `${owner}:${station.role}`,
|
|
station: number,
|
|
remainder: station.chainage_m - number * interval,
|
|
chainage_m: station.chainage_m,
|
|
structure: station.title,
|
|
...(pipe ? { structureType: "배관" as const, origin: "pipe" as const } : {}),
|
|
};
|
|
});
|
|
}
|