41 lines
1.9 KiB
TypeScript
41 lines
1.9 KiB
TypeScript
/* =============================================================================
|
|
* B05_Profile/B05_Profile_Footprint_Server.ts
|
|
* 계산 묶음 footprint 단계(D4) + 계산 자리 「서버」 길(PLAN 511-A) — 판 fixed_browser = server 면 잠잠 뒤 서버
|
|
* (`footprint.plan` · 같은 `footprintStage` 전 구간)가 셈 · 끊긴 차례는 묶음이 버림 · 못 받으면 브라우저 셈.
|
|
* 판 both = 지금 그대로(같은 틱 · 브라우저 셈).
|
|
* ========================================================================== */
|
|
|
|
import type { StageContext } from "../A00_Common/design/logic/design_pipeline_types";
|
|
import { calcOnServerNow } from "../A00_Common/design/design_calc_sites";
|
|
import {
|
|
calcChecked,
|
|
calcOnServerOnly,
|
|
trialRequest,
|
|
} from "../A00_Common/design/design_calc_server";
|
|
import { footprintStage } from "./logic/B05_Profile_Footprint_Stage";
|
|
import type { FootprintLines } from "./logic/B05_Profile_PlanFootprint";
|
|
|
|
/** 단계가 읽는 몫만 — 측점(지반) · 측점 횡단 detail · 노선 선. */
|
|
export function footprintInputs(ctx: StageContext<"footprint">): unknown {
|
|
const byKey = ctx.out.cross?.byKey ?? {};
|
|
const route = ctx.out.route;
|
|
return {
|
|
ground: { stations: ctx.out.ground?.stations ?? [] },
|
|
cross: {
|
|
byKey: Object.fromEntries(Object.entries(byKey).map(([k, v]) => [k, { detail: v.detail }])),
|
|
},
|
|
route: route ? { line: route.line, chainage: route.chainage, lengthM: route.lengthM } : null,
|
|
};
|
|
}
|
|
|
|
export function footprintStageSited(
|
|
ctx: StageContext<"footprint">,
|
|
): FootprintLines | Promise<FootprintLines> {
|
|
if (!calcOnServerNow("fixed_browser"))
|
|
return calcChecked("fixed_browser", "footprint.plan", footprintStage, [ctx]);
|
|
const asked = trialRequest("footprint.plan", [footprintInputs(ctx)]);
|
|
return calcOnServerOnly<FootprintLines>("fixed_browser", "D4", asked, ctx.signal).then(
|
|
(lines) => lines ?? footprintStage(ctx),
|
|
);
|
|
}
|