Compare commits
8 Commits
c467fc7fa8
...
84e8af50b8
| Author | SHA1 | Date | |
|---|---|---|---|
| 84e8af50b8 | |||
| 57446fa6d8 | |||
| 1fa02de62f | |||
| 06fa1766d6 | |||
| 63297328ed | |||
| 7c15da2b4c | |||
| 3432d64a3c | |||
| 9be21fc2b2 |
@ -87,7 +87,7 @@ export default function QSelectBox({
|
|||||||
<ul className="select-item-wrap">
|
<ul className="select-item-wrap">
|
||||||
{options?.length > 0 &&
|
{options?.length > 0 &&
|
||||||
options?.map((option, index) => (
|
options?.map((option, index) => (
|
||||||
<li key={option.id || index} className="select-item" onClick={() => handleClickSelectOption(option)}>
|
<li key={option.id + '_' + index} className="select-item" onClick={() => handleClickSelectOption(option)}>
|
||||||
<button key={option.id + 'btn'}>{showKey !== '' ? option[showKey] : option.name}</button>
|
<button key={option.id + 'btn'}>{showKey !== '' ? option[showKey] : option.name}</button>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
|
import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'
|
||||||
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
import { canvasState, currentAngleTypeSelector, currentMenuState, currentObjectState } from '@/store/canvasAtom'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useContext, useEffect, useRef, useState } from 'react'
|
||||||
import { useAxios } from '@/hooks/useAxios'
|
import { useAxios } from '@/hooks/useAxios'
|
||||||
import { useSwal } from '@/hooks/useSwal'
|
import { useSwal } from '@/hooks/useSwal'
|
||||||
import { usePolygon } from '@/hooks/usePolygon'
|
import { usePolygon } from '@/hooks/usePolygon'
|
||||||
@ -26,6 +26,7 @@ import { getChonByDegree, getDegreeByChon } from '@/util/canvas-util'
|
|||||||
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
import { moduleSelectionDataState } from '@/store/selectedModuleOptions'
|
||||||
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
import { useCanvasPopupStatusController } from '@/hooks/common/useCanvasPopupStatusController'
|
||||||
import { outerLinePointsState } from '@/store/outerLineAtom'
|
import { outerLinePointsState } from '@/store/outerLineAtom'
|
||||||
|
import { QcastContext } from '@/app/QcastProvider'
|
||||||
|
|
||||||
export function useRoofAllocationSetting(id) {
|
export function useRoofAllocationSetting(id) {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -49,7 +50,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
const { get, post } = useAxios(globalLocaleState)
|
const { get, post } = useAxios(globalLocaleState)
|
||||||
const { getMessage } = useMessage()
|
const { getMessage } = useMessage()
|
||||||
const { swalFire } = useSwal()
|
const { swalFire } = useSwal()
|
||||||
|
const { setIsGlobalLoading } = useContext(QcastContext)
|
||||||
const { setSurfaceShapePattern } = useRoofFn()
|
const { setSurfaceShapePattern } = useRoofFn()
|
||||||
|
|
||||||
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
const [moduleSelectionData, setModuleSelectionData] = useRecoilState(moduleSelectionDataState)
|
||||||
@ -200,6 +201,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
*/
|
*/
|
||||||
const basicSettingSave = async () => {
|
const basicSettingSave = async () => {
|
||||||
try {
|
try {
|
||||||
|
setIsGlobalLoading(true)
|
||||||
const patternData = {
|
const patternData = {
|
||||||
objectNo: correntObjectNo,
|
objectNo: correntObjectNo,
|
||||||
planNo: Number(basicSetting.planNo),
|
planNo: Number(basicSetting.planNo),
|
||||||
@ -222,6 +224,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
|
|
||||||
await post({ url: `/api/canvas-management/roof-allocation-settings`, data: patternData }).then((res) => {
|
await post({ url: `/api/canvas-management/roof-allocation-settings`, data: patternData }).then((res) => {
|
||||||
swalFire({ text: getMessage(res.returnMessage) })
|
swalFire({ text: getMessage(res.returnMessage) })
|
||||||
|
setIsGlobalLoading(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
//Recoil 설정
|
//Recoil 설정
|
||||||
@ -270,8 +273,6 @@ export function useRoofAllocationSetting(id) {
|
|||||||
* 선택한 지붕재로 할당
|
* 선택한 지붕재로 할당
|
||||||
*/
|
*/
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
basicSettingSave()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
|
* 모두 actualSize 있으면 바로 적용 없으면 actualSize 설정
|
||||||
*/
|
*/
|
||||||
@ -280,6 +281,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
} else {
|
} else {
|
||||||
apply()
|
apply()
|
||||||
resetPoints()
|
resetPoints()
|
||||||
|
basicSettingSave()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,7 +289,6 @@ export function useRoofAllocationSetting(id) {
|
|||||||
* 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
|
* 지붕재 오른쪽 마우스 클릭 후 단일로 지붕재 변경 필요한 경우
|
||||||
*/
|
*/
|
||||||
const handleSaveContext = () => {
|
const handleSaveContext = () => {
|
||||||
basicSettingSave()
|
|
||||||
const newRoofList = currentRoofList.map((roof, idx) => {
|
const newRoofList = currentRoofList.map((roof, idx) => {
|
||||||
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
|
return { ...roof, index: idx, raft: roof.raft ? roof.raft : roof.raftBaseCd }
|
||||||
})
|
})
|
||||||
@ -304,6 +305,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
drawDirectionArrow(currentObject)
|
drawDirectionArrow(currentObject)
|
||||||
modifyModuleSelectionData()
|
modifyModuleSelectionData()
|
||||||
closeAll()
|
closeAll()
|
||||||
|
basicSettingSave()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -361,6 +363,7 @@ export function useRoofAllocationSetting(id) {
|
|||||||
splitPolygonWithLines(roofBase)
|
splitPolygonWithLines(roofBase)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -767,7 +767,7 @@ export const usePolygon = () => {
|
|||||||
obj.type === 'QLine' &&
|
obj.type === 'QLine' &&
|
||||||
obj.attributes?.type !== 'pitchSizeLine' &&
|
obj.attributes?.type !== 'pitchSizeLine' &&
|
||||||
obj.attributes?.roofId === polygon.id &&
|
obj.attributes?.roofId === polygon.id &&
|
||||||
(innerLineTypes.includes(obj.name) || !obj.name),
|
innerLineTypes.includes(obj.name),
|
||||||
)
|
)
|
||||||
|
|
||||||
innerLines = [...polygon.innerLines]
|
innerLines = [...polygon.innerLines]
|
||||||
|
|||||||
@ -558,7 +558,7 @@
|
|||||||
"board.faq.title": "FAQ",
|
"board.faq.title": "FAQ",
|
||||||
"board.faq.sub.title": "FAQリスト",
|
"board.faq.sub.title": "FAQリスト",
|
||||||
"board.archive.title": "各種資料ダウンロード",
|
"board.archive.title": "各種資料ダウンロード",
|
||||||
"board.archive.sub.title": "見積書一覧",
|
"board.archive.sub.title": "掲載資料一覧",
|
||||||
"board.list.header.rownum": "番号",
|
"board.list.header.rownum": "番号",
|
||||||
"board.list.header.title": "タイトル",
|
"board.list.header.title": "タイトル",
|
||||||
"board.list.header.regDt": "登録日",
|
"board.list.header.regDt": "登録日",
|
||||||
|
|||||||
@ -518,14 +518,23 @@ export const sortedPointLessEightPoint = (points) => {
|
|||||||
*/
|
*/
|
||||||
// 직선의 방정식.
|
// 직선의 방정식.
|
||||||
// 방정식은 ax + by + c = 0이며, 점의 좌표를 대입하여 계산된 값은 직선과 점 사이의 관계를 나타낸다.
|
// 방정식은 ax + by + c = 0이며, 점의 좌표를 대입하여 계산된 값은 직선과 점 사이의 관계를 나타낸다.
|
||||||
export function isPointOnLine(line, point) {
|
export function isPointOnLine({ x1, y1, x2, y2 }, { x, y }) {
|
||||||
const a = line.y2 - line.y1
|
/*const a = line.y2 - line.y1
|
||||||
const b = line.x1 - line.x2
|
const b = line.x1 - line.x2
|
||||||
const c = line.x2 * line.y1 - line.x1 * line.y2
|
const c = line.x2 * line.y1 - line.x1 * line.y2
|
||||||
const result = Math.abs(a * point.x + b * point.y + c) / 100
|
const result = Math.abs(a * point.x + b * point.y + c) / 100
|
||||||
|
|
||||||
// 점이 선 위에 있는지 확인
|
// 점이 선 위에 있는지 확인
|
||||||
return result <= 10
|
return result <= 10*/
|
||||||
|
// 직선 방정식 만족 여부 확인
|
||||||
|
const crossProduct = (y - y1) * (x2 - x1) - (x - x1) * (y2 - y1)
|
||||||
|
if (Math.abs(crossProduct) > 5) return false // 작은 오차 허용
|
||||||
|
|
||||||
|
// 점이 선분의 범위 내에 있는지 확인
|
||||||
|
const withinXRange = Math.min(x1, x2) <= x && x <= Math.max(x1, x2)
|
||||||
|
const withinYRange = Math.min(y1, y2) <= y && y <= Math.max(y1, y2)
|
||||||
|
|
||||||
|
return withinXRange && withinYRange
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 점과 가까운 line 찾기
|
* 점과 가까운 line 찾기
|
||||||
|
|||||||
@ -305,6 +305,9 @@ export function removeDuplicatePolygons(polygons) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const isSamePoint = (a, b) => {
|
export const isSamePoint = (a, b) => {
|
||||||
|
if (!a || !b) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return Math.abs(Math.round(a.x) - Math.round(b.x)) <= 2 && Math.abs(Math.round(a.y) - Math.round(b.y)) <= 2
|
return Math.abs(Math.round(a.x) - Math.round(b.x)) <= 2 && Math.abs(Math.round(a.y) - Math.round(b.y)) <= 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user