[1818] 양단케이블(dblCblTotCnt) 유령 카운트 수정 — isPointInRect ε=0.5 여유로 千鳥(치도리) 대각선 이웃 반올림 오차 흡수, 진단 로그 제거 #960

Merged
ysCha merged 1 commits from dev into prd-deploy 2026-07-10 09:10:19 +09:00
Showing only changes of commit 057287452a - Show all commits

View File

@ -2499,8 +2499,11 @@ export const useTrestle = () => {
}) })
} }
function isPointInRect(rect, point) { // [DBL-CABLE-EPS 2026-07-10] 좌표가 소수점 2자리 반올림이라 千鳥 이웃 위치에 ±0.02 오차 누적 →
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height // 경계에 아슬아슬 걸친 이웃이 밖으로 판정되어 회로가 분리되고 유령 케이블(dblCblTotCnt) 1 발생.
// ε=0.5 로 반올림 오차 흡수(매칭 tolerance 0.5 기준). 남/북 fallback 에도 이 헬퍼 공유 사용.
function isPointInRect(rect, point, eps = 0.5) {
return point.x >= rect.x - eps && point.x <= rect.x + rect.width + eps && point.y >= rect.y - eps && point.y <= rect.y + rect.height + eps
} }
// 25-04-02 추가 // 25-04-02 추가
@ -3384,75 +3387,18 @@ export const useTrestle = () => {
const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) const surfaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE) const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE)
let case1Cnt = 0
let case2Cnt = 0
const perSurfaceGroups = []
surfaces.forEach((surface) => { surfaces.forEach((surface) => {
const modules = surface.modules const modules = surface.modules
// 1. 현재 surface의 모듈들을 그룹화 // 1. 현재 surface의 모듈들을 그룹화
const groupInSurface = groupPoints(modules, surface) const groupInSurface = groupPoints(modules, surface)
const surfaceCnt = countMatchingCircuitNumbers(groupInSurface) const surfaceCnt = countMatchingCircuitNumbers(groupInSurface)
perSurfaceGroups.push({
surfaceId: surface.id,
direction: surface.direction,
moduleIntvlHor: surface.trestleDetail?.moduleIntvlHor,
moduleIntvlVer: surface.trestleDetail?.moduleIntvlVer,
addedCnt: surfaceCnt,
groups: groupInSurface.map((g) =>
g.map((m) => {
const c = m.getCenterPoint()
return { id: m.id, circuitNumber: m.circuitNumber, x: +c.x.toFixed(2), y: +c.y.toFixed(2), w: m.width, h: m.height }
}),
),
})
cnt += surfaceCnt cnt += surfaceCnt
case1Cnt += surfaceCnt
}) })
const groupByCircuitAndSurfaceCnt = groupByCircuitAndSurface(modules) const groupByCircuitAndSurfaceCnt = groupByCircuitAndSurface(modules)
Object.keys(groupByCircuitAndSurfaceCnt).forEach((key) => { Object.keys(groupByCircuitAndSurfaceCnt).forEach((key) => {
cnt += groupByCircuitAndSurfaceCnt[key] - 1 cnt += groupByCircuitAndSurfaceCnt[key] - 1
case2Cnt += groupByCircuitAndSurfaceCnt[key] - 1
})
// [DBL-CABLE-PROD] 운영 1회 진단용 — env 게이트 없이 브라우저 콘솔에 전량 출력.
// 진단 후 제거. 이 한 줄만 복사해서 전달하면 원인(Case1 면내분리 / Case2 면교차) 확정 가능.
console.log('[DBL-CABLE-PROD]', {
total: cnt,
case1_sameSurfaceSplit: case1Cnt,
case2_crossSurface: case2Cnt,
groupByCircuitAndSurfaceCnt,
roofSizeSet,
modules: modules.map((m) => {
const c = m.getCenterPoint()
return {
id: m.id,
circuitNumber: m.circuitNumber,
surfaceId: m.surfaceId,
x: +c.x.toFixed(2),
y: +c.y.toFixed(2),
w: m.width,
h: m.height,
northModuleYn: m.moduleInfo?.northModuleYn,
moduleTpCd: m.moduleInfo?.moduleTpCd,
pcsItemId: m.pcsItemId,
pcsTpCd: m.pcs?.pcsTpCd,
}
}),
surfacesSummary: surfaces.map((s) => ({
id: s.id,
direction: s.direction,
moduleCount: s.modules?.length,
pitch: s.roofMaterial?.pitch,
roofMatlCd: s.roofMaterial?.roofMatlCd,
moduleIntvlHor: s.trestleDetail?.moduleIntvlHor,
moduleIntvlVer: s.trestleDetail?.moduleIntvlVer,
})),
perSurfaceGroups,
}) })
return cnt return cnt