mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-06 19:43:06 +02:00
Use TrackPoint instead of Location (and omit casting).
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package de.dennisguse.opentracks.content.data;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,7 +41,7 @@ public class Track {
|
||||
private TripStatistics tripStatistics = new TripStatistics();
|
||||
|
||||
// Location points (which may not have been loaded)
|
||||
private List<Location> locations = new ArrayList<>();
|
||||
private List<TrackPoint> trackPoints = new ArrayList<>();
|
||||
|
||||
public Track() {
|
||||
}
|
||||
@@ -97,15 +95,15 @@ public class Track {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void addLocation(Location location) {
|
||||
locations.add(location);
|
||||
public void addTrackPoint(TrackPoint location) {
|
||||
trackPoints.add(location);
|
||||
}
|
||||
|
||||
public List<Location> getLocations() {
|
||||
return locations;
|
||||
public List<TrackPoint> getTrackPoints() {
|
||||
return trackPoints;
|
||||
}
|
||||
|
||||
public void setLocations(ArrayList<Location> locations) {
|
||||
this.locations = locations;
|
||||
public void setTrackPoints(ArrayList<TrackPoint> trackPoints) {
|
||||
this.trackPoints = trackPoints;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package de.dennisguse.opentracks.content.data;
|
||||
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
|
||||
import de.dennisguse.opentracks.content.sensor.SensorDataSet;
|
||||
|
||||
@@ -24,8 +25,25 @@ import de.dennisguse.opentracks.content.sensor.SensorDataSet;
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
//TODO Check if we can drop inheritance from Location and use attributes instead.
|
||||
public class TrackPoint extends Location {
|
||||
|
||||
public static TrackPoint createPause() {
|
||||
TrackPoint pause = new TrackPoint(LocationManager.GPS_PROVIDER);
|
||||
pause.setLongitude(0);
|
||||
pause.setLatitude(TrackPointsColumns.PAUSE_LATITUDE);
|
||||
pause.setTime(System.currentTimeMillis());
|
||||
return pause;
|
||||
}
|
||||
|
||||
public static TrackPoint createResume() {
|
||||
TrackPoint resume = new TrackPoint(LocationManager.GPS_PROVIDER);
|
||||
resume.setLongitude(0);
|
||||
resume.setLatitude(TrackPointsColumns.RESUME_LATITUDE);
|
||||
resume.setTime(System.currentTimeMillis());
|
||||
return resume;
|
||||
}
|
||||
|
||||
private SensorDataSet sensorDataSet = null;
|
||||
|
||||
public TrackPoint(Location location, SensorDataSet sensorDataSet) {
|
||||
|
||||
Reference in New Issue
Block a user