@@ -164,15 +164,15 @@ public void run() {
164
164
KMLbw .write (" <IconStyle>" + newLine );
165
165
KMLbw .write (" <Icon> <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href> </Icon>" + newLine );
166
166
KMLbw .write (" </IconStyle>" + newLine );
167
- KMLbw .write (" </Style>" + newLine );
167
+ KMLbw .write (" </Style>" + newLine + newLine );
168
168
}
169
169
170
170
if (ExportGPX ) {
171
171
// Writing head of GPX file
172
172
173
173
GPXbw .write ("<?xml version=\" 1.0\" ?>" + newLine );
174
174
GPXbw .write ("<!-- Created with BasicAirData GPS Logger for Android - ver. " + versionName + " -->" + newLine );
175
- GPXbw .write ("<gpx creator=\" BasicAirData GPS Logger\" version=\" " + versionName + "\" xmlns=\" http://www.topografix.com/GPX/1/0\" xmlns:xsi=\" http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\" http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\" >" + newLine );
175
+ GPXbw .write ("<gpx creator=\" BasicAirData GPS Logger\" version=\" " + versionName + "\" xmlns=\" http://www.topografix.com/GPX/1/0\" xmlns:xsi=\" http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\" http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd\" >" + newLine + newLine );
176
176
}
177
177
178
178
@@ -208,7 +208,7 @@ public void run() {
208
208
209
209
List <LocationExtended > locationList = new ArrayList <LocationExtended >();
210
210
211
- for (int i = 0 ; i < track .getNumberOfLocations (); i += GroupOfLocations ) {
211
+ for (int i = 0 ; i <= track .getNumberOfLocations (); i += GroupOfLocations ) {
212
212
//Log.w("myApp", "[#] Exporter.java - " + (i + GroupOfLocations));
213
213
if (!locationList .isEmpty ()) locationList .clear ();
214
214
//Log.w("myApp", "[#] Exporter.java - DB query + list.addall(...)");
@@ -231,21 +231,26 @@ public void run() {
231
231
}
232
232
// GPX
233
233
if (ExportGPX ) {
234
- GPXbw .write (" <trkpt lat=\" " + formattedLatitude + "\" lon=\" " + formattedLongitude + "\" >" + newLine );
234
+ GPXbw .write (" <trkpt lat=\" " + formattedLatitude + "\" lon=\" " + formattedLongitude + "\" >" );
235
235
if (loc .getLocation ().hasAltitude ()) {
236
- GPXbw .write (" <ele>" ); // Elevation
236
+ GPXbw .write ("<ele>" ); // Elevation
237
237
GPXbw .write (formattedAltitude );
238
- GPXbw .write ("</ele>" + newLine );
238
+ GPXbw .write ("</ele>" );
239
239
}
240
240
if (loc .getLocation ().hasSpeed ()) {
241
- GPXbw .write (" <speed>" ); // Speed
241
+ GPXbw .write ("<speed>" ); // Speed
242
242
GPXbw .write (String .format (Locale .US , "%.3f" , loc .getLocation ().getSpeed ()));
243
- GPXbw .write ("</speed>" + newLine );
243
+ GPXbw .write ("</speed>" );
244
244
}
245
- GPXbw .write (" <time>" ); // Time
245
+ GPXbw .write ("<time>" ); // Time
246
246
GPXbw .write (dfdt .format (loc .getLocation ().getTime ()));
247
- GPXbw .write ("</time>" + newLine );
248
- GPXbw .write (" </trkpt>" + newLine );
247
+ GPXbw .write ("</time>" );
248
+ //if (loc.getNumberOfSatellites() > 0) {
249
+ // GPXbw.write("<sat>");
250
+ // GPXbw.write(String.valueOf(loc.getNumberOfSatellites()));
251
+ // GPXbw.write("</sat>");
252
+ //}
253
+ GPXbw .write ("</trkpt>" + newLine );
249
254
}
250
255
}
251
256
}
@@ -276,7 +281,7 @@ public void run() {
276
281
277
282
List <LocationExtended > placemarkList = new ArrayList <LocationExtended >();
278
283
279
- for (int i = 0 ; i < track .getNumberOfPlacemarks (); i += GroupOfLocations ) {
284
+ for (int i = 0 ; i <= track .getNumberOfPlacemarks (); i += GroupOfLocations ) {
280
285
//Log.w("myApp", "[#] Exporter.java - " + (i + GroupOfLocations));
281
286
if (!placemarkList .isEmpty ()) placemarkList .clear ();
282
287
placemarkList .addAll (GPSApplication .getInstance ().GPSDataBase .getPlacemarksList (track .getId (), i , i + GroupOfLocations - 1 ));
@@ -286,7 +291,7 @@ public void run() {
286
291
287
292
// KML
288
293
if (ExportKML ) {
289
- KMLbw .write (newLine + " <Placemark>" + newLine );
294
+ KMLbw .write (" <Placemark>" + newLine );
290
295
KMLbw .write (" <name>" );
291
296
KMLbw .write (loc .getDescription ()
292
297
.replace ("<" ,"<" )
@@ -311,36 +316,41 @@ public void run() {
311
316
KMLbw .write ("</coordinates>" + newLine );
312
317
KMLbw .write (" <extrude>1</extrude>" + newLine );
313
318
KMLbw .write (" </Point>" + newLine );
314
- KMLbw .write (" </Placemark>" + newLine );
319
+ KMLbw .write (" </Placemark>" + newLine + newLine );
315
320
}
316
321
317
322
318
323
// GPX
319
324
if (ExportGPX ) {
320
- GPXbw .write (newLine + "<wpt lat=\" " );
325
+ GPXbw .write ("<wpt lat=\" " );
321
326
GPXbw .write (String .format (Locale .US , "%.8f" , loc .getLocation ().getLatitude ()) + "\" lon=\" " +
322
- String .format (Locale .US , "%.8f" , loc .getLocation ().getLongitude ()) + "\" >" + newLine );
327
+ String .format (Locale .US , "%.8f" , loc .getLocation ().getLongitude ()) + "\" >" );
323
328
324
329
if (loc .getLocation ().hasAltitude ()) {
325
- GPXbw .write (" <ele>" ); // Elevation
330
+ GPXbw .write ("<ele>" ); // Elevation
326
331
GPXbw .write (String .format (Locale .US , "%.3f" , loc .getLocation ().getAltitude () + AltitudeManualCorrection - (((loc .getAltitudeEGM96Correction () == NOT_AVAILABLE ) || (!EGMAltitudeCorrection )) ? 0 : loc .getAltitudeEGM96Correction ())));
327
- GPXbw .write ("</ele>" + newLine );
332
+ GPXbw .write ("</ele>" );
328
333
}
329
334
330
- GPXbw .write (" <time>" ); // Time
335
+ GPXbw .write ("<time>" ); // Time
331
336
GPXbw .write (dfdt .format (loc .getLocation ().getTime ()));
332
- GPXbw .write ("</time>" + newLine );
337
+ GPXbw .write ("</time>" );
338
+
333
339
334
- GPXbw .write (" <name>" ); // Name
340
+ //if (loc.getNumberOfSatellites() > 0) {
341
+ // GPXbw.write("<sat>");
342
+ // GPXbw.write(String.valueOf(loc.getNumberOfSatellites()));
343
+ // GPXbw.write("</sat>");
344
+ ///
345
+
346
+ GPXbw .write ("<name>" ); // Name
335
347
GPXbw .write (loc .getDescription ()
336
348
.replace ("<" ,"<" )
337
349
.replace ("&" ,"&" )
338
350
.replace (">" ,">" )
339
351
.replace ("\" " ,""" )
340
352
.replace ("'" ,"'" ));
341
- GPXbw .write ("</name>" + newLine );
342
-
343
- GPXbw .write ("</wpt>" + newLine );
353
+ GPXbw .write ("</name></wpt>" + newLine + newLine );
344
354
}
345
355
}
346
356
}
0 commit comments