Browse Source

.

feature/auth
junh_eee 2 years ago
parent
commit
1f40cf01ad
  1. 1
      src/assets/css/custom.css
  2. 88
      test/pav-warning.js

1
src/assets/css/custom.css

@ -252,6 +252,7 @@ h1.logo span{display:block;color:#f4f4f4;font-weight:bold;letter-spacing:2px;fon
.measure-control{position:absolute; z-index:100;} .measure-control{position:absolute; z-index:100;}
.area-button{position:relative; z-index:100; margin-top:10px; margin-left:10px;} .area-button{position:relative; z-index:100; margin-top:10px; margin-left:10px;}
.area-input{position:relative; z-index:100; margin-top:10px; margin-left:10px;width:200px;}
.control-btn{margin-left: 7px; border-bottom: solid 1px #283046; margin-bottom:5px;} .control-btn{margin-left: 7px; border-bottom: solid 1px #283046; margin-bottom:5px;}
.buffer-input{text-align: center; border-radius: 100px; border: 1px solid #283046; width: 70px; margin-left: 5px;} .buffer-input{text-align: center; border-radius: 100px; border: 1px solid #283046; width: 70px; margin-left: 5px;}

88
test/pav-warning.js

@ -1,21 +1,96 @@
const {getConnection, writeData} = require("./pav-client") const {getConnection, writeData} = require("./pav-client")
const {getCoordsFormBetweenCoord, dumyData} = require("./pav-utils") const {getCoordsFormBetweenCoord, dumyData} = require("./pav-utils")
const host = "192.168.0.28" // const host = "192.168.0.24"
// const host = "localhost" // const host = "localhost"
// const host = "211.43.13.240" const host = "211.43.13.240"
const port = 8082 const port = 8082
// 기본정보 // 기본정보
const prefix = 'TEST-DRON-W' const prefix = 'TEST-DRON-W-'
const pathSampleCoord = [ const pathSampleCoord = [
[37.5215, 126.6050], [37.5215, 126.6050],
[37.5215, 126.6082], [37.5215, 126.6082],
[37.5210, 126.6082],
[37.5210, 126.6057],
[37.5205, 126.6057],
[37.5205, 126.6082],
[37.5200, 126.6082],
[37.5200, 126.6057],
[37.5195, 126.6057],
[37.5195, 126.6082],
[37.5190, 126.6082],
[37.5190, 126.6050]
]
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;
}
// [37.5210, 126.6082], const getClient = () => {
[37.5210, 126.6182], const dronName = prefix + '001';
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 client = getClient();
const iteratorSendData = (cnt = 0) => {
if(cnt >= client.data.length) {
client.socket.destroy()
return;
}
setTimeout(() => sendData(client, cnt), 1000);
}
iteratorSendData()
const {getConnection, writeData} = require("./pav-client")
const {getCoordsFormBetweenCoord, dumyData} = require("./pav-utils")
// const host = "192.168.0.24"
// const host = "localhost"
const host = "211.43.13.240"
const port = 8082
// 기본정보
const prefix = 'TEST-DRON-W-'
const pathSampleCoord = [
[37.5215, 126.6050],
[37.5215, 126.6082],
[37.5210, 126.6082],
[37.5210, 126.6057], [37.5210, 126.6057],
[37.5205, 126.6057], [37.5205, 126.6057],
[37.5205, 126.6082], [37.5205, 126.6082],
@ -41,8 +116,7 @@ const getCoords = (coords) => {
} }
const getClient = () => { const getClient = () => {
// const dronName = prefix + '001'; const dronName = prefix + '001';
const dronName = prefix + '008';
const client = {}; const client = {};
client.dronName = dronName client.dronName = dronName

Loading…
Cancel
Save