mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-07 11:53:07 +02:00
Cleanup: use Position and cleanup TrackPoint.
This commit is contained in:
+83
-71
@@ -49,11 +49,13 @@ import de.dennisguse.opentracks.TimezoneRule;
|
||||
import de.dennisguse.opentracks.content.data.TestDataUtil;
|
||||
import de.dennisguse.opentracks.data.ContentProviderUtils;
|
||||
import de.dennisguse.opentracks.data.models.ActivityType;
|
||||
import de.dennisguse.opentracks.data.models.Altitude;
|
||||
import de.dennisguse.opentracks.data.models.AltitudeGainLoss;
|
||||
import de.dennisguse.opentracks.data.models.Cadence;
|
||||
import de.dennisguse.opentracks.data.models.Distance;
|
||||
import de.dennisguse.opentracks.data.models.HeartRate;
|
||||
import de.dennisguse.opentracks.data.models.Marker;
|
||||
import de.dennisguse.opentracks.data.models.Position;
|
||||
import de.dennisguse.opentracks.data.models.Power;
|
||||
import de.dennisguse.opentracks.data.models.Speed;
|
||||
import de.dennisguse.opentracks.data.models.Track;
|
||||
@@ -224,15 +226,17 @@ public class ExportImportTest {
|
||||
List<TrackPoint> actual = TestDataUtil.getTrackPoints(contentProviderUtils, trackId);
|
||||
new TrackPointAssert().assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse("2020-02-02T02:02:02Z")),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:03Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(15))
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:02:03Z"),
|
||||
3d, 14d, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(1f)
|
||||
.setAltitudeGain(1f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:04Z"))
|
||||
.setAltitudeGain(1f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
Instant.parse("2020-02-02T02:02:04Z"))
|
||||
.setSensorDistance(Distance.of(10))
|
||||
.setSpeed(Speed.of(15))
|
||||
.setHeartRate(HeartRate.of(66))
|
||||
@@ -244,47 +248,49 @@ public class ExportImportTest {
|
||||
.setHeartRate(HeartRate.of(68))
|
||||
.setCadence(3)
|
||||
.setPower(50),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:17Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.001)
|
||||
.setAltitude(10)
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:02:17Z"),
|
||||
3d, 14.001, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(5)))
|
||||
.setSensorDistance(Distance.of(2))
|
||||
.setSpeed(Speed.of(5))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setHorizontalAccuracy(Distance.of(10))
|
||||
.setHeartRate(HeartRate.of(69))
|
||||
.setCadence(3)
|
||||
.setPower(50),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2020-02-02T02:02:18Z")),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse("2020-02-02T02:03:20Z")),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:03:21Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.002)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(15))
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:03:21Z"),
|
||||
3d, 14.002d, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-02-02T02:03:22Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(16)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(15))
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(Instant.parse("2020-02-02T02:03:22Z"),
|
||||
3d, 16d, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.IDLE, Instant.parse("2020-02-02T02:03:30Z"))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:03:50Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(16.001)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(15))
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:03:50Z"),
|
||||
3d, 16.001, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null, Speed.of(15)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2020-02-02T02:04:00Z"))
|
||||
), actual);
|
||||
}
|
||||
@@ -397,50 +403,56 @@ public class ExportImportTest {
|
||||
.setDelta(0.05); // speed is not fully
|
||||
List<TrackPoint> actual = TestDataUtil.getTrackPoints(contentProviderUtils, importTrackId);
|
||||
a.assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-02-02T02:02:03Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(15))
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:02:03Z"),
|
||||
3d, 14d, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(1f)
|
||||
.setAltitudeGain(1f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:17Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.001)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(5))
|
||||
.setAltitudeGain(1f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:02:17Z"),
|
||||
3d, 14.001, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(5)))
|
||||
.setAltitudeLoss(1f)
|
||||
.setAltitudeGain(1f)
|
||||
.setSensorDistance(Distance.of(12))
|
||||
.setHeartRate(69)
|
||||
.setPower(50f)
|
||||
.setCadence(3f)
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-02-02T02:03:21Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.002)
|
||||
.setAltitude(10)
|
||||
.setCadence(3f),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:03:21Z"),
|
||||
3d, 14.002, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:03:22Z"),
|
||||
3d, 16d, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(15)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-02-02T02:03:50Z"),
|
||||
3d, 16.001, Distance.of(10),
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(10)))
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(15))
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-02-02T02:03:22Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(16)
|
||||
.setAltitude(10)
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(15))
|
||||
.setHorizontalAccuracy(Distance.of(10)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:03:50Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(16.001)
|
||||
.setAltitude(10)
|
||||
.setAltitudeLoss(0f)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(15))
|
||||
.setHorizontalAccuracy(Distance.of(10))
|
||||
), actual);
|
||||
|
||||
// 3. trackstatistics
|
||||
@@ -597,7 +609,7 @@ public class ExportImportTest {
|
||||
Mockito.when(barometer.hasReceivedData()).thenReturn(true);
|
||||
Mockito.when(barometer.getAggregatedValue(Mockito.any())).thenReturn(new AltitudeGainLoss(altitudeGain, altitudeGain));
|
||||
sensorDataSet.add(barometer);
|
||||
} else {
|
||||
} else {
|
||||
sensorDataSet.add(new AggregatorBarometer("test", null));
|
||||
}
|
||||
}
|
||||
|
||||
+72
-57
@@ -15,21 +15,20 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dennisguse.opentracks.content.data.TestDataUtil;
|
||||
import de.dennisguse.opentracks.data.ContentProviderUtils;
|
||||
import de.dennisguse.opentracks.data.models.ActivityType;
|
||||
import de.dennisguse.opentracks.data.models.Altitude;
|
||||
import de.dennisguse.opentracks.data.models.Distance;
|
||||
import de.dennisguse.opentracks.data.models.Position;
|
||||
import de.dennisguse.opentracks.data.models.Speed;
|
||||
import de.dennisguse.opentracks.data.models.Track;
|
||||
import de.dennisguse.opentracks.data.models.TrackPoint;
|
||||
@@ -95,28 +94,37 @@ public class GPXTrackImporterTest {
|
||||
// first segment
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2021-01-07T21:51:59.179Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14)
|
||||
.setAltitude(10),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-01-07T21:52:00.653Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.001)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(75.4192)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-01-07T21:52:01.010Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.002)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(311.3948)),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2021-01-07T21:51:59.179Z"),
|
||||
3d, 14d, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
null)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-01-07T21:52:00.653Z"),
|
||||
3d, 14.001, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(75.4192))),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-01-07T21:52:01.010Z"),
|
||||
3d, 14.002, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null, Speed.of(311.3948))),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2021-01-07T21:52:02.658Z")),
|
||||
|
||||
// created resume trackpoint with time of next valid trackpoint
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse("2021-01-07T21:52:03.873Z")),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-01-07T21:52:04.103Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.003)
|
||||
.setAltitude(10)
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-01-07T21:52:04.103Z"),
|
||||
3d, 14.003, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
null))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
|
||||
@@ -151,20 +159,27 @@ public class GPXTrackImporterTest {
|
||||
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2021-09-07T22:10:19Z"))
|
||||
.setLatitude(30.14185982)
|
||||
.setLongitude(-40.3863038)
|
||||
.setAltitude(-5),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-09-07T22:11:07Z"))
|
||||
.setLatitude(30.14184657)
|
||||
.setLongitude(-40.38670089)
|
||||
.setAltitude(-5)
|
||||
.setSpeed(Speed.of(0.7976524233818054)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-09-07T22:12:00Z"))
|
||||
.setLatitude(30.14185982)
|
||||
.setLongitude(-40.3863038)
|
||||
.setAltitude(-5)
|
||||
.setSpeed(Speed.of(0.7224021553993225))
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:10:19Z"),
|
||||
30.14185982, -40.3863038, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
null)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:11:07Z"),
|
||||
30.14184657, -40.38670089, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
Speed.of(0.7976524233818054))),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:12:00Z"),
|
||||
30.14185982, -40.3863038, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
Speed.of(0.7224021553993225)))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
|
||||
@@ -199,22 +214,27 @@ public class GPXTrackImporterTest {
|
||||
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2021-09-07T22:10:19Z"))
|
||||
.setLatitude(30.14185982)
|
||||
.setLongitude(-40.3863038)
|
||||
.setAltitude(-5)
|
||||
.setSpeed(Speed.of(5)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-09-07T22:11:07Z"))
|
||||
.setLatitude(30.14184657)
|
||||
.setLongitude(-40.38670089)
|
||||
.setAltitude(-5)
|
||||
.setSpeed(Speed.of(0.7976524233818054))
|
||||
.setSpeed(Speed.of(4)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-09-07T22:12:00Z"))
|
||||
.setLatitude(30.14185982)
|
||||
.setLongitude(-40.3863038)
|
||||
.setAltitude(-5)
|
||||
.setSpeed(Speed.of(3))
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:10:19Z"),
|
||||
30.14185982, -40.3863038, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
Speed.of(5))),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:11:07Z"),
|
||||
30.14184657, -40.38670089, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
Speed.of(4))),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-09-07T22:12:00Z"),
|
||||
30.14185982, -40.3863038, null,
|
||||
Altitude.WGS84.of(-5), null,
|
||||
null,
|
||||
Speed.of(3)))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
|
||||
@@ -237,11 +257,6 @@ public class GPXTrackImporterTest {
|
||||
trackExporter.writeTrack(List.of(importedTrack), outputStream);
|
||||
|
||||
// then
|
||||
String expected = new BufferedReader(
|
||||
new InputStreamReader(inputStreamExpected, StandardCharsets.UTF_8))
|
||||
.lines()
|
||||
.collect(Collectors.joining("\n")) + "\n";
|
||||
|
||||
assertEquals(expected, outputStream.toString()); //TODO inputStream.readAllBytes() ?
|
||||
assertEquals(new String(inputStreamExpected.readAllBytes(), StandardCharsets.UTF_8), outputStream.toString());
|
||||
}
|
||||
}
|
||||
+80
-60
@@ -23,7 +23,9 @@ import java.util.List;
|
||||
import de.dennisguse.opentracks.content.data.TestDataUtil;
|
||||
import de.dennisguse.opentracks.data.ContentProviderUtils;
|
||||
import de.dennisguse.opentracks.data.models.ActivityType;
|
||||
import de.dennisguse.opentracks.data.models.Altitude;
|
||||
import de.dennisguse.opentracks.data.models.Distance;
|
||||
import de.dennisguse.opentracks.data.models.Position;
|
||||
import de.dennisguse.opentracks.data.models.Speed;
|
||||
import de.dennisguse.opentracks.data.models.Track;
|
||||
import de.dennisguse.opentracks.data.models.TrackPoint;
|
||||
@@ -81,23 +83,30 @@ public class KMLTrackImporterTest {
|
||||
|
||||
// 3. trackpoints
|
||||
List<TrackPoint> importedTrackPoints = TestDataUtil.getTrackPoints(contentProviderUtils, importTrackId);
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPointAssert().assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse("2021-05-29T18:06:21.767Z")),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-05-29T18:06:22.042Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14)
|
||||
.setAltitude(10),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-05-29T18:06:22.192Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.001)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(741.1196)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-05-29T18:06:22.318Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14.002)
|
||||
.setAltitude(10)
|
||||
.setSpeed(Speed.of(882.2853)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-05-29T18:06:22.042Z"),
|
||||
3d, 14d, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
null)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-05-29T18:06:22.192Z"),
|
||||
3d, 14.001, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(741.1196)
|
||||
)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2021-05-29T18:06:22.318Z"),
|
||||
3d, 14.002, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
Speed.of(882.2853))),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2021-05-29T18:06:22.512Z"))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
@@ -131,12 +140,13 @@ public class KMLTrackImporterTest {
|
||||
// 3. trackpoints
|
||||
List<TrackPoint> importedTrackPoints = TestDataUtil.getTrackPoints(contentProviderUtils, importTrackId);
|
||||
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2021-05-29T18:06:21.767Z"))
|
||||
.setLatitude(3)
|
||||
.setLongitude(14)
|
||||
.setAltitude(10),
|
||||
new TrackPointAssert().assertEquals(List.of(
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(Instant.parse("2021-05-29T18:06:21.767Z"),
|
||||
3d, 14d, null,
|
||||
Altitude.WGS84.of(10), null,
|
||||
null,
|
||||
null)),
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse("2021-05-29T18:06:22.042Z"))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
@@ -171,47 +181,57 @@ public class KMLTrackImporterTest {
|
||||
// 3. trackpoints
|
||||
List<TrackPoint> importedTrackPoints = TestDataUtil.getTrackPoints(contentProviderUtils, importTrackId);
|
||||
|
||||
TrackPointAssert a = new TrackPointAssert();
|
||||
a.assertEquals(List.of(
|
||||
new TrackPointAssert().assertEquals(List.of(
|
||||
// first 3 trackpoints
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-11-28T17:06:22.401Z"))
|
||||
.setLatitude(12.340097)
|
||||
.setLongitude(1.234156)
|
||||
.setAltitude(469.286376953125)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0.539)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-11-28T17:06:25.448Z"))
|
||||
.setLatitude(12.340036)
|
||||
.setLongitude(1.23415)
|
||||
.setAltitude(439.1626281738281)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0.1577)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-11-28T17:06:47.888Z"))
|
||||
.setLatitude(12.340057)
|
||||
.setLongitude(1.23405)
|
||||
.setAltitude(421.8070983886719)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0)),
|
||||
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:06:22.401Z"),
|
||||
12.340097, 1.234156, null,
|
||||
Altitude.WGS84.of(469.286376953125), null,
|
||||
null,
|
||||
Speed.of(0.539)))
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:06:25.448Z"),
|
||||
12.340036, 1.23415, null,
|
||||
Altitude.WGS84.of(439.1626281738281), null,
|
||||
null,
|
||||
Speed.of(0.1577)))
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:06:47.888Z"),
|
||||
12.340057, 1.23405, null,
|
||||
Altitude.WGS84.of(421.8070983886719), null,
|
||||
null,
|
||||
Speed.of(0)))
|
||||
.setAltitudeGain(0f),
|
||||
// created resume trackpoint with time of next valid trackpoint
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, Instant.parse("2020-11-28T17:06:55.861Z"))
|
||||
.setLatitude(12.340057)
|
||||
.setLongitude(1.23405)
|
||||
.setAltitude(419.93902587890625)
|
||||
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:06:55.861Z"),
|
||||
12.340057, 1.23405, null,
|
||||
Altitude.WGS84.of(419.93902587890625), null,
|
||||
null,
|
||||
Speed.of(0)))
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:06:56.905Z"),
|
||||
12.340057, 1.23405, null,
|
||||
Altitude.WGS84.of(419.9036560058594), null,
|
||||
null,
|
||||
Speed.of(0)))
|
||||
.setAltitudeGain(0f),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT,
|
||||
new Position(
|
||||
Instant.parse("2020-11-28T17:07:20.870Z"),
|
||||
12.340082, 1.234046, null,
|
||||
Altitude.WGS84.of(417.99432373046875), null,
|
||||
null,
|
||||
Speed.of(0)))
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-11-28T17:06:56.905Z"))
|
||||
.setLatitude(12.340057)
|
||||
.setLongitude(1.23405)
|
||||
.setAltitude(419.9036560058594)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0)),
|
||||
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-11-28T17:07:20.870Z"))
|
||||
.setLatitude(12.340082)
|
||||
.setLongitude(1.234046)
|
||||
.setAltitude(417.99432373046875)
|
||||
.setAltitudeGain(0f)
|
||||
.setSpeed(Speed.of(0))
|
||||
), importedTrackPoints);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user