모듈 위치 조정

This commit is contained in:
yjnoh 2025-02-08 22:25:25 +09:00
parent 74e0c26a16
commit 1ecb67e8a1

View File

@ -427,7 +427,7 @@ export function useModuleBasicSetting(tabNum) {
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i])
trestlePolygon = moduleSetupSurfaces[i]
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
flowDirection = moduleSetupSurfaces[i].flowDirection //도형의 방향
flowDirection = moduleSetupSurfaces[i].direction //도형의 방향
const moduleWidth = Number(checkedModule[0].longAxis) / 10
const moduleHeight = Number(checkedModule[0].shortAxis) / 10
@ -930,9 +930,9 @@ export function useModuleBasicSetting(tabNum) {
}
} else {
//디버깅용
// tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
}
@ -955,11 +955,20 @@ export function useModuleBasicSetting(tabNum) {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let flowLines = getFlowLines(moduleSetupSurface, width)
//육지붕이 아닐때만 넣는다 육지붕일땐 클릭 이벤트에 별도로 넣어놓음
let startPoint = flowLines.left
const moduleArray = []
if (flowLines.left.type === 'flat') {
const tempPoint = { ...flowLines.top }
startPoint = { ...flowLines.top, x1: tempPoint.x2, x2: tempPoint.x1 }
} else {
flowLines = getFlowLines(moduleSetupSurface, height)
const tempPoint = { ...flowLines.left }
startPoint = { ...flowLines.left, x1: tempPoint.x1 + 5, x2: tempPoint.x2, y1: tempPoint.y1 - 5 }
}
//중앙배치일 경우에는 계산한다
if (isCenter) {
if (flowLines.left.type === 'flat' && flowLines.bottom.type === 'flat' && flowLines.top.type === 'flat') {
@ -976,12 +985,6 @@ export function useModuleBasicSetting(tabNum) {
}
}
console.log('flowLines.top', flowLines.top)
if (flowLines.left.type === 'flat') {
startPoint = flowLines.top
}
const maxRightEndPoint = surfaceMaxLines.right.x1 //최 우측
const maxTopEndPoint = surfaceMaxLines.top.y1 //최 상단
const maxBottomEndPoint = surfaceMaxLines.bottom.y1 //최하단
@ -1043,9 +1046,9 @@ export function useModuleBasicSetting(tabNum) {
}
} else {
//디버깅용
// tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
}
@ -1069,6 +1072,11 @@ export function useModuleBasicSetting(tabNum) {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, height)
let startPoint = flowLines.top
if (flowLines.top.type === 'flat' && flowLines.right.type === 'curve') {
startPoint = flowLines.right
}
const moduleArray = []
if (isCenter) {
@ -1162,9 +1170,9 @@ export function useModuleBasicSetting(tabNum) {
}
} else {
//디버깅용
// tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
}
@ -1186,8 +1194,20 @@ export function useModuleBasicSetting(tabNum) {
checkedModule.forEach((module, index) => {
const { width, height } = getModuleWidthHeight(maxLengthLine, moduleSetupSurface, module)
const flowLines = getFlowLines(moduleSetupSurface, width)
let flowLines = getFlowLines(moduleSetupSurface, width)
let startPoint = flowLines.right
if (flowLines.right.type === 'flat') {
const tempPoint = { ...flowLines.bottom }
startPoint = { ...flowLines.bottom, x1: tempPoint.x2, x2: tempPoint.x1 }
} else {
flowLines = getFlowLines(moduleSetupSurface, height)
const tempPoint = { ...flowLines.right }
startPoint = { ...flowLines.right, x1: tempPoint.x1 - 5, x2: tempPoint.x2, y1: tempPoint.y1 + 5 }
}
console.log('startPoint', startPoint)
const moduleArray = []
if (isCenter) {
@ -1214,7 +1234,9 @@ export function useModuleBasicSetting(tabNum) {
let diffTopEndPoint = Math.abs(totalTopEndPoint / height)
let totalHeight = Math.ceil(Math.abs(maxBottomEndPoint - maxTopEndPoint) / height)
let totalWidth = Math.abs(startPoint.x1 - maxLeftEndPoint) / width
let startRowPoint = startPoint.y1 - height * Math.ceil(diffTopEndPoint) - 3 // -3으로 위치살짝 보정
let startRowPoint = startPoint.y1 - height * Math.ceil(diffTopEndPoint) // -3으로 위치살짝 보정1
console.log('startRowPoint', startRowPoint)
let tempMaxHeight = isMaxSetup ? height / 2 : height //최대배치인지 확인하려고 넣음
if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사
@ -1268,9 +1290,9 @@ export function useModuleBasicSetting(tabNum) {
}
} else {
//디버깅용
// tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
// canvas?.add(tempModule)
// canvas.renderAll()
tempModule.set({ fill: 'rgba(255,190,41, 0.4)', stroke: 'black', strokeWidth: 1 })
canvas?.add(tempModule)
canvas.renderAll()
}
}
}
@ -1290,7 +1312,7 @@ export function useModuleBasicSetting(tabNum) {
return acc.length > cur.length ? acc : cur
})
const flowDirection = moduleSetupSurface.flowDirection
const flowDirection = moduleSetupSurface.direction
let intvHor =
flowDirection === 'south' || flowDirection === 'north'
@ -1304,44 +1326,44 @@ export function useModuleBasicSetting(tabNum) {
//처마면 배치
if (setupLocation === 'eaves') {
// 흐름방향이 남쪽일때
if (moduleSetupSurface.flowDirection === 'south') {
if (moduleSetupSurface.direction === 'south') {
downFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'west') {
if (moduleSetupSurface.direction === 'west') {
leftFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'east') {
if (moduleSetupSurface.direction === 'east') {
rightFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'north') {
if (moduleSetupSurface.direction === 'north') {
topFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
} else if (setupLocation === 'ridge') {
//용마루
if (moduleSetupSurface.flowDirection === 'south') {
if (moduleSetupSurface.direction === 'south') {
topFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'west') {
if (moduleSetupSurface.direction === 'west') {
rightFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'east') {
if (moduleSetupSurface.direction === 'east') {
leftFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'north') {
if (moduleSetupSurface.direction === 'north') {
downFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, false, intvHor, intvVer)
}
} else if (setupLocation === 'center') {
//중가면
if (moduleSetupSurface.flowDirection === 'south') {
if (moduleSetupSurface.direction === 'south') {
downFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, true, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'west') {
if (moduleSetupSurface.direction === 'west') {
leftFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, true, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'east') {
if (moduleSetupSurface.direction === 'east') {
rightFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, true, intvHor, intvVer)
}
if (moduleSetupSurface.flowDirection === 'north') {
if (moduleSetupSurface.direction === 'north') {
topFlowSetupModule(surfaceMaxLines, maxLengthLine, moduleSetupArray, moduleSetupSurface, containsBatchObjects, true, intvHor, intvVer)
}
}
@ -1789,7 +1811,7 @@ export function useModuleBasicSetting(tabNum) {
turfPolygon = polygonToTurfPolygon(moduleSetupSurfaces[i], true)
trestlePolygon = moduleSetupSurfaces[i]
manualDrawModules = moduleSetupSurfaces[i].modules // 앞에서 자동으로 했을때 추가됨
flowDirection = moduleSetupSurfaces[i].flowDirection //도형의 방향
flowDirection = moduleSetupSurfaces[i].direction //도형의 방향
const moduleWidth = Number(checkedModule[0].longAxis) / 10
const moduleHeight = Number(checkedModule[0].shortAxis) / 10
@ -2575,19 +2597,17 @@ export function useModuleBasicSetting(tabNum) {
(maxLengthLine.flowDirection === 'east' || maxLengthLine.flowDirection === 'west' ? Number(module.shortAxis) : Number(module.longAxis)) / 10
//배치면때는 방향쪽으로 패널이 넓게 누워져야함
if (moduleSetupSurface.flowDirection !== undefined) {
if (moduleSetupSurface.direction !== undefined) {
tmpWidth =
(moduleSetupSurface.flowDirection === 'south' || moduleSetupSurface.flowDirection === 'north'
? Number(module.longAxis)
: Number(module.shortAxis)) / 10
(moduleSetupSurface.direction === 'south' || moduleSetupSurface.direction === 'north' ? Number(module.longAxis) : Number(module.shortAxis)) /
10
tmpHeight =
(moduleSetupSurface.flowDirection === 'south' || moduleSetupSurface.flowDirection === 'north'
? Number(module.shortAxis)
: Number(module.longAxis)) / 10
(moduleSetupSurface.direction === 'south' || moduleSetupSurface.direction === 'north' ? Number(module.shortAxis) : Number(module.longAxis)) /
10
}
return canvasSetting.roofSizeSet === '1'
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurface.roofMaterial.pitch), moduleSetupSurface.flowDirection)
? calculateVisibleModuleHeight(tmpWidth, tmpHeight, getDegreeByChon(moduleSetupSurface.roofMaterial.pitch), moduleSetupSurface.direction)
: { width: tmpWidth, height: tmpHeight }
}