- 원인: 관 알림 전 「모름」을 빈 목록으로 심어 종단도 선이 저장 관 측점(389) 꼭짓점을 뺌 → 첫 cross 가 380 · 389 · 400 을 그 선으로 셈 → 배지 −211.6 ㎥ 1 초 남짓 뒤 −204.2(새로고침 20 번 중 1 ~ 2) - design_facility_lane known() · ready · design_profile planted · listedBase null = 저장 기준 · Render deriveProfile 서버 측점 그대로 · design_view_profile_sections stationsReady - 시험 test_473_lane_ready(옛 코드 빨강) · test_346_2 가짜 다리에 stationsReady · 위키 rules 한 줄 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.8 KiB
TypeScript
54 lines
2.8 KiB
TypeScript
/* =============================================================================
|
|
* A00_Common/design/design_profile_base.ts
|
|
* 종단도 계획선 기준 = 측점 한 벌(서버 일반 + 지금 구조물 측점 · 272) — `design_profile` 에서 나눔(700줄).
|
|
* 계산 묶음 planline 단계(`design_pipeline_page`)도 같은 기준을 받음.
|
|
* ========================================================================== */
|
|
|
|
import type { SectionDetailResponse } from "../../B06_Section/B06_Section_Api_Fetch";
|
|
import type { AlignmentBase } from "../../B05_Profile/logic/B05_Profile_UI_Profile_Alignment";
|
|
import type { IrregularStation } from "../../B05_Profile/B05_Profile_UI_IrregularStations";
|
|
import {
|
|
irregularGraphStations,
|
|
maxChainageOf,
|
|
} from "../../B05_Profile/B05_Profile_UI_Profile_Layout";
|
|
import { followMovedNodes, oneStationList } from "../../common_util/common_util_structure_station";
|
|
import { readAlignment } from "../../B05_Profile/logic/B05_Profile_UI_Profile_Data";
|
|
import { seatBornNodes } from "../../B05_Profile/logic/B05_Profile_Grade_Seat";
|
|
|
|
/** 계획선 측점 줄 = 측점 한 벌(서버 일반 + 지금 구조물 측점 · 272) — 표 · ▲▼ · 그래프 · 3D · 횡단 다시 셈(342-1)이
|
|
* 같은 목록 · 사라진 구조물 측점의 꼭짓점은 서버와 같게 옮기거나 지우고 새 측점엔 세움(`followMovedNodes` · `seatBornNodes` · 427) ·
|
|
* 늘 저장분에서 셈. 심은 측점이 아직 없으면(null · 시설 줄 입력 전) 저장분 그대로(473). */
|
|
export function listedBase(
|
|
storedBase: AlignmentBase | null,
|
|
detail: SectionDetailResponse | null,
|
|
irregularStations: IrregularStation[] | null,
|
|
): AlignmentBase | null {
|
|
if (!storedBase || !detail || !irregularStations) return storedBase;
|
|
const server = detail.longitudinal.stations;
|
|
const planted = irregularGraphStations(irregularStations, maxChainageOf(detail.longitudinal));
|
|
const list = oneStationList(server, planted);
|
|
const after = new Set(list.map((station) => station.chainage_m.toFixed(3)));
|
|
const before = new Set(server.map((station) => station.chainage_m.toFixed(3)));
|
|
const gone = server
|
|
.filter((station) => station.kind === "irregular" && !station.grid)
|
|
.map((station) => station.chainage_m)
|
|
.filter((chainage) => !after.has(chainage.toFixed(3)));
|
|
const born = list
|
|
.map((station) => station.chainage_m)
|
|
.filter((chainage) => !before.has(chainage.toFixed(3)));
|
|
const moved = followMovedNodes(
|
|
storedBase.basePvi,
|
|
gone,
|
|
born,
|
|
Object.keys(readAlignment(detail.longitudinal)?.edits.station_offsets ?? {}),
|
|
);
|
|
return {
|
|
...storedBase,
|
|
basePvi: seatBornNodes(storedBase, moved.nodes, moved.seat, moved.held),
|
|
stations: list.map((station) => ({
|
|
station_id: station.station_id,
|
|
chainage_m: station.chainage_m,
|
|
})),
|
|
};
|
|
}
|