From 78524f739fa37a0e125f0c91272c1bc9dc1be296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Wed, 25 Oct 2023 15:26:32 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=ED=97=88=EC=9A=A9=EA=B3=A0=EB=8F=840m=20=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=ED=91=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/map/LaancAreaMap.js | 6 +- .../map/mapbox/draw/LaancDrawControl.js | 80 ++++++++++++++++++- src/components/map/mapbox/draw/LaancModal.js | 17 ++-- 3 files changed, 89 insertions(+), 14 deletions(-) diff --git a/src/components/laanc/map/LaancAreaMap.js b/src/components/laanc/map/LaancAreaMap.js index 0e55bf8..2bf1e2a 100644 --- a/src/components/laanc/map/LaancAreaMap.js +++ b/src/components/laanc/map/LaancAreaMap.js @@ -56,7 +56,11 @@ export default function LaancAreaMap({ ); const [number, setNumber] = useState(0); - const [modal, setModal] = useState(false); + const [modal, setModal] = useState({ + title: '', + desc: '', + isOpen: false + }); const [detailLayer, setDetailLayer] = useState(); diff --git a/src/components/map/mapbox/draw/LaancDrawControl.js b/src/components/map/mapbox/draw/LaancDrawControl.js index 24d7a2d..670e40c 100644 --- a/src/components/map/mapbox/draw/LaancDrawControl.js +++ b/src/components/map/mapbox/draw/LaancDrawControl.js @@ -79,6 +79,17 @@ export const LaancDrawControl = props => { const type = handlerReturnMode(drawObj.getMode()); const obj = state[type?.toLowerCase()]; + // const features = mapObject.queryRenderedFeatures(e.point, { + // layers: ['maine'] + // }); + // if (features.length > 0 && obj) { + // if (features[0].properties.description.includes('김포공항 비행불가')) { + // if (!obj?.properties?.isUnable) { + // drawObj.setFeatureProperty(obj.id, 'isUnable', true); + // } + // } + // } + if (type && obj) { const feature = drawObj.get(obj.id); const coordinates = feature.geometry.coordinates; @@ -236,8 +247,10 @@ export const LaancDrawControl = props => { // 모든 비정상상황 체크 const handlerAbnormalityCheck = (data, mode) => { - const isBreak = handlerIsSpecialFlight(data, mode); - if (isBreak) return; + const isBreak1 = handlerIsSpecialFlight(data, mode); + const isBreak2 = handlerIsUnableArea(data, mode); + if (isBreak1) return; + if (isBreak2) return; const initCoord = mode === 'LINE' @@ -252,7 +265,7 @@ export const LaancDrawControl = props => { handlerSaveAreaInfo(datas); }; - // 현재 그려진 모든 도형에 대한 비가시권 검사 + // 비가시권 검사 const handlerIsSpecialFlight = (data, mode) => { console.log('specialFlight'); let isBreak = false; @@ -273,7 +286,66 @@ export const LaancDrawControl = props => { } if (isBreak) { - props.setModal(true); + props.setModal({ + title: '특별 비행 신청', + desc: ( + <> + 육안으로 기체 확인이 불가능 합니다. +
가시권 밖 범위는 특별비행 신청을 진행하셔야 합니다.
+ 드론원스톱을 통해서 신청해 주시기 바랍니다. + + ), + isOpen: true + }); + handlerRemoveError(data.id); + return true; + } else { + props.handlerSaveCheck(true); + return false; + } + }; + + // 비행불가지역 검사 + const handlerIsUnableArea = (data, mode) => { + console.log('unableArea'); + let isBreak = false; + + if (mode === 'CIRCLE') { + const point = mapObject.project(data.coord); + const maine = mapObject.queryRenderedFeatures(point, { + layers: ['maine'] + }); + + if (maine.length > 0) { + if (maine[0].properties.description.includes('김포공항 비행불가')) { + isBreak = true; + // break; + } + } + } else { + const coord = mode === 'LINE' ? data.coord : data.coord[0]; + + for (let i = 0; i < coord.length; i++) { + const point = mapObject.project(coord[i]); + const maine = mapObject.queryRenderedFeatures(point, { + layers: ['maine'] + }); + + if (maine.length > 0) { + if (maine[0].properties.description.includes('김포공항 비행불가')) { + isBreak = true; + break; + } + } + } + } + + if (isBreak) { + props.setModal({ + title: '비행 불가 지역', + desc: <>비행불가!, + isOpen: true + }); handlerRemoveError(data.id); return true; } else { diff --git a/src/components/map/mapbox/draw/LaancModal.js b/src/components/map/mapbox/draw/LaancModal.js index 66724b8..c3761dc 100644 --- a/src/components/map/mapbox/draw/LaancModal.js +++ b/src/components/map/mapbox/draw/LaancModal.js @@ -8,23 +8,22 @@ export default function LaancModal({ modal, handler }) { return (
- 특별 비행 신청 - - 육안으로 기체 확인이 불가능 합니다.
가시권 밖 범위는 특별비행 신청을 - 진행하셔야 합니다.
드론원스톱을 통해서 신청해 주시기 바랍니다. -
+ {modal.title} + {modal.desc} - + {modal.title === '특별 비행 신청' ? ( + + ) : null}