|
|
|
@ -6,6 +6,8 @@ import {
|
|
|
|
|
handlerGetCircleCoord, |
|
|
|
|
handlerGetHtmlContent, |
|
|
|
|
handlerGetMidPoint, |
|
|
|
|
handlerRemoveAllMarker, |
|
|
|
|
handlerRemoveGroupMarker, |
|
|
|
|
handlerReturnMode |
|
|
|
|
} from '../../../../utility/DrawUtil'; |
|
|
|
|
import { drawTypeChangeAction } from '../../../../modules/control/map/actions/controlMapActions'; |
|
|
|
@ -41,7 +43,8 @@ export const LaancDrawControl = props => {
|
|
|
|
|
const areaType = props.areaCoordList[0].areaType; |
|
|
|
|
const drawType = mapControl.drawType; |
|
|
|
|
|
|
|
|
|
if (areaType !== drawType) drawInit(); |
|
|
|
|
drawInit(); |
|
|
|
|
// if (areaType !== drawType) drawInit();
|
|
|
|
|
}, [mapControl.drawType]); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
@ -260,6 +263,9 @@ export const LaancDrawControl = props => {
|
|
|
|
|
|
|
|
|
|
// 비정상 감지 시 해당 도형, 마커 삭제
|
|
|
|
|
const handlerRemoveError = id => { |
|
|
|
|
dispatch(drawTypeChangeAction('DONE')); |
|
|
|
|
// props.handlerAddChange('isAddable', false);
|
|
|
|
|
props.handlerAddChange('overAdd', false); |
|
|
|
|
drawObj.delete(id); |
|
|
|
|
handlerRemoveGroupMarker(id); |
|
|
|
|
props.handlerSaveCheck(false); |
|
|
|
@ -357,6 +363,7 @@ export const LaancDrawControl = props => {
|
|
|
|
|
paths.push(paths[0]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dispatch(drawTypeChangeAction('DONE')); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -389,21 +396,21 @@ export const LaancDrawControl = props => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 지도에 있는 모든 마커 삭제
|
|
|
|
|
const handlerRemoveAllMarker = () => { |
|
|
|
|
const ele = document.getElementsByClassName('mapboxgl-popup'); |
|
|
|
|
const eleArr = Array.from(ele); |
|
|
|
|
eleArr?.forEach(marker => marker.remove()); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 해당되는 id의 마커 삭제
|
|
|
|
|
const handlerRemoveGroupMarker = id => { |
|
|
|
|
const ele = document.getElementsByClassName('mapboxgl-popup'); |
|
|
|
|
const eleArr = Array.from(ele); |
|
|
|
|
eleArr?.forEach(marker => { |
|
|
|
|
if (marker.innerHTML.includes(id)) marker.remove(); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
// // 지도에 있는 모든 마커 삭제
|
|
|
|
|
// const handlerRemoveAllMarker = () => {
|
|
|
|
|
// const ele = document.getElementsByClassName('mapboxgl-popup');
|
|
|
|
|
// const eleArr = Array.from(ele);
|
|
|
|
|
// eleArr?.forEach(marker => marker.remove());
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// // 해당되는 id의 마커 삭제
|
|
|
|
|
// const handlerRemoveGroupMarker = id => {
|
|
|
|
|
// const ele = document.getElementsByClassName('mapboxgl-popup');
|
|
|
|
|
// const eleArr = Array.from(ele);
|
|
|
|
|
// eleArr?.forEach(marker => {
|
|
|
|
|
// if (marker.innerHTML.includes(id)) marker.remove();
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// 개별 마커 생성
|
|
|
|
|
const handlerCreateOneMarker = (anchor, lngLat, text, id) => { |
|
|
|
@ -439,33 +446,31 @@ export const LaancDrawControl = props => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const drawInit = () => { |
|
|
|
|
if (!props.addData.isAddable) { |
|
|
|
|
drawObj.deleteAll(); |
|
|
|
|
handlerRemoveAllMarker(); |
|
|
|
|
const mode = mapControl.drawType; |
|
|
|
|
if (mode !== 'DONE') { |
|
|
|
|
console.log(props.addData.isAddable, '-----'); |
|
|
|
|
if (!props.addData.isAddable) { |
|
|
|
|
drawObj.deleteAll(); |
|
|
|
|
handlerRemoveAllMarker(); |
|
|
|
|
|
|
|
|
|
props.handlerSaveCheck(false); |
|
|
|
|
setDrawObjId(); |
|
|
|
|
props.handlerSaveCheck(false); |
|
|
|
|
setDrawObjId(); |
|
|
|
|
|
|
|
|
|
props.handlerInitCoordinates(); |
|
|
|
|
} |
|
|
|
|
props.handlerInitCoordinates(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
props.setCoordArr([]); |
|
|
|
|
const mode = mapControl.drawType; |
|
|
|
|
if (!mode || mode === 'RESET') { |
|
|
|
|
props.handlerAddChange('isAddable', false); |
|
|
|
|
props.handlerAddChange('isViewAdd', false); |
|
|
|
|
props.handlerAddChange('overAdd', false); |
|
|
|
|
drawObj.deleteAll(); |
|
|
|
|
handlerRemoveAllMarker(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
props.setCoordArr([]); |
|
|
|
|
if (!mode || mode === 'RESET') { |
|
|
|
|
props.handlerAddChange('isAddable', false); |
|
|
|
|
props.handlerAddChange('isViewAdd', false); |
|
|
|
|
props.handlerAddChange('overAdd', false); |
|
|
|
|
drawObj.deleteAll(); |
|
|
|
|
handlerRemoveAllMarker(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const addData = props.addData; |
|
|
|
|
if (addData.isAddable && addData.isViewAdd && addData.overAdd) { |
|
|
|
|
alert('구역은 최대 2개까지 설정 가능합니다.'); |
|
|
|
|
return; |
|
|
|
|
handlerStartMode(mode); |
|
|
|
|
} |
|
|
|
|
handlerStartMode(mode); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handlerStartMode = mode => { |
|
|
|
|