diff --git a/src/util/skeleton-utils.js b/src/util/skeleton-utils.js index 5d31367b..e46053c4 100644 --- a/src/util/skeleton-utils.js +++ b/src/util/skeleton-utils.js @@ -281,7 +281,7 @@ const movingLineFromSkeleton = (roofId, canvas) => { else if (moveDirection === 'out') point.x = Big(point.x).plus(moveUpDownLength).toNumber(); // if (__isLocalMS) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}→${point.x}`) } else if (__isLocalMS) { - // logger.warn(`[BR-TRACE] i=${i} position=${position} 매칭 분기 없음 (이동 안 됨)`) + logger.warn(`[BR-TRACE] i=${i} position=${position} 매칭 분기 없음 (이동 안 됨)`) } }); @@ -469,7 +469,7 @@ const buildRawMovedPoints = (roofId, canvas) => { else if (moveDirection === 'in') point.x = Big(point.x).minus(moveUpDownLength).toNumber() // if (__isLocalBR) logger.log(`[BR-TRACE] i=${i} right/${moveDirection} x ${__bx}→${point.x}`) } else if (__isLocalBR) { - // logger.warn(`[BR-TRACE] i=${i} position=${position} 매칭 분기 없음 (이동 안 됨)`) + logger.warn(`[BR-TRACE] i=${i} position=${position} 매칭 분기 없음 (이동 안 됨)`) } }) @@ -483,7 +483,7 @@ const buildRawMovedPoints = (roofId, canvas) => { return newPoints } catch (e) { - // logger.warn('[buildRawMovedPoints] 실패 → null fallback:', e) + logger.warn('[buildRawMovedPoints] 실패 → null fallback:', e) return null } } @@ -566,9 +566,9 @@ export const verifyMoveBoundary = (roofId, canvas) => { const boundaryTol = Math.max(1.0, Math.abs(crossOrig) * 0.05) if (crossNew < -boundaryTol) { - // logger.warn( - // `[verifyMoveBoundary] 꼭짓점[${i}] 골짜기 → 볼록 뒤집힘 (CROSSED): ${crossOrig.toFixed(1)} → ${crossNew.toFixed(1)}` - // ) + logger.warn( + `[verifyMoveBoundary] 꼭짓점[${i}] 골짜기 → 볼록 뒤집힘 (CROSSED): ${crossOrig.toFixed(1)} → ${crossNew.toFixed(1)}` + ) return 'crossed' } if (Math.abs(crossNew) <= boundaryTol) { @@ -586,7 +586,7 @@ export const verifyMoveBoundary = (roofId, canvas) => { // logger.log(`[verifyMoveBoundary] 최종 판정: ${worst} (moved indices=[${movedIdx.join(',')}])`) return worst } catch (e) { - // logger.warn('[verifyMoveBoundary] 판정 실패 → unknown:', e) + logger.warn('[verifyMoveBoundary] 판정 실패 → unknown:', e) return 'unknown' } } @@ -601,7 +601,7 @@ const safeMovedPointsWithFallback = (roofId, canvas) => { const movedPoints = movingLineFromSkeleton(roofId, canvas) if (!Array.isArray(movedPoints) || movedPoints.length === 0) { - // logger.warn('[safeMovedPointsWithFallback] movedPoints 비정상 → bail out') + logger.warn('[safeMovedPointsWithFallback] movedPoints 비정상 → bail out') return null } @@ -651,13 +651,13 @@ const safeMovedPointsWithFallback = (roofId, canvas) => { } if (zeroLenEdges > 0 || severeReduction || selfIntersect) { - // logger.warn('[safeMovedPointsWithFallback] 붕괴/교차 감지 (로그만)', { - // movedLen: movedPoints.length, - // oldLen: oldPoints.length, - // zeroLenEdges, - // severeReduction, - // selfIntersect, - // }) + logger.warn('[safeMovedPointsWithFallback] 붕괴/교차 감지 (로그만)', { + movedLen: movedPoints.length, + oldLen: oldPoints.length, + zeroLenEdges, + severeReduction, + selfIntersect, + }) } return movedPoints @@ -975,7 +975,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { // 1. 지붕 폴리곤 유효성 검사 const coordinates = preprocessPolygonCoordinates(roof.points) if (coordinates.length < 3) { - // logger.warn('Polygon has less than 3 unique points. Cannot generate skeleton.') + logger.warn('Polygon has less than 3 unique points. Cannot generate skeleton.') return } @@ -1076,10 +1076,10 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { try { const __moveVerdict = verifyMoveBoundary(roofId, canvas) if (__moveVerdict === 'crossed') { - // logger.warn('[skeleton] 경계 넘음(crossed) → 오버된 wall.baseLine 좌표 기반 재빌드 진행') + logger.warn('[skeleton] 경계 넘음(crossed) → 오버된 wall.baseLine 좌표 기반 재빌드 진행') } } catch (e) { - // logger.warn('[skeleton] verifyMoveBoundary 예외 → 기존 흐름 진행:', e) + logger.warn('[skeleton] verifyMoveBoundary 예외 → 기존 흐름 진행:', e) } const movedPoints = safeMovedPointsWithFallback(roofId, canvas) @@ -1187,7 +1187,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { const next = changRoofLinePoints[(i + 1) % changRoofLinePoints.length] const dist = Math.hypot(next.x - curr.x, next.y - curr.y) if (dist < 0.5) { - // logger.warn(`[SK_WARN] 인접 중복점: [${i}](${Math.round(curr.x)},${Math.round(curr.y)}) ↔ [${(i + 1) % changRoofLinePoints.length}](${Math.round(next.x)},${Math.round(next.y)}) dist=${dist.toFixed(3)}`) + logger.warn(`[SK_WARN] 인접 중복점: [${i}](${Math.round(curr.x)},${Math.round(curr.y)}) ↔ [${(i + 1) % changRoofLinePoints.length}](${Math.round(next.x)},${Math.round(next.y)}) dist=${dist.toFixed(3)}`) } } @@ -1198,7 +1198,7 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { const next = changRoofLinePoints[(i + 1) % changRoofLinePoints.length] const cross = (curr.x - prev.x) * (next.y - prev.y) - (curr.y - prev.y) * (next.x - prev.x) if (Math.abs(cross) < 1.0) { - // logger.warn(`[SK_WARN] 일직선 점: [${i}](${Math.round(curr.x)},${Math.round(curr.y)}) cross=${cross.toFixed(3)}`) + logger.warn(`[SK_WARN] 일직선 점: [${i}](${Math.round(curr.x)},${Math.round(curr.y)}) cross=${cross.toFixed(3)}`) } } @@ -1363,12 +1363,12 @@ export const skeletonBuilder = (roofId, canvas, textMode) => { export const drawSkeletonRidgeRoofFromBaseLines = (roofId, canvas, textMode) => { const roof = canvas?.getObjects().find((o) => o.id === roofId) if (!roof) { - // logger.warn('[SK_OVER_FN] roof 없음 → 중단') + logger.warn('[SK_OVER_FN] roof 없음 → 중단') return } const wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes?.roofId === roofId) if (!wall || !wall.baseLines?.length) { - // logger.warn('[SK_OVER_FN] wall/baseLines 없음 → 중단') + logger.warn('[SK_OVER_FN] wall/baseLines 없음 → 중단') return } @@ -1382,14 +1382,14 @@ export const drawSkeletonRidgeRoofFromBaseLines = (roofId, canvas, textMode) => continue } if (bl == null || !isFinite(bl.x1) || !isFinite(bl.y1)) { - // logger.warn(`[SK_OVER_FN] baseLines[${i}] invalid coord → skip`) + logger.warn(`[SK_OVER_FN] baseLines[${i}] invalid coord → skip`) continue } rawPoints.push({ x: bl.x1, y: bl.y1 }) } if (rawPoints.length < 3) { - // logger.warn(`[SK_OVER_FN] 유효 baseLines 끝점 ${rawPoints.length} < 3 → 중단`) + logger.warn(`[SK_OVER_FN] 유효 baseLines 끝점 ${rawPoints.length} < 3 → 중단`) return } @@ -1731,8 +1731,8 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const _seen = new Map() roofLines.forEach((l, i) => { const k = _keyOfEdge(l) - // if (_seen.has(k)) logger.warn(`[PAIR-DIAG] key collision: idx ${_seen.get(k)} vs ${i} key=${k}`) - // else _seen.set(k, i) + if (_seen.has(k)) logger.warn(`[PAIR-DIAG] key collision: idx ${_seen.get(k)} vs ${i} key=${k}`) + else _seen.set(k, i) }) roofLines.forEach((rl, i) => { const wl = wallLines[i] @@ -1826,7 +1826,7 @@ const createInnerLinesFromSkeleton = (roofId, canvas, skeleton, textMode, isOver const wbL = wallBaseLine[l] const wL = wallLine[l] if (Math.abs(wbL - wL) < 0.1) { - // logger.warn(`⚠️ [${condition.toUpperCase()}_${isStart ? 'START' : 'END'}] Line crossing detected! newPoint:`, newPointM, 'pLine:', pLineM) + logger.warn(`⚠️ [${condition.toUpperCase()}_${isStart ? 'START' : 'END'}] Line crossing detected! newPoint:`, newPointM, 'pLine:', pLineM) if (moveAxis === 'x') { getAddLine({ x: pLineM, y: pLineL }, { x: newPointM, y: pLineL }, 'green') getAddLine({ x: newPointM, y: pLineL }, ePoint, 'pink') @@ -3342,7 +3342,7 @@ const calcOverCorrectedPoints = (points, origPoints) => { // 보정 실패 시(꼭짓점 부족) 원본 반환 → 기존 동작 보장 if (cleaned.length >= 3) return cleaned if (deduped.length >= 3) return deduped - // logger.warn('[SK_OVER] calcOverCorrectedPoints: 보정 실패 → 원본 반환') + logger.warn('[SK_OVER] calcOverCorrectedPoints: 보정 실패 → 원본 반환') return points } @@ -4664,7 +4664,7 @@ const checkPointInPolygon = (point, wall) => { // 2. wall.baseLines를 이용한 Ray Casting Algorithm if (!wall.baseLines || !Array.isArray(wall.baseLines)) { - // logger.warn('wall.baseLines가 없습니다'); + logger.warn('wall.baseLines가 없습니다'); return false; } @@ -4963,7 +4963,7 @@ function updateAndAddLine(innerLines, targetPoint) { } } if (!foundLine) { - // logger.warn(`[updateAndAddLine] NOT FOUND position=${targetPoint.position} point=(${targetPoint.x.toFixed(2)},${targetPoint.y.toFixed(2)})`); + logger.warn(`[updateAndAddLine] NOT FOUND position=${targetPoint.position} point=(${targetPoint.x.toFixed(2)},${targetPoint.y.toFixed(2)})`); return [...innerLines]; }