Try and get lines working. Also make sats disapper once done
parent
2578c9acd7
commit
95b52f7ce2
|
@ -104,12 +104,12 @@ function UpdateMap(e) {
|
||||||
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
|
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
|
||||||
Sats[norad].update()
|
Sats[norad].update()
|
||||||
Object.keys(Lines[norad]).forEach(function(x){
|
Object.keys(Lines[norad]).forEach(function(x){
|
||||||
if (x in .data[3]){
|
if (e.data[3].includes(x)){
|
||||||
Lines[norad][x]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]}
|
Lines[norad][x]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]}
|
||||||
Lines[norad][x].update()
|
Lines[norad][x].update()
|
||||||
}else{
|
}else{
|
||||||
Lines[norad][x].removeFrom(mymap)
|
|
||||||
delete Lines[norad][x]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -134,19 +134,39 @@ function UpdateMap(e) {
|
||||||
worker = new Worker('/static/Worker.js');
|
worker = new Worker('/static/Worker.js');
|
||||||
worker.onmessage = UpdateMap
|
worker.onmessage = UpdateMap
|
||||||
worker.postMessage([x,data[x]]);
|
worker.postMessage([x,data[x]]);
|
||||||
|
Workers[x] =worker
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
|
|
||||||
//marker.bindPopup("<b>Name: "+data[key]["name"]+"</b><br><b>Norad: "+key+"</b><br><b>Eclipsed?: "+data[key]["eclipsed"]);
|
|
||||||
//sats[key] = marker;
|
|
||||||
|
|
||||||
|
|
||||||
//lines
|
setInterval(function(){
|
||||||
// firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: '#'+entry[1].toString(16).repeat(2).substr(0,6),weight: 3,opacity: 1,smoothFactor: 1});
|
$.get("/occuring_sats", function(data, status){
|
||||||
|
data = JSON.parse(data)
|
||||||
|
Object.keys(data).forEach(function(x){
|
||||||
|
if (x in Workers){
|
||||||
|
}else{
|
||||||
|
worker = new Worker('/static/Worker.js');
|
||||||
|
worker.onmessage = UpdateMap
|
||||||
|
worker.postMessage([x,data[x]]);
|
||||||
|
Workers[x] =worker
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.keys(Workers).forEach(function(x){
|
||||||
|
if (Object.keys(data).includes(x)){
|
||||||
|
}else{
|
||||||
|
Workers[x].terminate()
|
||||||
|
delete Workers[x]
|
||||||
|
UpdateMap({"data":[x,"",[0,0],[]]})
|
||||||
|
Sats[x].removeFrom(mymap)
|
||||||
|
delete Sats[x]
|
||||||
|
delete Lines[x]
|
||||||
|
|
||||||
// firstpolyline.addTo(mymap)
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue