Browse Source

Added date range selection

master
Stephen Downward 3 years ago
parent
commit
be773547bf
11 changed files with 38 additions and 6 deletions
  1. +7
    -0
      css/jquery-ui.min.css
  2. BIN
      img/ui-icons_444444_256x240.png
  3. BIN
      img/ui-icons_555555_256x240.png
  4. BIN
      img/ui-icons_777620_256x240.png
  5. BIN
      img/ui-icons_777777_256x240.png
  6. BIN
      img/ui-icons_cc0000_256x240.png
  7. BIN
      img/ui-icons_ffffff_256x240.png
  8. +4
    -0
      index.html
  9. +4
    -5
      js/calc.js
  10. +7
    -0
      js/jquery-ui.min.js
  11. +16
    -1
      js/main.js

+ 7
- 0
css/jquery-ui.min.css
File diff suppressed because it is too large
View File


BIN
img/ui-icons_444444_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 6.8 KiB

BIN
img/ui-icons_555555_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 6.9 KiB

BIN
img/ui-icons_777620_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 4.6 KiB

BIN
img/ui-icons_777777_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 6.8 KiB

BIN
img/ui-icons_cc0000_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 4.5 KiB

BIN
img/ui-icons_ffffff_256x240.png View File

Before After
Width: 256  |  Height: 240  |  Size: 6.2 KiB

+ 4
- 0
index.html View File

@@ -3,7 +3,9 @@
<title>Multipoint Satellite Tracker</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.min.css">
<script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB3FKjZo6Fe6Lg--EU1Ci7V4rHIiU9Igb4"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script>
<script src="js/ng-map.min.js"></script>
@@ -35,6 +37,8 @@
Click on the map to add a point<br>
Time zone: {{getTimezone()}}
</div><BR><BR>
From <input type="text" id="fromDate" style="width: 90px;">
to <input type="text" id="toDate" style="width: 90px;"><br><br>
<button type="button" class="btn btn-success" ng-disabled="places.length == 0" ng-click="getPasses()">Calculate Passes</button>
<span class='glyphicon-left glyphicon glyphicon-refresh spinning' ng-show='isGettingPasses'></span>
</center><BR>


+ 4
- 5
js/calc.js View File

@@ -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;



+ 7
- 0
js/jquery-ui.min.js
File diff suppressed because it is too large
View File


+ 16
- 1
js/main.js View File

@@ -1,3 +1,11 @@
$(function () {
var now = new Date();
var then = new Date();
then.setDate(now.getDate() + 7);
$("#fromDate").datepicker().datepicker("setDate", now);
$("#toDate").datepicker().datepicker("setDate", then);
});

var app = angular.module('satTrackApp', ['ngMap']);

app.controller('satTrack-ctrl', function($scope, NgMap) {
@@ -76,7 +84,10 @@ app.controller('satTrack-ctrl', function($scope, NgMap) {
$scope.isGettingPasses = false;
$scope.$apply();
}, false);
worker.postMessage({coords: coords, satellites: $scope.satellites});
var fromDate = $("#fromDate").datepicker('getDate');
var toDate = $("#toDate").datepicker('getDate');
var duration = Math.abs(moment(toDate).diff(fromDate) / 1000) + 86400;
worker.postMessage({coords: coords, satellites: $scope.satellites, fromDate: minDate(fromDate, toDate), toDuration: duration});
}
}

@@ -131,3 +142,7 @@ function loadSatelliteData(callback) {
});
});
}

function minDate(date1, date2) {
return date1 < date2 ? date1 : date2;
}

Loading…
Cancel
Save