@@ -919,6 +919,26 @@ function updateVehicleInfo(vcallsign, newPosition) {
919919 } else {
920920 vehicle . marker . setMode ( "parachute" ) ;
921921 }
922+
923+ // Update landing marker if data is available
924+ if ( newPosition . data . hasOwnProperty ( "pred_lat" ) && newPosition . data . hasOwnProperty ( "pred_lon" ) ) {
925+ // Landing prediction data exists..
926+ if ( vehicle . landing_marker !== null ) {
927+ // We already have a marker initialized.
928+ if ( newPosition . gps_alt > 350 ) {
929+ // Balloon is still in flight, so update the marker.
930+ vehicle . landing_marker . setPosition ( new google . maps . LatLng ( newPosition . data . pred_lat , newPosition . data . pred_lon ) ) ;
931+ // Re-add to map if it's been removed previously.
932+ if ( vehicle . landing_marker . getMap ( ) == null ) {
933+ vehicle . landing_marker . setMap ( map ) ;
934+ }
935+ } else {
936+ // Balloon has landed, so hide the marker.
937+ // Should we do this? Can we re-add it safely?
938+ vehicle . landing_marker . setMap ( null ) ;
939+ }
940+ }
941+ }
922942 }
923943
924944 var image = vehicle . image_src ;
@@ -1657,6 +1677,30 @@ function addPosition(position) {
16571677 this . setPosition ( overlay . getProjection ( ) . fromDivPixelToLatLng ( pos ) ) ;
16581678 } ;
16591679
1680+ // Add landing marker if the payload provides a predicted landing position.
1681+ if ( position . data . hasOwnProperty ( 'pred_lat' ) && position . data . hasOwnProperty ( 'pred_lon' ) ) {
1682+ landing_image_src = host_url + markers_url + "balloon-xmark.png" ;
1683+ landing_image_src_size = new google . maps . Size ( 48 , 38 ) ;
1684+ landing_image_src_offset = new google . maps . Point ( 0 , - 38 ) ;
1685+
1686+ landing_marker = new google . maps . Marker ( {
1687+ icon : {
1688+ url : landing_image_src ,
1689+ size : landing_image_src_size ,
1690+ scaledSize : landing_image_src_size ,
1691+ anchor : new google . maps . Point ( 24 , 18 )
1692+ } ,
1693+ zIndex : Z_CAR ,
1694+ position : new google . maps . LatLng ( position . data . pred_lat , position . data . pred_lon ) ,
1695+ map : map ,
1696+ optimized : false ,
1697+ title : vcallsign + " Onboard Landing Prediction"
1698+ } ) ;
1699+ gmaps_elements . push ( landing_marker ) ;
1700+ } else {
1701+ landing_marker = null ;
1702+ }
1703+
16601704 horizon_circle = new google . maps . Circle ( {
16611705 map : map ,
16621706 zIndex : Z_RANGE ,
@@ -1790,6 +1834,7 @@ function addPosition(position) {
17901834 vehicle_type : vehicle_type ,
17911835 marker : marker ,
17921836 marker_shadow : marker_shadow ,
1837+ landing_marker : landing_marker ,
17931838 image_src : image_src ,
17941839 image_src_size : image_src_size ,
17951840 image_src_offset : image_src_offset ,
0 commit comments