[hamradio-commits] [dump1090] 311/389: Add Distance to Table Info
Matthew Ernisse
mernisse-guest at moszumanska.debian.org
Wed Nov 5 00:20:09 UTC 2014
This is an automated email from the git hooks/post-receive script.
mernisse-guest pushed a commit to branch master
in repository dump1090.
commit a13c2f854071a363f27ffc393b9b5b91383b9e43
Author: ddeitterick <doug at deitterick.com>
Date: Wed Jul 16 21:42:02 2014 -0400
Add Distance to Table Info
Add distance to table if site coordinates are provided and sort the
table by distance. If coordinates aren't provided, the column isn't
displayed.
---
public_html/script.js | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/public_html/script.js b/public_html/script.js
index 05d29b7..062bba0 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -399,11 +399,16 @@ function refreshTableInfo() {
'align="right">Altitude</td>';
html += '<td onclick="setASC_DESC(\'4\');sortTable(\'tableinfo\',\'4\');" ' +
'align="right">Speed</td>';
- html += '<td onclick="setASC_DESC(\'5\');sortTable(\'tableinfo\',\'5\');" ' +
+ // Add distance column header to table if site coordinates are provided
+ if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
+ html += '<td onclick="setASC_DESC(\'5\');sortTable(\'tableinfo\',\'5\');" ' +
+ 'align="right">Distance</td>';
+ }
+ html += '<td onclick="setASC_DESC(\'5\');sortTable(\'tableinfo\',\'6\');" ' +
'align="right">Track</td>';
- html += '<td onclick="setASC_DESC(\'6\');sortTable(\'tableinfo\',\'6\');" ' +
+ html += '<td onclick="setASC_DESC(\'6\');sortTable(\'tableinfo\',\'7\');" ' +
'align="right">Msgs</td>';
- html += '<td onclick="setASC_DESC(\'7\');sortTable(\'tableinfo\',\'7\');" ' +
+ html += '<td onclick="setASC_DESC(\'7\');sortTable(\'tableinfo\',\'8\');" ' +
'align="right">Seen</td></thead><tbody>';
for (var tablep in Planes) {
var tableplane = Planes[tablep]
@@ -447,6 +452,25 @@ function refreshTableInfo() {
html += '<td align="right">' + tableplane.altitude + '</td>';
html += '<td align="right">' + tableplane.speed + '</td>';
}
+ // Add distance column to table if site coordinates are provided
+ if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
+ html += '<td align="right">';
+ if (tableplane.vPosition) {
+ var siteLatLon = new google.maps.LatLng(SiteLat, SiteLon);
+ var planeLatLon = new google.maps.LatLng(tableplane.latitude, tableplane.longitude);
+ var dist = google.maps.geometry.spherical.computeDistanceBetween (siteLatLon, planeLatLon);
+ if (Metric) {
+ dist /= 1000;
+ } else {
+ dist /= 1852;
+ }
+ dist = (Math.round((dist)*10)/10).toFixed(1);
+ html += dist;
+ } else {
+ html += '0';
+ }
+ html += '</td>';
+ }
html += '<td align="right">';
if (tableplane.vTrack) {
@@ -499,6 +523,8 @@ function sortTable(szTableID,iCol) {
if (typeof iCol==='undefined'){
if(iSortCol!=-1){
var iCol=iSortCol;
+ } else if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
+ var iCol=5;
} else {
var iCol=iDefaultSortCol;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/dump1090.git
More information about the pkg-hamradio-commits
mailing list