From 5415a36754416dbdd14442dfd6f2bc5d56b3c908 Mon Sep 17 00:00:00 2001 From: sanguu Date: Thu, 11 Aug 2022 10:47:33 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=B9=84=ED=96=89=20=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95(waypoint,=EB=93=B1=EB=A1=9D=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=EC=B2=98=EB=A6=AC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flight/plan/FlightPlanAreaDetailForm.js | 1 + .../map/naver/draw/FlightPlanDraw.js | 32 +++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js index f9dbf7c..9697c1b 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js +++ b/src/components/basis/flight/plan/FlightPlanAreaDetailForm.js @@ -177,6 +177,7 @@ const FlightPlanAreaDetailForm = ({ handleSave, handleClose, handleChange, handl className='mr-1' color='primary' onClick={e => handleSave()} + disabled={!coordList[0].lat ? true : false } > 등록 diff --git a/src/components/map/naver/draw/FlightPlanDraw.js b/src/components/map/naver/draw/FlightPlanDraw.js index 9056860..bf45fdd 100644 --- a/src/components/map/naver/draw/FlightPlanDraw.js +++ b/src/components/map/naver/draw/FlightPlanDraw.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; +import { InfoModal } from '../../../../components/modal/InfoModal'; export const FlightPlanDraw = props => { const dispatch = useDispatch(); @@ -20,10 +21,16 @@ export const FlightPlanDraw = props => { const [areaDetail, setAreaDetail] = useState(); + const [alertModal, setAlertModal] = useState({ + isOpen: false, + title: '', + desc: '' + }); + const naver = props.naver; const map = props.map; let mode = props.mode; - + let areaInfo; let lastDistance; @@ -188,11 +195,16 @@ export const FlightPlanDraw = props => { setPolyline(polyline); setAreaInfo(polypaths); } else { - // polyline.setMap(null); + setAlertModal({ + isOpen: true, + title: '우회 여부 확인', + desc: '좌표를 두 개 점으로 이어주세요.' + }) + polyline.setMap(null); polyline = ''; } - - polyline.setMap(null) + + //polyline.setMap(null) setFigure(polyline) } else if (polygon) { @@ -218,6 +230,8 @@ export const FlightPlanDraw = props => { } } + + const onClickPolyline = (e) => { console.log('onClickPolyline') var coord = e.coord; @@ -839,5 +853,11 @@ export const FlightPlanDraw = props => { return text; } - return null; -}; \ No newline at end of file + + + +return( + + ) +}; +export default FlightPlanDraw; \ No newline at end of file From 5c01500b199a5403c2a69fbe67a81a2bea97b107 Mon Sep 17 00:00:00 2001 From: hagjoon Date: Thu, 11 Aug 2022 14:22:20 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EA=B8=B0=EC=B2=B4=EC=A0=95=EB=B3=B4=20-=20?= =?UTF-8?q?=EC=8B=9D=EB=B3=84=EB=B2=88=ED=98=B8=20=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=EC=B2=B4=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/dron/BasisIdntfContainer.js | 73 ++++++++++++++++--- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/src/containers/basis/dron/BasisIdntfContainer.js b/src/containers/basis/dron/BasisIdntfContainer.js index 5e67cc9..3932da7 100644 --- a/src/containers/basis/dron/BasisIdntfContainer.js +++ b/src/containers/basis/dron/BasisIdntfContainer.js @@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { Card, CardBody, Col, Row } from 'reactstrap'; import { BasisIdntfForm } from '../../../components/basis/dron/BasisIdntform'; import * as Actions from '../../../modules/basis/dron/actions/basisDronAction'; - +import { ErrorModal } from '../../../components/modal/ErrorModal'; export const BasisIdntfContainer = props => { const { listIdntf, idntfCount, detail, isRefreshIdntf } = useSelector( state => state.dronState @@ -18,6 +18,12 @@ export const BasisIdntfContainer = props => { hpno:'', isSave: false }); + //모달 관련 설정 + const [modal, setModal] = useState({ + isOpen: false, + title: '', + desc: '' + }); const [idntDataList, setIdntfDataList] = useState([]); @@ -50,16 +56,60 @@ export const BasisIdntfContainer = props => { dispatch(Actions.IDNTF_LIST.request(props.id)); }; - const handlerCreate = async data => { + const handlerCreate = async () => { console.log('idntDataList>>>', idntDataList); - let saveArr = idntDataList.filter(item => item.isSave === false); - dispatch( - Actions.IDNTF_CREATE.request({ - arcrftSno: detail?.arcrftSno, - data: saveArr - }) - ); + + if (saveArr.length > 0) { + let checking = true; + + saveArr.forEach(idntf => { + + if (!idntf.idntfNum && idntf.idntfNum === '') { + setModal({ + isOpen: true, + title: '필수값 입력 오류', + desc: '식별번호를 입력해주세요.' + }); + checking = false; + return false; + } + if(!idntf.ownerNm && idntf.ownerNm === '') { + setModal({ + isOpen: true, + title: '필수값 입력 오류', + desc: '소유자명을 입력해주세요.' + }); + checking = false; + return false; + } + if(!idntf.hpno && idntf.hpno === '') { + setModal({ + isOpen: true, + title: '필수값 입력 오류', + desc: '연락처를 입력해주세요.' + }); + checking = false; + return false; + } + }); + + if (!checking) return false; + + dispatch( + Actions.IDNTF_CREATE.request({ + arcrftSno: detail?.arcrftSno, + data: saveArr + }) + ); + } else { + setModal({ + isOpen: true, + title: '필수값 입력 오류', + desc: '식별장치 정보를 입력해주세요.' + }); + return false; + } }; const handlerDelete = async data => { @@ -104,6 +154,8 @@ export const BasisIdntfContainer = props => { ) : ( + + { handlerSave={handlerCreate} handlerDelete={handlerDelete} /> + + + ); }; From dd318874d91ef3d1ccf8d9cbb0e76b0245a4d418 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: Thu, 11 Aug 2022 14:50:52 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD?= =?UTF-8?q?=EC=84=A4=EC=A0=95=20-=20=EA=B1=B0=EB=A6=AC=EC=9E=AC=EA=B8=B0?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/naver/draw/FlightPlanDraw.js | 95 ++++++++++++++----- 1 file changed, 71 insertions(+), 24 deletions(-) diff --git a/src/components/map/naver/draw/FlightPlanDraw.js b/src/components/map/naver/draw/FlightPlanDraw.js index 5d36d0b..99b7be9 100644 --- a/src/components/map/naver/draw/FlightPlanDraw.js +++ b/src/components/map/naver/draw/FlightPlanDraw.js @@ -2,6 +2,7 @@ import $ from 'jquery'; import { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; +import { InfoModal } from '../../../modal/InfoModal'; export const FlightPlanDraw = props => { const dispatch = useDispatch(); @@ -20,6 +21,12 @@ export const FlightPlanDraw = props => { const [areaDetail, setAreaDetail] = useState(); + const [alertModal, setAlertModal] = useState({ + isOpen: false, + title: '', + desc: '' + }) + const naver = props.naver; const map = props.map; let mode = props.mode; @@ -188,6 +195,11 @@ export const FlightPlanDraw = props => { setPolyline(polyline); setAreaInfo(polypaths); } else { + setAlertModal({ + isOpen: true, + title: '우회 여부 확인', + desc: '좌표를 두 개 점으로 이어주세요.' + }) polyline.setMap(null); polyline = ''; } @@ -204,7 +216,7 @@ export const FlightPlanDraw = props => { lastDistance = guideline.getDistance(); guideline.getPath().push(polygonpaths[0]); var distance = guideline.getDistance(); - addMileStone(polygonpaths[0], fromMetersToText(distance - lastDistance)); + // addMileStone(polygonpaths[0], fromMetersToText(distance - lastDistance)); setMarker(distanceMarker); distanceMarker.forEach(c => c.setMap(null)) @@ -254,7 +266,8 @@ export const FlightPlanDraw = props => { polyline.getPath().push(coord); var distance = polyline.getDistance(); - addMileStone(coord, fromMetersToText(distance - lastDistance)); + // addMileStone(coord, fromMetersToText(distance - lastDistance)); + addMileStone(polyline.getPath()._array, fromMetersToText(distance - lastDistance)); lastDistance = distance; } } @@ -303,8 +316,13 @@ export const FlightPlanDraw = props => { polygon.getPath().push(coord); guideline.getPath().push(coord); + // console.log(polygon.getPath()._array, 'polygon') + // console.log(guideline.getPath()._array.length, 'guide') + // console.log(polygon.getPath()._array.length) + var distance = guideline.getDistance(); - addMileStone(coord, fromMetersToText(distance - lastDistance)); + // addMileStone(coord, fromMetersToText(distance - lastDistance)); + addMileStone(guideline.getPath()._array, fromMetersToText(distance - lastDistance)); lastDistance = distance; } } @@ -638,7 +656,7 @@ export const FlightPlanDraw = props => { position: paths[i], icon: { content: '
'+ 'Start' +'
', - anchor: new naver.maps.Point(-5, -5) + anchor: new naver.maps.Point(45, 35) }, map: map }) ) @@ -648,9 +666,14 @@ export const FlightPlanDraw = props => { let text = fromMetersToText(r); + let dis1 = paths[i-1] + let dis2 = paths[i] + let midPoint = new naver.maps.LatLng((dis1.y + dis2.y)/2, (dis1.x + dis2.x)/2); + distanceMarker.push( new naver.maps.Marker({ - position: paths[i], + // position: paths[i], + position: midPoint, icon: { content: '
'+ text +'
', anchor: new naver.maps.Point(-5, -5) @@ -705,48 +728,58 @@ export const FlightPlanDraw = props => { } for(let i = 0; i < paths.length+1; i++) { + //start if(i == 0) { distanceMarker.push( new naver.maps.Marker({ - position: paths[i], + position: paths[0], icon: { - content: '
'+ 'Start' +'
', - anchor: new naver.maps.Point(-5, -5) + content: '
'+ 'Start' +'
', + anchor: new naver.maps.Point(45, 35) }, map: map }) ) + //첫좌표이자 마지막 좌표 } else if(i == paths.length) { var proj = map.getProjection(), r = proj.getDistance(paths[0], paths[i-1]); let text = fromMetersToText(r); + let dis1 = paths[0] + let dis2 = paths[i-1] + let midPoint = new naver.maps.LatLng((dis1.y + dis2.y)/2, (dis1.x + dis2.x)/2); + distanceMarker.push( new naver.maps.Marker({ - position: paths[0], + // position: paths[0], + position: midPoint, icon: { content: '
'+ text +'
', - anchor: new naver.maps.Point(45, 35) + anchor: new naver.maps.Point(0, 35) }, map: map }) ) - } else if(i == paths.length-1) { - // let tt = new naver.maps.EPSG3857.getDistance(paths[i], paths[]) - + //그 외 나머지 } else { var proj = map.getProjection(), r = proj.getDistance(paths[i-1], paths[i]); let text = fromMetersToText(r); + let dis1 = paths[i-1] + let dis2 = paths[i] + let midPoint = new naver.maps.LatLng((dis1.y + dis2.y)/2, (dis1.x + dis2.x)/2); + distanceMarker.push( new naver.maps.Marker({ - position: paths[i], + // position: paths[i], + position: midPoint, icon: { content: '
'+ text +'
', - anchor: new naver.maps.Point(-5, -5) + anchor: new naver.maps.Point(20, 35) }, map: map }) @@ -801,17 +834,25 @@ export const FlightPlanDraw = props => { //div로 보여주기 const addMileStone = (coord, text) => { let content; + let midPoint; + let anchor; if(text == 'Start') { - content = '
'+ text +'
' + content = '
'+ text +'
' + midPoint = coord + anchor = new naver.maps.Point(45, 35) } else { content = '
'+ text +'
' + let dis1 = coord[coord.length-2]; + let dis2 = coord[coord.length-1]; + midPoint = new naver.maps.LatLng((dis1.y + dis2.y)/2, (dis1.x + dis2.x)/2); + anchor = new naver.maps.Point(20, 35) } var marker = new naver.maps.Marker({ - position: coord, + position: midPoint, icon: { content: content, - anchor: new naver.maps.Point(-5, -5) + anchor: anchor }, // map: map }); @@ -832,14 +873,20 @@ export const FlightPlanDraw = props => { var km = 1000, text = meters; + + text = parseFloat(meters.toFixed(1)) + 'm'; + - if(meters >= km) { - text = parseFloat((meters / km).toFixed(1)) + 'km'; - } else { - text = parseFloat(meters.toFixed(1)) + 'm'; - } + // if(meters >= km) { + // text = parseFloat((meters / km).toFixed(1)) + 'km'; + // } else { + // text = parseFloat(meters.toFixed(1)) + 'm'; + // } return text; } - return null; + // return null; + return( + + ) }; \ No newline at end of file