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 * as LaancAction from '../../../modules/laanc/actions/laancActions';
import LaancDrawModal from './LaancDrawModal';
import { handlerRemoveGroupMarker } from '../../../utility/DrawUtil';
const initialAddData = {
isAddable: false,
@ -84,7 +85,8 @@ export default function FlightArea({
const [saveData, setSaveData] = useState();
const [saveElev, setSaveElev] = useState();
const { laancElev } = useSelector(state => state.laancState);
// const [isDrawDone, setIsDrawDone] = useState(false);
//날씨 임시 데이터
const [wheather, setWheather] = useState([]);
@ -181,8 +183,16 @@ export default function FlightArea({
};
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')) {
// alert('비행구역설정 완료 후 타입을 변경해주세요.');
setModal({
title: '비행 구역 설정',
desc: (
@ -523,7 +533,7 @@ export default function FlightArea({
const obj = drawObj
.getAll()
.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}
handlerSaveElev={handlerSaveElev}
setModal={setModal}
// isDrawDone={isDrawDone}
// setIsDrawDone={setIsDrawDone}
/>
</ModalBody>
<ModalFooter>
@ -636,7 +648,7 @@ export default function FlightArea({
</Button>
{addData.isViewAdd ? (
<Button
disabled={addData.overAdd}
disabled={addData.overAdd || addData.isAddable}
color='primary'
onClick={() => {
handlerAddClick();

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

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

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

@ -87,6 +87,11 @@ export const LaancDrawControl = props => {
if (mode && obj) {
const feature = drawObj.get(obj.id);
if (!feature) {
drawObj.changeMode('simple_select');
return;
}
const initCoords = feature.geometry.coordinates;
if (mode !== 'CIRCLE') {
if (state.currentVertexPosition > 1) {
@ -163,6 +168,25 @@ export const LaancDrawControl = props => {
coords.splice(-1);
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 => {
if (areaInfo) {
drawObj.setFeatureProperty(obj.id, 'id', mode);
@ -208,7 +232,6 @@ export const LaancDrawControl = props => {
let isBreak = false;
// 비행금지 구역 체크
try {
const elev1 = await axios.post(`api/bas/laanc/valid/elev`, areaList);
props.handlerSaveElev(elev1.data);
@ -366,6 +389,7 @@ export const LaancDrawControl = props => {
}
drawObj.delete(id);
drawObj.changeMode('simple_select');
// 라인일 경우 버퍼도 삭제
const buffer = drawObj
@ -388,7 +412,7 @@ export const LaancDrawControl = props => {
const viewCoordObj = drawObj
.getAll()
.features.filter(o => o.properties.id !== 'BUFFER');
.features.filter(o => o.properties.id !== 'BUFFER' && o.properties.id);
props.setViewCoordObj(viewCoordObj);
@ -544,6 +568,7 @@ export const LaancDrawControl = props => {
handlerCreateGroupMarker(mapObject, data, area.areaType);
}
dispatch(drawTypeChangeAction('DONE'));
drawObj.changeMode('simple_select');
}
});
} else if (areas.length > 0 && areas[0].areaType) {
@ -670,10 +695,13 @@ export const LaancDrawControl = props => {
props.setViewCoordObj([]);
drawObj.deleteAll();
handlerRemoveAllMarker();
drawObj.changeMode('simple_select');
return;
}
handlerStartMode(mode);
} else {
drawObj.changeMode('simple_select');
}
};

Loading…
Cancel
Save