diff --git a/src/components/laanc/LaancAreaMap.js b/src/components/laanc/LaancAreaMap.js index 4b66566f..d55e0218 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 159d026b..f33621b2 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();