From 918034c81092d7d56382fcf47d6e11c92c14ad3c 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: Mon, 23 Oct 2023 16:24:33 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=EC=8B=9C=20=EC=97=90=EB=9F=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/LaancAreaMap.js | 1 + .../map/mapbox/draw/LaancDrawControl.js | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/laanc/LaancAreaMap.js b/src/components/laanc/LaancAreaMap.js index 4b66566..d55e021 100644 --- a/src/components/laanc/LaancAreaMap.js +++ b/src/components/laanc/LaancAreaMap.js @@ -315,6 +315,7 @@ export default function LaancAreaMap({
{mapObject && viewCoordObj.length > 0 ? (
+ {/* {console.log(viewCoordObj, '----')} */} {viewCoordObj?.map((obj, i) => { let coord = obj.properties.id === 'LINE' diff --git a/src/components/map/mapbox/draw/LaancDrawControl.js b/src/components/map/mapbox/draw/LaancDrawControl.js index 159d026..f33621b 100644 --- a/src/components/map/mapbox/draw/LaancDrawControl.js +++ b/src/components/map/mapbox/draw/LaancDrawControl.js @@ -124,9 +124,9 @@ export const LaancDrawControl = props => { // 도형 그리기 완료 시 // drawType을 바꾸면 종료처리가 돼서 이게 실행되는 듯 const handlerDblClickFinish = state => { + const mode = handlerReturnMode(drawObj.getMode()); if (state.currentVertexPosition !== 0) { console.log('dblclick'); - const mode = handlerReturnMode(drawObj.getMode()); if (mode === 'CIRCLE') { const obj = state.polygon; @@ -135,6 +135,9 @@ export const LaancDrawControl = props => { radius: obj.properties.radiusInKm * 1000, id: obj.id }; + // 임시 데이터(circle 관제권 유무 판별 여기서 해줘야 함) + drawObj.setFeatureProperty(obj.id, 'inAirArea', 'N'); + drawObj.setFeatureProperty(data.id, 'id', mode); handlerCreateOneMarker([0, -10], data.coord, data.radius, data.id); handlerAbnormalityCheck(data, mode); @@ -189,6 +192,15 @@ export const LaancDrawControl = props => { handlerAbnormalityCheck(data, mode); } } + } else { + // 좌표가 찍히기도 전에 틀만 생성된 도형들 삭제 + if (mode === 'CIRCLE') { + const obj = state.polygon; + drawObj.delete(obj.id); + } else { + const obj = state[mode.toLowerCase()]; + drawObj.delete(obj.id); + } } }; @@ -347,9 +359,8 @@ export const LaancDrawControl = props => { const viewCoordObj = drawObj .getAll() - .features.filter( - o => o.geometry.coordinates.length > 0 && o.properties.id !== 'BUFFER' - ); + .features.filter(o => o.properties?.inAirArea); + props.setViewCoordObj(viewCoordObj); if (viewCoordObj.length > 1) { @@ -542,6 +553,7 @@ export const LaancDrawControl = props => { const drawInit = () => { const mode = mapControl.drawType; if (mode !== 'DONE') { + // console.log(mode, 'mode----'); if (!props.addData.isAddable) { // 추가 상태가 아닐 때 drawObj.deleteAll();