modified filtering of 0 Values

This commit is contained in:
unknown 2020-12-17 14:46:35 +01:00
parent a4cd8d88d9
commit 6003b19d2c
2 changed files with 30 additions and 15 deletions

View File

@ -70,16 +70,18 @@ map.on('load', function () {
})
/*function updateMap (TCPlong, TCPlat, SERIALlong, SERIALlat) {
emptyTCP.features[0].geometry.coordinates.push([TCPlong, TCPlat]);
map.getSource('routeTCP').setData(emptyTCP);
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
map.getSource('routeSERIAL').setData(emptySERIAL);
if (!([TCPlong, TCPlat] = [0,0])) {
map.panTo({ 'center': [TCPlong, TCPlat], 'zoom': 17 });
if(!(TCPlong === 0) && !(TCPlat === 0)){
emptyTCP.features[0].geometry.coordinates.push([TCPlong, TCPlat]);
map.getSource('routeTCP').setData(emptyTCP);
}
else if (!([SERIALlong, SERIALlat] = [0,0])) {
map.panTo({ 'center': [SERIALlong, SERIALlat], 'zoom': 17 });
if(!(SERIALlong === 0) && !(SERIALlat === 0)){
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
map.getSource('routeSERIAL').setData(emptySERIAL);
}
// else if (!([TCPlong, TCPlat] = [0,0])) {
// map.panTo([TCPlong, TCPlat]);
// }
map.panTo([TCPlong, TCPlat]);
}*/
function updateMapTCP (TCPlong, TCPlat) {
@ -90,6 +92,6 @@ function updateMapTCP (TCPlong, TCPlat) {
function updateMapSERIAL (SERIALlong, SERIALlat) {
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
map.getSource('routeTCP').setData(emptySERIAL);
map.getSource('routeSERIAL').setData(emptySERIAL);
map.panTo([SERIALlong, SERIALlat]);
}

View File

@ -42,18 +42,27 @@ window.addEventListener("load", function(evt) {
//console.log(dat.SOURCE_TCP.Orientation)
if(!(dat.SOURCE_TCP.Orientation[0] === 0) && !(dat.SOURCE_TCP.Orientation[1] === 0) && !(dat.SOURCE_TCP.Orientation[2] === 0)){
document.getElementById("gyroscopeTCP").style.transform = `rotateX(${dat.SOURCE_TCP.Orientation[0]}deg) rotateY(${dat.SOURCE_TCP.Orientation[1]}deg) rotateZ(${dat.SOURCE_TCP.Orientation[2]}deg)`
addData(dat.SOURCE_TCP.Orientation[0])
}
if(!(dat.SOURCE_SERIAL.Orientation[0] === 0) || !(dat.SOURCE_SERIAL.Orientation[1] === 0) || !(dat.SOURCE_SERIAL.Orientation[2] === 0)){
if(!(dat.SOURCE_SERIAL.Orientation[0] === 0) && !(dat.SOURCE_SERIAL.Orientation[1] === 0) && !(dat.SOURCE_SERIAL.Orientation[2] === 0)){
document.getElementById("gyroscopeSERIAL").style.transform = `rotateX(${dat.SOURCE_SERIAL.Orientation[0]}deg) rotateY(${dat.SOURCE_SERIAL.Orientation[1]}deg) rotateZ(${dat.SOURCE_SERIAL.Orientation[2]}deg)`
}
if((!(dat.SOURCE_TCP.Position[0] === 0) && !(dat.SOURCE_TCP.Position[1] === 0)) || (!(dat.SOURCE_SERIAL.Position[0] === 0) && !(dat.SOURCE_SERIAL.Position[1] === 0))){
if(!(dat.SOURCE_TCP.Position[0] === 0) && !(dat.SOURCE_TCP.Position[1] === 0)){
document.getElementById("TCPlong").innerHTML = "Smartphone long: " + dat.SOURCE_TCP.Position[1]
document.getElementById("TCPlat").innerHTML = "Smartphone lat: " + dat.SOURCE_TCP.Position[0]
}
if(!(dat.SOURCE_SERIAL.Position[0] === 0) && !(dat.SOURCE_SERIAL.Position[1] === 0)){
document.getElementById("SERIALlong").innerHTML = "Ublox long: " + dat.SOURCE_SERIAL.Position[1]
document.getElementById("SERIALlat").innerHTML = "Ublox lat: " + dat.SOURCE_SERIAL.Position[0]
}
if(!(dat.SOURCE_TCP.Position[1] = 0) && !(dat.SOURCE_SERIAL.Position[1] === 0)){
document.getElementById("diffLong").innerHTML = "Differenz long: " + Math.abs(dat.SOURCE_TCP.Position[1] - dat.SOURCE_SERIAL.Position[1])
}
if(!(dat.SOURCE_TCP.Position[0] = 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){
document.getElementById("diffLat").innerHTML = "Differenz lat: " + Math.abs(dat.SOURCE_TCP.Position[0] - dat.SOURCE_SERIAL.Position[0])
}
@ -68,15 +77,19 @@ window.addEventListener("load", function(evt) {
// }
// addData(orientation[0] / multiplier)
*/
addData(dat.SOURCE_TCP.Orientation[0])
//updateMap(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0], dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
var long = dat.SOURCE_TCP.Position[1]
var lat = dat.SOURCE_TCP.Position[0]
console.log(long , lat)
if(!(dat.SOURCE_TCP.Position[1] === 0) && !(dat.SOURCE_TCP.Position[0] === 0)){
updateMapTCP(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0])
updateMapTCP(dat.SOURCE_TCP.Position[1], dat.SOURCE_TCP.Position[0]);
}
if(!(dat.SOURCE_SERIAL.Position[1] === 0) && !(dat.SOURCE_SERIAL.Position[0] === 0)){
updateMapSERIAL(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0])
updateMapSERIAL(dat.SOURCE_SERIAL.Position[1], dat.SOURCE_SERIAL.Position[0]);
}
// addData(dat[0])