refactor(472-3 B06 벽 · 기슭막이 · 배치): 구조물 기하 logic 분리 · 그림 파일은 그리기만
- logic 새 파일 다섯 — Cross_Wall_Geom(벽 1매) · Cross_Wall_Hatch_Geom(무늬 띠 · 물빼기 · 도수로 띠 · 원지반선) · Cross_Excavation_Geom(벽 터파기) · Cross_Design_Surface_Geom(암선 · 포장층) · Cross_Revetment_Geom(독립 기슭막이 배치) - logic 으로 옮김 — Body_Guard → Cross_Body_Guard · Structure_Layouts · Route_Carry_Patch(내용 그대로 · import 경로만) - inferStationInterval → common_util_station(글자표 없는 자리 · common_util_svg 는 다시 내보냄) — Node 묶음 ui_template_locale 끌림 끊음 - 부르는 쪽 import 줄 · 등록부 ts 경로 · 시험 · 도우미 경로 - test_472_3 GEOMETRY_PULLS 다섯 줄 걷음 · Wall_Hatch · Excavation · Design_Surface 세 줄은 Culvert · Box · Ford 그림 파일(518-2)이 그리기 함수로 부르는 동안 남김 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,3 +29,19 @@ export function stationPartsLabel(
|
||||
const scale = decimals ? 10 : 1;
|
||||
return `${stationNumber}+${Math.round(remainder * scale) / scale}`;
|
||||
}
|
||||
|
||||
/** 측점 간격을 실제 측점 배열에서 되짚는다(최빈 간격). 라벨 표기의 분모다. */
|
||||
export function inferStationInterval(stations: Array<{ chainage_m: number }>): number {
|
||||
const counts = new Map<number, number>();
|
||||
for (let index = 1; index < stations.length; index += 1) {
|
||||
const difference = stations[index].chainage_m - stations[index - 1].chainage_m;
|
||||
if (difference <= 0) continue;
|
||||
const rounded = Math.round(difference * 10) / 10;
|
||||
counts.set(rounded, (counts.get(rounded) ?? 0) + 1);
|
||||
}
|
||||
return (
|
||||
[...counts.entries()].sort(
|
||||
([intervalA, countA], [intervalB, countB]) => countB - countA || intervalB - intervalA,
|
||||
)[0]?.[0] ?? 1
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,20 +33,4 @@ export function svgText(
|
||||
return text;
|
||||
}
|
||||
|
||||
/** 측점 간격을 실제 측점 배열에서 되짚는다(최빈 간격). 라벨 표기의 분모다. */
|
||||
export function inferStationInterval(stations: Array<{ chainage_m: number }>): number {
|
||||
const counts = new Map<number, number>();
|
||||
for (let index = 1; index < stations.length; index += 1) {
|
||||
const difference = stations[index].chainage_m - stations[index - 1].chainage_m;
|
||||
if (difference <= 0) continue;
|
||||
const rounded = Math.round(difference * 10) / 10;
|
||||
counts.set(rounded, (counts.get(rounded) ?? 0) + 1);
|
||||
}
|
||||
return (
|
||||
[...counts.entries()].sort(
|
||||
([intervalA, countA], [intervalB, countB]) => countB - countA || intervalB - intervalA,
|
||||
)[0]?.[0] ?? 1
|
||||
);
|
||||
}
|
||||
|
||||
export { stationLabel } from "./common_util_station";
|
||||
export { inferStationInterval, stationLabel } from "./common_util_station";
|
||||
|
||||
Reference in New Issue
Block a user