A, B 패턴 지붕면 할당 기능 추가
This commit is contained in:
parent
f603a5defa
commit
d5eb0c71ae
@ -18,7 +18,7 @@ import { menuTypeState } from '@/store/menuAtom'
|
|||||||
export function useRoofAllocationSetting(id) {
|
export function useRoofAllocationSetting(id) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
const roofDisplay = useRecoilValue(roofDisplaySelector)
|
||||||
const { drawDirectionArrow, addLengthText, splitPolygonWithLines } = usePolygon()
|
const { drawDirectionArrow, addLengthText, splitPolygonWithLines, splitPolygonWithSeparate } = usePolygon()
|
||||||
const [popupId, setPopupId] = useState(uuidv4())
|
const [popupId, setPopupId] = useState(uuidv4())
|
||||||
const { addPopup, closePopup, closeAll } = usePopup()
|
const { addPopup, closePopup, closeAll } = usePopup()
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
@ -188,16 +188,19 @@ export function useRoofAllocationSetting(id) {
|
|||||||
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL)
|
||||||
roofBases.forEach((roofBase) => {
|
roofBases.forEach((roofBase) => {
|
||||||
try {
|
try {
|
||||||
splitPolygonWithLines(roofBase)
|
if (roofBase.separatePolygon.length > 0) {
|
||||||
|
splitPolygonWithSeparate(roofBase.separatePolygon)
|
||||||
|
} else {
|
||||||
|
splitPolygonWithLines(roofBase)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
roofBase.innerLines.forEach((line) => {
|
roofBase.innerLines.forEach((line) => {
|
||||||
canvas.remove(line)
|
canvas.remove(line)
|
||||||
})
|
})
|
||||||
|
|
||||||
// canvas.remove(roofBase)
|
canvas.remove(roofBase)
|
||||||
})
|
})
|
||||||
|
|
||||||
wallLines.forEach((wallLine) => {
|
wallLines.forEach((wallLine) => {
|
||||||
|
|||||||
@ -1026,6 +1026,47 @@ export const usePolygon = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const splitPolygonWithSeparate = (separates) => {
|
||||||
|
separates.forEach((separate) => {
|
||||||
|
const points = separate.lines.map((line) => {
|
||||||
|
return { x: line.x1, y: line.y1 }
|
||||||
|
})
|
||||||
|
let defense = ''
|
||||||
|
switch (separate.attributes.direction) {
|
||||||
|
case 'top':
|
||||||
|
defense = 'east'
|
||||||
|
break
|
||||||
|
case 'right':
|
||||||
|
defense = 'south'
|
||||||
|
break
|
||||||
|
case 'bottom':
|
||||||
|
defense = 'west'
|
||||||
|
break
|
||||||
|
case 'left':
|
||||||
|
defense = 'north'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
const roof = new QPolygon(points, {
|
||||||
|
fontSize: separate.fontSize,
|
||||||
|
stroke: 'black',
|
||||||
|
fill: 'transparent',
|
||||||
|
strokeWidth: 3,
|
||||||
|
name: POLYGON_TYPE.ROOF,
|
||||||
|
originX: 'center',
|
||||||
|
originY: 'center',
|
||||||
|
selectable: true,
|
||||||
|
defense: defense,
|
||||||
|
pitch: separate.attributes.pitch,
|
||||||
|
direction: defense,
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.add(roof)
|
||||||
|
})
|
||||||
|
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
addPolygon,
|
addPolygon,
|
||||||
addPolygonByLines,
|
addPolygonByLines,
|
||||||
@ -1033,5 +1074,6 @@ export const usePolygon = () => {
|
|||||||
drawDirectionArrow,
|
drawDirectionArrow,
|
||||||
addLengthText,
|
addLengthText,
|
||||||
splitPolygonWithLines,
|
splitPolygonWithLines,
|
||||||
|
splitPolygonWithSeparate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user