Skip to content

Commit 9d3eec3

Browse files
added LOS lines from selected balloon to receivers
1 parent fcfa587 commit 9d3eec3

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

js/tracker.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,51 @@ function updateZoom() {
681681
}
682682
}
683683

684+
var los_polylines = [];
685+
686+
function drawLOSPaths(vcallsign) {
687+
los_polylines.forEach(function(polyline) {
688+
polyline.setMap(null);
689+
});
690+
los_polylines = [];
691+
692+
if(offline.get('opt_hide_receivers')) return;
693+
694+
var vehicle = vehicles[vcallsign];
695+
696+
if(vehicle === undefined || vehicle.vehicle_type !== "balloon") return;
697+
698+
var callsigns = vehicle.curr_position.callsign.split(',');
699+
700+
callsigns.forEach(function(callsign) {
701+
callsign = callsign.trim(' ');
702+
703+
var r_index = receiver_names.indexOf(callsign);
704+
705+
if(r_index === -1) return;
706+
707+
var path = [
708+
vehicle.marker_shadow.getPosition(),
709+
receivers[r_index].marker.getPosition(),
710+
];
711+
712+
var p = new google.maps.Polyline({
713+
map: map,
714+
path: path,
715+
zIndex: Z_PATH,
716+
strokeColor: '#0F0',
717+
strokeOpacity: 0.8,
718+
strokeWeight: 3,
719+
clickable: true,
720+
draggable: false,
721+
geodesic: true
722+
});
723+
p.path_length = google.maps.geometry.spherical.computeDistanceBetween(path[0], path[1]);
724+
los_polylines.push(p);
725+
google.maps.event.addListener(p, 'click', mapInfoBox_handle_prediction_path);
726+
});
727+
}
728+
684729
function focusVehicle(vcallsign, ignoreOpt) {
685730
if(!offline.get('opt_hilight_vehicle') && ignoreOpt === undefined) return;
686731

@@ -723,6 +768,9 @@ function stopFollow(no_data_reset) {
723768
if(plot) plot = $.plot(plot_holder, {}, plot_options);
724769
updateGraph(null, true);
725770

771+
// clear LOS lines
772+
drawLOSPaths(null);
773+
726774
// update lookangles box
727775
if(GPS_ts !== null) $("#lookanglesbox span").hide().parent().find(".nofollow").show();
728776

@@ -755,6 +803,7 @@ function followVehicle(vcallsign, noPan, force) {
755803
$("#main .vehicle"+vehicles[vcallsign].uuid).addClass("follow");
756804

757805
updateGraph(vcallsign, true);
806+
drawLOSPaths(vcallsign);
758807
}
759808

760809
if(should_pan) {
@@ -2521,6 +2570,8 @@ function updateReceivers(r) {
25212570
receiver_names.splice(i,1);
25222571
}
25232572
}
2573+
2574+
if(follow_vehicle !== null) drawLOSPaths(follow_vehicle);
25242575
}
25252576

25262577
function updatePredictions(r) {
@@ -2637,6 +2688,7 @@ function update(response) {
26372688

26382689
if(listScroll) listScroll.refresh();
26392690
if(zoomed_in && follow_vehicle == vcallsign && !manual_pan) panTo(follow_vehicle);
2691+
if(follow_vehicle == vcallsign) drawLOSPaths(vcallsign);
26402692
}
26412693

26422694
// step to the next callsign

0 commit comments

Comments
 (0)