From dfd96b1e360c0924c0dd9a252723e2c34d85a057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?scnoh=28=EB=85=B8=EC=8A=B9=EC=B2=A0=29?= Date: Wed, 10 Aug 2022 16:17:25 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[=EB=B9=84=ED=96=89=EA=B4=80=EC=A0=9C]=20?= =?UTF-8?q?=EB=93=9C=EB=A1=A0=20history=20=EA=B0=B1=EC=8B=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/naver/NaverMap.js | 2 +- src/components/map/naver/dron/DronMarker.js | 64 ++++++++++++++----- src/modules/control/gp/sagas/controlGpSaga.ts | 25 ++++---- .../control/map/reducers/controlMapReducer.ts | 2 +- 4 files changed, 63 insertions(+), 30 deletions(-) diff --git a/src/components/map/naver/NaverMap.js b/src/components/map/naver/NaverMap.js index cd171f4..716b57d 100644 --- a/src/components/map/naver/NaverMap.js +++ b/src/components/map/naver/NaverMap.js @@ -41,7 +41,7 @@ export const NaverCustomMap = () => { center: new naver.maps.LatLng(36.56793936069445, 127.85101412107547), zoom: 10, zoomControl: true, - mapTypeId: naver.maps.MapTypeId.HYBRID, + mapTypeId: naver.maps.MapTypeId.NORMAL, zoomControlOptions: { position: naver.maps.Position.TOP_LEFT, diff --git a/src/components/map/naver/dron/DronMarker.js b/src/components/map/naver/dron/DronMarker.js index 3ab76be..9cc3885 100644 --- a/src/components/map/naver/dron/DronMarker.js +++ b/src/components/map/naver/dron/DronMarker.js @@ -45,7 +45,7 @@ export const DronMarker = props => { hideProgressBar: true, position: toast.POSITION.BOTTOM_RIGHT, onClick: props => { - if(marker) handlerDronClick(marker); + if(marker) handlerDronClick(marker); } } ) @@ -91,13 +91,8 @@ export const DronMarker = props => { title: id, id: id, controlId: controlId, - icon: { - // content: [ - // '
dddd
', - - // ].join(''), - url: DronIcon, - // size: new naver.maps.Size(50, 50), + icon: { + url: DronIcon, origin: new naver.maps.Point(0, 0), anchor: new naver.maps.Point(15, 15), } @@ -109,17 +104,16 @@ export const DronMarker = props => { handlerDronClick(marker); }); + // drone 정보 창 + // markerInfoWindow(marker); + setArrMarkers(m => [...m, marker]); }; const handlerDronClick = marker => { const idntfNum = marker.id; - const contorlId = marker.controlId; - - // 클릭한 식별번호 정보를 가진 그룹 추출 - // const group = controlGroupAuthInfo.find(group => group.idntfNum === idntfNum); - - //히스토리 불러오기 + const contorlId = marker.controlId; + dispatch(objectClickAction(contorlId)); dispatch(controlGpDtlAction.request(contorlId)); dispatch(controlGpFlightPlanAction.request(idntfNum)); @@ -169,10 +163,10 @@ export const DronMarker = props => { if (isExists) { moveMarkers(isExists, position); } else { - addMarkers(position, item.objectId, item.controlId); + addMarkers(position, item.objectId, item.controlId); } } else { - addMarkers(position, item.objectId, item.controlId); + addMarkers(position, item.objectId, item.controlId); } }); } @@ -182,5 +176,43 @@ export const DronMarker = props => { setArrMarkers(arrData); }; + const markerInfoWindow = (marker) => { + controlGpList.forEach(gps => { + + const contents = [ + `
`, + `
`, + ` ${marker.id}`, + `
`, + `
`, + `
`, + ` ${gps.speed}${gps.speedType}`, + `
`, + `
`, + ` ${gps.elev}${gps.elevType}`, + `
`, + `
`, + ` ${gps.heading}`, + `
`, + `
`, + `
` + ].join(''); + + const info = new naver.maps.InfoWindow({ + id: marker.id, + content: contents, + backgroundColor: '#283046', //박스안쪽영역 컬러 + anchorSize: new props.naver.maps.Size(30, -10), + anchorSkew: false, + anchorColor: '#283046', + pixelOffset: new props.naver.maps.Point(20, -20) + }); + + console.log(info); + + info.open(props.map, marker); + }); + } + return null; }; diff --git a/src/modules/control/gp/sagas/controlGpSaga.ts b/src/modules/control/gp/sagas/controlGpSaga.ts index 560cd0c..eb33d06 100644 --- a/src/modules/control/gp/sagas/controlGpSaga.ts +++ b/src/modules/control/gp/sagas/controlGpSaga.ts @@ -35,12 +35,10 @@ function* getControlGpSaga( } }); } - - console.log('gps ', gpsData); yield put( Actions.controlGpAction.success({ - controlGpList: gpsData + controlGpList: data }) ); @@ -57,17 +55,20 @@ function* getControlGpSaga( yield put(Actions.controlGpRtDtlAction.request(detailData)); - // History Push + // History Push if(controlGpHistory) { - const stateHistory = controlGpHistory; - const history = stateHistory.map((h) => { - return { - ...h, - detailData - } - }); + const stateHistory = controlGpHistory.concat(); - yield put(Actions.controlGpHisAction.success(history)); + const hisObj = { + lat: detailData.lat, + lng: detailData.lng, + objectId: detailData.objectId + } + stateHistory.push(hisObj); + + yield put(Actions.controlGpHisAction.success({ + controlGpHistory: stateHistory + })); } } } catch (error) { diff --git a/src/modules/control/map/reducers/controlMapReducer.ts b/src/modules/control/map/reducers/controlMapReducer.ts index 0eb82f5..116007a 100644 --- a/src/modules/control/map/reducers/controlMapReducer.ts +++ b/src/modules/control/map/reducers/controlMapReducer.ts @@ -1,6 +1,6 @@ // ** Initial State const initialState = { - mapType: 'HYBRID', + mapType: 'NORMAL', objectId: null, isClickObject: false, area0001: true, // 비행금지 구역 From 218decdb3f8a3c93f78b4ce0b961f026af52b512 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 10:07:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?polyline=20=EC=97=90=EB=9F=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/naver/draw/FlightPlanDraw.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/map/naver/draw/FlightPlanDraw.js b/src/components/map/naver/draw/FlightPlanDraw.js index 9056860..5d36d0b 100644 --- a/src/components/map/naver/draw/FlightPlanDraw.js +++ b/src/components/map/naver/draw/FlightPlanDraw.js @@ -188,11 +188,10 @@ export const FlightPlanDraw = props => { setPolyline(polyline); setAreaInfo(polypaths); } else { - // polyline.setMap(null); + polyline.setMap(null); polyline = ''; } - polyline.setMap(null) setFigure(polyline) } else if (polygon) { @@ -733,6 +732,9 @@ export const FlightPlanDraw = props => { 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]);