처마 커버 계산 추가

This commit is contained in:
hyojun.choi 2025-01-31 14:58:34 +09:00
parent 9a9b76482d
commit 10bfc1d389

View File

@ -41,9 +41,6 @@ export const useTrestle = () => {
const direction = parent.direction const direction = parent.direction
const rack = surface.trestleDetail.rack const rack = surface.trestleDetail.rack
let { rackQty, rackIntvlPct, rackYn, cvrPlvrYn } = surface.trestleDetail let { rackQty, rackIntvlPct, rackYn, cvrPlvrYn } = surface.trestleDetail
// rackYn = 'N'
// rackQty = 5
cvrPlvrYn = 'Y'
if (!rack) { if (!rack) {
//25/01/16 기준 랙이 없는 경우는 그냥 안그려준다. //25/01/16 기준 랙이 없는 경우는 그냥 안그려준다.
@ -95,6 +92,8 @@ export const useTrestle = () => {
leftExposedHalfTopModules.length > 0 || leftExposedHalfTopModules.length > 0 ||
rightExposedHalfTopPoints.length > 0 rightExposedHalfTopPoints.length > 0
surface.set({ isChidory: isChidory })
canvas canvas
.getObjects() .getObjects()
.filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parent === surface) .filter((obj) => ['eaveBar', 'halfEaveBar'].includes(obj.name) && obj.parent === surface)
@ -1005,8 +1004,8 @@ export const useTrestle = () => {
const installBracketWithOutRack = (surface, exposedBottomModules, leftExposedHalfBottomModules, rightExposedHalfBottomPoints, isChidory) => { const installBracketWithOutRack = (surface, exposedBottomModules, leftExposedHalfBottomModules, rightExposedHalfBottomPoints, isChidory) => {
let { rackQty, rackIntvlPct, moduleIntvlHor, moduleIntvlVer, lessSupFitQty, lessSupFitIntvlPct } = surface.trestleDetail let { rackQty, rackIntvlPct, moduleIntvlHor, moduleIntvlVer, lessSupFitQty, lessSupFitIntvlPct } = surface.trestleDetail
const direction = surface.direction const direction = surface.direction
rackQty = lessSupFitQty rackQty = 3
rackIntvlPct = lessSupFitIntvlPct rackIntvlPct = 10
canvas.renderAll() canvas.renderAll()
exposedBottomModules.forEach((module) => { exposedBottomModules.forEach((module) => {
@ -1517,7 +1516,7 @@ export const useTrestle = () => {
eavesTotCnt: eaveBar.length, eavesTotCnt: eaveBar.length,
eavesHalfTotCnt: halfEaveBar.length, eavesHalfTotCnt: halfEaveBar.length,
racks: rackParams, racks: rackParams,
rackTotCnt: rackList.length + smartRackGroup.length, rackTotCnt: rackList.length ?? 0 + smartRackGroup.length ?? 0,
rackFittingCnt: bracketList.length, rackFittingCnt: bracketList.length,
moduleRows: getMostLeftModules(surface), moduleRows: getMostLeftModules(surface),
} }
@ -1532,7 +1531,7 @@ export const useTrestle = () => {
let isEaveBar = construction.setupCover let isEaveBar = construction.setupCover
let isSnowGuard = construction.setupSnowCover let isSnowGuard = construction.setupSnowCover
let { rackYn, cvrPlvrYn, moduleIntvlHor, moduleIntvlVer, rackQty, lessSupFitQty } = surface.trestleDetail let { rackYn, cvrPlvrYn, moduleIntvlHor, moduleIntvlVer, rackQty, lessSupFitQty } = surface.trestleDetail
cvrPlvrYn = 'Y'
if (rackYn === 'N') { if (rackYn === 'N') {
rackQty = lessSupFitQty rackQty = lessSupFitQty
} }
@ -1619,30 +1618,48 @@ export const useTrestle = () => {
// 모듈 하면,최하면 등 구해야함 // 모듈 하면,최하면 등 구해야함
modules.forEach((module, index) => { modules.forEach((module, index) => {
// 해당 모듈 주변에 다른 모듈이 있는지 확인 // 해당 모듈 주변에 다른 모듈이 있는지 확인
let { bottomModule, topModule, bottomLeftModule, bottomRightModule, topLeftModule, topRightModule } = findSideModule(module, surface) let {
bottomModule,
topModule,
halfBottomLeftModule,
halfBottomRightModule,
halfTopLeftModule,
halfTopRightModule,
leftModule,
rightModule,
bottomLeftModule,
bottomRightModule,
} = findSideModule(module, surface)
if (bottomModule) { if (bottomModule) {
moduleRowResultData.touchedSurfaceCnt++ moduleRowResultData.touchedSurfaceCnt++
} }
if (!bottomModule) { if (!bottomModule) {
if (bottomLeftModule && bottomRightModule) { if (halfBottomLeftModule && halfBottomRightModule) {
moduleRowResultData.touchedSurfaceCnt++ moduleRowResultData.touchedSurfaceCnt++
} else if ((bottomLeftModule && !bottomRightModule) || (!bottomLeftModule && bottomRightModule)) { } else if ((halfBottomLeftModule && !halfBottomRightModule) || (!halfBottomLeftModule && halfBottomRightModule)) {
moduleRowResultData.touchedHalfSurfaceCnt++ moduleRowResultData.touchedHalfSurfaceCnt++
moduleRowResultData.exposedHalfBottomCnt++ moduleRowResultData.exposedHalfBottomCnt++
if (cvrPlvrYn === 'Y') { if (cvrPlvrYn === 'Y') {
moduleRowResultData.eavesHalfCnt++ moduleRowResultData.eavesHalfCnt++
if (bottomLeftModule || bottomRightModule || halfBottomLeftModule || halfBottomRightModule) {
moduleRowResultData.exposedSideEavesCnt++
}
} }
} else { } else {
moduleRowResultData.exposedBottomCnt++ moduleRowResultData.exposedBottomCnt++
if (isEaveBar) { if (isEaveBar) {
moduleRowResultData.eavesCnt++ moduleRowResultData.eavesCnt++
} }
if (!(leftModule && rightModule)) {
moduleRowResultData.exposedSideEavesCnt++
}
} }
} }
if (!topModule) { if (!topModule) {
if ((topLeftModule && !topRightModule) || (!topLeftModule && topRightModule)) { if ((halfTopLeftModule && !halfTopRightModule) || (!halfTopLeftModule && halfTopRightModule)) {
moduleRowResultData.exposedHalfTopCnt++ moduleRowResultData.exposedHalfTopCnt++
} else if (!topLeftModule && !topRightModule) { } else if (!halfTopLeftModule && !halfTopRightModule) {
moduleRowResultData.exposedTopCnt++ moduleRowResultData.exposedTopCnt++
} }
} }
@ -1651,9 +1668,6 @@ export const useTrestle = () => {
result.push(moduleRowResultData) result.push(moduleRowResultData)
}) })
if (isEaveBar) {
}
return result return result
} }
@ -1674,73 +1688,116 @@ export const useTrestle = () => {
let { width, height } = { ...module } let { width, height } = { ...module }
let { x, y } = { ...module.getCenterPoint() } let { x, y } = { ...module.getCenterPoint() }
let halfBottomLeftPoint
let halfBottomRightPoint
let halfTopLeftPoint
let halfTopRightPoint
let leftPoint
let rightPoint
let bottomLeftPoint let bottomLeftPoint
let bottomRightPoint let bottomRightPoint
let topLeftPoint
let topRightPoint
let bottomModule let bottomModule
let topModule let topModule
let halfBottomLeftModule
let halfBottomRightModule
let halfTopLeftModule
let halfTopRightModule
let leftModule
let rightModule
let bottomLeftModule let bottomLeftModule
let bottomRightModule let bottomRightModule
let topLeftModule
let topRightModule
switch (direction) { switch (direction) {
case 'south': case 'south':
width = width + horizontal width = width + horizontal
height = height + vertical height = height + vertical
bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + height)) < maxY) bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + height)) < maxY)
bottomLeftPoint = { x: x - width / 2, y: y + height } halfBottomLeftPoint = { x: x - width / 2, y: y + height }
bottomRightPoint = { x: x + width / 2, y: y + height } halfBottomRightPoint = { x: x + width / 2, y: y + height }
topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - height)) < maxY) topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - height)) < maxY)
topLeftPoint = { x: x - width / 2, y: y - height } halfTopLeftPoint = { x: x - width / 2, y: y - height }
topRightPoint = { x: x + width / 2, y: y - height } halfTopRightPoint = { x: x + width / 2, y: y - height }
leftPoint = { x: x - width, y: y }
rightPoint = { x: x + width, y: y }
bottomLeftModule = { x: x - width, y: y + height }
bottomRightModule = { x: x + width, y: y + height }
break break
case 'north': case 'north':
width = width + horizontal width = width + horizontal
height = height + vertical height = height + vertical
bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - height)) < maxY) bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y - height)) < maxY)
bottomLeftPoint = { x: x + width / 2, y: y - height } halfBottomLeftPoint = { x: x + width / 2, y: y - height }
bottomRightPoint = { x: x - width / 2, y: y - height } halfBottomRightPoint = { x: x - width / 2, y: y - height }
topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + height)) < maxY) topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - x) < maxX && Math.abs(centerPoint.y - (y + height)) < maxY)
topLeftPoint = { x: x + width / 2, y: y + height } halfTopLeftPoint = { x: x + width / 2, y: y + height }
topRightPoint = { x: x - width / 2, y: y + height } halfTopRightPoint = { x: x - width / 2, y: y + height }
leftPoint = { x: x + width, y: y }
rightPoint = { x: x - width, y: y }
bottomLeftModule = { x: x + width, y: y - height }
bottomRightModule = { x: x - width, y: y - height }
break break
case 'east': case 'east':
bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + width)) < maxX && Math.abs(centerPoint.y - y) < maxY) bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + width)) < maxX && Math.abs(centerPoint.y - y) < maxY)
width = width + horizontal width = width + horizontal
bottomLeftPoint = { x: x + width, y: y + height / 2 } halfBottomLeftPoint = { x: x + width, y: y + height / 2 }
bottomRightPoint = { x: x + width, y: y - height / 2 } halfBottomRightPoint = { x: x + width, y: y - height / 2 }
topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - width)) < maxX && Math.abs(centerPoint.y - y) < maxY) topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - width)) < maxX && Math.abs(centerPoint.y - y) < maxY)
topLeftPoint = { x: x - width, y: y + height / 2 } halfTopLeftPoint = { x: x - width, y: y + height / 2 }
topRightPoint = { x: x - width, y: y - height / 2 } halfTopRightPoint = { x: x - width, y: y - height / 2 }
leftPoint = { x: x, y: y + height }
rightPoint = { x: x, y: y - height }
bottomLeftModule = { x: x + width, y: y + height }
bottomRightModule = { x: x + width, y: y - height }
break break
case 'west': case 'west':
bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - width)) < maxX && Math.abs(centerPoint.y - y) < maxY) bottomModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x - width)) < maxX && Math.abs(centerPoint.y - y) < maxY)
width = width + horizontal width = width + horizontal
bottomLeftPoint = { x: x - width, y: y - height / 2 } halfBottomLeftPoint = { x: x - width, y: y - height / 2 }
bottomRightPoint = { x: x - width, y: y + height / 2 } halfBottomRightPoint = { x: x - width, y: y + height / 2 }
topLeftPoint = { x: x + width, y: y - height / 2 }
topRightPoint = { x: x + width, y: y + height / 2 }
topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + width)) < maxX && Math.abs(centerPoint.y - y) < maxY) topModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - (x + width)) < maxX && Math.abs(centerPoint.y - y) < maxY)
halfTopLeftPoint = { x: x + width, y: y - height / 2 }
halfTopRightPoint = { x: x + width, y: y + height / 2 }
leftPoint = { x: x, y: y - height }
rightPoint = { x: x, y: y + height }
bottomLeftModule = { x: x - width, y: y - height }
bottomRightModule = { x: x - width, y: y + height }
break break
} }
topLeftModule = centerPoints.find( halfTopLeftModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < maxX && Math.abs(centerPoint.y - topLeftPoint.y) < maxY, (centerPoint) => Math.abs(centerPoint.x - halfTopLeftPoint.x) < maxX && Math.abs(centerPoint.y - halfTopLeftPoint.y) < maxY,
) )
topRightModule = centerPoints.find( halfTopRightModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < maxX && Math.abs(centerPoint.y - topRightPoint.y) < maxY, (centerPoint) => Math.abs(centerPoint.x - halfTopRightPoint.x) < maxX && Math.abs(centerPoint.y - halfTopRightPoint.y) < maxY,
) )
halfBottomLeftModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - halfBottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - halfBottomLeftPoint.y) < maxY,
)
halfBottomRightModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - halfBottomRightPoint.x) < maxX && Math.abs(centerPoint.y - halfBottomRightPoint.y) < maxY,
)
leftModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - leftPoint.x) < maxX && Math.abs(centerPoint.y - leftPoint.y) < maxY)
rightModule = centerPoints.find((centerPoint) => Math.abs(centerPoint.x - rightPoint.x) < maxX && Math.abs(centerPoint.y - rightPoint.y) < maxY)
bottomLeftModule = centerPoints.find( bottomLeftModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < maxX && Math.abs(centerPoint.y - bottomLeftPoint.y) < maxY, (centerPoint) => Math.abs(centerPoint.x - bottomLeftModule.x) < maxX && Math.abs(centerPoint.y - bottomLeftModule.y) < maxY,
) )
bottomRightModule = centerPoints.find( bottomRightModule = centerPoints.find(
(centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < maxX && Math.abs(centerPoint.y - bottomRightPoint.y) < maxY, (centerPoint) => Math.abs(centerPoint.x - bottomRightModule.x) < maxX && Math.abs(centerPoint.y - bottomRightModule.y) < maxY,
) )
return { bottomModule, topModule, bottomLeftModule, bottomRightModule, topLeftModule, topRightModule } return {
bottomModule,
topModule,
halfBottomLeftModule,
halfBottomRightModule,
halfTopLeftModule,
halfTopRightModule,
leftModule,
rightModule,
bottomLeftModule,
bottomRightModule,
}
} }
return { apply, getTrestleParams } return { apply, getTrestleParams }