Browse Source

Merge branch 'master' of http://gitea.palntour.com/pav/pav-home

feature/auth
junh_eee 2 years ago
parent
commit
13a5925776
  1. 69
      src/components/basis/flight/plan/FlightPlanAreaMap.js

69
src/components/basis/flight/plan/FlightPlanAreaMap.js

@ -24,18 +24,20 @@ const FlightPlanAreaMap = (props) => {
const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList); const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList);
useEffect(() => { useEffect(() => {
NaverMapInit(); NaverMapInit();
}, []); }, []);
useEffect(() => { useEffect(() => {
setIsMapLoad(true); setIsMapLoad(true);
}, [airArea]); }, [airArea]);
useEffect(() => { useEffect(() => {
ModeInit(); ModeInit();
}, [mapControl.drawType]); }, [mapControl.drawType]);
useEffect(() => { useEffect(() => {
// NaverMapInit();
setMapAreaCoordList(areaCoordList) setMapAreaCoordList(areaCoordList)
}, [areaCoordList]); }, [areaCoordList]);
@ -44,41 +46,40 @@ const FlightPlanAreaMap = (props) => {
setMode(mapControl.drawType) setMode(mapControl.drawType)
} }
//console.log("상현>>",mapAreaCoordList[0].coordList[0].lat);
console.log("상현>>",map);
const NaverMapInit = () => { const NaverMapInit = () => {
if(!mapAreaCoordList[0].coordList[0].lat){ const center = {};
debugger const bufferzoom ={};
const mapOptions = { if(areaCoordList) {
center: new naver.maps.LatLng(mapAreaCoordList[0].coordList[0].lat, mapAreaCoordList[0].coordList[0].lon), center.lat = areaCoordList[0].coordList[0].lat === 0 ? 37.520357 : areaCoordList[0].coordList[0].lat;
// center: new naver.maps.LatLng(37.520357, 126.610166), center.lon = areaCoordList[0].coordList[0].lon === 0 ? 126.610166 : areaCoordList[0].coordList[0].lon;
//center: new naver.maps.LatLng(, ), if(areaCoordList[0].bufferZone>=0 && areaCoordList[0].bufferZone<2000){
// zoom: 10, bufferzoom.bufferzoom =13;
zoom: 15, }
zoomControl: true, else if(areaCoordList[0].bufferZone>=2000 && areaCoordList[0].bufferZone <5000){
mapTypeId: naver.maps.MapTypeId.NORMAL, bufferzoom.bufferzoom =12;
zoomControlOptions: { }
position: naver.maps.Position.LEFT_CENTER, else if(areaCoordList[0].bufferZone>=5000 && areaCoordList[0].bufferZone <=9000){
style: naver.maps.ZoomControlStyle.SMALL bufferzoom.bufferzoom =11;
} }
}; else{
setMap(new naver.maps.Map('map', mapOptions)); bufferzoom.bufferzoom =10;
}
} }
else if(!(mapAreaCoordList[0].coordList[0].lat)){ console.log("bufferzoom>>",bufferzoom);
debugger console.log(center);
const mapOptions = { const mapOptions2 = {
// center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547), // center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547),
center: new naver.maps.LatLng(37.520357, 126.610166), center: new naver.maps.LatLng(center.lat, center.lon),
// zoom: 10, // zoom: 10,
zoom: 15, zoom: bufferzoom.bufferzoom,
zoomControl: true, zoomControl: true,
mapTypeId: naver.maps.MapTypeId.NORMAL, mapTypeId: naver.maps.MapTypeId.NORMAL,
zoomControlOptions: { zoomControlOptions: {
position: naver.maps.Position.LEFT_CENTER, position: naver.maps.Position.LEFT_CENTER,
style: naver.maps.ZoomControlStyle.SMALL style: naver.maps.ZoomControlStyle.SMALL
} }
}; };
setMap(new naver.maps.Map('map', mapOptions)); setMap(new naver.maps.Map('map', mapOptions2));
} }
} }
const handlerDrawType = val => { const handlerDrawType = val => {

Loading…
Cancel
Save