@@ -1032,17 +1032,11 @@ function updateVehicleInfo(vcallsign, newPosition) {
10321032 var latlng = new L . LatLng ( newPosition . gps_lat , newPosition . gps_lon ) ;
10331033 }
10341034
1035- // update market z-index based on latitude, 90 being background and -90 foreground
1036- // the first 2 decimal digits are included for added accuracy
1037- var zIndex = 900000 - parseInt ( newPosition . gps_lat * 10000 ) ;
1038-
10391035 // update position
10401036 if ( vehicle . marker_shadow ) {
10411037 vehicle . marker_shadow . setLatLng ( latlng ) ;
1042- //vehicle.marker_shadow.setZIndex(Z_SHADOW + zIndex);
10431038 }
10441039 vehicle . marker . setLatLng ( latlng ) ;
1045- //vehicle.marker.setZIndex(((vehicle.vehicle_type=="car")? Z_CAR : Z_PAYLOAD) + zIndex);
10461040
10471041 if ( ! ! vehicle . marker . setCourse ) {
10481042 if ( vehicle . curr_position . gps_heading ) {
@@ -1165,8 +1159,6 @@ function updateVehicleInfo(vcallsign, newPosition) {
11651159 $ ( '.portrait' ) . append ( '<div class="row vehicle' + vehicle . uuid + '" data-vcallsign="' + vcallsign + '"></div>' ) ;
11661160 $ ( '.landscape' ) . append ( '<div class="row vehicle' + vehicle . uuid + '" data-vcallsign="' + vcallsign + '"></div>' ) ;
11671161 }
1168-
1169-
11701162
11711163 } else if ( elm . attr ( 'data-vcallsign' ) === undefined ) {
11721164 elm . attr ( 'data-vcallsign' , vcallsign ) ;
@@ -2220,6 +2212,12 @@ function addPosition(position) {
22202212 var curr_ts = convert_time ( vehicle . curr_position . gps_time ) ;
22212213 var dt = ( new_ts - curr_ts ) / 1000 ; // convert to seconds
22222214
2215+ if ( typeof position . type !== 'undefined' && typeof vehicle . curr_position . type !== 'undefined' ) {
2216+ if ( position . type . length < vehicle . curr_position . type . length ) {
2217+ position . type = vehicle . curr_position . type ;
2218+ }
2219+ }
2220+
22232221 if ( dt >= 0 ) {
22242222 if ( vehicle . num_positions > 0 ) {
22252223 // calculate vertical rate
@@ -2904,16 +2902,16 @@ function liveData() {
29042902 $ ( "#stText" ) . text ( "websocket |" ) ;
29052903 } )
29062904
2907- client . on ( 'connect' , function ( ) {
2908- client . subscribe ( '#' )
2909- $ ( "#stText" ) . text ( "websocket |" ) ;
2910- } )
2911-
29122905 client . on ( 'message' , function ( topic , message ) {
29132906 var frame = JSON . parse ( message . toString ( ) ) ;
2914- var test = formatData ( frame , true ) ;
2915- update ( test ) ;
2916- $ ( "#stTimer" ) . attr ( "data-timestamp" , new Date ( ) . getTime ( ) ) ;
2907+ if ( ( new Date ( ) . getTime ( ) - new Date ( frame . time_received ) . getTime ( ) ) < 30000 ) {
2908+ var test = formatData ( frame , true ) ;
2909+ update ( test ) ;
2910+ $ ( "#stTimer" ) . attr ( "data-timestamp" , new Date ( ) . getTime ( ) ) ;
2911+ $ ( "#stText" ) . text ( "websocket |" ) ;
2912+ } else {
2913+ $ ( "#stText" ) . text ( "error |" ) ;
2914+ }
29172915 } )
29182916}
29192917
0 commit comments