Merge branch 'qcast-pub' into dev

This commit is contained in:
김민식 2025-02-21 12:56:49 +09:00
commit cc9ddb997a
2 changed files with 25 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import offsetPolygon, { calculateAngle } from '@/util/qpolygon-utils'
import { QPolygon } from '@/components/fabric/QPolygon' import { QPolygon } from '@/components/fabric/QPolygon'
import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom' import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom'
import { useEvent } from '@/hooks/useEvent' import { useEvent } from '@/hooks/useEvent'
import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common' import { POLYGON_TYPE, BATCH_TYPE, LINE_TYPE } from '@/common/common'
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
import { useSwal } from '@/hooks/useSwal' import { useSwal } from '@/hooks/useSwal'
import { compasDegAtom } from '@/store/orientationAtom' import { compasDegAtom } from '@/store/orientationAtom'
@ -22,6 +22,7 @@ import { v4 as uuidv4 } from 'uuid'
// import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle' // import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { isObjectNotEmpty } from '@/util/common-utils' import { isObjectNotEmpty } from '@/util/common-utils'
import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle' import { useCircuitTrestle } from '@/hooks/useCirCuitTrestle'
import { useMode } from '../useMode'
export function useModuleBasicSetting(tabNum) { export function useModuleBasicSetting(tabNum) {
const canvas = useRecoilValue(canvasState) const canvas = useRecoilValue(canvasState)
@ -51,6 +52,7 @@ export function useModuleBasicSetting(tabNum) {
const [currentObject, setCurrentObject] = useRecoilState(currentObjectState) const [currentObject, setCurrentObject] = useRecoilState(currentObjectState)
const { setModuleStatisticsData } = useCircuitTrestle() const { setModuleStatisticsData } = useCircuitTrestle()
const { createRoofPolygon, createMarginPolygon } = useMode()
useEffect(() => { useEffect(() => {
// console.log('basicSetting', basicSetting) // console.log('basicSetting', basicSetting)
@ -131,6 +133,7 @@ export function useModuleBasicSetting(tabNum) {
//가대 상세 데이터 들어오면 실행 //가대 상세 데이터 들어오면 실행
useEffect(() => { useEffect(() => {
if (trestleDetailList.length > 0) { if (trestleDetailList.length > 0) {
console.log('trestleDetailList', trestleDetailList)
//지붕을 가져옴 //지붕을 가져옴
canvas canvas
.getObjects() .getObjects()
@ -143,6 +146,12 @@ export function useModuleBasicSetting(tabNum) {
if (Number(detail.data.roofIndex) === roofIndex) { if (Number(detail.data.roofIndex) === roofIndex) {
//roof에 상세 데이터 추가 //roof에 상세 데이터 추가
roof.set({ trestleDetail: detail.data }) roof.set({ trestleDetail: detail.data })
roof.lines.forEach((line) => {
line.attributes = {
...line.attributes,
offset: getOffset(detail.data, line.attributes.type),
}
})
//배치면 설치 영역 //배치면 설치 영역
makeModuleInstArea(roof, detail.data) makeModuleInstArea(roof, detail.data)
//surface에 상세 데이터 추가 //surface에 상세 데이터 추가
@ -153,6 +162,18 @@ export function useModuleBasicSetting(tabNum) {
} }
}, [trestleDetailList]) }, [trestleDetailList])
const getOffset = (data, type) => {
switch (type) {
case LINE_TYPE.WALLLINE.EAVES:
return data.eaveIntvl / 10
case LINE_TYPE.WALLLINE.GABLE:
return data.kerabaIntvl / 10
case LINE_TYPE.SUBLINE.RIDGE:
return data.ridgeIntvl / 10
default:
return 60
}
}
//선택 배치면 배열` //선택 배치면 배열`
let selectedModuleInstSurfaceArray = [] let selectedModuleInstSurfaceArray = []
@ -220,7 +241,7 @@ export function useModuleBasicSetting(tabNum) {
} else { } else {
let offsetLength = canvasSetting.roofSizeSet === '3' ? -30 : (trestleDetail.eaveIntvl / 10) * -1 let offsetLength = canvasSetting.roofSizeSet === '3' ? -30 : (trestleDetail.eaveIntvl / 10) * -1
setSurfaceShapePattern(roof, roofDisplay.column, true, roof.roofMaterial) //패턴 변경 setSurfaceShapePattern(roof, roofDisplay.column, true, roof.roofMaterial) //패턴 변경
const offsetPoints = offsetPolygon(roof.points, offsetLength) //안쪽 offset const offsetPoints = createMarginPolygon(createRoofPolygon(roof.getCurrentPoints()), roof.lines).vertices //안쪽 offset
//모듈설치영역?? 생성 //모듈설치영역?? 생성
const surfaceId = uuidv4() const surfaceId = uuidv4()

View File

@ -5743,5 +5743,7 @@ export function useMode() {
drawCellManualInTrestle, drawCellManualInTrestle,
setDirectionTrestles, setDirectionTrestles,
cutHelpLines, cutHelpLines,
createRoofPolygon,
createMarginPolygon,
} }
} }