chore(merge): main_laptop_1 받음 — D03 장면 목록 양쪽 살림(sub2 장면 00 · 05 · 08 + D03_09 꺾임점 고침)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 13:37:17 +09:00
co-authored by Claude Opus 5.5
11 changed files with 430 additions and 40 deletions
+8 -7
View File
@@ -1,6 +1,6 @@
# 측점 횡단
평면에서 측점을 누르면 그 자리의 지반선 횡단이 아래 판에 그려짐.
평면에서 측점을 누르면 그 자리의 지반선과 예상 횡단이 아래 판에 그려짐.
## 여는 길
@@ -8,15 +8,15 @@
![측점 횡단](D03_05_station_cross.webp)
그림 번호 — 1 제목 줄(연도 · 측점 이름 · 중심 지반고) · 2 지반선 그림
그림 번호 — 1 제목 줄(연도 · 측점 이름 · 중심 지반고 · 예상 절토 · 성토 ㎡) · 2 지반선 + 예상 횡단 그림
## 단계
| 단계 | 할 일 |
| --- | --- |
| 1 | 평면 지도에서 확인할 측점 눈금(예: 20+0)을 누름. |
| 2 | 아래 판의 제목 줄에서 연도 · 측점 · 중심 지반고를 읽음. |
| 3 | 그림에서 좌우 20 m 범위의 지반선을 확인함. |
| 2 | 아래 판의 제목 줄에서 연도 · 측점 · 중심 지반고 · 예상 절토 · 성토 넓이(㎡)를 읽음. |
| 3 | 그림에서 회색 지반선과 주황 예상 횡단선(노면 · 측구 · 절토 · 성토 비탈)을 확인함. |
| 4 | 판 위쪽 「횡단」 줄을 누르면 판이 접히고, 다시 누르면 펼쳐짐. |
![접힌 횡단 판](D03_06_cross_fold.webp)
@@ -25,9 +25,10 @@
## 보이는 것
- 제목 줄 = 「연도 · 측점 이름 · 중심 지반고」.
- 그림 = 노선 중심에서 좌우 20 m 안의 지반. 설계선(노면 · 절토 · 성토)은 없음.
- 아직 측점을 누르지 않았으면 「평면에서 측점을 누르면 그 자리 지반선 횡단이 보입니다.」가 보임.
- 제목 줄 = 「연도 · 측점 이름 · 중심 지반고 · 예상(표준 횡단 기본값 · 계획고 = 지반고) 절토 ㎡ · 성토 ㎡」.
- 그림 = 노선 중심에서 좌우 20 m 안의 지반(회색) + 예상 횡단(주황 · 「기본 계획 횡단」). 비탈이 20 m 안에서 지반과 안 만나면 만날 때까지 넓혀 그림.
- 예상 횡단 = 표준 횡단의 프로그램 기본값(노폭 3.0 m · 노견 0.5 m · 리핑암 · 산쪽 절토 · 일반 측구 · 성토 1:1.2) · 계획고 = 측점 중심 지반고 · 곡선 확폭 없음. 종단 설계 전 모양이라 실제 설계 횡단과 다름.
- 아직 측점을 누르지 않았으면 「평면에서 측점을 누르면 그 자리 지반선 · 예상 횡단이 보입니다.」가 보임.
- 노선이 없는 연도의 측점은 누를 수 없음. 지점을 옮긴 뒤에는 다시 [분석]을 해야 함.
- 이 측점 횡단은 지형 자료의 평활본에서 읽은 값이라 실제 측량 단면과 다를 수 있음.
+6 -4
View File
@@ -1,6 +1,6 @@
# 3D 보기
지형과 연도별 노선을 입체로 보는 창.
지형과 연도별 노선 · 예상 코리도를 입체로 보는 창.
## 여는 길
@@ -8,7 +8,7 @@
![3D 보기 창](D03_08_3d_modal.webp)
그림 번호 — 1 연도 고르는 칸 · 2 3D 화면
그림 번호 — 1 연도 고르는 칸 · 2 「예상 코리도」 켬끔 · 3 3D 화면
## 단계
@@ -17,12 +17,14 @@
| 1 | [3D]를 누름. 「3D 보기 — 지형 + 노선」 창이 열리고 지형을 불러오는 동안 진행 표시가 돎. |
| 2 | 창 위쪽 연도 칸으로 볼 연도를 바꿈. 한 번에 한 연도씩 보임. |
| 3 | 마우스로 돌리고 휠로 확대 · 축소해 노선 둘레를 살핌. |
| 4 | 다 보았으면 창 오른쪽 위 [닫기]를 누름. |
| 4 | 「예상 코리도」 칸을 끄면 원래 지형과 노선만, 켜면 예상 노면 · 절토 · 성토면이 보임. |
| 5 | 다 보았으면 창 오른쪽 위 [닫기]를 누름. |
## 보이는 것
- 그 연도의 지형(높이에 따라 색이 달라짐)과 고른 후보의 노선, 측점 막대가 보임. 지형 위의 가는 하늘색 선이 노선.
- 노견 · 절토 · 성토면 · 구조물은 3D 에도 없음.
- 예상 코리도 = 측점 횡단 판과 같은 예상 횡단(표준 횡단 기본값 · 계획고 = 지반고)을 측점마다 이은 노면 · 측구 · 절토 · 성토면. 처음 열 때 켜져 있음.
- 구조물은 3D 에도 없음.
- 평면에서 측점을 눌러 둔 연도가 있으면 그 연도가 먼저 열림.
- 창을 닫으면 3D 화면에 쓰던 자원이 정리됨.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1000 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 107 KiB

+3 -3
View File
@@ -1,12 +1,12 @@
[
{"name":"D03_00_overview","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(400)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__map","pos":"tr"},{"n":2,"sel":".d03-plan__cross","pos":"tr"},{"n":3,"sel":".d03-plan__hint"},{"n":4,"sel":".d03-plan__years"},{"n":5,"sel":".ui-sidebar-actions","pos":"tr"}]},
{"name":"D03_00_overview","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(100)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__map","pos":"tr"},{"n":2,"sel":".d03-plan__cross","pos":"tr"},{"n":3,"sel":".d03-plan__hint"},{"n":4,"sel":".d03-plan__years"},{"n":5,"sel":".ui-sidebar-actions","pos":"tr"}]},
{"name":"D03_01_terrain_card","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000}],"settle_ms":2000,"clip":".ui-sidebar-scroll > .ui-sidebar-card:nth-child(1)","callouts":[{"n":1,"sel":".d03-plan__hint"}]},
{"name":"D03_02_year_cards","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000}],"settle_ms":2000,"clip":".ui-sidebar-scroll > .ui-sidebar-card:nth-child(2)","callouts":[{"n":1,"sel":".d03-plan__year-head"},{"n":2,"sel":".d03-plan__mode.is-picked","pos":"tr"},{"n":3,"sel":".d03-plan__mode:not(.is-picked)","pos":"tr"}]},
{"name":"D03_03_pick_mode","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"click":".d03-plan__year[data-year=\"2028\"] .d03-plan__mode[data-mode=\"gentle\"]"},{"wait":".d03-plan__year[data-year=\"2028\"] .d03-plan__mode[data-mode=\"gentle\"].is-picked"},{"wait_ms":800}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__year[data-year=\"2028\"] .d03-plan__year-head"},{"n":2,"sel":".d03-plan__year[data-year=\"2028\"] .d03-plan__mode.is-picked","pos":"tr"},{"n":3,"sel":".d03-plan__map","pos":"tr"}]},
{"name":"D03_04_plan_map","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(400)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":".d03-plan__map","callouts":[{"n":1,"sel":".d03-plan__map","pos":"tr"}]},
{"name":"D03_05_station_cross","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(400)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":".d03-plan__cross","callouts":[{"n":1,"sel":".d03-plan__cross-head"},{"n":2,"sel":".d03-plan__cross-body"}]},
{"name":"D03_05_station_cross","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(100)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":".d03-plan__cross","callouts":[{"n":1,"sel":".d03-plan__cross-head"},{"n":2,"sel":".d03-plan__cross-body"}]},
{"name":"D03_06_cross_fold","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,900],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.pick(400)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600},{"click":".d03-plan__cross .ui-workflow-overlay__handle"},{"wait_ms":800}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__cross .ui-workflow-overlay__handle","pos":"tr"}]},
{"name":"D03_07_buttons","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000}],"settle_ms":2000,"clip":".ui-sidebar-actions","callouts":[{"n":1,"sel":".ui-sidebar-actions > button:nth-child(1)"},{"n":2,"sel":".ui-sidebar-actions > button:nth-child(2)"},{"n":3,"sel":".ui-sidebar-actions > button:nth-child(3)"},{"n":4,"sel":".ui-sidebar-actions > button:nth-child(4)"},{"n":5,"sel":".ui-sidebar-actions > button:nth-child(5)"},{"n":6,"sel":".ui-sidebar-actions > button:nth-child(6)"}]},
{"name":"D03_08_3d_modal","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"click":".ui-sidebar-actions > button:nth-child(6)"},{"wait":".b05-route__3d-modal"},{"wait_ms":9000}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__3d-year"},{"n":2,"sel":".b05-route__3d-body","pos":"tr"}]},
{"name":"D03_08_3d_modal","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"click":".ui-sidebar-actions > button:nth-child(6)"},{"wait":".b05-route__3d-modal"},{"wait_ms":9000},{"wait":".d03-plan__3d-corridor input:checked"}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__3d-year"},{"n":2,"sel":".d03-plan__3d-corridor"},{"n":3,"sel":".b05-route__3d-body .b05-route__viewport","pos":"br"}]},
{"name":"D03_09_ip_edit","route":"#/d03-plan-analysis","project":"plan","viewport":[1600,1250],"before":[{"wait":".d03-plan__map canvas"},{"wait":".d03-plan__mode"},{"wait_ms":4000},{"eval":"window.__d03Plan.nudge(3, 18, 14)"},{"eval":"window.__d03Plan.pick(200)"},{"wait":".d03-plan__cross-body svg"},{"wait_ms":600}],"settle_ms":2000,"clip":null,"callouts":[{"n":1,"sel":".d03-plan__map","pos":"tr"},{"n":2,"sel":".d03-plan__year[data-year=\"2027\"] .d03-plan__year-head:nth-child(2)","pos":"tr"},{"n":3,"sel":".d03-plan__year[data-year=\"2027\"] .d03-plan__mode.is-picked","pos":"tr"},{"n":4,"sel":".ui-sidebar-actions > button:nth-child(7)","pos":"tr"}]}
]
+42 -4
View File
@@ -1,8 +1,9 @@
/* =============================================================================
* D03_PlanAnalysis_UI_3D.ts
* D03 [3D] 큰 모달(PLAN 530-3) — 한 연도 DEM + 그 연도 고른 노선 + 측점 막대만. 코리도 · 구조물은
* 안 부름(`setCorridor` 안 씀 → 노견 · 절성토면 · 구조물 없음). 연도 고름 = 모달 위 칸.
* 뷰어 = B05 `createRouteViewer` 그대로 · 닫으면 버림(WebGL 문맥까지).
* D03 [3D] 큰 모달(PLAN 530-3 · 544-3) — 한 연도 DEM + 그 연도 고른 노선 + 측점 막대 + 예상 코리도.
* 예상 코리도 = 측점마다 횡단 판과 같은 예상 단면(`logic/D03_PlanAnalysis_Expect`) → B05 `buildCorridor`
* → `setCorridor`(노면 · 측구 · 절성토면 · 지형 잘림) · 구조물 없음 · 「예상 코리도」 켬끔.
* 연도 고름 = 모달 위 칸 · 뷰어 = B05 `createRouteViewer` 그대로 · 닫으면 버림(WebGL 문맥까지).
* ========================================================================== */
import "../B05_Profile/B05_Profile_UI_Style.css";
@@ -12,7 +13,11 @@ import { showToast } from "@ui/ui_template_elements";
import type { DtmGrid } from "../common_util/common_util_surface_sampler";
import { createRouteViewer, type RouteViewer } from "../B05_Profile/B05_Profile_UI_Viewer";
import { sectionsGround } from "../B05_Profile/logic/B05_Profile_Sections_Ground";
import { buildCorridor } from "../B05_Profile/logic/B05_Profile_Corridor_Build";
import type { CrossSection } from "../B06_Section/B06_Section_Api_Types";
import type { Vertex } from "./logic/D03_PlanAnalysis_Plan";
import { expectSections } from "./logic/D03_PlanAnalysis_Expect";
import { loadExpectStandard } from "./D03_PlanAnalysis_UI_Cross";
export interface Plan3dYear {
year: number;
@@ -50,9 +55,18 @@ export function openPlan3d(projectId: string, years: Plan3dYear[], firstYear: nu
pick.className = "d03-plan__3d-year";
for (const item of years)
pick.append(new Option(`${item.year}년`, String(item.year), false, item.year === firstYear));
const corridorBox = document.createElement("label");
corridorBox.className = "d03-plan__3d-corridor";
const corridorOn = Object.assign(document.createElement("input"), {
type: "checkbox",
checked: true,
});
corridorBox.append(corridorOn, " 예상 코리도(표준 횡단 기본값 · 계획고 = 지반고)");
corridorOn.addEventListener("change", () => viewer?.setCorridorVisible(corridorOn.checked));
const top = document.createElement("div");
top.className = "d03-plan__3d-top";
top.append(pick);
top.append(pick, corridorBox);
const standard = loadExpectStandard(projectId);
const load = async (year: number): Promise<void> => {
const item = years.find((entry) => entry.year === year) ?? years[0];
@@ -60,6 +74,9 @@ export function openPlan3d(projectId: string, years: Plan3dYear[], firstYear: nu
const progress = createProgressCircle({ label: "3D 지형을 불러오는 중…", overlay: true });
progress.set(null);
viewer.root.append(progress.root);
const started = performance.now();
const stat: Record<string, unknown> = { year: item.year, done: false };
(window as unknown as { __d03Plan3d?: unknown }).__d03Plan3d = stat;
try {
await viewer.loadSurface(projectId, item.modelId, "dtm", true, 5, gridBounds(item.grid));
if (!viewer) return;
@@ -81,10 +98,31 @@ export function openPlan3d(projectId: string, years: Plan3dYear[], firstYear: nu
})),
2.5,
);
const std = await standard;
if (!viewer) return;
const built = performance.now();
const sections = std
? (expectSections(ground.stations, std, item.grid) as unknown as CrossSection[])
: [];
const build = buildCorridor(
sections,
item.line.map(([x, y]) => ({ x, y })),
);
if (build) build.sections = sections; // 지형 잘림이 읽음
viewer.setCorridor(build);
viewer.setCorridorVisible(corridorOn.checked);
Object.assign(stat, {
sections: sections.length,
corridor: !!build,
buildMs: Math.round(performance.now() - built),
centers: sections.map((c) => [c.center_x, c.center_y, c.center_z]),
});
viewer.setView("iso");
} catch (error) {
showToast(error instanceof Error ? error.message : "3D 지형을 불러오지 못했습니다.", "error");
} finally {
stat.done = true;
stat.totalMs = Math.round(performance.now() - started);
progress.remove();
}
};
+55 -22
View File
@@ -1,10 +1,12 @@
/* =============================================================================
* D03_PlanAnalysis_UI_Cross.ts
* D03 하 패널 — 누른 측점의 지반선 횡단(PLAN 530-3). 계산 = 화면 TS 즉시(① 짝 `sectionsGround` ↔
* `generate_sections` · 격자 = 그 연도 DEM 평활본) · 그림 = B05 `buildCrossSvg` 지반만.
* D03 하 패널 — 누른 측점의 지반선 + 예상 횡단(PLAN 530-3 · 544-2). 계산 = 화면 TS 즉시(① 짝 `sectionsGround` ↔
* `generate_sections` · 격자 = 그 연도 DEM 평활본) · 예상 = `logic/D03_PlanAnalysis_Expect`(표준 횡단 기본값 ·
* 계획고 = 중심 지반고 · 표준값 = `sections/context` 세션 캐시) · 그림 = B05 `buildCrossSvg`.
* ========================================================================== */
import "../B05_Profile/B05_Profile_UI_Style_RouteEdit.css";
import { CURRENT_PROJECT_ID_KEY } from "@config/config_frontend";
import { createWorkflowPanelHandle } from "@ui/ui_template_overlay";
import { stationLabel } from "../common_util/common_util_station";
import type { DtmGrid } from "../common_util/common_util_surface_sampler";
@@ -13,7 +15,9 @@ import {
sectionsGround,
type StationGround,
} from "../B05_Profile/logic/B05_Profile_Sections_Ground";
import { fetchSectionContext } from "../B06_Section/B06_Section_Api_Context";
import type { Vertex } from "./logic/D03_PlanAnalysis_Plan";
import { expectCross, type ExpectStandard } from "./logic/D03_PlanAnalysis_Expect";
import { PLAN_STATION_INTERVAL_M } from "./D03_PlanAnalysis_UI_Map";
export interface PlanCross {
@@ -29,6 +33,17 @@ export interface PlanCross {
clear: (text: string) => void;
}
/** 표준 횡단 기본값(config · 서버 한 번 · 세션 캐시) — 못 받으면 null(지반선만). */
export function loadExpectStandard(projectId: string): Promise<ExpectStandard | null> {
return fetchSectionContext(projectId).then(
(context) => ({
standard: context.standard_cross_section as ExpectStandard["standard"],
rockBoundaryM: context.rock_boundary_default_offset_m,
}),
() => null,
);
}
export function createPlanCross(): PlanCross {
const root = document.createElement("section");
root.className = "d03-plan__cross";
@@ -51,7 +66,9 @@ export function createPlanCross(): PlanCross {
body.replaceChildren(Object.assign(document.createElement("p"), { textContent: text }));
delete root.dataset.chainage;
};
clear("평면에서 측점을 누르면 그 자리 지반선 횡단이 보입니다.");
clear("평면에서 측점을 누르면 그 자리 지반선 · 예상 횡단이 보입니다.");
let standard: ExpectStandard | null = null;
let asked: Promise<ExpectStandard | null> | null = null;
return {
root,
@@ -64,26 +81,42 @@ export function createPlanCross(): PlanCross {
}
const name = stationLabel(chainage, PLAN_STATION_INTERVAL_M, 1);
const z = station.center_z === null ? "—" : `${station.center_z.toFixed(2)} m`;
head.textContent = `${year}년 · ${name} · 중심 지반고 ${z}`;
root.dataset.chainage = String(chainage);
const rect = body.getBoundingClientRect();
const plot = buildCrossSvg(
{
status: "success",
chainage_m: chainage,
label: name,
uphill_side: station.uphill_side,
plan_radius_m: null,
curve_widening_m: null,
cross_half_width_m: 20,
samples: station.samples,
design: null,
},
Math.max(rect.width, 320),
Math.max(rect.height, 160),
true,
);
body.replaceChildren(plot.svg);
const draw = (): void => {
const expect = standard ? expectCross(station, standard, grid) : null;
const area = expect
? ` · 예상(표준 횡단 기본값 · 계획고 = 지반고) 절토 ${expect.design.cut_area_m2.toFixed(2)}㎡ · 성토 ${expect.design.fill_area_m2.toFixed(2)}㎡`
: "";
head.textContent = `${year}년 · ${name} · 중심 지반고 ${z}${area}`;
const rect = body.getBoundingClientRect();
const plot = buildCrossSvg(
{
status: "success",
chainage_m: chainage,
label: name,
uphill_side: station.uphill_side,
plan_radius_m: null,
curve_widening_m: null,
cross_half_width_m: 20,
samples: expect?.samples ?? station.samples,
design: expect ? { ...expect.design } : null,
},
Math.max(rect.width, 320),
Math.max(rect.height, 160),
!expect,
);
body.replaceChildren(plot.svg);
};
draw();
if (!standard) {
const projectId = localStorage.getItem(CURRENT_PROJECT_ID_KEY) ?? "";
asked ??= loadExpectStandard(projectId);
void asked.then((value) => {
standard = value;
// 그사이 다른 측점을 눌렀으면 그 측점이 다시 그림
if (value && root.dataset.chainage === String(chainage)) draw();
});
}
return station;
},
};
@@ -0,0 +1,124 @@
/* =============================================================================
* D03_PlanAnalysis_Expect.ts
* D03 예상 횡단(PLAN 544-1 · 요구 363-1) — 측점 지반 → 표준 횡단 기본값 설계선 · 절 · 성토 ㎡.
* 셈 = 공용 `computeCrossDesign`(① 짝 `compute_cross_design` · 거울 `test_b06_cross_design_mirror.py`)
* · 기본 = B 초기 설계와 같음(리핑암 · 산쪽 절토 · 일반 측구 · 암 경계 = 서버 기본) · 계획고 = 측점 중심 지반고
* · 미교차 = `extendUnclosed`(격자 있을 때) · 곡선 확폭 없음 · 보기만(저장 없음).
* 3D = 같은 단면을 B05 `buildCorridor` 가 읽는 측점 꼴로(`expectSections`).
* 시험 `resources/tester/test_544_1_plan_expect.py`.
* ========================================================================== */
import {
computeCrossDesign,
type CrossDesignOptions,
type CrossDesignResult,
type StandardCrossSectionSpec,
} from "../../common_util/common_util_cross_design";
import type { DtmGrid } from "../../common_util/common_util_surface_sampler";
import {
extendUnclosed,
type CrossGroundPoint,
type StationGround,
} from "../../B05_Profile/logic/B05_Profile_Sections_Ground";
/** 서버 `sections/context` 의 표준 횡단(config) · 암 경계 기본 오프셋. */
export interface ExpectStandard {
standard: StandardCrossSectionSpec;
rockBoundaryM: number | null;
}
export interface ExpectCross {
design: CrossDesignResult;
/** 설계에 쓴 지반 표본(미교차로 넓혔으면 넓힌 것). */
samples: CrossGroundPoint[];
}
/** B 초기 설계 기본 — 리핑암 · 산쪽 절토(모르면 좌) · 일반 측구. */
export function expectOptions(
uphill: "left" | "right" | null,
std: ExpectStandard,
): CrossDesignOptions {
return {
groundType: "ripping_rock",
sectionMode: `${uphill ?? "left"}_cut`,
ditchType: "standard",
standard: std.standard,
rockBoundaryOffsetM: std.rockBoundaryM,
};
}
/** 측점 하나 예상 단면 — 지반고 · 표본이 없으면 null. */
export function expectCross(
station: StationGround,
std: ExpectStandard,
grid?: DtmGrid | null,
): ExpectCross | null {
const elevation = station.center_z;
if (elevation === null) return null;
const options = expectOptions(station.uphill_side, std);
try {
let samples = station.samples;
let design = computeCrossDesign(samples, elevation, options);
const wide =
design.slope_unclosed && grid
? extendUnclosed(
samples,
[station.center_x, station.center_y],
station.left_xy,
(next) => computeCrossDesign(next, elevation, options),
grid,
)
: null;
if (wide) {
samples = wide.samples as CrossGroundPoint[];
design = computeCrossDesign(samples, elevation, options);
}
return { design, samples };
} catch {
return null; // 표본 부족 — B 와 같은 태도(그 측점 건너뜀)
}
}
/** B06 `CrossSection` 중 `buildCorridor` 가 읽는 칸(B06 형 파일은 별칭 import 라 여기 안 끌어옴). */
export interface ExpectSection {
station_id: string;
chainage_m: number;
label: string;
kind: "regular";
center_z: number | null;
azimuth_deg: null;
center_x: number;
center_y: number;
uphill_side: "left" | "right" | null;
frame: { left_xy: [number, number] };
samples: CrossGroundPoint[];
design: CrossDesignResult;
}
/** 3D 코리도 입력 — 측점마다 예상 단면(못 세운 측점 뺌) · 누가 = 연도 노선 위 누가. */
export function expectSections(
stations: StationGround[],
std: ExpectStandard,
grid?: DtmGrid | null,
): ExpectSection[] {
return stations.flatMap((station) => {
const cross = expectCross(station, std, grid);
if (!cross) return [];
return [
{
station_id: String(station.chainage_m),
chainage_m: station.chainage_m,
label: "",
kind: "regular",
center_z: station.center_z,
azimuth_deg: null,
center_x: station.center_x,
center_y: station.center_y,
uphill_side: station.uphill_side,
frame: { left_xy: station.left_xy },
samples: cross.samples,
design: cross.design,
},
];
});
}
@@ -203,3 +203,8 @@ on 이 맞음. 그런데 shell command가 아님?
1. 예정노선
- 다음맵 페이지나 노선추천에서 각지점들의 수정이 가능해야함. 이때 측점을 누르면 보이는 횡단도는 원지반선 뿐만아니라 표준 횡단도의 프로그챔 기본값으로 반영된 예상횡단도 그림이 있어야 하면 이걸 3d에도 볼 수 있어야 함.
2. 측점의 표기는 프로그램 로직에서 초기테 누가거리 형태로 표기하는데 측점no. +거리 표기가 되어야함. 이 표현 방식은 b그룹 임도설계 로직에 많이 사용됨.
## 요구 364 (10-26 · 사용자 · 363 계획 답)
서브3 폴더계획서 원본 연결
꺽인점 고치기와 예상 횡단도, 3d 계획은 진행해
+187
View File
@@ -0,0 +1,187 @@
"""D03 예상 횡단(PLAN 544-1) — TS `logic/D03_PlanAnalysis_Expect.ts` 값 = 파이썬 `compute_cross_design`.
기본 = 리핑암 · 산쪽 절토(모르면 좌) · 일반 측구 · 암 경계 = config 기본 · 계획고 = 측점 중심 지반고.
미교차 = 격자로 넓힌 표본 · 넓힌 표본으로 파이썬이 다시 셈한 값과 같음 · 코리도 측점 꼴.
./venv/Scripts/python.exe -m pytest resources/tester/test_544_1_plan_expect.py -q
"""
from __future__ import annotations
import json
import re
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from B06_Section.B06_Section_Engine_Design import compute_cross_design # noqa: E402
from config.config_system_design import ( # noqa: E402
STANDARD_CROSS_SECTION,
STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M,
)
TS_FILE = ROOT / "D03_PlanAnalysis" / "logic" / "D03_PlanAnalysis_Expect.ts"
TSC = ROOT / "config" / "node_modules" / "typescript" / "bin" / "tsc"
_RUNNER = """
import { readFileSync, writeFileSync } from "node:fs";
import * as expect from "./D03_PlanAnalysis/logic/D03_PlanAnalysis_Expect.js";
const job = JSON.parse(readFileSync(process.argv[2], "utf8"));
const std = { standard: job.standard, rockBoundaryM: job.rock };
// 평면 격자 — z = 100 + slope * y(좌 축 = +y) · 1 m · ±100 m
const n = 201;
const axis = Float64Array.from({ length: n }, (_, i) => i - 100);
const z = new Float64Array(n * n);
for (let iy = 0; iy < n; iy += 1)
for (let ix = 0; ix < n; ix += 1) z[iy * n + ix] = 100 + job.wideSlope * axis[iy];
const grid = { x: axis, y: axis, z, validBits: new Uint8Array(Math.ceil((n * n) / 8)).fill(255) };
const cross = job.stations.map((s) => expect.expectCross(s, std));
const wide = expect.expectCross(job.wide, std, grid);
const sections = expect.expectSections([...job.stations, job.wide], std, grid);
writeFileSync(process.argv[3], JSON.stringify({ cross, wide, sections }));
"""
def _station(slope: float, uphill: str | None, *, half: float = 20.0) -> dict:
samples = []
count = int(half * 2 / 0.5) + 1
for i in range(count):
offset = -half + i * 0.5
z = round(100.0 + slope * offset, 6)
samples.append(
{"offset_m": offset, "x": 0.0, "y": offset, "z": z, "elevation_m": z, "valid": True}
)
return {
"chainage_m": 40.0,
"center_x": 0.0,
"center_y": 0.0,
"center_z": 100.0,
"tangent_xy": [1.0, 0.0],
"left_xy": [0.0, 1.0],
"uphill_side": uphill,
"samples": samples,
}
_STATIONS = [
_station(0.30, "left"),
_station(-0.45, "right"),
_station(0.05, None),
{**_station(0.2, "left"), "center_z": None},
]
_WIDE_SLOPE = 0.8
def _run_ts(tmp_path: Path) -> dict:
out = tmp_path / "js"
subprocess.run( # noqa: S603 — 고정 실행 파일
[
"node",
str(TSC),
str(TS_FILE),
"--outDir",
str(out),
"--rootDir",
str(ROOT),
"--module",
"esnext",
"--target",
"es2022",
"--moduleResolution",
"bundler",
"--ignoreConfig",
],
cwd=str(ROOT),
check=True,
capture_output=True,
)
for emitted in out.rglob("*.js"):
emitted.write_text(
re.sub(r'(from\s+"\.\.?/[^"]+)"', r'\1.js"', emitted.read_text(encoding="utf-8")),
encoding="utf-8",
)
(out / "runner.mjs").write_text(_RUNNER, encoding="utf-8")
job = tmp_path / "job.json"
result = tmp_path / "out.json"
job.write_text(
json.dumps(
{
"standard": STANDARD_CROSS_SECTION,
"rock": STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M,
"stations": _STATIONS,
"wide": _station(_WIDE_SLOPE, "left"),
"wideSlope": _WIDE_SLOPE,
}
),
encoding="utf-8",
)
subprocess.run( # noqa: S603
["node", str(out / "runner.mjs"), str(job), str(result)],
cwd=str(ROOT),
check=True,
capture_output=True,
)
return json.loads(result.read_text(encoding="utf-8"))
def _python(samples: list[dict], elevation: float, uphill: str | None) -> dict:
return compute_cross_design(
samples,
elevation,
ground_type="ripping_rock",
section_mode=f"{uphill or 'left'}_cut",
ditch_type="standard",
standard=STANDARD_CROSS_SECTION,
rock_boundary_offset_m=STANDARD_ROCK_BOUNDARY_DEFAULT_OFFSET_M,
)
def _same(ts: dict, py: dict) -> None:
assert ts["section_mode"] == py["section_mode"]
assert ts["ground_type"] == "ripping_rock" and ts["ditch_type"] == "standard"
assert abs(ts["cut_area_m2"] - py["cut_area_m2"]) < 1e-9
assert abs(ts["fill_area_m2"] - py["fill_area_m2"]) < 1e-9
assert len(ts["design_line"]) == len(py["design_line"])
for a, b in zip(ts["design_line"], py["design_line"]):
assert abs(a["offset_m"] - b["offset_m"]) < 1e-9
assert abs(a["elevation_m"] - b["elevation_m"]) < 1e-9
def test_expect_matches_python(tmp_path: Path) -> None:
got = _run_ts(tmp_path)
for station, ts in zip(_STATIONS, got["cross"]):
if station["center_z"] is None:
assert ts is None # 지반고 없음 = 못 세움
continue
py = _python(station["samples"], station["center_z"], station["uphill_side"])
_same(ts["design"], py)
assert ts["design"]["design_elevation_m"] == station["center_z"]
# 산쪽 절토 · 모르면 좌
assert [c and c["design"]["section_mode"] for c in got["cross"]] == [
"left_cut",
"right_cut",
"left_cut",
None,
]
# 비탈 표본 — 절토 · 성토 둘 다 섬
assert got["cross"][0]["design"]["cut_area_m2"] > 0
assert got["cross"][0]["design"]["fill_area_m2"] > 0
def test_unclosed_extends_and_sections(tmp_path: Path) -> None:
got = _run_ts(tmp_path)
wide = got["wide"]
narrow = _python(_station(_WIDE_SLOPE, "left")["samples"], 100.0, "left")
assert narrow["slope_unclosed"] is True # ±20 m 안에선 안 닫힘
assert wide["design"]["slope_unclosed"] is False
assert min(s["offset_m"] for s in wide["samples"]) < -20.0
_same(wide["design"], _python(wide["samples"], 100.0, "left"))
# 코리도 측점 = 세운 측점만(지반고 없는 측점 뺌) · 좌 축 · 설계 실음
sections = got["sections"]
assert len(sections) == 4
assert all(s["frame"]["left_xy"] == [0.0, 1.0] and s["design"]["design_line"] for s in sections)
assert sections[-1]["samples"] == wide["samples"]