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