Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Elevation Column #189

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update script.js
  • Loading branch information
V999TEC committed Jul 11, 2022
commit d30cf14f51bb05d6025be40b6112bb5653bb0b08
27 changes: 26 additions & 1 deletion public_html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

var DefaultSiteElevationAsl =0; ////
var SiteElevationAsl //// will be set from LocalStorage
const SiteAltFeet = 0; ////
var LowestElevationAngle = 90.0; ////
var HighestElevationAngle= 0.0; ////
var SpecialElevations = [ { exceptional: -0.5, markerColor: 'rgb(255, 0, 0)', logColour: "yellow"},
Expand Down Expand Up @@ -1756,6 +1757,8 @@ function refreshTableInfo() {
var elevationAngle = format_elevation(SiteAltFeet, tableplane.sitedist, tableplane.altitude, tableplane.gs);
tableplane.elevation = elevationAngle;



if( elevationAngle > 90 ) {

tableplane.tr.cells[20].textContent = '';
Expand All @@ -1764,7 +1767,6 @@ function refreshTableInfo() {
tableplane.tr.cells[20].textContent = tableplane.elevation+'\u00b0';

// OPTIONAL: log the ident of the lowest and highest elevation angles seen so far

let timestamp = new Date();
let secondsNow= (Date.now() / 1000) >> 0; //// ms to integer seconds

Expand Down Expand Up @@ -1836,6 +1838,7 @@ function refreshTableInfo() {

if( true == log ) {

let timestamp = new Date();
console.log("%c%s",colour,timestamp.toLocaleString()+" ADS-B Message Rate: "+MessageRate.toFixed(1)+"/sec(max="+
MaximumMessageRate.toFixed(1)+") Aircraft: "+TrackedAircraft+"(max="+MaximumTrackedAircraft+
") Positions: " +TrackedAircraftPositions+"(max="+MaximumTrackedAircraftPositions+")");
Expand Down Expand Up @@ -2793,6 +2796,28 @@ function onSetRangeRings() {
createSiteCircleFeatures();
}


//// functions to support configuration of global SiteElevationAsl
function setElevationAsl(val) {
localStorage['SiteElevationAsl'] = val;
setElevation();
}

function setElevation() {

SiteElevationAsl = Number(localStorage['SiteElevationAsl']) || DefaultSiteElevationAsl;
// Populate text field with current value
$('#elevation_asl').val(SiteElevationAsl);
}

function onSetElevationAsl() {
// Save state to localStorage
localStorage.setItem('SiteElevationAsl', parseFloat($("#elevation_asl").val().trim()));
setElevation();
}
////


function toggleColumn(div, checkbox, toggled) {
if (typeof localStorage[checkbox] === 'undefined') {
localStorage.setItem(checkbox, 'deselected');
Expand Down