diff --git a/public_html/config.js b/public_html/config.js index 0bb539a..e027134 100644 --- a/public_html/config.js +++ b/public_html/config.js @@ -7,7 +7,7 @@ // -- Output Settings ------------------------------------- // Show metric values -Metric = false; // true|false +Metric = false; // true or false // -- Map settings ---------------------------------------- // The Latitude and Longitude in decimal format @@ -27,3 +27,6 @@ SiteShow = false; // true or false SiteLat = 45.0; SiteLon = 9.0; +SiteCircles = true; // true or false (Only shown if SiteShow is true) +SiteCirclesDistances = new Array(100,150,200); // In nautical miles or km (depending settings value 'Metric') + diff --git a/public_html/script.js b/public_html/script.js index c3acfb4..07cda07 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -146,9 +146,10 @@ function initialize() { GoogleMap.mapTypes.set("dark_map", styledMap); // Add home marker if requested - if (SiteShow) { - var siteMarker = new google.maps.LatLng(SiteLat, SiteLon); - var markerImage = new google.maps.MarkerImage('http://maps.google.com/mapfiles/kml/pal4/icon57.png', + if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) { + var siteMarker = new google.maps.LatLng(SiteLat, SiteLon); + var markerImage = new google.maps.MarkerImage( + 'http://maps.google.com/mapfiles/kml/pal4/icon57.png', new google.maps.Size(32, 32), // Image size new google.maps.Point(0, 0), // Origin point of image new google.maps.Point(16, 16)); // Position where marker should point @@ -157,7 +158,13 @@ function initialize() { map: GoogleMap, icon: markerImage, title: 'My Radar Site' - }); + }); + + if (SiteCircles) { + for (var i=0;iN/A (' + selected.icao + ')'; + html += 'N/A (' + + selected.icao + ')'; } else if (selected && selected.flight != "") { - html += '' + selected.flight + ''; + html += '' + + selected.flight + ''; } else { html += 'DUMP1090'; } @@ -355,12 +364,18 @@ function refreshTableInfo() { html += ''; html += 'ICAO'; html += 'Flight'; - html += 'Squawk'; - html += 'Altitude'; - html += 'Speed'; - html += 'Track'; - html += 'Msgs'; - html += 'Seen'; + html += 'Squawk'; + html += 'Altitude'; + html += 'Speed'; + html += 'Track'; + html += 'Msgs'; + html += 'Seen'; for (var tablep in Planes) { var tableplane = Planes[tablep] if (!tableplane.reapable) { @@ -526,3 +541,29 @@ function selectPlaneByHex(hex) { refreshSelected(); refreshTableInfo(); } + +function drawCircle(marker, distance) { + if (typeof distance === 'undefined') { + return false; + + if (!(!isNaN(parseFloat(distance)) && isFinite(distance)) || distance < 0) { + return false; + } + } + + distance *= 1000.0; + if (!Metric) { + distance *= 1.852; + } + + // Add circle overlay and bind to marker + var circle = new google.maps.Circle({ + map: GoogleMap, + radius: distance, // In meters + fillOpacity: 0.0, + strokeWeight: 1, + strokeOpacity: 0.3 + }); + circle.bindTo('center', marker, 'position'); +} +