|
|
|
@ -12,12 +12,7 @@ import {
|
|
|
|
|
} from '../../../../utility/DrawUtil'; |
|
|
|
|
import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions'; |
|
|
|
|
import MapboxDraw from '@mapbox/mapbox-gl-draw'; |
|
|
|
|
import { |
|
|
|
|
CircleMode, |
|
|
|
|
DragCircleMode, |
|
|
|
|
DirectMode, |
|
|
|
|
SimpleSelectMode |
|
|
|
|
} from 'mapbox-gl-draw-circle'; |
|
|
|
|
import { CircleMode } from 'mapbox-gl-draw-circle'; |
|
|
|
|
|
|
|
|
|
export const LaancDrawControl = props => { |
|
|
|
|
const dispatch = useDispatch(); |
|
|
|
@ -223,8 +218,8 @@ export const LaancDrawControl = props => {
|
|
|
|
|
id: obj.id |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
handlerRemoveGroupMarker(obj.id); |
|
|
|
|
handlerCreateGroupMarker(data, mode); |
|
|
|
|
// handlerRemoveGroupMarker(obj.id);
|
|
|
|
|
// handlerCreateGroupMarker(data, mode);
|
|
|
|
|
handlerAbnormalityCheck(data, mode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -385,7 +380,7 @@ export const LaancDrawControl = props => {
|
|
|
|
|
const objs = drawObj?.getAll().features; |
|
|
|
|
const areas = props.areaCoordList; |
|
|
|
|
if (areas.length > 0 && objs.length > 0) { |
|
|
|
|
// areas -> 지도에 그려진 모든 구역 정보여야함
|
|
|
|
|
// areas -> 현재는 1개이지만 추후에 데이터가 바뀌면 여러개의 도형도 처리 가능!
|
|
|
|
|
areas.forEach((area, idx) => { |
|
|
|
|
const paths = []; |
|
|
|
|
area.coordList.forEach(coord => paths.push([coord.lon, coord.lat])); |
|
|
|
@ -393,6 +388,7 @@ export const LaancDrawControl = props => {
|
|
|
|
|
console.log('pastDraw', area); |
|
|
|
|
if (area.areaType === 'CIRCLE') { |
|
|
|
|
} else { |
|
|
|
|
let objId = ''; |
|
|
|
|
if (area.areaType === 'LINE') { |
|
|
|
|
// 버퍼 생성
|
|
|
|
|
if (area.bufferCoordList) { |
|
|
|
@ -431,10 +427,35 @@ export const LaancDrawControl = props => {
|
|
|
|
|
const newBufferId = drawObj.add(newBuffer); |
|
|
|
|
drawObj.setFeatureProperty(newBufferId[0], 'id', 'BUFFER'); |
|
|
|
|
drawObj.setFeatureProperty(newBufferId[0], 'lineId', lineId); |
|
|
|
|
|
|
|
|
|
objId = lineId; |
|
|
|
|
} |
|
|
|
|
} else if (area.areaType === 'POLYGON') { |
|
|
|
|
paths.push(paths[0]); |
|
|
|
|
|
|
|
|
|
let polygonId = ''; |
|
|
|
|
const polygons = objs.filter( |
|
|
|
|
o => o.properties.id === 'POLYGON' |
|
|
|
|
); |
|
|
|
|
for (let i = 0; i < polygons.length; i++) { |
|
|
|
|
const result = handlerArraysAreEqual( |
|
|
|
|
polygons[i].geometry.coordinates[0], |
|
|
|
|
paths |
|
|
|
|
); |
|
|
|
|
if (result) { |
|
|
|
|
polygonId = polygons[i].id; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
objId = polygonId; |
|
|
|
|
} |
|
|
|
|
// 마커를 삭제하고 다시 그려주기
|
|
|
|
|
const data = { |
|
|
|
|
coord: area.areaType === 'LINE' ? paths : [paths], |
|
|
|
|
id: objId |
|
|
|
|
}; |
|
|
|
|
handlerRemoveGroupMarker(data.id); |
|
|
|
|
handlerCreateGroupMarker(data, area.areaType); |
|
|
|
|
} |
|
|
|
|
dispatch(drawTypeChangeAction('DONE')); |
|
|
|
|
} |
|
|
|
|