|
|
|
@ -23,11 +23,10 @@ const FlightPlanAreaMap = (props) => {
|
|
|
|
|
const [mode, setMode] = useState(); |
|
|
|
|
const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList); |
|
|
|
|
|
|
|
|
|
let dragCircleSize; |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
useEffect(() => { |
|
|
|
|
NaverMapInit();
|
|
|
|
|
}, []); |
|
|
|
|
},[]); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
setIsMapLoad(true); |
|
|
|
@ -39,45 +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; |
|
|
|
|
dragCircleSize = 15; |
|
|
|
|
} |
|
|
|
|
else if(areaCoordList[0].bufferZone>=2000 && areaCoordList[0].bufferZone <5000){ |
|
|
|
|
bufferzoom.bufferzoom =12; |
|
|
|
|
dragCircleSize = 20; |
|
|
|
|
} |
|
|
|
|
else if(areaCoordList[0].bufferZone>=5000 && areaCoordList[0].bufferZone <=9000){ |
|
|
|
|
bufferzoom.bufferzoom =11; |
|
|
|
|
dragCircleSize = 25; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
bufferzoom.bufferzoom =10; |
|
|
|
|
dragCircleSize = 30; |
|
|
|
|
} |
|
|
|
|
}
|
|
|
|
|
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: { |
|
|
|
@ -85,7 +79,7 @@ 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 => { |
|
|
|
@ -147,7 +141,6 @@ const FlightPlanAreaMap = (props) => {
|
|
|
|
|
handleCoordinates={handleCoordinates} |
|
|
|
|
handleInitCoordinates={handleInitCoordinates} |
|
|
|
|
handleConfirm={props.handleConfirm} |
|
|
|
|
dragCircleSize={dragCircleSize} |
|
|
|
|
/> : null} |
|
|
|
|
|
|
|
|
|
{/* <Button.Ripple |
|
|
|
|