@@ -121,22 +121,27 @@ function MapGrapher() {
121
121
}
122
122
123
123
this . setFlightLogIndexs ( ) ;
124
-
125
124
let { latlngs, maxAlt, minAlt } = this . getPolylinesData ( ) ;
126
125
127
- const polyline = L . polyline ( latlngs , polylineOptions ) ;
126
+ const hasGpsData = latlngs . length > 0 ;
128
127
129
- const polylineC = this . createAltitudeColoredPolyline (
130
- latlngs ,
131
- maxAlt ,
132
- minAlt
133
- ) ;
128
+ if ( hasGpsData ) {
129
+ const polyline = L . polyline ( latlngs , polylineOptions ) ;
130
+
131
+ const polylineC = this . createAltitudeColoredPolyline (
132
+ latlngs ,
133
+ maxAlt ,
134
+ minAlt
135
+ ) ;
134
136
135
- trailLayers . set ( logIndex , { polyline, polylineC } ) ;
137
+ trailLayers . set ( logIndex , { polyline, polylineC } ) ;
136
138
137
- if ( latlngs . length > 0 ) {
138
139
homePosition = this . getHomeCoordinatesFromFlightLog ( flightLog ) ;
140
+ } else {
141
+ console . debug ( "FlightLog has no gps data." ) ;
139
142
}
143
+
144
+ $ ( "#mapContainer" ) . toggleClass ( "no-gps-data" , ! hasGpsData ) ;
140
145
} ;
141
146
142
147
this . setFlightLogIndexs = function ( ) {
@@ -382,7 +387,7 @@ function MapGrapher() {
382
387
const lng = frame [ lngIndex ] ;
383
388
const alt = frame [ altitudeIndex ] ;
384
389
385
- return typeof lat == "number" || typeof lng == "number"
390
+ return this . isNumber ( lat ) && this . isNumber ( lng )
386
391
? L . latLng (
387
392
lat / coordinateDivider ,
388
393
lng / coordinateDivider ,
@@ -391,6 +396,10 @@ function MapGrapher() {
391
396
: null ;
392
397
} ;
393
398
399
+ this . isNumber = function ( n ) {
400
+ return typeof n === "number" && ! isNaN ( n ) ;
401
+ } ;
402
+
394
403
this . getGroundCourseFromFrame = function ( frame , groundCourseIndex ) {
395
404
const gc = frame [ groundCourseIndex ] ;
396
405
return typeof gc == "number" ? gc / grounCourseDivider : 0 ;
0 commit comments