@@ -937,6 +937,33 @@ function updateVehicleInfo(vcallsign, newPosition) {
937937 // Should we do this? Can we re-add it safely?
938938 vehicle . landing_marker . setMap ( null ) ;
939939 }
940+ } else {
941+ // Landing marker has not been initialised yet.
942+ if ( ( newPosition . data . pred_lat !== 0.0 ) && ( newPosition . data . pred_lon !== 0.0 ) ) {
943+
944+ landing_image_src = host_url + markers_url + "balloon-xmark.png" ;
945+ landing_image_src_size = new google . maps . Size ( 48 , 38 ) ;
946+ landing_image_src_offset = new google . maps . Point ( 0 , - 38 ) ;
947+
948+ landing_marker = new google . maps . Marker ( {
949+ icon : {
950+ url : landing_image_src ,
951+ size : landing_image_src_size ,
952+ scaledSize : landing_image_src_size ,
953+ anchor : new google . maps . Point ( 24 , 18 )
954+ } ,
955+ zIndex : Z_CAR ,
956+ position : new google . maps . LatLng ( position . data . pred_lat , position . data . pred_lon ) ,
957+ map : map ,
958+ optimized : false ,
959+ title : vcallsign + " Onboard Landing Prediction"
960+ } ) ;
961+
962+ // Add the marker to the map, and to the vehicle object.
963+ landing_marker . setMap ( map ) ;
964+ vehicle . landing_marker = landing_marker ;
965+ }
966+
940967 }
941968 }
942969 }
@@ -1678,25 +1705,29 @@ function addPosition(position) {
16781705 } ;
16791706
16801707 // Add landing marker if the payload provides a predicted landing position.
1708+ // TODO: Only create this if the lat/lon are not zero.
16811709 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 ) ;
1710+ // Only create the marker if the pred lat/lon are not zero (as will be the case during ascent).
1711+ if ( ( position . data . pred_lat !== 0.0 ) && ( position . data . pred_lon !== 0.0 ) ) {
1712+ landing_image_src = host_url + markers_url + "balloon-xmark.png" ;
1713+ landing_image_src_size = new google . maps . Size ( 48 , 38 ) ;
1714+ landing_image_src_offset = new google . maps . Point ( 0 , - 38 ) ;
1715+
1716+ landing_marker = new google . maps . Marker ( {
1717+ icon : {
1718+ url : landing_image_src ,
1719+ size : landing_image_src_size ,
1720+ scaledSize : landing_image_src_size ,
1721+ anchor : new google . maps . Point ( 24 , 18 )
1722+ } ,
1723+ zIndex : Z_CAR ,
1724+ position : new google . maps . LatLng ( position . data . pred_lat , position . data . pred_lon ) ,
1725+ map : map ,
1726+ optimized : false ,
1727+ title : vcallsign + " Onboard Landing Prediction"
1728+ } ) ;
1729+ gmaps_elements . push ( landing_marker ) ;
1730+ }
17001731 } else {
17011732 landing_marker = null ;
17021733 }
0 commit comments