From b9340db11626daf9d4cc40875864c5e9059abc3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Mon, 30 Oct 2023 17:20:51 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=ED=95=A0=20=EB=95=8C=EB=A7=8C=20elev?= =?UTF-8?q?=EA=B0=92=20Redux=20=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/laanc/map/FlightArea.js | 23 +++++++++++++++----- src/components/laanc/map/LaancAreaMap.js | 4 +++- src/components/laanc/map/LaancDrawControl.js | 7 +----- 3 files changed, 21 insertions(+), 13 deletions(-) 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..3eb7e29 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;