|
|
|
@ -76,10 +76,6 @@ export const LaancDrawControl = props => {
|
|
|
|
|
} |
|
|
|
|
}, [isDrawDone]); |
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// console.log(inAirArea, '--1122');
|
|
|
|
|
// }, [inAirArea]);
|
|
|
|
|
|
|
|
|
|
// 클릭할 때마다 마커 찍어줌
|
|
|
|
|
const handlerCustomOnClick = (state, e) => { |
|
|
|
|
console.log('click'); |
|
|
|
@ -91,7 +87,6 @@ export const LaancDrawControl = props => {
|
|
|
|
|
inAirArea = 'Y'; |
|
|
|
|
// setInAirArea(true);
|
|
|
|
|
// console.log(features, '>>>>>관제권?');
|
|
|
|
|
// areaCoordList 컬럼 새로 만든거에 TRUE 머시기... 가 아니라 여기가 아님 일단은!! 노트 참고해!!!
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const type = handlerReturnMode(drawObj.getMode()); |
|
|
|
@ -147,7 +142,6 @@ export const LaancDrawControl = props => {
|
|
|
|
|
const length = state.currentVertexPosition; |
|
|
|
|
drawObj.setFeatureProperty(obj.id, 'id', mode); |
|
|
|
|
drawObj.setFeatureProperty(obj.id, 'inAirArea', inAirArea); |
|
|
|
|
// console.log(inAirArea, '--------------------');
|
|
|
|
|
|
|
|
|
|
// dbl클릭이 click 두번으로 인식돼서, 마지막 값을 없애버리기로 함
|
|
|
|
|
if (mode === 'LINE') { |
|
|
|
@ -162,6 +156,7 @@ export const LaancDrawControl = props => {
|
|
|
|
|
} |
|
|
|
|
} else if (mode === 'POLYGON') { |
|
|
|
|
obj.coordinates[0].splice(-1); |
|
|
|
|
|
|
|
|
|
if (length < 2) { |
|
|
|
|
setAlertModal({ |
|
|
|
|
isOpen: true, |
|
|
|
@ -206,7 +201,7 @@ export const LaancDrawControl = props => {
|
|
|
|
|
id: obj.id |
|
|
|
|
}; |
|
|
|
|
handlerRemoveGroupMarker(obj.id); |
|
|
|
|
handlerCreateGroupMarker(data.coord, obj.id); |
|
|
|
|
handlerCreateGroupMarker(data, mode); |
|
|
|
|
handlerAbnormalityCheck(data, mode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -227,7 +222,6 @@ export const LaancDrawControl = props => {
|
|
|
|
|
: null; |
|
|
|
|
|
|
|
|
|
const datas = { coord: initCoord, mode: mode, inAirArea: inAirArea }; |
|
|
|
|
// handlerSaveAreaInfo(initCoord, mode);
|
|
|
|
|
handlerSaveAreaInfo(datas); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -314,6 +308,15 @@ export const LaancDrawControl = props => {
|
|
|
|
|
} |
|
|
|
|
props.handlerCoordinates(areaInfo); |
|
|
|
|
setIsDrawDone(true); |
|
|
|
|
|
|
|
|
|
const obj = drawObj |
|
|
|
|
.getAll() |
|
|
|
|
.features.filter(obj => obj.properties.id !== 'BUFFER'); |
|
|
|
|
if (obj.length > 1) { |
|
|
|
|
props.handlerAddChange('overAdd', true); |
|
|
|
|
} else { |
|
|
|
|
props.handlerAddChange('isViewAdd', true); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handlerPastDraw = () => { |
|
|
|
@ -411,40 +414,52 @@ export const LaancDrawControl = props => {
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 해당되는 id의 마커 생성
|
|
|
|
|
const handlerCreateGroupMarker = (coords, id) => { |
|
|
|
|
const handlerCreateGroupMarker = (data, mode) => { |
|
|
|
|
const areas = props.areaCoordList[0]; |
|
|
|
|
|
|
|
|
|
if (areas.areaType !== 'CIRCLE') { |
|
|
|
|
for (let i = 0; i < coords.length; i++) { |
|
|
|
|
if (mode !== 'CIRCLE') { |
|
|
|
|
const coord = mode === 'LINE' ? data.coord : data.coord[0]; |
|
|
|
|
for (let i = 0; i < coord.length; i++) { |
|
|
|
|
const coords = coord; |
|
|
|
|
if (i === 0) { |
|
|
|
|
handlerCreateOneMarker([0, -10], coords[i], 'Start', id); |
|
|
|
|
handlerCreateOneMarker([0, -10], coords[i], 'Start', data.id); |
|
|
|
|
} else { |
|
|
|
|
const lngLat = handlerGetMidPoint(coords[i - 1], coords[i]); |
|
|
|
|
const text = CalculateDistance(coords[i - 1], coords[i]); |
|
|
|
|
handlerCreateOneMarker([0, 0], lngLat, text, id); |
|
|
|
|
handlerCreateOneMarker([0, 0], lngLat, text, data.id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
handlerCreateOneMarker([0, -10], coords[0], areas.bufferZone, id); |
|
|
|
|
handlerCreateOneMarker([0, -10], coords[0], areas.bufferZone, data.id); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const drawInit = () => { |
|
|
|
|
// drawObj.deleteAll();
|
|
|
|
|
// handlerRemoveAllMarker();
|
|
|
|
|
// setInAirArea(false);
|
|
|
|
|
if (!props.addData.isAddable) { |
|
|
|
|
drawObj.deleteAll(); |
|
|
|
|
handlerRemoveAllMarker(); |
|
|
|
|
|
|
|
|
|
props.handlerSaveCheck(false); |
|
|
|
|
setDrawObjId(); |
|
|
|
|
props.handlerSaveCheck(false); |
|
|
|
|
setDrawObjId(); |
|
|
|
|
|
|
|
|
|
props.handlerInitCoordinates(); |
|
|
|
|
props.handlerInitCoordinates(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const mode = mapControl.drawType; |
|
|
|
|
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); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|