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_엔진_지문은_코드_내용():