Commit 59be8292 authored by Stephen D's avatar Stephen D
Browse files

Ability to select/deselect specific satellites

parent 1ad33c2d
html, body {
height: 100%;
width: 100%;
}
#container {
display: flex;
height: 100%;
overflow-y: hidden;
}
#controls {
......@@ -10,18 +16,37 @@
}
#map {
width: calc(100% - 450px);
width: -moz-calc(100% - 450px);
width: calc(100% - 450px);
width: 100%;
min-width: 250px;
height: 100%;
background-color: grey;
flex-grow: 1;
}
#rightNav {
width: calc(100% - 450px);
width: -moz-calc(100% - 450px);
width: calc(100% - 450px);
}
#footer {
}
#tabs {
}
#config {
white-space: normal;
word-break:break-all;
width: 100%;
height: 100%;
overflow-y: auto;
}
#satlist {
column-width: 210px;
}
input[type=number] {
width: 40px;
}
......
......@@ -31,10 +31,10 @@
<td><button type="button" class="btn btn-danger" ng-click="removePoint($index)">Remove</button></td>
</tr>
</table>
<div style="margin: 6px">
Click on the map to add a point<br>
Time zone: {{getTimezone()}}
</div><BR><BR>
<div style="margin: 6px">
Click on the map to add a point<br>
Time zone: {{getTimezone()}}
</div><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>
......@@ -70,12 +70,27 @@
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Bitcoin: 198i9KpiBNtBmNabqWvLYbWk5Waf4VmyRc
</center>
</div>
</div>
<div id="map">
<ng-map center="39.82, -77.01" zoom="4" style="height:100%"></ng-map>
<div id="rightNav">
<div id="tabs">
<ul class="nav nav-tabs">
<li class="{{(selectedTab == 'map') ? 'active':''}}"><a href ng-click="selectedTab = 'map'">Map</a></li>
<li class="{{(selectedTab == 'config') ? 'active':''}}"><a href ng-click="selectedTab = 'config'">Configure satellites</a></li>
</ul>
</div>
<div id="map" ng-show="selectedTab == 'map'">
<ng-map center="39.82, -77.01" zoom="4" style="height:100%"></ng-map>
</div>
<div id="config" ng-show="selectedTab == 'config'">
<center>
Select all/none <input type="checkbox" ng-model="selectAllSats" ng-change="toggleEnabled(selectAllSats)"><br><br>
</center>
<div id="satlist">
<div ng-repeat="sat in satellites" style="white-space: nowrap;"><input type="checkbox" ng-model="sat.enabled">&emsp;{{sat.name}}</div>
</div>
</div>
</div>
</div>
</body>
......
......@@ -44,7 +44,7 @@ function calcSatellites(ground_coords, satellites) {
var currentTimestamp = new Date();
for(var i = 0; i < satellites.length; i++) { //Satellites
if(satellites[i].satrec.error === 0) {
if(satellites[i].enabled && satellites[i].satrec.error === 0) {
var passes = [];
var time_start = 0;
......
......@@ -4,10 +4,12 @@ app.controller('satTrack-ctrl', function($scope, NgMap) {
$scope.places = [];
$scope.passes = [];
$scope.isGettingPasses = false;
$scope.selectedTab = 'map';
$scope.satellites = [];
$scope.selectAllSats = true;
var satellites = [];
loadSatelliteData(function(satList) {
satellites = satList;
$scope.satellites = satList;
});
var elevator;
......@@ -74,7 +76,7 @@ app.controller('satTrack-ctrl', function($scope, NgMap) {
$scope.isGettingPasses = false;
$scope.$apply();
}, false);
worker.postMessage({coords: coords, satellites: satellites});
worker.postMessage({coords: coords, satellites: $scope.satellites});
}
}
......@@ -98,6 +100,12 @@ app.controller('satTrack-ctrl', function($scope, NgMap) {
halfHourStr = halfHour > 9 ? "" + halfHour : "0" + halfHour;
return "GMT" + (offset > 0 ? "-" : "+") + Math.floor(offset / 60) + halfHourStr;
}
$scope.toggleEnabled = function(val) {
for(var i = 0; i < $scope.satellites.length; i++) {
$scope.satellites[i].enabled = val;
}
}
});
function loadSatelliteData(callback) {
......@@ -116,7 +124,7 @@ function loadSatelliteData(callback) {
var sat = satellite.twoline2satrec(splitLines[i + 1], splitLines[i + 2]);
var name = idsAndNames[sat.satnum];
if(!name) name = splitLines[i].slice(2); //If not found in name database, use unfriendly name
satellites.push({name: name, satrec: sat});
satellites.push({name: name, satrec: sat, enabled: true});
}
}
callback(satellites);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment