Browse Source

laanc 비행구역 추가시 에러 수정

pull/2/head
junh_eee(이준희) 11 months ago
parent
commit
918034c810
  1. 1
      src/components/laanc/LaancAreaMap.js
  2. 20
      src/components/map/mapbox/draw/LaancDrawControl.js

1
src/components/laanc/LaancAreaMap.js

@ -315,6 +315,7 @@ export default function LaancAreaMap({
<div className='d-flex coords-wrap'> <div className='d-flex coords-wrap'>
{mapObject && viewCoordObj.length > 0 ? ( {mapObject && viewCoordObj.length > 0 ? (
<div className='coords-box'> <div className='coords-box'>
{/* {console.log(viewCoordObj, '----')} */}
{viewCoordObj?.map((obj, i) => { {viewCoordObj?.map((obj, i) => {
let coord = let coord =
obj.properties.id === 'LINE' obj.properties.id === 'LINE'

20
src/components/map/mapbox/draw/LaancDrawControl.js

@ -124,9 +124,9 @@ export const LaancDrawControl = props => {
// 도형 그리기 완료 시 // 도형 그리기 완료 시
// drawType을 바꾸면 종료처리가 돼서 이게 실행되는 듯 // drawType을 바꾸면 종료처리가 돼서 이게 실행되는 듯
const handlerDblClickFinish = state => { const handlerDblClickFinish = state => {
const mode = handlerReturnMode(drawObj.getMode());
if (state.currentVertexPosition !== 0) { if (state.currentVertexPosition !== 0) {
console.log('dblclick'); console.log('dblclick');
const mode = handlerReturnMode(drawObj.getMode());
if (mode === 'CIRCLE') { if (mode === 'CIRCLE') {
const obj = state.polygon; const obj = state.polygon;
@ -135,6 +135,9 @@ export const LaancDrawControl = props => {
radius: obj.properties.radiusInKm * 1000, radius: obj.properties.radiusInKm * 1000,
id: obj.id id: obj.id
}; };
// 임시 데이터(circle 관제권 유무 판별 여기서 해줘야 함)
drawObj.setFeatureProperty(obj.id, 'inAirArea', 'N');
drawObj.setFeatureProperty(data.id, 'id', mode); drawObj.setFeatureProperty(data.id, 'id', mode);
handlerCreateOneMarker([0, -10], data.coord, data.radius, data.id); handlerCreateOneMarker([0, -10], data.coord, data.radius, data.id);
handlerAbnormalityCheck(data, mode); handlerAbnormalityCheck(data, mode);
@ -189,6 +192,15 @@ export const LaancDrawControl = props => {
handlerAbnormalityCheck(data, mode); 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 const viewCoordObj = drawObj
.getAll() .getAll()
.features.filter( .features.filter(o => o.properties?.inAirArea);
o => o.geometry.coordinates.length > 0 && o.properties.id !== 'BUFFER'
);
props.setViewCoordObj(viewCoordObj); props.setViewCoordObj(viewCoordObj);
if (viewCoordObj.length > 1) { if (viewCoordObj.length > 1) {
@ -542,6 +553,7 @@ export const LaancDrawControl = props => {
const drawInit = () => { const drawInit = () => {
const mode = mapControl.drawType; const mode = mapControl.drawType;
if (mode !== 'DONE') { if (mode !== 'DONE') {
// console.log(mode, 'mode----');
if (!props.addData.isAddable) { if (!props.addData.isAddable) {
// 추가 상태가 아닐 때 // 추가 상태가 아닐 때
drawObj.deleteAll(); drawObj.deleteAll();

Loading…
Cancel
Save