|
|
@ -5,7 +5,7 @@ self.addEventListener('message', function(e) { |
|
|
|
//as it is arranged into groups by satallite. Below fixes that
|
|
|
|
|
|
|
|
//Make new array equal to all the old array.passes
|
|
|
|
var passes = calcSatellites(e.data.coords, e.data.satellites).map(function(a) { |
|
|
|
var passes = calcSatellites(e.data.coords, e.data.satellites, e.data.fromDate, e.data.toDuration).map(function(a) { |
|
|
|
//Add satellite names to each pass
|
|
|
|
a.passes.map(function(b) { |
|
|
|
b.name = a.name; |
|
|
@ -28,7 +28,7 @@ function flatten(arr) { |
|
|
|
}, []); |
|
|
|
} |
|
|
|
|
|
|
|
function calcSatellites(ground_coords, satellites) { |
|
|
|
function calcSatellites(ground_coords, satellites, from, duration) { |
|
|
|
|
|
|
|
//Convert coords to radians
|
|
|
|
var ground_coords_rad = []; |
|
|
@ -41,7 +41,6 @@ function calcSatellites(ground_coords, satellites) { |
|
|
|
} |
|
|
|
|
|
|
|
var viableSats = []; |
|
|
|
var currentTimestamp = new Date(); |
|
|
|
|
|
|
|
for(var i = 0; i < satellites.length; i++) { //Satellites
|
|
|
|
if(satellites[i].enabled && satellites[i].satrec.error === 0) { |
|
|
@ -50,8 +49,8 @@ function calcSatellites(ground_coords, satellites) { |
|
|
|
var time_start = 0; |
|
|
|
var pointStats = []; |
|
|
|
|
|
|
|
for(var secondsFromNow = 0; secondsFromNow < 604800; secondsFromNow += 30) { //Up to a week in the future, in 30 second increments
|
|
|
|
var timeToProgressTo = new Date(currentTimestamp.getTime() + (secondsFromNow * 1000)); |
|
|
|
for(var secondsFrom = 0; secondsFrom < duration; secondsFrom += 30) { //Time incremental
|
|
|
|
var timeToProgressTo = new Date(from.getTime() + (secondsFrom * 1000)); |
|
|
|
//console.log(satellites[i].satrec.error);
|
|
|
|
var viableTime = true; |
|
|
|
|
|
|
|