From 7d5a235b9585ac909c13464e42d94350ce08875a Mon Sep 17 00:00:00 2001 From: Jaeyoung Lee Date: Fri, 13 Jun 2025 14:59:28 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EB=B0=8F=20=ED=99=95=EC=9D=B8=EC=9A=A9=20?= =?UTF-8?q?=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/qpolygon-utils.js | 149 ++----------------------------------- 1 file changed, 8 insertions(+), 141 deletions(-) diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index 8f1a72ce..c1564699 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -469,8 +469,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { const baseLinePoints = baseLines.map((line) => ({ x: line.x1, y: line.y1 })) /** 벽취합이 있는 경우 소매가 있다면 지붕 형상을 변경해야 한다. */ - console.log('baseLines :', baseLines) - console.log('roof : ', roof) baseLines .filter((line) => line.attributes.type === LINE_TYPE.WALLLINE.WALL && line.attributes.offset > 0) .forEach((currentLine) => { @@ -864,14 +862,14 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { /** 용마루의 갯수*/ let baseRidgeCount = 0 - console.log('drawEavesFirstLines :', drawEavesFirstLines) - console.log('drawEavesSecondLines :', drawEavesSecondLines) - console.log('drawGableRidgeFirst: ', drawGableRidgeFirst) - console.log('drawGableRidgeSecond:', drawGableRidgeSecond) - console.log('drawGablePolygonFirst :', drawGablePolygonFirst) - console.log('drawGablePolygonSecond :', drawGablePolygonSecond) - console.log('drawHipAndGableFirst :', drawHipAndGableFirst) - console.log('drawWallLines :', drawWallRidgeLine) + // console.log('drawEavesFirstLines :', drawEavesFirstLines) + // console.log('drawEavesSecondLines :', drawEavesSecondLines) + // console.log('drawGableRidgeFirst: ', drawGableRidgeFirst) + // console.log('drawGableRidgeSecond:', drawGableRidgeSecond) + // console.log('drawGablePolygonFirst :', drawGablePolygonFirst) + // console.log('drawGablePolygonSecond :', drawGablePolygonSecond) + // console.log('drawHipAndGableFirst :', drawHipAndGableFirst) + // console.log('drawWallLines :', drawWallRidgeLine) /** 박공지붕에서 파생되는 마루를 그린다. ㄷ 형태*/ drawGableRidgeFirst.forEach((current) => { @@ -2056,15 +2054,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { const prevLine = prevBaseLine.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) /** 다음 라인의 경사 */ @@ -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 = [] @@ -2491,8 +2475,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { baseGableRidgeLines = uniqueRidgeLines - console.log('baseGableRidgeLines : ', baseGableRidgeLines) - /** 박공지붕 polygon 생성 */ drawGablePolygonFirst.forEach((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(), y: currentMidY.plus(Big(10).times(Math.sign(yVector.toNumber()))).toNumber(), } - console.log('checkWallPolygon.inPolygon(checkPoints)', checkWallPolygon.inPolygon(checkPoints)) if (checkWallPolygon.inPolygon(checkPoints)) { 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 if (prevRidge) { @@ -3312,24 +3272,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { if (currentVectorY === 0) { 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 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) { 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 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) { currentRidge = nextRidge } @@ -3373,15 +3297,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { } 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 }) /** 기준점이 될 포인트를 찾는다. 기준점 = 지붕선이나 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 }) }) - 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() - console.log('hipSize', hipSize.toNumber()) /** 이전 라인과의 사이 추녀마루의 각도를 확인한다, 각도가 지붕안쪽으로 향하지 않을때 반대로 처리한다.*/ const prevCheckPoint = { @@ -4037,8 +3946,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { 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 (oppRoofLine) { 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() - console.log('hipLength 1 :', hipLength.toNumber()) /** * 현재 라인에서 2번째 전 라인과 2번째 후 라인의 각도가 같을때 -_- 와 같은 형태로 판단하고 * 맞은 편 외벽선까지의 거리를 확인후 currentSize 를 조정한다. @@ -4772,7 +4678,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { ).length > 0 /** 6각 */ - console.log('isConnect :', isConnect) if (isConnect) { const checkScale = currentSize.pow(2).plus(currentSize.pow(2)).sqrt() 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), } } - 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 = [] baseRidgeLines.forEach((line) => { @@ -6047,27 +5939,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { { vertex1: { x: x2, y: y2 }, vertex2: nextEndPoint }, { 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 ( intersection && ((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]) if (intersectRidge) { @@ -6272,7 +6140,6 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => { checkPoint[1].onRoofLine = true } }) - // console.log('checkPoint : ', checkPoint) if ((checkPoint[0].cnt === 0 || checkPoint[0].cnt % 2 !== 0) && !checkPoint[0].onRoofLine) { unFinishedRidge.push(checkPoint[0]) }