Merge remote-tracking branch 'origin/sub_laptop_8' into main_laptop_1

This commit is contained in:
2026-10-18 15:54:44 +09:00
10 changed files with 479 additions and 10 deletions
+14 -2
View File
@@ -24,6 +24,7 @@ import { pipeIdAt, pipeIdNear } from "../A00_Common/design/design_pipe_ids";
import { showToast } from "@ui/ui_template_elements";
import {
chainageKey,
curveMoves,
dedupeStationKeys,
looseChainage,
stationKey,
@@ -265,6 +266,13 @@ export function chainageOfKey(
return near ? Number(chainageKey(near.chainageM)) : null;
}
/** 두 노선 목록 사이 MC 가 움직인 곡선 열쇠(432-3 · 서버 `carry_cross_inputs` 와 같음). */
function curveMovesBetween(projectId: string, fromRouteId: number, toRouteId: number) {
const pairs = (routeId: number) =>
(lists.get(scopeOf(projectId, routeId)) ?? []).map((e) => [e.key, e.chainageM] as const);
return curveMoves(pairs(fromRouteId), pairs(toRouteId));
}
function readRaw(name: KeyedState, projectId: string, routeId: number): Raw {
const raw = readState<Raw>(name, projectId, routeId);
return raw && typeof raw === "object" ? raw : {};
@@ -338,6 +346,7 @@ export function carryStationDrafts(
{ quiet = false }: { quiet?: boolean } = {},
): number {
const outside = new Set<string>();
const curves = curveMovesBetween(projectId, fromRouteId, toRouteId);
for (const name of KEYED_STATES) {
const raw = readRaw(name, projectId, fromRouteId);
const next: Raw = { [HINT]: {} };
@@ -345,7 +354,8 @@ export function carryStationDrafts(
// 옛 열쇠(누가거리 · at:)는 옛 목록으로 측점 열쇠부터 · 측점 열쇠(id)는 그대로
const fromAt =
looseChainage(key) === null ? null : chainageOfKey(projectId, fromRouteId, key);
const stable = fromAt === null ? key : keyAt(projectId, fromRouteId, fromAt);
const was = fromAt === null ? key : keyAt(projectId, fromRouteId, fromAt);
const stable = curves.get(was) ?? was;
const toAt = chainageOfKey(projectId, toRouteId, stable, looseChainage(stable) ?? undefined);
const carried = carriedValue(name, value);
if (toAt === null || stable.startsWith("at:")) {
@@ -420,10 +430,12 @@ export function carryChainageStates(
): number {
const facilityAt = facilities.keyAt ?? (() => null);
const outside = new Set<string>();
const curves = curveMovesBetween(projectId, fromRouteId, toRouteId);
const moveAt = (state: string, text: string): string | null => {
const moved = facilities.movedAt?.(Number(text));
if (moved !== null && moved !== undefined) return chainageKey(moved);
const stable = keyAt(projectId, fromRouteId, Number(text));
const was = keyAt(projectId, fromRouteId, Number(text));
const stable = curves.get(was) ?? was;
const structural = stable.startsWith("pipe:") || stable.startsWith("structure:");
// 새 목록에 그 열쇠가 없으면 그 시설의 새 자리 · 없으면 같은 자리 측점(초안 측점 = 저장 측점)
const toAt =