diff --git a/src/components/basis/flight/plan/FlightPlanAreaMap.js b/src/components/basis/flight/plan/FlightPlanAreaMap.js
index 4112baf..04300b1 100644
--- a/src/components/basis/flight/plan/FlightPlanAreaMap.js
+++ b/src/components/basis/flight/plan/FlightPlanAreaMap.js
@@ -14,8 +14,7 @@ import { AREA_COORDINATE_LIST_SAVE } from '../../../../modules/basis/flight/acti
const FlightPlanAreaMap = (props) => {
const dispatch = useDispatch();
const naver = window.naver;
- const airArea = props.airArea;
- const isFlightDone = props.isFlightDone;
+ const airArea = props.airArea;
const mapControl = useSelector(state => state.controlMapReducer);
const { areaCoordList } = useSelector(state => state.flightState);
@@ -24,9 +23,10 @@ const FlightPlanAreaMap = (props) => {
const [mode, setMode] = useState();
const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList);
- useEffect(() => {
+
+ useEffect(() => {
NaverMapInit();
- }, []);
+ },[]);
useEffect(() => {
setIsMapLoad(true);
@@ -38,41 +38,40 @@ const FlightPlanAreaMap = (props) => {
}, [mapControl.drawType]);
useEffect(() => {
- // NaverMapInit();
+ if(areaCoordList) {
+ if(areaCoordList[0].coordList[0].lat !== 0 && areaCoordList[0].coordList[0].lon !== 0){
+ if(map) {
+ map.setCenter(new naver.maps.LatLng(areaCoordList[0].coordList[0].lat, areaCoordList[0].coordList[0].lon))
+ }
+ }
+ }
setMapAreaCoordList(areaCoordList)
}, [areaCoordList]);
-
const ModeInit = () => {
setMode(mapControl.drawType)
}
-
+
const NaverMapInit = () => {
- const center = {};
const bufferzoom ={};
- if(areaCoordList) {
- center.lat = areaCoordList[0].coordList[0].lat === 0 ? 37.520357 : areaCoordList[0].coordList[0].lat;
- center.lon = areaCoordList[0].coordList[0].lon === 0 ? 126.610166 : areaCoordList[0].coordList[0].lon;
- if(areaCoordList[0].bufferZone>=0 && areaCoordList[0].bufferZone<2000){
- bufferzoom.bufferzoom =13;
- }
- else if(areaCoordList[0].bufferZone>=2000 && areaCoordList[0].bufferZone <5000){
- bufferzoom.bufferzoom =12;
- }
- else if(areaCoordList[0].bufferZone>=5000 && areaCoordList[0].bufferZone <=9000){
- bufferzoom.bufferzoom =11;
- }
- else{
- bufferzoom.bufferzoom =10;
- }
- }
- console.log("bufferzoom>>",bufferzoom);
- console.log(center);
- const mapOptions2 = {
+ if(areaCoordList){
+ if(areaCoordList[0].bufferZone>=0 && areaCoordList[0].bufferZone <2000){
+ bufferzoom.bufferzoom =13;
+ }
+ else if(areaCoordList[0].bufferZone>=2000 && areaCoordList[0].bufferZone <5000){
+ bufferzoom.bufferzoom =12;
+ }
+ else if(areaCoordList[0].bufferZone>=5000 && areaCoordList[0].bufferZone <=9000){
+ bufferzoom.bufferzoom =11;
+ }
+ else{
+ bufferzoom.bufferzoom =10;
+ }
+ }
+ const mapOptions = {
// center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547),
- center: new naver.maps.LatLng(center.lat, center.lon),
- // zoom: 10,
- zoom: bufferzoom.bufferzoom,
+ center: new naver.maps.LatLng(37.520357, 126.610166),
+ zoom: !areaCoordList ? 13 : bufferzoom.bufferzoom,
zoomControl: true,
mapTypeId: naver.maps.MapTypeId.NORMAL,
zoomControlOptions: {
@@ -80,9 +79,9 @@ const FlightPlanAreaMap = (props) => {
style: naver.maps.ZoomControlStyle.SMALL
}
};
- setMap(new naver.maps.Map('map', mapOptions2));
+ setMap(new naver.maps.Map('map', mapOptions));
}
-
+
const handlerDrawType = val => {
dispatch(drawTypeChangeAction(val));
};
@@ -142,7 +141,6 @@ const FlightPlanAreaMap = (props) => {
handleCoordinates={handleCoordinates}
handleInitCoordinates={handleInitCoordinates}
handleConfirm={props.handleConfirm}
- isFlightDone={isFlightDone}
/> : null}
{/* {
handlerDrawType('RESET')}
- {...(isFlightDone)? {disabled:true} : {} }
+ onClick={e => handlerDrawType('RESET')}
>
초기화
@@ -173,7 +170,6 @@ const FlightPlanAreaMap = (props) => {
className='mr-1'
color='primary'
onClick={e => handlerDrawType('LINE')}
- {...(isFlightDone)? {disabled:true} : {} }
>
WayPoint
@@ -181,14 +177,12 @@ const FlightPlanAreaMap = (props) => {
className='mr-1'
color='primary'
onClick={e => handlerDrawType('CIRCLE')}
- {...(isFlightDone)? {disabled:true} : {} }
>
Circle
handlerDrawType('POLYGON')}
- {...(isFlightDone)? {disabled:true} : {} }
>
Polygon