Test: export and import tracks via KML and GPX; now includes waypoints.

TripStatistics is not tested.
This commit is contained in:
Dennis Guse
2019-12-22 18:50:54 +01:00
parent bdd9ded1e8
commit 5ac72092fb
9 changed files with 221 additions and 159 deletions
@@ -99,7 +99,6 @@ public class FileTrackExporter implements TrackExporter {
boolean hasWaypoints = false;
try (Cursor cursor = contentProviderUtils.getWaypointCursor(track.getId(), -1L, ContentProviderUtils.MAX_LOADED_WAYPOINTS_POINTS)) {
if (cursor != null && cursor.moveToFirst()) {
// Intentionally skip first waypoint (contains statistics).
for (int i = 0; i < cursor.getCount(); i++) {
if (Thread.interrupted()) {
throw new InterruptedException();
@@ -174,6 +174,7 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
return;
}
}
if (location == null) {
if (!locationIterator.hasNext()) {
// No more track points. Ignore the rest of the waypoints.
@@ -183,9 +184,11 @@ abstract class AbstractFileTrackImporter extends DefaultHandler implements Track
trackTripStatisticstrackUpdater.addLocation(location, recordingDistanceInterval);
markerTripStatisticsUpdater.addLocation(location, recordingDistanceInterval);
}
if (waypoint.getLocation().getTime() > location.getTime()) {
location = null;
} else if (waypoint.getLocation().getTime() < location.getTime()) {
Log.w(TAG, "Ignoring waypoint: current location was after waypoint.");
waypoint = null;
} else {
// The waypoint location time matches the track point time