From fb48bd74fbab156f9fab35915a1f13603b3f464e Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 27 Oct 2026 20:26:50 +0900 Subject: [PATCH] =?UTF-8?q?fix(E03):=20=EC=9C=84=ED=97=98=20=EB=9D=A0=20?= =?UTF-8?q?=EA=B3=A0=EB=A5=B8=20=EC=B8=A1=EC=A0=90=20=EA=B3=81=20=EC=86=8E?= =?UTF-8?q?=EC=9D=80=20=EA=B8=80=20=EA=B2=B9=EC=B9=A8=20=EB=BA=8C=20(PLAN?= =?UTF-8?q?=20566-2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - planLabelKeys — 고른 측점 반 걸음 안 글은 뺌(원배율에서 24+0 · 25+0 겹침) - 시험 532_3 logic TS 에 고른 측점 곁 뺌 Co-Authored-By: Claude Opus 5.5 --- E03_StabSection/logic/E03_StabSection_Logic.ts | 8 ++++++-- resources/tester/test_532_3_e03_section.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/E03_StabSection/logic/E03_StabSection_Logic.ts b/E03_StabSection/logic/E03_StabSection_Logic.ts index 969d97871..ea80a9bc6 100644 --- a/E03_StabSection/logic/E03_StabSection_Logic.ts +++ b/E03_StabSection/logic/E03_StabSection_Logic.ts @@ -197,7 +197,8 @@ export function labelStride(intervalPx: number, minPx: number): number { return PLAN_LABEL_STRIDES.find((s) => s * intervalPx >= minPx) ?? 100; } -/** 측점 글 붙일 열쇠 — 본 측점(간격 배수) 중 걸음 배수 · 걸음 1 이면 보조 측점도 · 고른 측점은 늘 */ +/** 측점 글 붙일 열쇠 — 본 측점(간격 배수) 중 걸음 배수 · 걸음 1 이면 보조 측점도 · 고른 측점은 늘 + * (고른 측점 곁 반 걸음 안 글은 뺌 — 겹침) */ export function planLabelKeys( rows: StationRow[], interval: number, @@ -205,10 +206,13 @@ export function planLabelKeys( active: string | null, ): string[] { const step = interval > 0 ? interval : 1; + const at = rows.find((r) => r.key === active)?.chainage_m; return rows .filter((r) => r.center && r.center[0] !== null && r.center[1] !== null) .filter((r) => { - if (r.key === active || stride === 1) return true; + if (r.key === active) return true; + if (at !== undefined && Math.abs(r.chainage_m - at) < (stride * step) / 2) return false; + if (stride === 1) return true; const n = Math.round(r.chainage_m / step); return Math.abs(r.chainage_m - n * step) < 0.05 && n % stride === 0; }) diff --git a/resources/tester/test_532_3_e03_section.py b/resources/tester/test_532_3_e03_section.py index 4e051d996..7cf96914f 100644 --- a/resources/tester/test_532_3_e03_section.py +++ b/resources/tester/test_532_3_e03_section.py @@ -446,7 +446,7 @@ process.stdout.write(JSON.stringify({ zAt: [m.zAt([[0, 0], [10, 10]], 2.5), m.zAt([[10, 10], [0, 0]], -5)], stride: [m.labelStride(100, 64), m.labelStride(40, 64), m.labelStride(10, 64), m.labelStride(0.1, 64)], labels: [1, 2, 5].map((k) => m.planLabelKeys(input.rows, 20, k, null)), - labelsActive: m.planLabelKeys(input.rows, 20, 5, "e"), + labelsActive: [m.planLabelKeys(input.rows, 20, 5, "e"), m.planLabelKeys(input.rows, 20, 5, "b")], })); """ @@ -580,7 +580,7 @@ def test_logic_TS(): # 평면 띠 측점 글 솎음 — 간격 px × 걸음 ≥ 64 · 본 측점 중 걸음 배수 · 고른 측점은 늘 assert out["stride"] == [1, 2, 10, 100] assert out["labels"] == [["a", "b", "c", "d", "e"], ["a", "c", "e"], ["a"]] - assert out["labelsActive"] == ["a", "e"] + assert out["labelsActive"] == [["a", "e"], ["b"]] # 고른 측점 반 걸음(50 m) 안 「a」 뺌 def test_엔진_지문은_코드_내용():