feat(D 예정노선): 노드마다 긋기 방식 · 값 기록 — 꼭짓점과 같이 움직임 · 옮긴 노드 기록 남기고 경고 고리 (PLAN 599-2 · 요구 463-11)

- 점 찍을 때 그때 방식 · 값을 nodes 칸에(594-1 꼴 · 붙은 점 = 자유 · 처음 기록 = 앞 노드 기록 없음)
- 끼움 · 더함 · 뺌 · 지움 · 뒤집기(토막 끝 노드 몫 한 칸 밀림) · 잇기 · 다시 긋기(뒤 노드 = 자유)가 기록 길이를 꼭짓점과 맞춤 — [저장] 400 막음
- nodeRecord · nodeOff(길이 1 cm · 기울기 0.1 % 넘게 어긋남) — Span.ts(Plan 700 줄 넘지 않게) · 598 노드 판이 씀
- 시험 599_3 에 기록 따라감 · 어긋남

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 14:49:21 +09:00
co-authored by Claude Opus 5.5
parent b92aae3254
commit 9febb63e13
5 changed files with 175 additions and 32 deletions
+55 -3
View File
@@ -1,7 +1,8 @@
"""D03 다시 긋기(PLAN 599-3 · 요구 463-12) — TS `logic/D03_PlanAnalysis_Span.ts`.
"""D03 다시 긋기 · 노드 기록(PLAN 599-2 · 599-3 · 요구 463-11 · 12) — TS `logic/D03_PlanAnalysis_Span.ts` · `_Plan.ts`.
두 꺾임점 사이를 새 점으로 바꿈 · 끝 두 점 그대로 · 뒤 갈래 차례 밈 · 속 점 갈래 = 막음 ·
마크 = 바뀐 구간 안 길이 비율 · 뒤는 길이 차 · 조각 id 그대로.
마크 = 바뀐 구간 안 길이 비율 · 뒤는 길이 차 · 조각 id 그대로 · 노드 기록 = 꼭짓점과 같은 길이로 따라감
(더함 · 끼움 · 뺌 · 지움 · 뒤집기 · 잇기 · 다시 긋기) · 옮긴 노드 = 기록 남고 어긋남.
./venv/Scripts/python.exe -m pytest resources/tester/test_599_3_plan_span.py -q
"""
@@ -34,7 +35,32 @@ const done = span.replaceSpan(n, 0, 1, 2, [[150, 50]]);
const wide = span.replaceSpan(n, 0, 0, 3, [[150, 50]]);
const bad = span.replaceSpan(n, 0, 2, 2, []);
const straight = span.replaceSpan(n, 0, 0, 2, []);
writeFileSync(process.argv[2], JSON.stringify({ before: n, done, wide, bad, straight }));
// 599-2 노드 기록
const L = span.nodeRecord("length", 20, 9);
const S = span.nodeRecord("slope", 20, 9);
let r = plan.newLine(plan.emptyNetwork(), [0, 0]);
r = plan.appendVertex(r, 0, [10, 0]);
r = plan.appendVertex(r, 0, [30, 0], L);
r = plan.appendVertex(r, 0, [30, 5], S);
const recorded = r;
const inserted = plan.insertVertex(r, 0, 0, [5, 0]);
const dropped = plan.dropLastVertex(r, 0);
const removed = plan.removeVertex(r, 0, 1);
const reversed = plan.reverseLine(r, 0);
let t = plan.appendVertex(plan.newLine(r, [30, 5]), 1, [40, 5], L);
const joined = plan.attachHead(t, 1);
const moved = plan.moveVertex(r, 0, 2, [33, 0]);
const flat = () => 0;
const off = [1, 2, 3].map((v) => span.nodeOff(moved.lines[0], v, flat));
const respanned = span.replaceSpan(r, 0, 1, 3, [[20, 9]], [L]);
const plain = span.replaceSpan(n, 0, 1, 2, [[150, 50]]);
writeFileSync(
process.argv[2],
JSON.stringify({
before: n, done, wide, bad, straight,
recorded, inserted, dropped, removed, reversed, joined, moved, off, respanned, plain,
}),
);
"""
@@ -99,3 +125,29 @@ def test_blocked_and_straight(tmp_path: Path) -> None:
straight = r["straight"]["lines"][0]["vertices"]
assert straight == [[0, 0], [200, 0], [300, 0]] # 속 점 없이 곧게
assert r["straight"]["lines"][1]["branch"]["vertex"] == 1
L = {"kind": "length", "length_m": 20, "slope_pct": None}
S = {"kind": "slope", "length_m": None, "slope_pct": 9}
F = {"kind": "free", "length_m": None, "slope_pct": None}
def _nodes(network: dict, i: int = 0) -> list:
line = network["lines"][i]
assert len(line.get("nodes") or line["vertices"]) == len(line["vertices"]) # 서버 400 막음
return line.get("nodes")
def test_node_records_follow_vertices(tmp_path: Path) -> None:
r = _run_ts(tmp_path)
assert _nodes(r["recorded"]) == [None, None, L, S] # 첫 기록 = 앞 노드 기록 없음
assert _nodes(r["inserted"]) == [None, None, None, L, S]
assert _nodes(r["dropped"]) == [None, None, L]
assert _nodes(r["removed"]) == [None, L, S]
assert _nodes(r["reversed"]) == [None, S, L, None] # 토막 끝 노드 몫 = 한 칸 밀림
assert len(r["joined"]["lines"]) == 1 and _nodes(r["joined"]) == [None, None, L, S, L]
assert _nodes(r["moved"]) == [None, None, L, S] # 옮겨도 기록 남음
# 2 = 길이 20 기록 · 지금 23 · 3 = 기울기 9 % 기록 · 평지 0 % → 둘 다 어긋남 · 1 = 기록 없음
assert r["off"] == [False, True, True]
assert _nodes(r["respanned"]) == [None, None, L, F] # 속 점 = 그때 기록 · 뒤 노드 = 자유
assert "nodes" not in r["plain"]["lines"][0] # 기록 없는 선 = 그대로 없음