From 5a5ec7bb32b8b68f1061b6fedfdbca17484c712b 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: Thu, 26 Oct 2023 14:11:28 +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=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=20=EA=B0=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/map/LaancAreaMap.js | 13 ++- .../map/mapbox/draw/LaancDrawControl.js | 83 ++++++++++++++----- 2 files changed, 74 insertions(+), 22 deletions(-) diff --git a/src/components/laanc/map/LaancAreaMap.js b/src/components/laanc/map/LaancAreaMap.js index 583e2a7..a7ace1e 100644 --- a/src/components/laanc/map/LaancAreaMap.js +++ b/src/components/laanc/map/LaancAreaMap.js @@ -275,11 +275,11 @@ export default function LaancAreaMap({ // dispatch(AREA_COORDINATE_LIST_SAVE(init)); // }; - const handlerCoordinates = areaInfo => { + const handlerAreaInfoToAreaList = areaInfo => { const initAreaList = initFlightBas.initDetail.areaList.concat(); const coordList = []; - areaInfo.coordinates.forEach((c, idx) => { + areaInfo.coordinates.forEach(c => { const coord = Object.assign({}, initFlightBas['coord']); coord.lat = c.lat; coord.lon = c.lon; @@ -287,7 +287,7 @@ export default function LaancAreaMap({ coordList.push(coord); }); - const areaList = initAreaList.map((area, idx) => { + const areaList = initAreaList.map(area => { return { ...area, bufferZone: areaInfo.bufferZone, @@ -296,6 +296,12 @@ export default function LaancAreaMap({ }; }); + return areaList; + }; + + const handlerCoordinates = areaInfo => { + const areaList = handlerAreaInfoToAreaList(areaInfo); + if (areaInfo.areaType === 'LINE' || areaInfo.areaType === 'POLYGON') { dispatch(FLIGHT_PLAN_AREA_BUFFER_LIST.request(areaList)); } else { @@ -412,6 +418,7 @@ export default function LaancAreaMap({ handlerCoordinates={handlerCoordinates} handlerInitCoordinates={handlerInitCoordinates} setSaveData={setSaveData} + handlerAreaInfoToAreaList={handlerAreaInfoToAreaList} /> {modal ? ( diff --git a/src/components/map/mapbox/draw/LaancDrawControl.js b/src/components/map/mapbox/draw/LaancDrawControl.js index e46b059..c13f1d3 100644 --- a/src/components/map/mapbox/draw/LaancDrawControl.js +++ b/src/components/map/mapbox/draw/LaancDrawControl.js @@ -13,6 +13,7 @@ import { import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions'; import MapboxDraw from '@mapbox/mapbox-gl-draw'; import { CircleMode } from 'mapbox-gl-draw-circle'; +import axios from '../../../../modules/utils/customAxiosUtil'; export const LaancDrawControl = props => { const dispatch = useDispatch(); @@ -235,11 +236,8 @@ export const LaancDrawControl = props => { }; // 모든 비정상상황 체크 - const handlerAbnormalityCheck = (data, mode) => { - const isBreak1 = handlerIsSpecialFlight(data, mode); - const isBreak2 = handlerIsUnableArea(data, mode); - if (isBreak1) return; - if (isBreak2) return; + const handlerAbnormalityCheck = async (data, mode) => { + console.log('비정상체크'); const initCoord = mode === 'LINE' @@ -251,7 +249,53 @@ export const LaancDrawControl = props => { : null; const datas = { coord: initCoord, mode: mode }; - handlerSaveAreaInfo(datas); + const areaInfo = handlerSettingAreaInfo(datas); + + const areaList = props.handlerAreaInfoToAreaList(areaInfo); + + const isBreak1 = handlerIsSpecialFlight(data, mode); + const isBreak2 = handlerIsUnableArea(data, mode); + if (isBreak1 || isBreak2) return; + + try { + console.log('unableElev'); + const result = await axios.post(`api/bas/laanc/valid/elev`, areaList); + + if (result.data[0] === 0) { + props.setModal({ + title: '비행 불가 지역', + desc: ( + <> + 설정하신 비행구역 중 허용고도가 0m인 구역이 있습니다. +
+ 비행구역 설정 시 허용고도를 다시 확인해주시기 바랍니다. + + ), + isOpen: true + }); + handlerRemoveError(data.id); + return; + } else { + props.handlerSaveCheck(true); + } + } catch (error) { + alert('에러 발생'); + } + + props.handlerCoordinates(areaInfo); + setIsDrawDone(true); + + const viewCoordObj = drawObj + .getAll() + .features.filter(o => o.properties.id !== 'BUFFER'); + + props.setViewCoordObj(viewCoordObj); + + if (viewCoordObj.length > 19) { + props.handlerAddChange('overAdd', true); + } else { + props.handlerAddChange('isViewAdd', true); + } }; // 비가시권 검사 @@ -374,12 +418,12 @@ export const LaancDrawControl = props => { }; // areaInfo 셋팅 - const handlerSaveAreaInfo = data => { + const handlerSettingAreaInfo = data => { if (!data.coord || !data.mode) { alert('에러 발생. 다시 시도해 주세요.'); return; } - console.log('saveAreaInfo'); + console.log('settingeAreaInfo'); const areaInfo = { coordinates: [], @@ -416,20 +460,21 @@ export const LaancDrawControl = props => { areaInfo.bufferZone = feature[0].properties.radiusInKm * 1000; } - props.handlerCoordinates(areaInfo); - setIsDrawDone(true); + return areaInfo; + // props.handlerCoordinates(areaInfo); + // setIsDrawDone(true); - const viewCoordObj = drawObj - .getAll() - .features.filter(o => o.properties.id !== 'BUFFER'); + // const viewCoordObj = drawObj + // .getAll() + // .features.filter(o => o.properties.id !== 'BUFFER'); - props.setViewCoordObj(viewCoordObj); + // props.setViewCoordObj(viewCoordObj); - if (viewCoordObj.length > 19) { - props.handlerAddChange('overAdd', true); - } else { - props.handlerAddChange('isViewAdd', true); - } + // if (viewCoordObj.length > 19) { + // props.handlerAddChange('overAdd', true); + // } else { + // props.handlerAddChange('isViewAdd', true); + // } }; // 두 좌표배열이 완전히 일치하는지 판단