feat(B06 CAD 글): 조합 미지정 구조물 = 종류 이름만 · 같은 측점 같은 종류 한 줄 (372-3)

TS ↔ 파이썬 짝 · 거울 시험에 중복 사례 추가.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWh5wNNycMkbwMpACz1rte
This commit is contained in:
2026-10-17 11:57:41 +09:00
co-authored by Claude Sonnet 5.5
parent 373f6703fe
commit 98396f9939
4 changed files with 28 additions and 12 deletions
@@ -7,7 +7,7 @@
* (`_Engine_Cad_Table.cross_note_cad_entities`).
* 처음 열 때 칸이 없으면 — 옛 글(`structure_note`)이 있으면 줄마다 Text 로 옮김 · 없으면 미리 넣음
* (265-2 · 관 주인 측점 = 원형 마크 · 그 측점 구조물마다 지정된 구조물 조합 이름 줄 · 미지정 =
* 「이름 조합 미지정」 · 이어서 좌측 패널 옵션 줄 = `structureOptionLines` · 166-1) · 그 밖 = 빈 도면.
* 종류 이름만(같은 측점 같은 종류 한 줄) · 이어서 좌측 패널 옵션 줄 = `structureOptionLines` · 166-1) · 그 밖 = 빈 도면.
* ⚠ 짝(①) = `B07_DesignDetail/B07_DesignDetail_Engine_Cad_CulvertNote.py` — `noteEntities` ·
* `structureNoteLines` · `stationNoLabel` 와 같은 입력 → 같은 엔티티(id 만 다름) · 모달을 안 연
* 측점은 B07 이 그것으로 그림 · 거울 시험 `test_260_note_cad.py` · `test_265_note_cad.py`.
@@ -158,10 +158,11 @@ export const thingsAt = (things: readonly NoteThing[], chainageM: number): NoteT
/**
* 구조물 조합 줄 — 구조물마다 지정된 조합(본체 → 그룹 차례) 이름 한 줄씩(이름 = 일위대가 이름 +
* 조합 경로 옵션 값) · 같은 구조물의 같은 이름은 한 줄 · 미지정 = 「{구조물 이름} 조합 미지정」 ·
* 조합 경로 옵션 값) · 같은 구조물의 같은 이름은 한 줄 · 미지정 = 종류 이름만(같은 측점 같은 종류는 한 줄) ·
* 배관은 본체 줄 없음(원형 마크) — 보호공 · 흙막이 · 도수로 조합만 · 이어서 그 구조물 좌측 패널 옵션 줄(166-1).
*/
export function structureNoteLines(things: readonly NoteThing[], chainageM: number): string[] {
const kinds = new Set<string>();
return thingsAt(things, chainageM).flatMap((thing) => {
const own = readSummaryItem(thing.summary_item);
const slots: Array<[string, SummaryItem]> = Object.entries(readGroupItems(thing.group_items));
@@ -171,9 +172,10 @@ export function structureNoteLines(things: readonly NoteThing[], chainageM: numb
.map(([, item]) => summaryLabel(item));
const combos = slots.length
? [...new Set(names)]
: thing.pipe
: thing.pipe || kinds.has(thing.name)
? []
: [`${thing.name} 조합 미지정`];
: [thing.name];
if (!slots.length) kinds.add(thing.name);
return [...combos, ...(thing.optionLines ?? [])];
});
}
@@ -7,7 +7,7 @@ B06 [상세] 모달을 한 번도 안 연 측점(칸 = 없음)에 B07 이 같은
(빈 엔티티)은 덮지 않음 · 옛 글(`structure_note`)이 있으면 옛 글이 먼저
(모달이 처음 열 때 옮기는 차례와 같음).
그림 = 관 주인 측점 원형 마크(배수관 · Φ · L 정수) + 측점 · 그 측점 구조물마다 지정된
구조물 조합 이름 줄(미지정 = 「이름 조합 미지정」) + 그 구조물 좌측 패널 옵션 줄(166-1).
구조물 조합 이름 줄(미지정 = 종류 이름만) + 그 구조물 좌측 패널 옵션 줄(166-1).
옵션 줄은 파이썬으로 다시 짜지 않음 — 화면과 같은 TS(`structureOptionLines`)를 Node
진입점(`B07_DesignDetail_Note_Options_Node.ts` · CLAUDE.md 5장 ②)으로 돌려 받음 ·
실패는 비치명(조합 줄만).
@@ -109,10 +109,11 @@ def things_at(things: list[Thing], chainage_m: float) -> list[Thing]:
def structure_note_lines(things: list[Thing], chainage_m: float) -> list[str]:
"""구조물 조합 줄 — TS `structureNoteLines` 짝.
본체 → 그룹 차례 · 같은 이름 한 줄 · 미지정 = 「이름 조합 미지정」 · 배관 본체 뺌 ·
본체 → 그룹 차례 · 같은 이름 한 줄 · 미지정 = 종류 이름만(같은 측점 같은 종류 한 줄) · 배관 본체 뺌 ·
이어서 그 구조물 좌측 패널 옵션 줄(`option_lines` · 166-1).
"""
lines: list[str] = []
kinds: set[str] = set()
for thing in things_at(things, chainage_m):
own = _summary_item(thing.get("summary_item"))
slots = ([("", own)] if own else []) + _group_items(thing.get("group_items"))
@@ -123,8 +124,9 @@ def structure_note_lines(things: list[Thing], chainage_m: float) -> list[str]:
]
if slots:
lines += list(dict.fromkeys(names))
elif not thing["pipe"]:
lines.append(f"{thing['name']} 조합 미지정")
elif not thing["pipe"] and thing["name"] not in kinds:
kinds.add(thing["name"])
lines.append(thing["name"])
lines += [str(line) for line in thing.get("option_lines") or []]
return lines
+1 -1
View File
@@ -107,7 +107,7 @@ def test_조합_줄_뒤에_옵션_줄_미지정도_옵션_줄():
"group_items": None,
"option_lines": ["옹벽: 높이 2.5m"],
}
assert structure_note_lines([thing], 40.0) == ["옹벽 조합 미지정", "옹벽: 높이 2.5m"]
assert structure_note_lines([thing], 40.0) == ["옹벽", "옹벽: 높이 2.5m"]
def test_화면은_구조물마다_옵션_줄을_붙임():
+15 -3
View File
@@ -124,12 +124,12 @@ _LINES = [
"기슭막이 메쌓기 1.2m 기초무",
"돌붙임 찰붙임",
"옹벽 콘크리트 H=2.0",
"돌쌓기(찰) 조합 미지정",
"가드레일 조합 미지정",
"돌쌓기(찰)",
"가드레일",
]
def test_구조물_여럿_글은_조합_이름_미지정_배관_본체_뺌_TS_파이썬_같음():
def test_구조물_여럿_글은_조합_이름_미지정은_종류_이름만_배관_본체_뺌_TS_파이썬_같음():
culvert = {**_culvert_set(_PIPE), "chainage_m": 40.2}
cases = [
_case(_THINGS, 40.0, culvert, {"pipe_length_m": 8.5}),
@@ -229,3 +229,15 @@ def test_원형_마크_L_은_사사오입_정수_TS_파이썬_같음(length, lab
py = note_entities(40.0, culvert, design, "NO.2", [])
assert _labels(ts["entities"])[2] == label
assert _labels(py)[2] == label
def test_미지정_같은_종류는_한_줄_조합_있는_같은_이름은_따로_TS_파이썬_같음():
things = [
{"name": "옹벽", "pipe": False, "at": 40.0},
{"name": "옹벽", "pipe": False, "at": 40.1},
{"name": "돌쌓기", "pipe": False, "at": 40.0, "summary_item": _B},
{"name": "돌쌓기", "pipe": False, "at": 40.0},
]
[ts] = _helper("mirror", [_case(things, 40.0, None, {})])
lines = structure_note_lines(things, 40.0)
assert ts["lines"] == lines == ["옹벽", "돌붙임 찰붙임", "돌쌓기"]