diff --git a/src/components/laanc/map/FlightArea.js b/src/components/laanc/map/FlightArea.js index 6366d18..3476d2d 100644 --- a/src/components/laanc/map/FlightArea.js +++ b/src/components/laanc/map/FlightArea.js @@ -1,7 +1,6 @@ import 'mapbox-gl/dist/mapbox-gl.css'; import mapboxgl from 'mapbox-gl'; import threebox from 'threebox-plugin'; -import * as turf from '@turf/turf'; import MapboxLanguage from '@mapbox/mapbox-gl-language'; import MapboxDraw from '@mapbox/mapbox-gl-draw'; import { @@ -38,11 +37,10 @@ import flatGimpo from '../../map/geojson/flatGimpoAirportAirArea.json'; import gimpo from '../../map/geojson/gimpoAirportAirArea.json'; import geoJson from '../../map/geojson/airArea.json'; import axios from '../../../modules/utils/customAxiosUtil'; -import { ErrorModal } from '../../modal/ErrorModal'; import { FeatureAirZone } from '../../map/mapbox/feature/FeatureAirZone'; import { WeatherContainer } from '../../../containers/basis/flight/plan/WeatherContainer'; -import { InfoModal } from '../../modal/InfoModal'; import { initFlightBas } from '../../../modules/laanc/models/laancModels'; +import * as LaancAction from '../../../modules/laanc/actions/laancActions'; const initialAddData = { isAddable: false, @@ -78,6 +76,8 @@ export default function FlightArea({ const [addData, setAddData] = useState(initialAddData); const [saveData, setSaveData] = useState(); + const [saveElev, setSaveElev] = useState(); + const { laancElev } = useSelector(state => state.laancState); //날씨 임시 데이터 const [wheather, setWheather] = useState([]); @@ -96,12 +96,19 @@ export default function FlightArea({ const area = areaCoordList[0]; if (area.areaType && area.areaType !== '') { if (!centeredModal && previewLayer) handlerPreviewDraw(); - // if (!centeredModal && previewLayer) handlerPrivewDrawObj(); } setWheather(areaCoordList); } }, [areaCoordList, centeredModal, previewLayer]); + // useEffect(() => { + // console.log(saveElev, '---elev'); + // }, [saveElev]); + + // useEffect(() => { + // console.log(laancElev, '---laancelev'); + // }, [laancElev]); + const handlerCreateAirSpace = ( map, useGeoJson = { @@ -499,8 +506,6 @@ export default function FlightArea({ .getAll() .features.filter(obj => obj.properties.id !== 'BUFFER'); handlerDrawType(obj[0].properties.id); - } else { - // alert('구역은 최대 2개까지 설정 가능합니다.'); } }; @@ -526,6 +531,10 @@ export default function FlightArea({ dispatch(AREA_COORDINATE_LIST_SAVE(init)); }; + const handlerSaveElev = elev => { + setSaveElev(elev); + }; + return (
@@ -562,6 +571,7 @@ export default function FlightArea({ handlerAddChange={handlerAddChange} addData={addData} setSaveData={setSaveData} + handlerSaveElev={handlerSaveElev} /> @@ -644,6 +654,7 @@ export default function FlightArea({ disabled={!isSaveable} onClick={() => { handlerSave(); + dispatch(LaancAction.LAANC_ALTITUDE.success(saveElev)); }} > {/* 닫기 */} diff --git a/src/components/laanc/map/LaancAreaMap.js b/src/components/laanc/map/LaancAreaMap.js index 3667cbe..05a6893 100644 --- a/src/components/laanc/map/LaancAreaMap.js +++ b/src/components/laanc/map/LaancAreaMap.js @@ -42,7 +42,8 @@ export default function LaancAreaMap({ handlerAddChange, addData, handlerInitCoordinates, - setSaveData + setSaveData, + handlerSaveElev }) { const dispatch = useDispatch(); const mapControl = useSelector(state => state.controlMapReducer); @@ -413,6 +414,7 @@ export default function LaancAreaMap({ handlerInitCoordinates={handlerInitCoordinates} setSaveData={setSaveData} handlerAreaInfoToAreaList={handlerAreaInfoToAreaList} + handlerSaveElev={handlerSaveElev} /> {modal ? ( diff --git a/src/components/laanc/map/LaancDrawControl.js b/src/components/laanc/map/LaancDrawControl.js index d44056d..b6e3010 100644 --- a/src/components/laanc/map/LaancDrawControl.js +++ b/src/components/laanc/map/LaancDrawControl.js @@ -20,7 +20,6 @@ export const LaancDrawControl = props => { const dispatch = useDispatch(); const mapControl = useSelector(state => state.controlMapReducer); - const { laancElev } = useSelector(state => state.laancState); const drawObj = props.drawObj; const mapObject = props.mapObject; @@ -35,10 +34,6 @@ export const LaancDrawControl = props => { desc: '' }); - // useEffect(() => { - // console.log(laancElev, '----elev'); - // }, [laancElev]); - useEffect(() => { const areaType = props.areaCoordList[0].areaType; const drawType = mapControl.drawType; @@ -214,7 +209,7 @@ export const LaancDrawControl = props => { console.log('unableElev'); try { const elev1 = await axios.post(`api/bas/laanc/valid/elev`, areaList); - dispatch(LaancAction.LAANC_ALTITUDE.success(elev1.data)); + props.handlerSaveElev(elev1.data); const elev2 = []; const formatCoords = mode === 'CIRCLE' ? [coords] : coords; @@ -353,7 +348,15 @@ export const LaancDrawControl = props => { // props.handlerAddChange('isAddable', false); props.handlerAddChange('overAdd', false); handlerRemoveGroupMarker(id); - props.handlerSaveCheck(false); + + const remainObj = drawObj + .getAll() + .features.filter(o => o.properties.id !== 'BUFFER' && o.id !== id); + if (remainObj.length === 0) { + props.handlerSaveCheck(false); + } else { + props.handlerSaveCheck(true); + } drawObj.delete(id);