불필요한 로그 및 확인용 포인트 제거

This commit is contained in:
Jaeyoung Lee 2025-06-13 14:59:28 +09:00
parent 0430be1945
commit 7d5a235b95

View File

@ -469,8 +469,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
const baseLinePoints = baseLines.map((line) => ({ x: line.x1, y: line.y1 })) const baseLinePoints = baseLines.map((line) => ({ x: line.x1, y: line.y1 }))
/** 벽취합이 있는 경우 소매가 있다면 지붕 형상을 변경해야 한다. */ /** 벽취합이 있는 경우 소매가 있다면 지붕 형상을 변경해야 한다. */
console.log('baseLines :', baseLines)
console.log('roof : ', roof)
baseLines baseLines
.filter((line) => line.attributes.type === LINE_TYPE.WALLLINE.WALL && line.attributes.offset > 0) .filter((line) => line.attributes.type === LINE_TYPE.WALLLINE.WALL && line.attributes.offset > 0)
.forEach((currentLine) => { .forEach((currentLine) => {
@ -864,14 +862,14 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
/** 용마루의 갯수*/ /** 용마루의 갯수*/
let baseRidgeCount = 0 let baseRidgeCount = 0
console.log('drawEavesFirstLines :', drawEavesFirstLines) // console.log('drawEavesFirstLines :', drawEavesFirstLines)
console.log('drawEavesSecondLines :', drawEavesSecondLines) // console.log('drawEavesSecondLines :', drawEavesSecondLines)
console.log('drawGableRidgeFirst: ', drawGableRidgeFirst) // console.log('drawGableRidgeFirst: ', drawGableRidgeFirst)
console.log('drawGableRidgeSecond:', drawGableRidgeSecond) // console.log('drawGableRidgeSecond:', drawGableRidgeSecond)
console.log('drawGablePolygonFirst :', drawGablePolygonFirst) // console.log('drawGablePolygonFirst :', drawGablePolygonFirst)
console.log('drawGablePolygonSecond :', drawGablePolygonSecond) // console.log('drawGablePolygonSecond :', drawGablePolygonSecond)
console.log('drawHipAndGableFirst :', drawHipAndGableFirst) // console.log('drawHipAndGableFirst :', drawHipAndGableFirst)
console.log('drawWallLines :', drawWallRidgeLine) // console.log('drawWallLines :', drawWallRidgeLine)
/** 박공지붕에서 파생되는 마루를 그린다. ㄷ 형태*/ /** 박공지붕에서 파생되는 마루를 그린다. ㄷ 형태*/
drawGableRidgeFirst.forEach((current) => { drawGableRidgeFirst.forEach((current) => {
@ -2056,15 +2054,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
const prevLine = prevBaseLine.line const prevLine = prevBaseLine.line
const nextLine = nextBaseLine.line const nextLine = nextBaseLine.line
const checkLine = new fabric.Line([currentLine.x1, currentLine.y1, currentLine.x2, currentLine.y2], {
stroke: 'red',
strokeWidth: 4,
parentId: roofId,
name: 'checkLine',
})
canvas.add(checkLine)
canvas.renderAll()
/** 이전 라인의 경사 */ /** 이전 라인의 경사 */
const prevDegree = getDegreeByChon(prevLine.attributes.pitch) const prevDegree = getDegreeByChon(prevLine.attributes.pitch)
/** 다음 라인의 경사 */ /** 다음 라인의 경사 */
@ -2465,11 +2454,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
} }
} }
canvas
.getObjects()
.filter((obj) => obj.name === 'checkLine' || obj.name === 'checkCircle')
.forEach((obj) => canvas.remove(obj))
canvas.renderAll()
}) })
const uniqueRidgeLines = [] const uniqueRidgeLines = []
@ -2491,8 +2475,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
baseGableRidgeLines = uniqueRidgeLines baseGableRidgeLines = uniqueRidgeLines
console.log('baseGableRidgeLines : ', baseGableRidgeLines)
/** 박공지붕 polygon 생성 */ /** 박공지붕 polygon 생성 */
drawGablePolygonFirst.forEach((current) => { drawGablePolygonFirst.forEach((current) => {
const { currentBaseLine, prevBaseLine, nextBaseLine } = current const { currentBaseLine, prevBaseLine, nextBaseLine } = current
@ -3109,7 +3091,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
x: currentMidX.plus(Big(10).times(Math.sign(xVector.toNumber()))).toNumber(), x: currentMidX.plus(Big(10).times(Math.sign(xVector.toNumber()))).toNumber(),
y: currentMidY.plus(Big(10).times(Math.sign(yVector.toNumber()))).toNumber(), y: currentMidY.plus(Big(10).times(Math.sign(yVector.toNumber()))).toNumber(),
} }
console.log('checkWallPolygon.inPolygon(checkPoints)', checkWallPolygon.inPolygon(checkPoints))
if (checkWallPolygon.inPolygon(checkPoints)) { if (checkWallPolygon.inPolygon(checkPoints)) {
const currentRidge = baseGableRidgeLines.find((line) => const currentRidge = baseGableRidgeLines.find((line) =>
@ -3278,27 +3259,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
} }
if (prevRidge) {
const checkLine = new fabric.Line([prevRidge.x1, prevRidge.y1, prevRidge.x2, prevRidge.y2], {
stroke: 'red',
strokeWidth: 4,
parentId: roofId,
name: 'checkLine',
})
canvas.add(checkLine)
canvas.renderAll()
}
if (nextRidge) {
const checkLine = new fabric.Line([nextRidge.x1, nextRidge.y1, nextRidge.x2, nextRidge.y2], {
stroke: 'yellow',
strokeWidth: 4,
parentId: roofId,
name: 'checkLine',
})
canvas.add(checkLine)
canvas.renderAll()
}
let currentRidge let currentRidge
if (prevRidge) { if (prevRidge) {
@ -3312,24 +3272,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
if (currentVectorY === 0) { if (currentVectorY === 0) {
const minX = Math.min(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2) const minX = Math.min(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2)
const maxX = Math.max(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2) const maxX = Math.max(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2)
const checkCircle = new fabric.Circle({
left: minX,
top: prevRidge.y1,
radius: 5,
fill: 'blue',
parentId: roofId,
name: 'checkCircle',
})
const checkCircle1 = new fabric.Circle({
left: maxX,
top: prevRidge.y1,
radius: 5,
fill: 'green',
parentId: roofId,
name: 'checkCircle',
})
canvas.add(checkCircle, checkCircle1)
canvas.renderAll()
if (minX <= prevRidge.x1 && maxX >= prevRidge.x1 && minX <= prevRidge.x2 && maxX >= prevRidge.x2) { if (minX <= prevRidge.x1 && maxX >= prevRidge.x1 && minX <= prevRidge.x2 && maxX >= prevRidge.x2) {
currentRidge = prevRidge currentRidge = prevRidge
@ -3348,24 +3290,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
const minX = Math.min(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2) const minX = Math.min(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2)
const maxX = Math.max(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2) const maxX = Math.max(currentLine.x1, currentLine.x2, currentRoof.x1, currentRoof.x2)
const checkCircle = new fabric.Circle({
left: minX,
top: nextRidge.y1,
radius: 5,
fill: 'blue',
parentId: roofId,
name: 'checkCircle',
})
const checkCircle1 = new fabric.Circle({
left: maxX,
top: nextRidge.y1,
radius: 5,
fill: 'green',
parentId: roofId,
name: 'checkCircle',
})
canvas.add(checkCircle, checkCircle1)
canvas.renderAll()
if (minX <= nextRidge.x1 && maxX >= nextRidge.x1 && minX <= nextRidge.x2 && maxX >= nextRidge.x2) { if (minX <= nextRidge.x1 && maxX >= nextRidge.x1 && minX <= nextRidge.x2 && maxX >= nextRidge.x2) {
currentRidge = nextRidge currentRidge = nextRidge
} }
@ -3373,15 +3297,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
if (currentRidge) { if (currentRidge) {
const checkLine = new fabric.Line([currentRidge.x1, currentRidge.y1, currentRidge.x2, currentRidge.y2], {
stroke: 'green',
strokeWidth: 4,
parentId: roofId,
name: 'checkLine',
})
canvas.add(checkLine)
canvas.renderAll()
polygonPoints.push({ x: currentRidge.x1, y: currentRidge.y1 }, { x: currentRidge.x2, y: currentRidge.y2 }) polygonPoints.push({ x: currentRidge.x1, y: currentRidge.y1 }, { x: currentRidge.x2, y: currentRidge.y2 })
/** 기준점이 될 포인트를 찾는다. 기준점 = 지붕선이나 hip 등에 붙지 않은 포인트 */ /** 기준점이 될 포인트를 찾는다. 기준점 = 지붕선이나 hip 등에 붙지 않은 포인트 */
@ -3493,11 +3408,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
baseHipLines.push({ x1: hipLine.x1, y1: hipLine.y1, x2: hipLine.x2, y2: hipLine.y2, line: hipLine }) baseHipLines.push({ x1: hipLine.x1, y1: hipLine.y1, x2: hipLine.x2, y2: hipLine.y2, line: hipLine })
}) })
canvas
.getObjects()
.filter((obj) => obj.name === 'checkLine' || obj.name === 'checkCircle')
.forEach((obj) => canvas.remove(obj))
canvas.renderAll()
}) })
/** 케라바 지붕에 연결된 마루 중 처마라인이 그려지지 않은 경우 확*/ /** 케라바 지붕에 연결된 마루 중 처마라인이 그려지지 않은 경우 확*/
@ -3828,7 +3738,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
/** 현재 라인의 길이 추녀마루 길이의 기준이 된다. */ /** 현재 라인의 길이 추녀마루 길이의 기준이 된다. */
let hipSize = Big(lineWidth).pow(2).plus(Big(lineWidth).pow(2)).sqrt() let hipSize = Big(lineWidth).pow(2).plus(Big(lineWidth).pow(2)).sqrt()
console.log('hipSize', hipSize.toNumber())
/** 이전 라인과의 사이 추녀마루의 각도를 확인한다, 각도가 지붕안쪽으로 향하지 않을때 반대로 처리한다.*/ /** 이전 라인과의 사이 추녀마루의 각도를 확인한다, 각도가 지붕안쪽으로 향하지 않을때 반대로 처리한다.*/
const prevCheckPoint = { const prevCheckPoint = {
@ -4037,8 +3946,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
oppRoofLine = oppositeRoofs.sort((a, b) => a.size - b.size)[0].line oppRoofLine = oppositeRoofs.sort((a, b) => a.size - b.size)[0].line
} }
console.log('oppositeRoofs', oppositeRoofs)
console.log('oppositeRoofLine', oppRoofLine)
if (oppCurrLine.attributes.type === LINE_TYPE.WALLLINE.EAVES) { if (oppCurrLine.attributes.type === LINE_TYPE.WALLLINE.EAVES) {
if (oppRoofLine) { if (oppRoofLine) {
const oppRoofSize = Big(oppRoofLine.attributes.planeSize).div(20) const oppRoofSize = Big(oppRoofLine.attributes.planeSize).div(20)
@ -4718,7 +4625,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
/** 현재 라인의 길이를 기준으로 추녀 마루의 길이를 삼각함수를 사용하여 판단한다.*/ /** 현재 라인의 길이를 기준으로 추녀 마루의 길이를 삼각함수를 사용하여 판단한다.*/
let hipLength = currentSize.div(2).pow(2).plus(currentSize.div(2).pow(2)).sqrt() let hipLength = currentSize.div(2).pow(2).plus(currentSize.div(2).pow(2)).sqrt()
console.log('hipLength 1 :', hipLength.toNumber())
/** /**
* 현재 라인에서 2번째 라인과 2번째 라인의 각도가 같을때 -_- 같은 형태로 판단하고 * 현재 라인에서 2번째 라인과 2번째 라인의 각도가 같을때 -_- 같은 형태로 판단하고
* 맞은 외벽선까지의 거리를 확인후 currentSize 조정한다. * 맞은 외벽선까지의 거리를 확인후 currentSize 조정한다.
@ -4772,7 +4678,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
).length > 0 ).length > 0
/** 6각 */ /** 6각 */
console.log('isConnect :', isConnect)
if (isConnect) { if (isConnect) {
const checkScale = currentSize.pow(2).plus(currentSize.pow(2)).sqrt() const checkScale = currentSize.pow(2).plus(currentSize.pow(2)).sqrt()
const intersectBaseLine = [] const intersectBaseLine = []
@ -5753,11 +5658,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
} }
} }
canvas
.getObjects()
.filter((obj) => obj.name === 'checkLine' || obj.name === 'checkCircle')
.forEach((obj) => canvas.remove(obj))
canvas.renderAll()
}) })
/** 중복제거 */ /** 중복제거 */
@ -6032,14 +5932,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
.round(2), .round(2),
} }
} }
const checkLine = new fabric.Line([x2, y2, nextEndPoint.x, nextEndPoint.y], {
stroke: 'red',
strokeWidth: 4,
parentId: roofId,
name: 'checkLine',
})
canvas.add(checkLine)
canvas.renderAll()
const intersectRidgeLine = [] const intersectRidgeLine = []
baseRidgeLines.forEach((line) => { baseRidgeLines.forEach((line) => {
@ -6047,27 +5939,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
{ vertex1: { x: x2, y: y2 }, vertex2: nextEndPoint }, { vertex1: { x: x2, y: y2 }, vertex2: nextEndPoint },
{ vertex1: { x: line.x1, y: line.y1 }, vertex2: { x: line.x2, y: line.y2 } }, { vertex1: { x: line.x1, y: line.y1 }, vertex2: { x: line.x2, y: line.y2 } },
) )
console.log('intersection : ', intersection)
console.log('isPointOnLine(line, intersection)', isPointOnLine(line, intersection))
console.log(
'line : ',
(line.x1 <= intersection.x && line.x2 >= intersection.x && line.y1 <= intersection.y && line.y2 >= intersection.y) ||
(line.x2 <= intersection.x && line.x1 >= intersection.x && line.y2 <= intersection.y && line.y1 >= intersection.y),
)
if (intersection) {
const checkCircle = new fabric.Circle({
left: intersection.x,
top: intersection.y,
radius: 5,
fill: 'blue',
parentId: roofId,
name: 'checkCircle',
})
canvas.add(checkCircle)
canvas.renderAll()
}
if ( if (
intersection && intersection &&
((line.x1 <= intersection.x && line.x2 >= intersection.x && line.y1 <= intersection.y && line.y2 >= intersection.y) || ((line.x1 <= intersection.x && line.x2 >= intersection.x && line.y1 <= intersection.y && line.y2 >= intersection.y) ||
@ -6084,9 +5955,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
} }
}) })
canvas.remove(checkLine)
canvas.renderAll()
const intersectRidge = intersectRidgeLine.reduce((prev, current) => (prev.distance < current.distance ? prev : current), intersectRidgeLine[0]) const intersectRidge = intersectRidgeLine.reduce((prev, current) => (prev.distance < current.distance ? prev : current), intersectRidgeLine[0])
if (intersectRidge) { if (intersectRidge) {
@ -6272,7 +6140,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
checkPoint[1].onRoofLine = true checkPoint[1].onRoofLine = true
} }
}) })
// console.log('checkPoint : ', checkPoint)
if ((checkPoint[0].cnt === 0 || checkPoint[0].cnt % 2 !== 0) && !checkPoint[0].onRoofLine) { if ((checkPoint[0].cnt === 0 || checkPoint[0].cnt % 2 !== 0) && !checkPoint[0].onRoofLine) {
unFinishedRidge.push(checkPoint[0]) unFinishedRidge.push(checkPoint[0])
} }