- 새 B06_Section_UI_Cross_Line_Cell.ts — 아래 띠 왼쪽 공용 칸(제목 · ◀▲↺▼▶ 한 벌 · 값 한 줄 말줄임 · 길게 누름 반복) · 숨은 버튼은 방향키 슬롯 뗌 - Design_Pick — 암 점선 위 판정 선(키 rock · ▲▼↺ · ◀▶ 막음 · 방향키 = 암만) · 떠 있는 선 조정창 · 우측 위 치수 라벨 걷음 · 안 고르면 암 칸 · 고르면 그 선(노면 · 사면 · 소단 · 중심점 · 교차점 · 암) - Center.ts bindAxisDrag(한 축 끌기 · 놓을 때 한 번 · click 한 번 막음) — 중심점 · 암 세로 끌기 같이 씀 - buildRockBoundaryControl = 공용 칸 「안 고름」 꼴(Cross_Design) · Card_Chrome 띠 왼쪽 = 공용 칸 · Detail_Pick 표 강조에 암 판정 선 뺌 - CSS(Cross.css 공용 칸 · Areas.css 암 고름 띠 · Controls.css 주석) · 시험 test_370_3 새로 · 137 · 139_6 · 179_1 · 193_1 · 194_1 · 318 · 356 · 370_2 고쳐 씀 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
191 lines
8.9 KiB
TypeScript
191 lines
8.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 "./logic/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;
|
|
}
|
|
|
|
/**
|
|
* 시설을 **기본값으로 그렸거나 못 그린 까닭** `[보이는 글, 툴팁]` (2026-09-14 브레인 판정 ②③).
|
|
* 저장만 안 하는 것으로는 모자람 — 그림이 설계값처럼 보이면 기본값이 몰래 확정으로 굳던 병의 잔재.
|
|
*/
|
|
function facilityNotes(section: CrossSection): Array<[string, string]> {
|
|
const notes: Array<[string, string]> = [];
|
|
const sets: Array<[string, string[] | undefined]> = [
|
|
["BOX암거", section.box?.defaulted],
|
|
["세월교", section.ford?.defaulted],
|
|
["물넘이포장", section.ford_pavement?.defaulted],
|
|
];
|
|
for (const [name, items] of sets) {
|
|
if (!items?.length) continue;
|
|
notes.push([
|
|
`⚠ ${name} 기본값(미확정)`,
|
|
`B05 시설 칸에 안 적어 기본값으로 그림 — ${items.join(" · ")} · 적으면 그 값으로 그림`,
|
|
]);
|
|
}
|
|
// 빈칸 경고 한 꼴(323-4) — 형상 필수 칸이 빈 관 · 구조물(관경 · 벽 · 기슭막이 높이 · 맹암거 높이 · 월류
|
|
// 높이 · 형상 얹기가 측점 계획 자리에 얹음). 세월교 · 박스 흙막이 높이 빈 칸 = 본체 끝 높이(79-7)라 안 셈
|
|
for (const item of section.blank ?? [])
|
|
notes.push([
|
|
`⚠ ${item} 빈칸`,
|
|
`${item}을 안 적어 그 그림을 안 그림(수치를 지어내지 않음 · 수량도 미확정) — 시설 칸에 적으면 그림`,
|
|
]);
|
|
return notes;
|
|
}
|
|
|
|
/**
|
|
* 카드 제목행을 만들어 카드에 붙인다(설계 조작이 있으면 조작 바까지).
|
|
*
|
|
* 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);
|
|
}
|
|
for (const [text, tip] of facilityNotes(section)) {
|
|
const note = document.createElement("span");
|
|
note.className = "b06-cross-card__warning";
|
|
note.textContent = text;
|
|
note.title = tip;
|
|
meta.append(note);
|
|
}
|
|
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);
|
|
}
|
|
|
|
/** 하단 정보행 — 왼쪽 = 선 공용 칸(370-3 · 안 고르면 암 경계선) · 오른쪽 = (암 지반일 때) 암 절토 경사. */
|
|
export function appendCardFooter(
|
|
card: HTMLElement,
|
|
section: CrossSection,
|
|
rockBoundary?: RockBoundaryControl,
|
|
cutSlope?: CutSlopeControl,
|
|
/** 설계선 고름 공용 칸(370-3 · `_Cross_Line_Cell`) — 있으면 왼쪽 칸(안 고르면 암 · 고르면 그 선). */
|
|
lineCell?: HTMLElement,
|
|
): void {
|
|
// 중심고는 그래프 Y축 라벨 상자로 옮김(318-2 · `_Cross_Axes`) — 하단 띠는 암 제어만 · 비어도 띠 높이 그대로
|
|
const footer = document.createElement("footer");
|
|
if (lineCell) {
|
|
lineCell.classList.add("b06-cross-card__rockb");
|
|
footer.append(lineCell);
|
|
}
|
|
// 암 경계선 제어는 하단 정보 행 왼쪽(318-2) — 암 지반만 · 설계선 고름이 없는 카드.
|
|
else 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);
|
|
}
|