Segments: only insert one trackpoint and set the type.

Existing data is not migrated.
#316.
This commit is contained in:
Dennis Guse
2020-12-25 20:27:45 +01:00
parent bc66cd33a9
commit 47b2d0748a
4 changed files with 117 additions and 62 deletions
@@ -80,7 +80,8 @@ public class TrackPoint {
}
}
private final Type type;
@NonNull
private Type type;
private Float heartRate_bpm = null;
private Float cyclingCadence_rpm = null;
@@ -92,7 +93,7 @@ public class TrackPoint {
this(Type.TRACKPOINT, new Location(""));
}
public TrackPoint(Type type) {
public TrackPoint(@NonNull Type type) {
this.type = type;
this.location = new Location("");
}
@@ -108,18 +109,6 @@ public class TrackPoint {
this.location = location;
}
public TrackPoint(@NonNull TrackPoint trackPoint) {
this.type = trackPoint.getType();
this.location = trackPoint.getLocation();
this.heartRate_bpm = trackPoint.getHeartRate_bpm();
this.cyclingCadence_rpm = trackPoint.getCyclingCadence_rpm();
this.power = trackPoint.getPower();
this.elevationGain = trackPoint.getElevationGain();
this.elevationLoss = trackPoint.getElevationLoss();
}
public TrackPoint(double latitude, double longitude, Double altitude, long time) {
this.type = Type.TRACKPOINT;
location = new Location(LocationManager.GPS_PROVIDER);
@@ -172,6 +161,10 @@ public class TrackPoint {
return type;
}
public void setType(@NonNull Type type) {
this.type = type;
}
public boolean isSegmentStart() {
return type == Type.SEGMENT_START_AUTOMATIC || type == Type.SEGMENT_START_MANUAL;
}