처마 용마루 방향에 따른 타입 작업
This commit is contained in:
parent
79d873c135
commit
414d6fa0c5
@ -1100,20 +1100,22 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const maxLine = polygon.lines
|
//직선 찾는 로직
|
||||||
.filter((line) => line[coord1] === line[coord2])
|
const maxLine = polygon.lines.filter((line) => line[coord1] === line[coord2])
|
||||||
.sort(
|
|
||||||
(a, b) =>
|
if (maxLine.length > 0) {
|
||||||
(polygon.direction === 'south' || polygon.direction === 'east' ? b : a)[coord1] -
|
const maxLineSorted = maxLine.reduce((a, b) => {
|
||||||
(polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1],
|
return (polygon.direction === 'south' || polygon.direction === 'east' ? b : a)[coord1] >
|
||||||
)[0]
|
(polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1]
|
||||||
|
? b
|
||||||
|
: a
|
||||||
|
})
|
||||||
|
|
||||||
if (maxLine) {
|
|
||||||
if (
|
if (
|
||||||
(polygon.direction === 'south' && maxLine.direction === 'left') ||
|
(polygon.direction === 'south' && maxLineSorted.direction === 'left') ||
|
||||||
(polygon.direction === 'north' && maxLine.direction === 'right') ||
|
(polygon.direction === 'north' && maxLineSorted.direction === 'right') ||
|
||||||
(polygon.direction === 'east' && maxLine.direction === 'bottom') ||
|
(polygon.direction === 'east' && maxLineSorted.direction === 'bottom') ||
|
||||||
(polygon.direction === 'west' && maxLine.direction === 'top')
|
(polygon.direction === 'west' && maxLineSorted.direction === 'top')
|
||||||
) {
|
) {
|
||||||
polygon.lines.forEach((line) => {
|
polygon.lines.forEach((line) => {
|
||||||
if (line.attributes.type === LINE_TYPE.WALLLINE.EAVES) {
|
if (line.attributes.type === LINE_TYPE.WALLLINE.EAVES) {
|
||||||
@ -1123,30 +1125,43 @@ export function useSurfaceShapeBatch({ isHidden, setIsHidden }) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxLine.length === 1) {
|
||||||
|
const maxLineCoord = polygon.lines.reduce((a, b) => {
|
||||||
|
return (polygon.direction === 'south' || polygon.direction === 'east' ? b : a)[coord1] >
|
||||||
|
(polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1]
|
||||||
|
? b
|
||||||
|
: a
|
||||||
|
})
|
||||||
|
|
||||||
|
const isRealEavesLine = polygon.lines.find((line) => line.attributes.type === LINE_TYPE.WALLLINE.EAVES)
|
||||||
|
if (isRealEavesLine) {
|
||||||
|
if (polygon.direction === 'south' || polygon.direction === 'north') {
|
||||||
|
const targetCoord =
|
||||||
|
polygon.direction === 'south' ? Math.max(maxLineCoord.y1, maxLineCoord.y2) : Math.min(maxLineCoord.y1, maxLineCoord.y2)
|
||||||
|
const realLineCoord =
|
||||||
|
polygon.direction === 'south' ? Math.max(isRealEavesLine.y1, isRealEavesLine.y2) : Math.min(isRealEavesLine.y1, isRealEavesLine.y2)
|
||||||
|
|
||||||
|
if (targetCoord !== realLineCoord) {
|
||||||
|
isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE
|
||||||
|
}
|
||||||
|
} else if (polygon.direction === 'east' || polygon.direction === 'west') {
|
||||||
|
const targetCoord = polygon.direction === 'east' ? Math.max(maxLineCoord.x1, maxLineCoord.x2) : Math.min(maxLineCoord.x1, maxLineCoord.x2)
|
||||||
|
const realLineCoord =
|
||||||
|
polygon.direction === 'east' ? Math.max(isRealEavesLine.x1, isRealEavesLine.x2) : Math.min(isRealEavesLine.x1, isRealEavesLine.x2)
|
||||||
|
|
||||||
|
if (targetCoord !== realLineCoord) {
|
||||||
|
isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 진짜 처마 라인인지 확인하는 로직 -> 특정 모양에 따라 처마가 없는 경우가 있는데 위에 로직으로는
|
* 진짜 처마 라인인지 확인하는 로직 -> 특정 모양에 따라 처마가 없는 경우가 있는데 위에 로직으로는
|
||||||
* 용마루도 처마로 만들어서 재보정
|
* 용마루도 처마로 만들어서 재보정
|
||||||
*/
|
*/
|
||||||
const maxLineCoord = polygon.lines.sort(
|
|
||||||
(a, b) =>
|
|
||||||
(polygon.direction === 'south' || polygon.direction === 'east' ? b : a)[coord1] -
|
|
||||||
(polygon.direction === 'south' || polygon.direction === 'east' ? a : b)[coord1],
|
|
||||||
)[0]
|
|
||||||
|
|
||||||
const isRealEavesLine = polygon.lines.find((line) => line.attributes.type === LINE_TYPE.WALLLINE.EAVES)
|
|
||||||
if (isRealEavesLine) {
|
|
||||||
if (polygon.direction === 'south' || polygon.direction === 'north') {
|
|
||||||
if (maxLineCoord.y1 !== isRealEavesLine.y1) {
|
|
||||||
isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE
|
|
||||||
}
|
|
||||||
} else if (polygon.direction === 'east' || polygon.direction === 'west') {
|
|
||||||
if (maxLineCoord.x1 !== isRealEavesLine.x1) {
|
|
||||||
isRealEavesLine.attributes.type = LINE_TYPE.SUBLINE.RIDGE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateFlippedPoints = (polygon) => {
|
const updateFlippedPoints = (polygon) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user