hhjk00 10 months ago
parent
commit
bcdee67198
  1. 20
      src/components/laanc/map/FlightArea.js
  2. 8
      src/components/laanc/map/LaancAreaMap.js
  3. 32
      src/components/laanc/map/LaancDrawControl.js

20
src/components/laanc/map/FlightArea.js

@ -42,6 +42,7 @@ import { WeatherContainer } from '../../../containers/basis/flight/plan/WeatherC
import { initFlightBas } from '../../../modules/laanc/models/laancModels'; import { initFlightBas } from '../../../modules/laanc/models/laancModels';
import * as LaancAction from '../../../modules/laanc/actions/laancActions'; import * as LaancAction from '../../../modules/laanc/actions/laancActions';
import LaancDrawModal from './LaancDrawModal'; import LaancDrawModal from './LaancDrawModal';
import { handlerRemoveGroupMarker } from '../../../utility/DrawUtil';
const initialAddData = { const initialAddData = {
isAddable: false, isAddable: false,
@ -84,7 +85,8 @@ export default function FlightArea({
const [saveData, setSaveData] = useState(); const [saveData, setSaveData] = useState();
const [saveElev, setSaveElev] = useState(); const [saveElev, setSaveElev] = useState();
const { laancElev } = useSelector(state => state.laancState);
// const [isDrawDone, setIsDrawDone] = useState(false);
//날씨 임시 데이터 //날씨 임시 데이터
const [wheather, setWheather] = useState([]); const [wheather, setWheather] = useState([]);
@ -181,8 +183,16 @@ export default function FlightArea({
}; };
const handlerDrawType = val => { const handlerDrawType = val => {
// if (drawObj.getMode().includes('draw')) {
// const isEmpty = drawObj
// .getAll()
// .features.filter(o => !o.properties.id && o.properties.id !== 'BUFFER');
// drawObj.delete(isEmpty[0].id);
// handlerRemoveGroupMarker(isEmpty[0].id);
// }
// dispatch(drawTypeChangeAction(val));
if (drawObj.getMode().includes('draw')) { if (drawObj.getMode().includes('draw')) {
// alert('비행구역설정 완료 후 타입을 변경해주세요.');
setModal({ setModal({
title: '비행 구역 설정', title: '비행 구역 설정',
desc: ( desc: (
@ -523,7 +533,7 @@ export default function FlightArea({
const obj = drawObj const obj = drawObj
.getAll() .getAll()
.features.filter(obj => obj.properties.id !== 'BUFFER'); .features.filter(obj => obj.properties.id !== 'BUFFER');
handlerDrawType(obj[0].properties.id); // handlerDrawType(obj[0].properties.id);
} }
}; };
@ -591,6 +601,8 @@ export default function FlightArea({
setSaveData={setSaveData} setSaveData={setSaveData}
handlerSaveElev={handlerSaveElev} handlerSaveElev={handlerSaveElev}
setModal={setModal} setModal={setModal}
// isDrawDone={isDrawDone}
// setIsDrawDone={setIsDrawDone}
/> />
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
@ -636,7 +648,7 @@ export default function FlightArea({
</Button> </Button>
{addData.isViewAdd ? ( {addData.isViewAdd ? (
<Button <Button
disabled={addData.overAdd} disabled={addData.overAdd || addData.isAddable}
color='primary' color='primary'
onClick={() => { onClick={() => {
handlerAddClick(); handlerAddClick();

8
src/components/laanc/map/LaancAreaMap.js

@ -44,6 +44,8 @@ export default function LaancAreaMap({
setSaveData, setSaveData,
handlerSaveElev, handlerSaveElev,
setModal setModal
// isDrawDone,
// setIsDrawDone
}) { }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const mapControl = useSelector(state => state.controlMapReducer); const mapControl = useSelector(state => state.controlMapReducer);
@ -343,7 +345,9 @@ export default function LaancAreaMap({
onClick={() => { onClick={() => {
const allObj = drawObj const allObj = drawObj
.getAll() .getAll()
.features.filter(o => o.properties.id !== 'BUFFER'); .features.filter(
o => o.properties.id !== 'BUFFER' && o.properties.id
);
drawObj.changeMode('direct_select', { drawObj.changeMode('direct_select', {
featureId: allObj[i].id featureId: allObj[i].id
@ -414,6 +418,8 @@ export default function LaancAreaMap({
setSaveData={setSaveData} setSaveData={setSaveData}
handlerAreaInfoToAreaList={handlerAreaInfoToAreaList} handlerAreaInfoToAreaList={handlerAreaInfoToAreaList}
handlerSaveElev={handlerSaveElev} handlerSaveElev={handlerSaveElev}
// isDrawDone={isDrawDone}
// setIsDrawDone={setIsDrawDone}
/> />
<FeatureAirZone map={mapObject} mapboxgl={mapboxgl} /> <FeatureAirZone map={mapObject} mapboxgl={mapboxgl} />
{/* {modal ? ( {/* {modal ? (

32
src/components/laanc/map/LaancDrawControl.js

@ -87,6 +87,11 @@ export const LaancDrawControl = props => {
if (mode && obj) { if (mode && obj) {
const feature = drawObj.get(obj.id); const feature = drawObj.get(obj.id);
if (!feature) {
drawObj.changeMode('simple_select');
return;
}
const initCoords = feature.geometry.coordinates; const initCoords = feature.geometry.coordinates;
if (mode !== 'CIRCLE') { if (mode !== 'CIRCLE') {
if (state.currentVertexPosition > 1) { if (state.currentVertexPosition > 1) {
@ -163,6 +168,25 @@ export const LaancDrawControl = props => {
coords.splice(-1); coords.splice(-1);
const data = { coords: coords, mode: mode, id: obj.id }; const data = { coords: coords, mode: mode, id: obj.id };
// 에러 체크
// const isExist = drawObj.getAll().features.some(o => o.id === obj.id);
// if (!isExist) {
// console.log('1111111?');
// props.setModal({
// title: '비행 구역 설정',
// desc: (
// <>
// 비행구역 설정이 완료되지 않았습니다.
// <br />
// 비행구역 설정을 다시 해주시기 부탁드립니다.
// </>
// ),
// isOpen: true
// });
// dispatch(drawTypeChangeAction('DONE'));
// return;
// }
handlerAbnormalityCheck(data).then(areaInfo => { handlerAbnormalityCheck(data).then(areaInfo => {
if (areaInfo) { if (areaInfo) {
drawObj.setFeatureProperty(obj.id, 'id', mode); drawObj.setFeatureProperty(obj.id, 'id', mode);
@ -208,7 +232,6 @@ export const LaancDrawControl = props => {
let isBreak = false; let isBreak = false;
// 비행금지 구역 체크 // 비행금지 구역 체크
try { try {
const elev1 = await axios.post(`api/bas/laanc/valid/elev`, areaList); const elev1 = await axios.post(`api/bas/laanc/valid/elev`, areaList);
props.handlerSaveElev(elev1.data); props.handlerSaveElev(elev1.data);
@ -366,6 +389,7 @@ export const LaancDrawControl = props => {
} }
drawObj.delete(id); drawObj.delete(id);
drawObj.changeMode('simple_select');
// 라인일 경우 버퍼도 삭제 // 라인일 경우 버퍼도 삭제
const buffer = drawObj const buffer = drawObj
@ -388,7 +412,7 @@ export const LaancDrawControl = props => {
const viewCoordObj = drawObj const viewCoordObj = drawObj
.getAll() .getAll()
.features.filter(o => o.properties.id !== 'BUFFER'); .features.filter(o => o.properties.id !== 'BUFFER' && o.properties.id);
props.setViewCoordObj(viewCoordObj); props.setViewCoordObj(viewCoordObj);
@ -544,6 +568,7 @@ export const LaancDrawControl = props => {
handlerCreateGroupMarker(mapObject, data, area.areaType); handlerCreateGroupMarker(mapObject, data, area.areaType);
} }
dispatch(drawTypeChangeAction('DONE')); dispatch(drawTypeChangeAction('DONE'));
drawObj.changeMode('simple_select');
} }
}); });
} else if (areas.length > 0 && areas[0].areaType) { } else if (areas.length > 0 && areas[0].areaType) {
@ -670,10 +695,13 @@ export const LaancDrawControl = props => {
props.setViewCoordObj([]); props.setViewCoordObj([]);
drawObj.deleteAll(); drawObj.deleteAll();
handlerRemoveAllMarker(); handlerRemoveAllMarker();
drawObj.changeMode('simple_select');
return; return;
} }
handlerStartMode(mode); handlerStartMode(mode);
} else {
drawObj.changeMode('simple_select');
} }
}; };

Loading…
Cancel
Save