forked from upstream-mirrors/OpenTracks
TrackPoint: all sensors are the same - no need to distinguish the source of a TrackPoint (BLE sensor vs GPS).
Part of #1187.
This commit is contained in:
@@ -136,14 +136,7 @@ public class CSVTrackExporter implements TrackExporter {
|
||||
while (trackPointIterator.hasNext()) {
|
||||
if (Thread.interrupted()) throw new InterruptedException();
|
||||
|
||||
TrackPoint trackPoint = trackPointIterator.next();
|
||||
|
||||
switch (trackPoint.getType()) {
|
||||
case SEGMENT_START_MANUAL, SEGMENT_END_MANUAL, SEGMENT_START_AUTOMATIC, SENSORPOINT, TRACKPOINT ->
|
||||
writeTrackPoint(columns, trackPoint);
|
||||
default ->
|
||||
throw new RuntimeException("Exporting this TrackPoint type is not implemented: " + trackPoint.getType());
|
||||
}
|
||||
writeTrackPoint(columns, trackPointIterator.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,15 +158,18 @@ public class GPXTrackExporter implements TrackExporter {
|
||||
sensorPoints.add(trackPoint);
|
||||
}
|
||||
}
|
||||
case SENSORPOINT -> sensorPoints.add(trackPoint);
|
||||
case TRACKPOINT -> {
|
||||
if (!wroteSegment) {
|
||||
// Might happen for older data (pre v3.15.0)
|
||||
writeOpenSegment();
|
||||
wroteSegment = true;
|
||||
}
|
||||
trackDistance = trackDistance.plus(writeTrackPoint(track.getZoneOffset(), trackPoint, sensorPoints, trackDistance));
|
||||
sensorPoints.clear();
|
||||
if (trackPoint.hasLocation()) {
|
||||
trackDistance = trackDistance.plus(writeTrackPoint(track.getZoneOffset(), trackPoint, sensorPoints, trackDistance));
|
||||
sensorPoints.clear();
|
||||
} else {
|
||||
sensorPoints.add(trackPoint);
|
||||
}
|
||||
}
|
||||
default ->
|
||||
throw new RuntimeException("Exporting this TrackPoint type is not implemented: " + trackPoint.getType());
|
||||
|
||||
@@ -177,7 +177,7 @@ public class KMLTrackExporter implements TrackExporter {
|
||||
writeCloseSegment();
|
||||
wroteSegment = false;
|
||||
}
|
||||
case SENSORPOINT, TRACKPOINT -> {
|
||||
case TRACKPOINT -> {
|
||||
if (!wroteSegment) {
|
||||
// Might happen for older data (pre v3.15.0)
|
||||
writeOpenSegment();
|
||||
|
||||
@@ -308,9 +308,8 @@ public class KmlTrackImporter extends DefaultHandler implements XMLImporter.Trac
|
||||
Instant time = whenList.get(i);
|
||||
Location location = locationList.get(i);
|
||||
|
||||
TrackPoint trackPoint = new TrackPoint(TrackPoint.Type.SENSORPOINT, time);
|
||||
TrackPoint trackPoint = new TrackPoint(TrackPoint.Type.TRACKPOINT, time);
|
||||
if (location != null) {
|
||||
trackPoint.setType(TrackPoint.Type.TRACKPOINT);
|
||||
trackPoint.setLocation(location);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user