diff --git a/A00_Common/design/design_pipeline_page.ts b/A00_Common/design/design_pipeline_page.ts index ba84ea700..1332c800a 100644 --- a/A00_Common/design/design_pipeline_page.ts +++ b/A00_Common/design/design_pipeline_page.ts @@ -21,7 +21,8 @@ * [저장](sub5)이 서버 정본 — 노선을 먼저 보내고 `pendingAlignment(DRAFT_ROUTE_ID)` 를 새 노선에 보냄. * ========================================================================== */ -import { createDesignPipeline, publishToStore, type DesignPipeline } from "./logic/design_pipeline"; +import { createDesignPipeline, type DesignPipeline } from "./logic/design_pipeline"; +import { publishPagePipeline } from "./design_pipeline_page_publish"; import { SOURCE_INPUT } from "./logic/design_pipeline_types"; export { pipelineWork } from "./logic/design_pipeline"; import { pipelineCrossSource, type PipelineCrossSource } from "./design_pipeline_cross"; @@ -30,7 +31,6 @@ import type { ChangeSource, FollowPatch, PipelineInputs, - PipelineOutputs, PipelineRunRecord, PipelineStation, RangePart, @@ -380,27 +380,7 @@ function createPagePipeline( }, }, }); - const publish = publishToStore(store); - /** 상세가 맞춘 측점 목록(열쇠 · 자리) — 열 때 · 되돌린 차례 측점 · 마지막으로 낸 측점. 같은 목록이면 가게에 - * 다시 안 냄(되돌린 상세 측점이 묶음 측점과 달라도 · 관 · 구조물 메아리가 상세를 갈아끼우지 않게 · 349-0q). */ - let stationsShown: string | null = null; - pipe.subscribe((event) => { - const saved = event.kind === "stage" && (event.stage === "ground" || event.stage === "profile"); - const quiet = saved && event.generation === quietGeneration; - if (event.kind === "stage" && event.stage === "ground") { - const list = JSON.stringify( - (event.value as PipelineOutputs["ground"] | null)?.stations.map((station) => [ - station.key, - station.chainageM, - station.x, - station.y, - ]) ?? null, - ); - if (!quiet && list === stationsShown) return; - stationsShown = list; - } - if (!quiet) publish(event); - }, "가게"); + publishPagePipeline(pipe, store, () => quietGeneration); /** 노선 초안을 버린 차례 끝 — 초안 전 상세로 되돌림(열 때와 같은 상태 · 측점이 달라도 · 다른 자리는 * 기록에) · 그 상세가 저장 정본(다시 하기도 같은 기준). 차례 끝에서 판정 — ground 를 건너뛰어도 · 사진첩 * 되돌리기가 가게 초안을 먼저 비워도(349-0m). */ diff --git a/A00_Common/design/design_pipeline_page_publish.ts b/A00_Common/design/design_pipeline_page_publish.ts new file mode 100644 index 000000000..7d5dccdd8 --- /dev/null +++ b/A00_Common/design/design_pipeline_page_publish.ts @@ -0,0 +1,40 @@ +/* ============================================================================= + * A00_Common/design/design_pipeline_page_publish.ts + * 페이지 계산 묶음 → 가게(stations · profile · footprint · generation) 잇기(`design_pipeline_page` 700줄 쪼갬 · 466). + * + * 조용한 차례(열 때 · 노선 초안을 버린 차례)는 측점 · 종단을 안 냄(상세 = 저장 정본 · 초안 전 상세 그대로) · + * 그 목록을 「보인 측점」으로 적어 뒤 같은 목록 차례도 안 냄(관 · 구조물 메아리가 상세를 갈아끼우지 않게 · 349-0q). + * ========================================================================== */ + +import { publishToStore, type DesignPipeline } from "./logic/design_pipeline"; +import type { PipelineOutputs } from "./logic/design_pipeline_types"; +import type { DesignStore } from "./design_store"; + +/** 묶음 출력을 가게에 냄 — `quietGeneration` = 측점 · 종단을 안 내는 차례 번호(부를 때마다 읽음). */ +export function publishPagePipeline( + pipe: DesignPipeline, + store: DesignStore, + quietGeneration: () => number, +): void { + const publish = publishToStore(store); + /** 상세가 맞춘 측점 목록(열쇠 · 자리) — 열 때 · 되돌린 차례 측점 · 마지막으로 낸 측점. 같은 목록이면 가게에 + * 다시 안 냄(되돌린 상세 측점이 묶음 측점과 달라도 · 관 · 구조물 메아리가 상세를 갈아끼우지 않게 · 349-0q). */ + let stationsShown: string | null = null; + pipe.subscribe((event) => { + const saved = event.kind === "stage" && (event.stage === "ground" || event.stage === "profile"); + const quiet = saved && event.generation === quietGeneration(); + if (event.kind === "stage" && event.stage === "ground") { + const list = JSON.stringify( + (event.value as PipelineOutputs["ground"] | null)?.stations.map((station) => [ + station.key, + station.chainageM, + station.x, + station.y, + ]) ?? null, + ); + if (!quiet && list === stationsShown) return; + stationsShown = list; + } + if (!quiet) publish(event); + }, "가게"); +}