Skip to content
Merged
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
Handle pred_lat/lon being zero during ascent.
  • Loading branch information
darksidelemm committed Sep 15, 2019
commit 1ab637d652bf23ebe9dfacb7b1b44c49cbff8586
67 changes: 49 additions & 18 deletions js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,33 @@ function updateVehicleInfo(vcallsign, newPosition) {
// Should we do this? Can we re-add it safely?
vehicle.landing_marker.setMap(null);
}
} else{
// Landing marker has not been initialised yet.
if((newPosition.data.pred_lat !== 0.0) && (newPosition.data.pred_lon !== 0.0)){

landing_image_src = host_url + markers_url + "balloon-xmark.png";
landing_image_src_size = new google.maps.Size(48,38);
landing_image_src_offset = new google.maps.Point(0,-38);

landing_marker = new google.maps.Marker({
icon: {
url: landing_image_src,
size: landing_image_src_size,
scaledSize: landing_image_src_size,
anchor: new google.maps.Point(24,18)
},
zIndex: Z_CAR,
position: new google.maps.LatLng(position.data.pred_lat, position.data.pred_lon),
map: map,
optimized: false,
title: vcallsign + " Onboard Landing Prediction"
});

// Add the marker to the map, and to the vehicle object.
landing_marker.setMap(map);
vehicle.landing_marker = landing_marker;
}

}
}
}
Expand Down Expand Up @@ -1678,25 +1705,29 @@ function addPosition(position) {
};

// Add landing marker if the payload provides a predicted landing position.
// TODO: Only create this if the lat/lon are not zero.
if (position.data.hasOwnProperty('pred_lat') && position.data.hasOwnProperty('pred_lon')){
landing_image_src = host_url + markers_url + "balloon-xmark.png";
landing_image_src_size = new google.maps.Size(48,38);
landing_image_src_offset = new google.maps.Point(0,-38);

landing_marker = new google.maps.Marker({
icon: {
url: landing_image_src,
size: landing_image_src_size,
scaledSize: landing_image_src_size,
anchor: new google.maps.Point(24,18)
},
zIndex: Z_CAR,
position: new google.maps.LatLng(position.data.pred_lat, position.data.pred_lon),
map: map,
optimized: false,
title: vcallsign + " Onboard Landing Prediction"
});
gmaps_elements.push(landing_marker);
// Only create the marker if the pred lat/lon are not zero (as will be the case during ascent).
if ((position.data.pred_lat !== 0.0) && (position.data.pred_lon !== 0.0)){
landing_image_src = host_url + markers_url + "balloon-xmark.png";
landing_image_src_size = new google.maps.Size(48,38);
landing_image_src_offset = new google.maps.Point(0,-38);

landing_marker = new google.maps.Marker({
icon: {
url: landing_image_src,
size: landing_image_src_size,
scaledSize: landing_image_src_size,
anchor: new google.maps.Point(24,18)
},
zIndex: Z_CAR,
position: new google.maps.LatLng(position.data.pred_lat, position.data.pred_lon),
map: map,
optimized: false,
title: vcallsign + " Onboard Landing Prediction"
});
gmaps_elements.push(landing_marker);
}
} else {
landing_marker = null;
}
Expand Down