80 lines
3.4 KiB
TypeScript
80 lines
3.4 KiB
TypeScript
/* =============================================================================
|
|
* A00_Common/design/logic/design_calc_node_sections.ts
|
|
* 계산 Node 입구(`design_calc_node.ts`)의 측점 몫(PLAN 511-B B-2) — 화면 묶음 stations 단계와 같은 TS.
|
|
*
|
|
* stations.list 입력 stations { line · curves · pipes · structures · types · definition? · plus ·
|
|
* interval_m · include_endpoint? · station_snap · station_snap_step } →
|
|
* 측점 목록(`buildStations` · 열쇠 · 종류 · 반경 · 확폭 · 지반 null) — 계산 자리 「서버」 ·
|
|
* 노선 저장 옛 노선 열쇠
|
|
* stations.sections 같은 입력 + grid(DTM 격자 이진 경로) · 표본 간격 → 서버 `generate_sections` 꼴
|
|
* (`generateSections`) — 서버 측점 생성 길만(창구 `/calc` 는 막음 · 경로 입력)
|
|
* definition = 구조물 정의(`{types, …정의}` · 화면 `fetchStructureTypes` 와 같은 꼴) — 심는 측점 · 카드 이름 표.
|
|
* ========================================================================== */
|
|
|
|
import { useCatalogDefinition, type CatalogDefinition } from "@util/common_util_structure_catalog";
|
|
import type { PlanPipe, PlanStructure, PlanType } from "@util/common_util_structure_station";
|
|
import { buildStations } from "../../../B05_Profile/logic/B05_Profile_Sections_Stations";
|
|
import { generateSections } from "../../../B05_Profile/logic/B05_Profile_Sections_Generate";
|
|
import type { DesignCurve, Vertex } from "./design_pipeline_types";
|
|
import { gridAt } from "./design_calc_node_stages";
|
|
|
|
export interface SectionsInputs {
|
|
stations?: {
|
|
line: Vertex[];
|
|
curves?: DesignCurve[];
|
|
pipes?: PlanPipe[];
|
|
structures?: PlanStructure[];
|
|
types: PlanType[];
|
|
definition?: CatalogDefinition | null;
|
|
plus?: number[];
|
|
interval_m?: number;
|
|
include_endpoint?: boolean;
|
|
station_snap?: boolean;
|
|
station_snap_step?: number | null;
|
|
grid?: string;
|
|
cross_half_width_m?: number;
|
|
cross_sample_interval_m?: number;
|
|
long_sample_interval_m?: number;
|
|
};
|
|
}
|
|
|
|
/** id → 셈(입구 `RUNNERS` 에 얹음). */
|
|
export function sectionsRunners(inputs: SectionsInputs): Record<string, () => unknown> {
|
|
const args = () => {
|
|
const at = inputs.stations;
|
|
if (!at) throw new Error("측점 입력(stations) 없음");
|
|
if (at.definition !== undefined) useCatalogDefinition(at.definition);
|
|
const options = {
|
|
intervalM: at.interval_m,
|
|
includeEndpoint: at.include_endpoint,
|
|
stationSnap: at.station_snap ?? false,
|
|
stationSnapStep: at.station_snap_step ?? null,
|
|
types: at.types,
|
|
plus: at.plus ?? [],
|
|
crossHalfWidthM: at.cross_half_width_m,
|
|
crossSampleIntervalM: at.cross_sample_interval_m,
|
|
longSampleIntervalM: at.long_sample_interval_m,
|
|
};
|
|
return { at, options };
|
|
};
|
|
return {
|
|
"stations.list": () => {
|
|
const { at, options } = args();
|
|
return buildStations(at.line, at.curves ?? [], at.pipes ?? [], at.structures ?? [], options);
|
|
},
|
|
"stations.sections": () => {
|
|
const { at, options } = args();
|
|
if (!at.grid) throw new Error("DTM 격자 없음 — DTM 아닌 지표면은 파이썬 길");
|
|
const grid = gridAt(at.grid);
|
|
return generateSections(
|
|
at.line,
|
|
at.curves ?? [],
|
|
at.pipes ?? [],
|
|
at.structures ?? [],
|
|
grid,
|
|
options,
|
|
);
|
|
},
|
|
};
|
|
}
|