Position: use for TrackPoint.

This commit is contained in:
Dennis Guse
2025-02-28 22:20:39 +01:00
parent e83ba04d71
commit 1d5f65be48
7 changed files with 212 additions and 162 deletions
@@ -107,19 +107,19 @@ public class TrackPointCreator implements SharedPreferences.OnSharedPreferenceCh
public Pair<TrackPoint, SensorDataSet> createCurrentTrackPoint(@Nullable TrackPoint lastTrackPointUISpeed, @Nullable TrackPoint lastTrackPointUIAltitude, @Nullable TrackPoint lastStoredTrackPointWithLocation) {
TrackPoint currentTrackPoint = new TrackPoint(TrackPoint.Type.TRACKPOINT, createNow());
if (lastStoredTrackPointWithLocation != null && lastStoredTrackPointWithLocation.hasLocation()) {
//We are taking the coordinates from the last stored TrackPoint, so the distance is monotonously increasing.
currentTrackPoint.setPosition(lastStoredTrackPointWithLocation.getPosition());
}
if (lastTrackPointUISpeed != null) {
currentTrackPoint.setSpeed(lastTrackPointUISpeed.getSpeed());
}
if (lastTrackPointUIAltitude != null) {
currentTrackPoint.setAltitude(lastTrackPointUIAltitude.getAltitude());
}
if (lastStoredTrackPointWithLocation != null && lastStoredTrackPointWithLocation.hasLocation()) {
//We are taking the coordinates from the last stored TrackPoint, so the distance is monotonously increasing.
currentTrackPoint.setLongitude(lastStoredTrackPointWithLocation.getLongitude());
currentTrackPoint.setLatitude(lastStoredTrackPointWithLocation.getLatitude());
}
SensorDataSet sensorDataSet = addSensorData(currentTrackPoint);
return new Pair<>(currentTrackPoint, sensorDataSet);