사용자 지시(2026-09-07): 「대신 경고부분은 삭제해주고 대신 각도를 사용자가 넣을수 있게 반영.
전체 공통으로 변경하는 경우에는 기본값 지정으로 하면 되지만 횡단도 하나만 변경하는 폼은
가져야함 / 개별 횡단도에는 암 절토 각도의 개별 수정 가능해야함」
**화면** — 암 측점 카드 아래에 「암 절토 68.2° ↺」 칸이 섬. 값을 넣으면 그 측점만 사면이
새 경사로 다시 그려지고 절토량도 따라 바뀜. ↺ 는 표준값으로 되돌림. 전체를 바꾸는 자리는
종전대로 좌측 [표준 횡단면 설정]임.
**계산에 넣는 자리는 한 곳씩** — 파이썬 `compute_cross_design(cut_slope_ratio=…)` ·
TS `computeCrossDesign({cutSlopeRatio})` 의 **그룹을 만든 바로 뒤**에서 경사비만 갈아 끼움.
부르는 쪽 9곳에서 표준값을 측점마다 복제하는 방식은 안 씀(한 곳만 빠져도 값이 조용히
사라지는 실패군). 기하·소단 코드는 한 줄도 안 건드림 — 25 확인대로 소단이 그 값을 읽어
서므로 **위치·개수가 새 경사를 저절로 따라옴**.
⚠ **경사는 나르는 값이 아니라 기하 입력임** — 계산 뒤에 키만 베껴 붙이면 설계선은 옛 경사로
그려지고 숫자만 새것이 됨(소단에서 겪은 자리). 그래서 재계산 세 경로(포장 강제·세월교 하강·
선형 재계산)와 브라우저 재계산·서버 프리뷰 **모두 계산 인자로** 넘김.
**되돌리기는 0 을 남김** — 세션에서 지우기만 하면 정본에 남은 옛 사용자 값이 되살아나
표준으로 못 돌아감. 0 = 「표준값을 씀」.
값의 길 — 세션 `cutslope`(등록표 한 줄) → 카드 입력 → [저장]·[확정]에서 `cross_patches`
(`design.cut_slope_ratio_user`) → 정본. `USER_TOUCHED_KEYS` 양쪽에 넣어 **표준을 바꿔도
개별로 고친 측점은 그대로** 둠(사용자 원문 끝줄).
시험 — 새 7건(넣은 경사가 실제로 그려짐 · 무릎 위 토사 경사는 그대로 · 0 은 되돌림 ·
재계산에도 남음 · **계산 전에 넘어감** · 각도↔경사비 · 칸은 암 측점에만),
거울 시험에 「암 절토 경사를 측점에서 바꿈」 한 갈래 추가, 7-3 회귀 한 줄 추가.
전체 **483 passed · 17 skipped**.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
152 lines
6.9 KiB
TypeScript
152 lines
6.9 KiB
TypeScript
/* =============================================================================
|
|
* B06_Section_UI_Cross_Card_Chrome.ts
|
|
* 횡단 카드의 **껍데기**(제목행·하단 정보행)만 떼어 낸 조립기 (2026-09-03 · 700줄 제한).
|
|
*
|
|
* 카드 본체(`_UI_Cross_View`)는 SVG 도면과 조작을 맡고, 도면과 무관한 머리·꼬리는 여기서
|
|
* 만든다. 여기 있는 것은 전부 **읽어서 붙이는 값**이라 카드 상태(줌·선택)를 건드리지 않는다.
|
|
* ========================================================================== */
|
|
|
|
import type { CrossSection } from "./B06_Section_Api_Fetch";
|
|
import type { RockBoundaryControl } from "./B06_Section_UI_Cross_Design";
|
|
import { buildCutSlopeControl, type CutSlopeControl } from "./B06_Section_UI_Cross_CutSlope";
|
|
import {
|
|
buildDesignControls,
|
|
buildRockBoundaryControl,
|
|
sectionModeLabel,
|
|
} from "./B06_Section_UI_Cross_Design";
|
|
import { type FillSlopeLength, fillSlopeLengths } from "./B06_Section_UI_Cross_Fit";
|
|
import {
|
|
type DesignChangeHandler,
|
|
L,
|
|
stationLabel,
|
|
structureDisplayName,
|
|
} from "./B06_Section_UI_Section_Common";
|
|
|
|
/**
|
|
* 성토사면 경사길이 표기 칸 — 성토측이 없으면 null.
|
|
*
|
|
* 값은 **구조물이 끊기 전 본래 사면**(정본 설계선 기준)이라, 기슭막이·집수정이 선 측점도
|
|
* 표준 횡단의 사면 길이를 그대로 보여 준다(2026-09-03 사용자 지시).
|
|
*/
|
|
function fillSlopeInfo(section: CrossSection): HTMLElement | null {
|
|
const lengths = fillSlopeLengths(section);
|
|
const sides = (["left", "right"] as const).filter((side) => lengths[side] !== null);
|
|
if (!sides.length) return null;
|
|
const both = sides.length > 1;
|
|
const info = document.createElement("span");
|
|
info.className = "b06-cross-card__fillslope";
|
|
info.textContent = `${L("B06_Cross_FillSlope")} ${sides
|
|
.map((side) => {
|
|
const length = lengths[side] as FillSlopeLength;
|
|
// 계산 반폭 안에서 원지반을 못 만난 사면은 거기까지만 잰 하한값이라 「≥」로 구분한다.
|
|
const value = `${length.open ? "≥" : ""}${length.lengthM.toFixed(2)}m`;
|
|
if (!both) return value;
|
|
const label = L(side === "left" ? "B06_Design_Ditch_Left" : "B06_Design_Ditch_Right");
|
|
return `${label} ${value}`;
|
|
})
|
|
.join(" · ")}`;
|
|
info.title = L("B06_Cross_FillSlope_Tip");
|
|
return info;
|
|
}
|
|
|
|
/**
|
|
* 카드 제목행을 만들어 카드에 붙인다(설계 조작이 있으면 조작 바까지).
|
|
*
|
|
* 1행 구조(E-2/E-3): 측점 위치표기 → 지반유형 → 단면유형 pill → 구조물 → 측점정보.
|
|
*/
|
|
export function appendCardHeader(
|
|
card: HTMLElement,
|
|
section: CrossSection,
|
|
stationInterval: number,
|
|
onDesignChange?: DesignChangeHandler,
|
|
): void {
|
|
const header = document.createElement("header");
|
|
const title = document.createElement("div");
|
|
title.className = "b06-cross-card__title";
|
|
const label = document.createElement("strong");
|
|
label.textContent = stationLabel(section.chainage_m, stationInterval);
|
|
const chainage = document.createElement("span");
|
|
chainage.textContent = `${section.chainage_m.toFixed(1)}m`;
|
|
title.append(label, chainage);
|
|
|
|
// 단면유형 pill(자동 판정, 읽기 전용) — 구조물 pill과 동일 표기, 좌측 배치(E-3).
|
|
const modePill = document.createElement("span");
|
|
modePill.className = "b06-cross-card__mode";
|
|
modePill.textContent = sectionModeLabel(section.design?.section_mode);
|
|
modePill.title = L("B06_Design_Mode_Legend");
|
|
|
|
const meta = document.createElement("div");
|
|
meta.className = "b06-cross-card__meta";
|
|
// 사면이 계산 반폭 끝까지 원지반을 못 만난 측점 — 면적이 거기서 잘려 유토곡선까지
|
|
// 그 값을 쌓는다. 계산은 손대지 않고 사실만 알린다(2026-09-03 사용자 확정).
|
|
if (section.design?.slope_unclosed) {
|
|
const openSlope = document.createElement("span");
|
|
openSlope.className = "b06-cross-card__warning";
|
|
openSlope.textContent = `⚠ ${L("B06_Cross_SlopeUnclosed")}`;
|
|
openSlope.title = L("B06_Cross_SlopeUnclosed_Tip");
|
|
meta.append(openSlope);
|
|
}
|
|
const structureName = section.structure;
|
|
if (structureName) {
|
|
const structure = document.createElement("span");
|
|
structure.className = "b06-cross-card__structure";
|
|
// 배수관은 관종·관경(`파형강관 D1200`)이 아니라 표시 이름 하나로 적는다
|
|
// (2026-09-03 사용자 지시). 관종·관경은 툴팁에 남긴다.
|
|
structure.textContent = structureDisplayName(structureName);
|
|
structure.title = `구조물: ${structureName}`;
|
|
meta.append(structure);
|
|
}
|
|
// 측점 종류는 시·종점(BP/EP)만 적는다 — "일반측점"은 대다수라 정보가 없다(2026-08-02 사용자 지시).
|
|
if (section.kind === "bp" || section.kind === "ep") {
|
|
const kind = document.createElement("span");
|
|
kind.textContent = L(
|
|
section.kind === "ep" ? "B06_Profile_View_Kind_EP" : "B06_Profile_View_Kind_BP",
|
|
);
|
|
meta.append(kind);
|
|
}
|
|
// 성토사면 경사길이는 **행 우측 끝**(2026-09-03 사용자 지시) — meta 가 제목행의 오른쪽
|
|
// 끝이므로 그 마지막 칸에 붙인다.
|
|
const fillSlope = fillSlopeInfo(section);
|
|
if (fillSlope) meta.append(fillSlope);
|
|
|
|
// 단면유형 pill은 지반유형 우측·우측 맞춤으로 배치(1번). 좌측 구분선은 지반유형 세그먼트에 준다(3번).
|
|
modePill.classList.add("b06-cross-card__mode--right");
|
|
header.append(title);
|
|
if (onDesignChange) {
|
|
const controls = buildDesignControls(section, onDesignChange);
|
|
controls.groundSegment.classList.add("b06-cross-card__ground");
|
|
header.append(controls.groundSegment, modePill, meta);
|
|
card.append(header, controls.bar);
|
|
return;
|
|
}
|
|
header.append(modePill, meta);
|
|
card.append(header);
|
|
}
|
|
|
|
/** 하단 정보행 — 중심고와 (암 지반일 때) 암 경계선·암 절토 경사 제어. */
|
|
export function appendCardFooter(
|
|
card: HTMLElement,
|
|
section: CrossSection,
|
|
rockBoundary?: RockBoundaryControl,
|
|
cutSlope?: CutSlopeControl,
|
|
): void {
|
|
const footer = document.createElement("footer");
|
|
const center = document.createElement("span");
|
|
center.textContent = `${L("B06_Profile_View_CenterElevation")} ${section.center_z?.toFixed(2) ?? "-"}m`;
|
|
footer.append(center);
|
|
// 암 경계선 제어는 하단 정보 행 가운데(2026-08-02) — 암 지반만.
|
|
if (rockBoundary && section.design?.geometry_preset === "rock") {
|
|
const rockControl = buildRockBoundaryControl(section, rockBoundary);
|
|
rockControl.classList.add("b06-cross-card__rockb");
|
|
footer.append(rockControl);
|
|
}
|
|
// 암 절토 경사(각도)는 암 측점에만 — 토사 측점은 암반이 없어 쓰이지 않는다
|
|
// (2026-09-07 사용자 확정). 전체를 바꾸는 자리는 좌측 [표준 횡단면 설정]이다.
|
|
if (cutSlope && section.design?.geometry_preset === "rock") {
|
|
const slopeControl = buildCutSlopeControl(section, cutSlope);
|
|
slopeControl.classList.add("b06-cross-card__cutslope");
|
|
footer.append(slopeControl);
|
|
}
|
|
card.append(footer);
|
|
}
|