From 54d75ab9b5925bdb0ddad75e8776cbee852066cd 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: Mon, 7 Nov 2022 15:38:05 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B4=80=EC=A0=9C=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=ED=8C=8C=EC=9D=BC=20-=20=ED=84=B0=EB=AF=B8=EB=84=90ID?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/naver/feature/FeatureAirZone.js | 22 ++-- test/pav-warning.js | 105 +++++++++--------- 2 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/components/map/naver/feature/FeatureAirZone.js b/src/components/map/naver/feature/FeatureAirZone.js index be571e5..6f10663 100644 --- a/src/components/map/naver/feature/FeatureAirZone.js +++ b/src/components/map/naver/feature/FeatureAirZone.js @@ -149,28 +149,28 @@ export const FeatureAirZone = props => { buffer ); - let tt = 0; + let reduce = 0; if (j === 0) { - tt = 218.6; + reduce = 218.6; } else if (j === 1) { - tt = 905.4; + reduce = 905.4; } else if (j === 2) { - tt = 2195; + reduce = 2195; } else if (j === 3) { - tt = 4560.2; + reduce = 4560.2; } if (angle % 180 == 0) { - const polyES = new naver.maps.Polyline({ + const polyEW = new naver.maps.Polyline({ path: [ new naver.maps.EPSG3857.getDestinationCoord( coord, 90, - SENSOR_RADIUS - tt + SENSOR_RADIUS - reduce ), new naver.maps.EPSG3857.getDestinationCoord( coord, 270, - SENSOR_RADIUS - tt + SENSOR_RADIUS - reduce ) ], strokeWeight: 0.8, @@ -184,12 +184,12 @@ export const FeatureAirZone = props => { new naver.maps.EPSG3857.getDestinationCoord( coord, 0, - SENSOR_RADIUS - tt + SENSOR_RADIUS - reduce ), new naver.maps.EPSG3857.getDestinationCoord( coord, 180, - SENSOR_RADIUS - tt + SENSOR_RADIUS - reduce ) ], strokeWeight: 0.8, @@ -214,7 +214,7 @@ export const FeatureAirZone = props => { strokeColor: color, map: props.map }); - const ES = new naver.maps.Polyline({ + const EW = new naver.maps.Polyline({ path: [ new naver.maps.EPSG3857.getDestinationCoord( position, diff --git a/test/pav-warning.js b/test/pav-warning.js index c3fb80d..2d8b8dc 100644 --- a/test/pav-warning.js +++ b/test/pav-warning.js @@ -2,82 +2,83 @@ const { getConnection, writeData } = require('./pav-client'); const { getCoordsFormBetweenCoord, dumyData } = require('./pav-utils'); // const host = "192.168.0.24" -const host = "localhost" +const host = 'localhost'; // const host = '192.168.0.34'; const port = 8082; // 기본정보 -const prefix = 'PASANGUU'; +const prefix = 'PA'; +const terminalId = 'SANDBOX-001'; const pathSampleCoord = [ - [37.5215, 126.605], - [37.5215, 126.61], - // [37.5215, 126.6082], - [37.521, 126.6082], - [37.521, 126.6057], - [37.5205, 126.6057], - [37.5205, 126.6082], - [37.52, 126.6082], - [37.52, 126.6057], - [37.5195, 126.6057], - [37.5195, 126.6082], - [37.519, 126.6082], - [37.519, 126.605] + [37.5215, 126.605], + [37.5215, 126.61], //비정상, 날릴 것 + // [37.5215, 126.6082], 계획서 + [37.521, 126.6082], + [37.521, 126.6057], + [37.5205, 126.6057], + [37.5205, 126.6082], + [37.52, 126.6082], + [37.52, 126.6057], + [37.5195, 126.6057], + [37.5195, 126.6082], + [37.519, 126.6082], + [37.519, 126.605] ]; const divDist = 10; // [m] // 특정거리에 따른 좌표 추출 const getCoords = coords => { - if (!coords || coords.length < 1) return; - const totalCoords = []; - for (let i = 1; i < coords.length; i++) { - const divCoords = getCoordsFormBetweenCoord( - coords[i - 1], - coords[i], - divDist - ); - totalCoords.push(...divCoords); - } - return totalCoords; + if (!coords || coords.length < 1) return; + const totalCoords = []; + for (let i = 1; i < coords.length; i++) { + const divCoords = getCoordsFormBetweenCoord( + coords[i - 1], + coords[i], + divDist + ); + totalCoords.push(...divCoords); + } + return totalCoords; }; const getClient = () => { - const dronName = prefix; - // const dronName = prefix + '0000001A'; + const dronName = prefix + 'trmnlId'; - const client = {}; - client.dronName = dronName; - client.socket = getConnection(dronName, host, port); - client.data = getCoords(pathSampleCoord); - return client; + const client = {}; + client.dronName = dronName; + client.socket = getConnection(dronName, host, port); + client.data = getCoords(pathSampleCoord); + return client; }; const sendData = (client, cnt) => { - const data = { - ...dumyData, - terminalId: client.dronName, - body: [ - { - ...dumyData.body[0], - objectId: client.dronName, - lat: client.data[cnt][0], - lon: client.data[cnt][1] - } - ] - }; - writeData(client.socket, JSON.stringify(data)); - iteratorSendData(++cnt); + const data = { + ...dumyData, + terminalId: terminalId, + command: 'SANDBOX', + body: [ + { + ...dumyData.body[0], + objectId: client.dronName, + lat: client.data[cnt][0], + lon: client.data[cnt][1] + } + ] + }; + writeData(client.socket, JSON.stringify(data)); + iteratorSendData(++cnt); }; const client = getClient(); const iteratorSendData = (cnt = 0) => { - if (cnt >= client.data.length) { - client.socket.destroy(); - return; - } - setTimeout(() => sendData(client, cnt), 1000); + if (cnt >= client.data.length) { + client.socket.destroy(); + return; + } + setTimeout(() => sendData(client, cnt), 1000); }; iteratorSendData();