마루 형상 버그 수정 및 innerLines 수정
This commit is contained in:
parent
9f76fa97c5
commit
10c2668a67
@ -846,6 +846,9 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
let baseHipLines = []
|
||||
/** 용마루 */
|
||||
let baseRidgeLines = []
|
||||
/** 용마루의 갯수*/
|
||||
let baseRidgeCount = 0
|
||||
|
||||
/** ⨆ 모양 처마에 추녀마루를 그린다. */
|
||||
drawEavesFirstLines.forEach((current) => {
|
||||
const { currentLine, prevLine, nextLine } = current
|
||||
@ -1629,6 +1632,8 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
// console.log('oppositeSize : ', oppositeSize, 'lineMinSize : ', lineMinSize.toNumber(), 'ridgeSize : ', ridgeSize.toNumber())
|
||||
|
||||
if (ridgeSize.gt(0)) {
|
||||
baseRidgeCount = baseRidgeCount + 1
|
||||
console.log('baseRidgeCount : ', baseRidgeCount)
|
||||
const points = [
|
||||
startPoint.x,
|
||||
startPoint.y,
|
||||
@ -1691,21 +1696,20 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
.forEach((ridge2) => {
|
||||
let overlap = segmentsOverlap(ridge, ridge2)
|
||||
if (overlap) {
|
||||
roof.ridges = roof.ridges.filter((r) => r !== ridge && r !== ridge2)
|
||||
roof.innerLines = roof.innerLines.filter((l) => l !== ridge && l !== ridge2)
|
||||
roof.canvas.remove(ridge)
|
||||
roof.canvas.remove(ridge2)
|
||||
baseRidgeLines = baseRidgeLines.filter((r) => r !== ridge && r !== ridge2)
|
||||
|
||||
baseRidgeCount = baseRidgeCount - 2
|
||||
|
||||
let x1 = Math.min(ridge.x1, ridge2.x1, ridge.x2, ridge2.x2)
|
||||
let x2 = Math.max(ridge.x1, ridge2.x1, ridge.x2, ridge2.x2)
|
||||
let y1 = Math.min(ridge.y1, ridge2.y1, ridge.y2, ridge2.y2)
|
||||
let y2 = Math.max(ridge.y1, ridge2.y1, ridge.y2, ridge2.y2)
|
||||
|
||||
const newRidge = drawRidgeLine([x1, y1, x2, y2], canvas, roof, textMode)
|
||||
roof.ridges.push(newRidge)
|
||||
roof.innerLines.push(newRidge)
|
||||
baseRidgeLines.push(newRidge)
|
||||
baseRidgeCount = baseRidgeCount + 1
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -2600,11 +2604,32 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
|
||||
/** 직교 하는 포인트가 존재 할때 마루를 그린다. */
|
||||
if (orthogonalPoints.length > 0) {
|
||||
baseRidgeCount = baseRidgeCount + 1
|
||||
const points = [current.x2, current.y2, orthogonalPoints[0].x2, orthogonalPoints[0].y2]
|
||||
const ridgeLine = drawRidgeLine(points, canvas, roof, textMode)
|
||||
baseRidgeLines.push(ridgeLine)
|
||||
/** array에서 object 삭제*/
|
||||
noRidgeHipPoints = noRidgeHipPoints.filter((point) => point !== current && point !== orthogonalPoints[0])
|
||||
// noRidgeHipPoints = noRidgeHipPoints.filter((point) => point !== current && point !== orthogonalPoints[0])
|
||||
}
|
||||
})
|
||||
|
||||
/** 중복제거*/
|
||||
baseRidgeLines.forEach((current) => {
|
||||
const sameRidge = baseRidgeLines.filter(
|
||||
(line) =>
|
||||
line !== current &&
|
||||
((line.x1 === current.x1 && line.y1 === current.y1 && line.x2 === current.x2 && line.y2 === current.y2) ||
|
||||
(line.x1 === current.x2 && line.y1 === current.y2 && line.x2 === current.x1 && line.y2 === current.y1)),
|
||||
)
|
||||
|
||||
console.log('sameRidge : ', sameRidge)
|
||||
if (sameRidge.length > 0) {
|
||||
sameRidge.forEach((duplicateLine) => {
|
||||
const index = baseRidgeLines.indexOf(duplicateLine)
|
||||
if (index !== -1) {
|
||||
baseRidgeLines.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@ -2709,6 +2734,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
noRidgeHipPoints.forEach((hipPoint) => {
|
||||
const angle = calculateAngle({ x: intersectPoint.x, y: intersectPoint.y }, { x: hipPoint.x2, y: hipPoint.y2 })
|
||||
if (angle === 0 || angle === 180 || angle === 90 || angle === -90) {
|
||||
baseRidgeCount = baseRidgeCount + 1
|
||||
const ridgeLine = drawRidgeLine([intersectPoint.x, intersectPoint.y, hipPoint.x2, hipPoint.y2], canvas, roof, textMode)
|
||||
baseRidgeLines.push(ridgeLine)
|
||||
let baseHipLine = baseHipLines.filter((line) => line === intersection.line)[0]
|
||||
@ -2753,11 +2779,9 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
|
||||
console.log('ridgeAllPoints :', ridgeAllPoints)
|
||||
|
||||
console.log('지붕 마루 갯수 확인 : ', baseRidgeLines.length, getMaxRidge(baseLines.length))
|
||||
console.log('지붕 마루 갯수 확인 : ', baseRidgeLines.length, baseRidgeCount, getMaxRidge(baseLines.length))
|
||||
|
||||
ridgeAllPoints.forEach((current) => {
|
||||
console.log('current :', current)
|
||||
|
||||
const ridgeLines = [],
|
||||
hipLines = []
|
||||
|
||||
@ -2781,8 +2805,9 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
canvas.renderAll()*/
|
||||
let checkRidgeLine, checkHipLine
|
||||
/** 직선인 경우 마루 확인*/
|
||||
console.log('baseRidgeCount :', baseRidgeCount, baseRidgeLines.length)
|
||||
if (
|
||||
baseRidgeLines.length < getMaxRidge(baseLines.length) &&
|
||||
baseRidgeCount < getMaxRidge(baseLines.length) &&
|
||||
((point.x === current.x && point.y !== current.y) || (point.x !== current.x && point.y === current.y))
|
||||
) {
|
||||
checkRidgeLine = { x1: current.x, y1: current.y, x2: point.x, y2: point.y }
|
||||
@ -2835,6 +2860,7 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
)
|
||||
|
||||
if (!baseIntersection && alreadyRidges.length === 0 && otherRidgeInterSection.length === 0) {
|
||||
baseRidgeCount = baseRidgeCount + 1
|
||||
const ridgeLine = drawRidgeLine(ridgePoints, canvas, roof, textMode)
|
||||
baseRidgeLines.push(ridgeLine)
|
||||
}
|
||||
@ -2887,6 +2913,8 @@ export const drawRidgeRoof = (roofId, canvas, textMode) => {
|
||||
})
|
||||
})
|
||||
|
||||
roof.innerLines = [...baseRidgeLines, ...baseHipLines.map((line) => line.line)]
|
||||
|
||||
/** 연결 되지 않은 마루 갯수*/
|
||||
/*const missingCount = Big(baseRidgeLines.length)
|
||||
.minus(connectRidgePoint.length + 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user