배치 오브젝트 오프셋 작업중
This commit is contained in:
parent
5ad95a3579
commit
fd904bb21f
@ -547,15 +547,7 @@ export function useModuleBasicSetting() {
|
||||
?.getObjects()
|
||||
.filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE && !moduleSetupSurfaces.includes(obj)) //설치면이 아닌것
|
||||
|
||||
const batchObjects = canvas
|
||||
?.getObjects()
|
||||
.filter(
|
||||
(obj) =>
|
||||
obj.name === BATCH_TYPE.OPENING ||
|
||||
obj.name === BATCH_TYPE.TRIANGLE_DORMER ||
|
||||
obj.name === BATCH_TYPE.PENTAGON_DORMER ||
|
||||
obj.name === BATCH_TYPE.SHADOW,
|
||||
) //도머s 객체
|
||||
const batchObjects = canvas?.getObjects().filter((obj) => obj.name === POLYGON_TYPE.OBJECT_SURFACE) //도머s 객체
|
||||
|
||||
if (moduleSetupSurfaces.length === 0) {
|
||||
swalFire({ text: getMessage('module.place.no.surface') })
|
||||
@ -609,18 +601,7 @@ export function useModuleBasicSetting() {
|
||||
const objectsIncludeSurface = (turfModuleSetupSurface) => {
|
||||
let containsBatchObjects = []
|
||||
containsBatchObjects = batchObjects.filter((batchObject) => {
|
||||
let convertBatchObject
|
||||
|
||||
if (batchObject.type === 'group') {
|
||||
//도머는 그룹형태임
|
||||
convertBatchObject = batchObjectGroupToTurfPolygon(batchObject)
|
||||
} else {
|
||||
//개구, 그림자
|
||||
batchObject.set({ points: rectToPolygon(batchObject) })
|
||||
canvas?.renderAll() // set된걸 바로 적용하기 위해
|
||||
convertBatchObject = polygonToTurfPolygon(batchObject) //rect를 폴리곤으로 변환 -> turf 폴리곤으로 변환
|
||||
}
|
||||
|
||||
let convertBatchObject = polygonToTurfPolygon(batchObject)
|
||||
// 폴리곤 안에 도머 폴리곤이 포함되어있는지 확인해서 반환하는 로직
|
||||
return turf.booleanContains(turfModuleSetupSurface, convertBatchObject) || turf.booleanWithin(convertBatchObject, turfModuleSetupSurface)
|
||||
})
|
||||
@ -1248,7 +1229,6 @@ export function useModuleBasicSetting() {
|
||||
}
|
||||
|
||||
const coordToTurfPolygon = (points) => {
|
||||
console.log('points', points)
|
||||
const coordinates = points.map((point) => [point.x, point.y])
|
||||
coordinates.push(coordinates[0])
|
||||
return turf.polygon([coordinates])
|
||||
|
||||
@ -93,7 +93,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
})
|
||||
|
||||
if (!selectedSurface) {
|
||||
swalFire({ text: '지붕안에 그려야해요', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
initEvent() //이벤트 초기화
|
||||
if (setIsHidden) setIsHidden(false)
|
||||
return
|
||||
@ -150,7 +150,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -162,7 +162,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
|
||||
|
||||
if (isCross) {
|
||||
swalFire({ text: '겹치기 불가요...', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
|
||||
deleteTempObjects()
|
||||
return
|
||||
}
|
||||
@ -232,7 +232,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(rectPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '개구를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -244,7 +244,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
const isCross = preObjectsArray.some((object) => turf.booleanOverlap(pointsToTurfPolygon(object), rectPolygon))
|
||||
|
||||
if (isCross) {
|
||||
swalFire({ text: '겹치기 불가요...', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.notinstall.cross'), icon: 'error' })
|
||||
deleteTempObjects()
|
||||
return
|
||||
}
|
||||
@ -379,7 +379,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(trianglePolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
@ -604,7 +604,7 @@ export function useObjectBatch({ isHidden, setIsHidden }) {
|
||||
|
||||
//지붕 밖으로 그렸을때
|
||||
if (!turf.booleanWithin(pentagonPolygon, selectedSurfacePolygon)) {
|
||||
swalFire({ text: '도머를 배치할 수 없습니다.', icon: 'error' })
|
||||
swalFire({ text: getMessage('batch.object.outside.roof'), icon: 'error' })
|
||||
//일단 지워
|
||||
deleteTempObjects()
|
||||
return
|
||||
|
||||
@ -995,5 +995,7 @@
|
||||
"batch.canvas.delete.all": "배치면 내용을 전부 삭제하시겠습니까?",
|
||||
"module.not.found": "설치 모듈을 선택하세요.",
|
||||
"construction.length.difference": "지붕면 공법을 전부 선택해주세요.",
|
||||
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다."
|
||||
"menu.validation.canvas.roof": "패널을 배치하려면 지붕면을 입력해야 합니다.",
|
||||
"batch.object.outside.roof": "오브젝트는 지붕내에 설치해야 합니다.",
|
||||
"batch.object.notinstall.cross": "오브젝트는 겹쳐서 설치 할 수 없습니다."
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user