Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 0 additions & 7 deletions index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,6 @@ <h4>Visibility</h4>
<input type="checkbox" id="opt_hide_chase">
</div>
</div>
<div class="row option">
<span><b>Show Horizon Rings</b></span>
<div class="switch off" id="sw_hide_horizon">
<span class="thumb"></span>
<input type="checkbox" id="opt_hide_horizon">
</div>
</div>
<div class="row option">
<span><b>Hide Titles</b></span>
<div class="switch off" id="sw_hide_titles">
Expand Down
11 changes: 1 addition & 10 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,6 @@ $(window).ready(function() {
"#sw_hide_chase",
"#sw_hide_timebox",
"#sw_hilight_vehicle",
'#sw_hide_horizon',
'#sw_hide_titles',
'#sw_layers_launches',
'#sw_selective_sidebar',
Expand Down Expand Up @@ -907,14 +906,6 @@ $(window).ready(function() {
$('#lookanglesbox').css({top:'40px'});
}
break;
case "opt_hide_horizon":
if(on) {
showHorizonRings();
}
else {
hideHorizonRings();
}
break;
case "opt_hide_titles":
if(on) {
hideTitles();
Expand Down Expand Up @@ -1152,4 +1143,4 @@ check_banner()
update_check = setInterval(check_version, 15 * 60 * 1000)
load_hash();
startAjax();
load();
load();
86 changes: 38 additions & 48 deletions js/sondehub.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,27 +998,25 @@ function load() {
map.on('zoomend', function() {
sub_to_nearby_sondes();
//do check for horizon labels
if (offline.get("opt_hide_horizon")) {
for (key in vehicles) {
if (vehicles[key]["vehicle_type"] == "balloon") {
if (vehicles[key]["horizon_circle"]["_map"])
{
try {
var zoom = map.getZoom();
var horizonzoom = (Math.abs(Math.log(vehicles[key]["horizon_circle"].getRadius()/2000000)/0.75));
var subhorizonzoom = (Math.abs(Math.log(vehicles[key]["subhorizon_circle"].getRadius()/2000000)/0.75));
if (horizonzoom > zoom) {
map.removeLayer(vehicles[key]["horizon_circle_title"]);
} else {
map.addLayer(vehicles[key]["horizon_circle_title"]);
}
if (subhorizonzoom > zoom) {
map.removeLayer(vehicles[key]["subhorizon_circle_title"]);
} else {
map.addLayer(vehicles[key]["subhorizon_circle_title"]);
}
} catch(e){};
}
for (key in vehicles) {
if (vehicles[key]["vehicle_type"] == "balloon") {
if (vehicles[key]["horizon_circle"]["_map"])
{
try {
var zoom = map.getZoom();
var horizonzoom = (Math.abs(Math.log(vehicles[key]["horizon_circle"].getRadius()/2000000)/0.75));
var subhorizonzoom = (Math.abs(Math.log(vehicles[key]["subhorizon_circle"].getRadius()/2000000)/0.75));
if (horizonzoom > zoom) {
map.removeLayer(vehicles[key]["horizon_circle_title"]);
} else {
map.addLayer(vehicles[key]["horizon_circle_title"]);
}
if (subhorizonzoom > zoom) {
map.removeLayer(vehicles[key]["subhorizon_circle_title"]);
} else {
map.addLayer(vehicles[key]["subhorizon_circle_title"]);
}
} catch(e){};
}
}
}
Expand Down Expand Up @@ -1564,6 +1562,7 @@ function stopFollow(no_data_reset) {
if(follow_vehicle !== null) {
if(!no_data_reset) {
focusVehicle(null);
hideHorizonRings();

// remove target mark
$("#main .row.follow").removeClass("follow");
Expand Down Expand Up @@ -1612,6 +1611,7 @@ function followVehicle(vcallsign, noPan, force) {

follow_vehicle = vcallsign;
vehicles[follow_vehicle].follow = true;
updateHorizonVisibility();

// add target mark
$("#main .row.follow").removeClass("follow");
Expand Down Expand Up @@ -3307,12 +3307,7 @@ function addPosition(position) {
} else {
map.addLayer(vehicle.marker.shadow);

if(!offline.get('opt_hide_horizon') == false){
map.addLayer(vehicle.horizon_circle);
map.addLayer(vehicle.subhorizon_circle);
map.addLayer(vehicle.horizon_circle_title);
map.addLayer(vehicle.subhorizon_circle_title);
}
updateHorizonVisibility();

if(mode == "parachute") {
img_src = recolorSVG(host_url + markers_url + "parachute.svg", this.balloonColor);
Expand Down Expand Up @@ -3384,11 +3379,6 @@ function addPosition(position) {
title: "Line-of-right (radio) horizon of the payload"
});

if (offline.get("opt_hide_horizon")) {
horizon_circle.addTo(map);
horizon_circle_title.addTo(map);
}

horizon_circle.on('move', function (e) {
try {
var latlng = L.latLng(e.target.getBounds()._southWest.lat, ((e.target.getBounds()._northEast.lng + e.target.getBounds()._southWest.lng)/2));
Expand Down Expand Up @@ -3417,11 +3407,6 @@ function addPosition(position) {
title: "Payload is greater than 5 degrees above the horizon within this circle, which indicates it should be fairly easily receivable."
});

if (offline.get("opt_hide_horizon")) {
subhorizon_circle.addTo(map);
subhorizon_circle_title.addTo(map);
}

subhorizon_circle.on('move', function (e) {
try {
var latlng = L.latLng(e.target.getBounds()._southWest.lat, ((e.target.getBounds()._northEast.lng + e.target.getBounds()._southWest.lng)/2));
Expand Down Expand Up @@ -3587,6 +3572,7 @@ function addPosition(position) {
}

vehicles[vcallsign] = vehicle_info;
updateHorizonVisibility();
}

var vehicle = vehicles[vcallsign];
Expand Down Expand Up @@ -5059,17 +5045,21 @@ function hideHorizonRings(){
}
}

function showHorizonRings(){
for(var vcallsign in vehicles) {
if(vehicles[vcallsign].vehicle_type == "balloon"){
map.addLayer(vehicles[vcallsign].horizon_circle);
map.addLayer(vehicles[vcallsign].subhorizon_circle);
vehicles[vcallsign].horizon_circle.fire("move")
vehicles[vcallsign].subhorizon_circle.fire("move")
map.addLayer(vehicles[vcallsign].horizon_circle_title);
map.addLayer(vehicles[vcallsign].subhorizon_circle_title);
}
}
function updateHorizonVisibility(){
// Only show horizon rings for the sonde we are currently 'following'
// (the last selected sonde)
hideHorizonRings();

if (follow_vehicle === null) return;
if (!vehicles.hasOwnProperty(follow_vehicle)) return;
if (vehicles[follow_vehicle].vehicle_type != "balloon") return;

map.addLayer(vehicles[follow_vehicle].horizon_circle);
map.addLayer(vehicles[follow_vehicle].subhorizon_circle);
vehicles[follow_vehicle].horizon_circle.fire("move");
vehicles[follow_vehicle].subhorizon_circle.fire("move");
map.addLayer(vehicles[follow_vehicle].horizon_circle_title);
map.addLayer(vehicles[follow_vehicle].subhorizon_circle_title);
}

function hideTitles(){
Expand Down