북면 모듈 설치 여부 추가, 북면 모듈 설치 시 동면 제외
This commit is contained in:
parent
5ac023d72d
commit
c499653e79
@ -224,6 +224,7 @@ export const SAVE_KEY = [
|
||||
'viewportTransform',
|
||||
'outerLineFix',
|
||||
'adjustRoofLines',
|
||||
'northModuleYn',
|
||||
]
|
||||
|
||||
export const OBJECT_PROTOTYPE = [fabric.Line.prototype, fabric.Polygon.prototype, fabric.Triangle.prototype, fabric.Group.prototype]
|
||||
|
||||
@ -235,6 +235,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
canvas.add(moduleCircuitText)
|
||||
})
|
||||
|
||||
|
||||
const roofSurfaceList = canvas
|
||||
.getObjects()
|
||||
.filter((obj) => POLYGON_TYPE.MODULE_SETUP_SURFACE === obj.name && obj?.modules.length > 0)
|
||||
@ -244,6 +245,7 @@ export default function PassivityCircuitAllocation(props) {
|
||||
roofSurface: surface.direction,
|
||||
roofSurfaceIncl: +canvas.getObjects().filter((obj) => obj.id === surface.parentId)[0].pitch,
|
||||
roofSurfaceNorthYn: surface.direction === 'north' ? 'Y' : 'N',
|
||||
roofSurfaceNorthModuleYn: surface.northModuleYn,
|
||||
moduleList: surface.modules.map((module) => {
|
||||
return {
|
||||
itemId: module.moduleInfo.itemId,
|
||||
|
||||
@ -99,6 +99,12 @@ export function useCircuitTrestle(executeEffect = false) {
|
||||
// 지붕면 목록
|
||||
const getRoofSurfaceList = () => {
|
||||
const roofSurfaceList = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE)
|
||||
|
||||
roofSurfaceList.forEach((roofSurface) => {
|
||||
const modules = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE && obj.surfaceId === roofSurface.id)
|
||||
roofSurface.northModuleYn = modules.every((module) => module.moduleInfo.northModuleYn === 'Y') ? 'Y' : 'N'
|
||||
})
|
||||
|
||||
roofSurfaceList.sort((a, b) => a.left - b.left || b.top - a.top)
|
||||
|
||||
const result = roofSurfaceList
|
||||
@ -119,6 +125,7 @@ export function useCircuitTrestle(executeEffect = false) {
|
||||
}
|
||||
}),
|
||||
roofSurfaceNorthYn: obj.direction === 'north' ? 'Y' : 'N',
|
||||
roofSurfaceNorthModuleYn: obj.northModuleYn,
|
||||
}
|
||||
})
|
||||
.filter((surface) => surface.moduleList.length > 0)
|
||||
@ -139,11 +146,14 @@ export function useCircuitTrestle(executeEffect = false) {
|
||||
let remaining = [...arr]
|
||||
|
||||
while (remaining.length > 0) {
|
||||
const { roofSurface, roofSurfaceIncl } = remaining[0]
|
||||
const key = `${roofSurface}|${roofSurfaceIncl}`
|
||||
const { roofSurface, roofSurfaceIncl, roofSurfaceNorthModuleYn } = remaining[0]
|
||||
const key = `${roofSurface}|${roofSurfaceIncl}|${roofSurfaceNorthModuleYn}`
|
||||
|
||||
// 해당 그룹 추출
|
||||
const group = remaining.filter((item) => item.roofSurface === roofSurface && item.roofSurfaceIncl === roofSurfaceIncl)
|
||||
const group = remaining.filter(
|
||||
(item) =>
|
||||
item.roofSurface === roofSurface && item.roofSurfaceIncl === roofSurfaceIncl && item.roofSurfaceNorthModuleYn === roofSurfaceNorthModuleYn,
|
||||
)
|
||||
|
||||
// 이미 처리했는지 체크 후 저장
|
||||
if (!seen.has(key)) {
|
||||
@ -152,7 +162,14 @@ export function useCircuitTrestle(executeEffect = false) {
|
||||
}
|
||||
|
||||
// remaining에서 제거
|
||||
remaining = remaining.filter((item) => !(item.roofSurface === roofSurface && item.roofSurfaceIncl === roofSurfaceIncl))
|
||||
remaining = remaining.filter(
|
||||
(item) =>
|
||||
!(
|
||||
item.roofSurface === roofSurface &&
|
||||
item.roofSurfaceIncl === roofSurfaceIncl &&
|
||||
item.roofSurfaceNorthModuleYn === roofSurfaceNorthModuleYn
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user