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.
This commit is contained in:
parent
c0d6ea073f
commit
a13c2f8540
|
@ -399,11 +399,16 @@ function refreshTableInfo() {
|
||||||
'align="right">Altitude</td>';
|
'align="right">Altitude</td>';
|
||||||
html += '<td onclick="setASC_DESC(\'4\');sortTable(\'tableinfo\',\'4\');" ' +
|
html += '<td onclick="setASC_DESC(\'4\');sortTable(\'tableinfo\',\'4\');" ' +
|
||||||
'align="right">Speed</td>';
|
'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>';
|
'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>';
|
'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>';
|
'align="right">Seen</td></thead><tbody>';
|
||||||
for (var tablep in Planes) {
|
for (var tablep in Planes) {
|
||||||
var tableplane = Planes[tablep]
|
var tableplane = Planes[tablep]
|
||||||
|
@ -447,6 +452,25 @@ function refreshTableInfo() {
|
||||||
html += '<td align="right">' + tableplane.altitude + '</td>';
|
html += '<td align="right">' + tableplane.altitude + '</td>';
|
||||||
html += '<td align="right">' + tableplane.speed + '</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">';
|
html += '<td align="right">';
|
||||||
if (tableplane.vTrack) {
|
if (tableplane.vTrack) {
|
||||||
|
@ -499,6 +523,8 @@ function sortTable(szTableID,iCol) {
|
||||||
if (typeof iCol==='undefined'){
|
if (typeof iCol==='undefined'){
|
||||||
if(iSortCol!=-1){
|
if(iSortCol!=-1){
|
||||||
var iCol=iSortCol;
|
var iCol=iSortCol;
|
||||||
|
} else if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
|
||||||
|
var iCol=5;
|
||||||
} else {
|
} else {
|
||||||
var iCol=iDefaultSortCol;
|
var iCol=iDefaultSortCol;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue