지붕면 할당 시 방향 설정 작업 추가

This commit is contained in:
hyojun.choi 2024-11-04 16:02:02 +09:00
parent 19e22ba9ea
commit 4891eb50aa

View File

@ -1339,10 +1339,45 @@ export const splitPolygonWithLines = (polygon) => {
}) })
const newRoofs = removeDuplicatePolygons(roofs) const newRoofs = removeDuplicatePolygons(roofs)
console.log(newRoofs)
newRoofs.forEach((roofPoint, index) => { newRoofs.forEach((roofPoint, index) => {
let defense, pitch let defense, pitch
const direction = getDirectionByPoint(roofPoint[0], roofPoint[roofPoint.length - 1]) const polygonLines = [...polygon.lines]
let representLines = []
let representLine
// 지붕을 그리면서 기존 polygon의 line중 연결된 line을 찾는다.
polygonLines.forEach((line) => {
let startFlag = false
let endFlag = false
const startPoint = line.startPoint
const endPoint = line.endPoint
roofPoint.forEach((point, index) => {
if (isSamePoint(point, startPoint)) {
startFlag = true
}
if (isSamePoint(point, endPoint)) {
endFlag = true
}
})
if (startFlag && endFlag) {
representLines.push(line)
}
})
// representLines중 가장 긴 line을 찾는다.
representLines.forEach((line) => {
if (!representLine) {
representLine = line
} else {
if (representLine.length < line.length) {
representLine = line
}
}
})
const direction = representLine.direction
switch (direction) { switch (direction) {
case 'top': case 'top':