4각형 패턴 생성

This commit is contained in:
yjnoh 2024-08-02 17:08:44 +09:00
parent 896a0baa7e
commit c411046e0e

View File

@ -1181,15 +1181,15 @@ export function useMode() {
setTemplateType(2)
}
const handleOuterLineTemplateA4Points = (polygon) => {
const edge = 20
const eaves = 50
const handleOuterLineTemplateA4Points = (polygon, offsetInputX = 20, offsetInputY = 50) => {
const edge = offsetInputX
const eaves = offsetInputY
// 폴리곤의 각 변을 선으로 생성
const createLine = (start, end, stroke, property) =>
new QLine([start.x, start.y, end.x, end.y], {
stroke,
strokeWidth: 5,
strokeWidth: 1,
property,
fontSize: 14,
})
@ -1227,7 +1227,7 @@ export function useMode() {
strokeDashArray: dashArray,
})
const vertCenterLine = createCenterLine(centerPointX, lines[0].y1 - edge, centerPointX, lines[0].y2 + edge, 'blue', 4, 'center')
const vertCenterLine = createCenterLine(centerPointX, lines[0].y1 - edge, centerPointX, lines[0].y2 + edge, 'blue', 1, 'center')
canvas.add(vertCenterLine)
const horiCenterLineLeft = createCenterLine(
@ -1289,6 +1289,31 @@ export function useMode() {
const outLine = createLine({ x: line.x1, y: line.y1 }, { x: line.x2, y: line.y2 }, 'blue', 'normal')
canvas.add(outLine)
})
const roofPatternPolygonArray = []
const leftLine = drawArray[0]
const rightLine = drawArray[3]
//사각형 왼쪽 지붕 패턴 생성 배열
const leftPolygon = [
{ x: leftLine.x1, y: leftLine.y1 },
{ x: leftLine.x2, y: leftLine.y2 },
{ x: vertCenterLine.x1, y: vertCenterLine.y1 },
{ x: vertCenterLine.x2, y: vertCenterLine.y2 },
]
roofPatternPolygonArray.push(leftPolygon)
//사각형 오른쪽 지붕 패턴 생성 배열
const rightPolygon = [
{ x: vertCenterLine.x1, y: vertCenterLine.y1 },
{ x: vertCenterLine.x2, y: vertCenterLine.y2 },
{ x: rightLine.x1, y: rightLine.y1 },
{ x: rightLine.x2, y: rightLine.y2 },
]
roofPatternPolygonArray.push(rightPolygon)
setRoofPolygonPattern({ roofPatternPolygonArray, lines }) //모든 행을 저장
}
//탬플릿A 적용