modified filtering of 0 Values
This commit is contained in:
parent
a4cd8d88d9
commit
6003b19d2c
@ -70,16 +70,18 @@ map.on('load', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
/*function updateMap (TCPlong, TCPlat, SERIALlong, SERIALlat) {
|
/*function updateMap (TCPlong, TCPlat, SERIALlong, SERIALlat) {
|
||||||
emptyTCP.features[0].geometry.coordinates.push([TCPlong, TCPlat]);
|
if(!(TCPlong === 0) && !(TCPlat === 0)){
|
||||||
map.getSource('routeTCP').setData(emptyTCP);
|
emptyTCP.features[0].geometry.coordinates.push([TCPlong, TCPlat]);
|
||||||
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
|
map.getSource('routeTCP').setData(emptyTCP);
|
||||||
map.getSource('routeSERIAL').setData(emptySERIAL);
|
|
||||||
if (!([TCPlong, TCPlat] = [0,0])) {
|
|
||||||
map.panTo({ 'center': [TCPlong, TCPlat], 'zoom': 17 });
|
|
||||||
}
|
}
|
||||||
else if (!([SERIALlong, SERIALlat] = [0,0])) {
|
if(!(SERIALlong === 0) && !(SERIALlat === 0)){
|
||||||
map.panTo({ 'center': [SERIALlong, SERIALlat], 'zoom': 17 });
|
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) {
|
function updateMapTCP (TCPlong, TCPlat) {
|
||||||
@ -90,6 +92,6 @@ function updateMapTCP (TCPlong, TCPlat) {
|
|||||||
|
|
||||||
function updateMapSERIAL (SERIALlong, SERIALlat) {
|
function updateMapSERIAL (SERIALlong, SERIALlat) {
|
||||||
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
|
emptySERIAL.features[0].geometry.coordinates.push([SERIALlong, SERIALlat]);
|
||||||
map.getSource('routeTCP').setData(emptySERIAL);
|
map.getSource('routeSERIAL').setData(emptySERIAL);
|
||||||
map.panTo([SERIALlong, SERIALlat]);
|
map.panTo([SERIALlong, SERIALlat]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,18 +42,27 @@ window.addEventListener("load", function(evt) {
|
|||||||
//console.log(dat.SOURCE_TCP.Orientation)
|
//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)){
|
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)`
|
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)`
|
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("TCPlong").innerHTML = "Smartphone long: " + dat.SOURCE_TCP.Position[1]
|
||||||
document.getElementById("TCPlat").innerHTML = "Smartphone lat: " + dat.SOURCE_TCP.Position[0]
|
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("SERIALlong").innerHTML = "Ublox long: " + dat.SOURCE_SERIAL.Position[1]
|
||||||
document.getElementById("SERIALlat").innerHTML = "Ublox lat: " + dat.SOURCE_SERIAL.Position[0]
|
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])
|
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])
|
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(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])
|
//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)){
|
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)){
|
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])
|
// addData(dat[0])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user