Cleanup: TrackPoint uses AltitudeGainLoss.

This commit is contained in:
Dennis Guse
2025-10-30 22:33:00 +01:00
parent 696939112a
commit f31e146cda
20 changed files with 105 additions and 207 deletions
@@ -119,8 +119,7 @@ public class TestDataUtil {
trackPoint.setHeartRate(100f + i % 80); trackPoint.setHeartRate(100f + i % 80);
trackPoint.setCadence(300f + i); trackPoint.setCadence(300f + i);
trackPoint.setPower(400f + i); trackPoint.setPower(400f + i);
trackPoint.setAltitudeGain(ALTITUDE_GAIN); trackPoint.setAltitudeGainLoss(ALTITUDE_GAIN, ALTITUDE_LOSS);
trackPoint.setAltitudeLoss(ALTITUDE_LOSS);
return trackPoint; return trackPoint;
} }
@@ -41,8 +41,7 @@ public class TestSensorDataUtil {
if (power != null) { if (power != null) {
tp.setPower(power); tp.setPower(power);
} }
tp.setAltitudeGain(3f); tp.setAltitudeGainLoss(3, 3);
tp.setAltitudeLoss(3f);
trackPointList.add(tp); trackPointList.add(tp);
} }
@@ -237,17 +237,14 @@ public class ExportImportTest {
Altitude.WGS84.of(1020.25), null, Altitude.WGS84.of(1020.25), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(1f) .setAltitudeGainLoss(1, 1),
.setAltitudeGain(1f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
Instant.parse("2020-02-02T02:02:04Z")) Instant.parse("2020-02-02T02:02:04Z"))
.setSensorDistance(Distance.of(10)) .setSensorDistance(Distance.of(10))
.setSpeed(Speed.of(15)) .setSpeed(Speed.of(15))
.setHeartRate(HeartRate.of(66)) .setHeartRate(HeartRate.of(66))
.setCadence(3) .setCadence(3)
.setPower(50) .setPower(50).setAltitudeGainLoss(1, 1),
.setAltitudeLoss(1f)
.setAltitudeGain(1f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:15Z")) new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse("2020-02-02T02:02:15Z"))
.setHeartRate(HeartRate.of(68)) .setHeartRate(HeartRate.of(68))
.setCadence(3) .setCadence(3)
@@ -260,8 +257,7 @@ public class ExportImportTest {
null, null,
Speed.of(5))) Speed.of(5)))
.setSensorDistance(Distance.of(2)) .setSensorDistance(Distance.of(2))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeGain(0f)
.setHeartRate(HeartRate.of(69)) .setHeartRate(HeartRate.of(69))
.setCadence(3) .setCadence(3)
.setPower(50), .setPower(50),
@@ -274,27 +270,23 @@ public class ExportImportTest {
Altitude.WGS84.of(999.1229858398438), null, Altitude.WGS84.of(999.1229858398438), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
new Position(Instant.parse("2020-02-02T02:03:22Z"), new Position(Instant.parse("2020-02-02T02:03:22Z"),
3.123456, 16d, Distance.of(10), 3.123456, 16d, Distance.of(10),
Altitude.WGS84.of(999.1229858398438), null, Altitude.WGS84.of(999.1229858398438), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.IDLE, Instant.parse("2020-02-02T02:03:30Z")) new TrackPoint(TrackPoint.Type.IDLE, Instant.parse("2020-02-02T02:03:30Z"))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-02-02T02:03:50Z"), Instant.parse("2020-02-02T02:03:50Z"),
3.123456, 16.001, Distance.of(10), 3.123456, 16.001, Distance.of(10),
Altitude.WGS84.of(999.1229858398438), null, Altitude.WGS84.of(999.1229858398438), null,
null, Speed.of(15))) null, Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2020-02-02T02:04:00Z")) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse("2020-02-02T02:04:00Z"))
), actual); ), actual);
} }
@@ -433,8 +425,7 @@ public class ExportImportTest {
Altitude.WGS84.of(1020.2), null, Altitude.WGS84.of(1020.2), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(1f) .setAltitudeGainLoss(1, 1),
.setAltitudeGain(1f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-02-02T02:02:17Z"), Instant.parse("2020-02-02T02:02:17Z"),
@@ -442,8 +433,7 @@ public class ExportImportTest {
Altitude.WGS84.of(1020.2), null, Altitude.WGS84.of(1020.2), null,
null, null,
Speed.of(5))) Speed.of(5)))
.setAltitudeLoss(1f) .setAltitudeGainLoss(1, 1)
.setAltitudeGain(1f)
.setSensorDistance(Distance.of(12)) .setSensorDistance(Distance.of(12))
.setHeartRate(69) .setHeartRate(69)
.setPower(50f) .setPower(50f)
@@ -455,8 +445,7 @@ public class ExportImportTest {
Altitude.WGS84.of(999.0999755859375), null, Altitude.WGS84.of(999.0999755859375), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
new Position( new Position(
Instant.parse("2020-02-02T02:03:22Z"), Instant.parse("2020-02-02T02:03:22Z"),
@@ -464,8 +453,7 @@ public class ExportImportTest {
Altitude.WGS84.of(999.0999755859375), null, Altitude.WGS84.of(999.0999755859375), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-02-02T02:03:50Z"), Instant.parse("2020-02-02T02:03:50Z"),
@@ -473,8 +461,7 @@ public class ExportImportTest {
Altitude.WGS84.of(999.0999755859375), null, Altitude.WGS84.of(999.0999755859375), null,
null, null,
Speed.of(10))) Speed.of(10)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeGain(0f)
.setSpeed(Speed.of(15)) .setSpeed(Speed.of(15))
), actual); ), actual);
@@ -267,8 +267,7 @@ public class GPXTrackImporterTest {
Altitude.WGS84.of(10), null, Altitude.WGS84.of(10), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(1f) .setAltitudeGainLoss(1, 1),
.setAltitudeGain(1f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-02-02T02:02:17Z"), Instant.parse("2020-02-02T02:02:17Z"),
@@ -276,8 +275,7 @@ public class GPXTrackImporterTest {
Altitude.WGS84.of(10), null, Altitude.WGS84.of(10), null,
null, null,
Speed.of(5))) Speed.of(5)))
.setAltitudeLoss(1f) .setAltitudeGainLoss(1, 1)
.setAltitudeGain(1f)
.setSensorDistance(Distance.of(12)) .setSensorDistance(Distance.of(12))
.setHeartRate(69) .setHeartRate(69)
.setPower(50f) .setPower(50f)
@@ -289,8 +287,7 @@ public class GPXTrackImporterTest {
Altitude.WGS84.of(10), null, Altitude.WGS84.of(10), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
new Position( new Position(
Instant.parse("2020-02-02T02:03:22Z"), Instant.parse("2020-02-02T02:03:22Z"),
@@ -298,8 +295,7 @@ public class GPXTrackImporterTest {
Altitude.WGS84.of(10), null, Altitude.WGS84.of(10), null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-02-02T02:03:50Z"), Instant.parse("2020-02-02T02:03:50Z"),
@@ -307,8 +303,7 @@ public class GPXTrackImporterTest {
Altitude.WGS84.of(10), null, Altitude.WGS84.of(10), null,
null, null,
Speed.of(10))) Speed.of(10)))
.setAltitudeLoss(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeGain(0f)
.setSpeed(Speed.of(15)) .setSpeed(Speed.of(15))
), actual); ), actual);
} }
@@ -189,24 +189,21 @@ public class KMLTrackImporterTest {
12.340097, 1.234156, null, 12.340097, 1.234156, null,
Altitude.WGS84.of(469.286376953125), null, Altitude.WGS84.of(469.286376953125), null,
null, null,
Speed.of(0.539))) Speed.of(0.539))),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-11-28T17:06:25.448Z"), Instant.parse("2020-11-28T17:06:25.448Z"),
12.340036, 1.23415, null, 12.340036, 1.23415, null,
Altitude.WGS84.of(439.1626281738281), null, Altitude.WGS84.of(439.1626281738281), null,
null, null,
Speed.of(0.1577))) Speed.of(0.1577))),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-11-28T17:06:47.888Z"), Instant.parse("2020-11-28T17:06:47.888Z"),
12.340057, 1.23405, null, 12.340057, 1.23405, null,
Altitude.WGS84.of(421.8070983886719), null, Altitude.WGS84.of(421.8070983886719), null,
null, null,
Speed.of(0))) Speed.of(0))),
.setAltitudeGain(0f),
// created resume trackpoint with time of next valid trackpoint // created resume trackpoint with time of next valid trackpoint
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
new Position( new Position(
@@ -214,16 +211,14 @@ public class KMLTrackImporterTest {
12.340057, 1.23405, null, 12.340057, 1.23405, null,
Altitude.WGS84.of(419.93902587890625), null, Altitude.WGS84.of(419.93902587890625), null,
null, null,
Speed.of(0))) Speed.of(0))),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-11-28T17:06:56.905Z"), Instant.parse("2020-11-28T17:06:56.905Z"),
12.340057, 1.23405, null, 12.340057, 1.23405, null,
Altitude.WGS84.of(419.9036560058594), null, Altitude.WGS84.of(419.9036560058594), null,
null, null,
Speed.of(0))) Speed.of(0))),
.setAltitudeGain(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse("2020-11-28T17:07:20.870Z"), Instant.parse("2020-11-28T17:07:20.870Z"),
@@ -231,7 +226,6 @@ public class KMLTrackImporterTest {
Altitude.WGS84.of(417.99432373046875), null, Altitude.WGS84.of(417.99432373046875), null,
null, null,
Speed.of(0))) Speed.of(0)))
.setAltitudeGain(0f)
), importedTrackPoints); ), importedTrackPoints);
} }
@@ -29,13 +29,9 @@ public class TrackPointAssert {
Assert.assertEquals("altitude", expected.getAltitude().toM(), actual.getAltitude().toM(), delta); Assert.assertEquals("altitude", expected.getAltitude().toM(), actual.getAltitude().toM(), delta);
} }
Assert.assertEquals("has altitudeGain", expected.hasAltitudeGain(), actual.hasAltitudeGain()); Assert.assertEquals("has altitudeGainLoss", expected.hasAltitudeGainLoss(), actual.hasAltitudeGainLoss());
if (expected.hasAltitudeGain()) { if (expected.hasAltitudeGainLoss()) {
Assert.assertEquals("altitudeGain", expected.getAltitudeGain(), actual.getAltitudeGain(), delta); Assert.assertEquals("altitudeGainLoss", expected.getAltitudeGainLoss(), actual.getAltitudeGainLoss());
}
Assert.assertEquals("has altitudeLoss", expected.hasAltitudeLoss(), actual.hasAltitudeLoss());
if (expected.hasAltitudeLoss()) {
Assert.assertEquals("altitudeLoss", expected.getAltitudeLoss(), actual.getAltitudeLoss(), delta);
} }
Assert.assertEquals("has speed", expected.hasSpeed(), actual.hasSpeed()); Assert.assertEquals("has speed", expected.hasSpeed(), actual.hasSpeed());
@@ -127,8 +127,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -199,8 +198,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
//when //when
@@ -215,8 +213,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(resumeTime)) new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(resumeTime))
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -249,8 +246,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(starTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(starTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(pauseTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), trackPoints); ), trackPoints);
} }
@@ -279,8 +275,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(resumeTime)) new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(resumeTime))
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -316,12 +311,10 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse(sensor3)) new TrackPoint(TrackPoint.Type.TRACKPOINT, Instant.parse(sensor3))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
.setHeartRate(HeartRate.of(7)), .setHeartRate(HeartRate.of(7)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
.setHeartRate(HeartRate.of(7)) .setHeartRate(HeartRate.of(7))
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -379,8 +372,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse(gps2), Instant.parse(gps2),
@@ -388,8 +380,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse(gps3), Instant.parse(gps3),
@@ -397,11 +388,9 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -455,8 +444,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse(gps3), Instant.parse(gps3),
@@ -464,8 +452,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL,
new Position( new Position(
Instant.parse(stopTime), Instant.parse(stopTime),
@@ -473,8 +460,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -516,8 +502,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.TRACKPOINT, new TrackPoint(TrackPoint.Type.TRACKPOINT,
new Position( new Position(
Instant.parse(gps3), Instant.parse(gps3),
@@ -525,11 +510,9 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -573,8 +556,7 @@ public class TrackRecordingServiceRecordingTest {
new TrackPointAssert().assertEquals(List.of( new TrackPointAssert().assertEquals(List.of(
new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)), new TrackPoint(TrackPoint.Type.SEGMENT_START_MANUAL, Instant.parse(startTime)),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -624,8 +606,7 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC, new TrackPoint(TrackPoint.Type.SEGMENT_START_AUTOMATIC,
new Position( new Position(
Instant.parse(gps2), Instant.parse(gps2),
@@ -633,11 +614,9 @@ public class TrackRecordingServiceRecordingTest {
null, null, null, null,
null, null,
Speed.of(15))) Speed.of(15)))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0),
.setAltitudeLoss(0f),
new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime)) new TrackPoint(TrackPoint.Type.SEGMENT_END_MANUAL, Instant.parse(stopTime))
.setAltitudeGain(0f) .setAltitudeGainLoss(0, 0)
.setAltitudeLoss(0f)
), TestDataUtil.getTrackPoints(contentProviderUtils, trackId)); ), TestDataUtil.getTrackPoints(contentProviderUtils, trackId));
} }
@@ -105,7 +105,7 @@ public class IntervalStatisticsUpdaterTest {
ArrayList<TrackPoint> trackPoints = new ArrayList<>(); ArrayList<TrackPoint> trackPoints = new ArrayList<>();
for (int i = 0; i < numberOfPoints; i++) { for (int i = 0; i < numberOfPoints; i++) {
trackPoints.add(TestDataUtil.createTrackPoint(i).setAltitudeLoss(null)); trackPoints.add(TestDataUtil.createTrackPoint(i).setAltitudeGainLoss(null));
} }
trackStatisticsUpdater.addTrackPoints(trackPoints); trackStatisticsUpdater.addTrackPoints(trackPoints);
@@ -74,7 +74,6 @@ Average moving pace: 0:00 min/km (0:00 min/mi)
Fastest pace: 0:00 min/km (0:00 min/mi) Fastest pace: 0:00 min/km (0:00 min/mi)
Max elevation: -9223372036854775808 m (-9223372036854775808 ft) Max elevation: -9223372036854775808 m (-9223372036854775808 ft)
Min elevation: 9223372036854775807 m (9223372036854775807 ft) Min elevation: 9223372036854775807 m (9223372036854775807 ft)
Elevation gain: 0 m (0 ft)
Max grade: 0 % Max grade: 0 %
Min grade: 0 % Min grade: 0 %
Recorded: 6/23 11:29]]></description> Recorded: 6/23 11:29]]></description>
@@ -126,11 +125,6 @@ Recorded: 6/23 11:29]]></description>
<gx:value>0.15777911</gx:value> <gx:value>0.15777911</gx:value>
<gx:value>0.0</gx:value> <gx:value>0.0</gx:value>
</gx:SimpleArrayData> </gx:SimpleArrayData>
<gx:SimpleArrayData name="elevation_gain">
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
</gx:SimpleArrayData>
</SchemaData> </SchemaData>
</ExtendedData> </ExtendedData>
</gx:Track> </gx:Track>
@@ -148,14 +142,6 @@ Recorded: 6/23 11:29]]></description>
<gx:value>0.0</gx:value> <gx:value>0.0</gx:value>
<gx:value>0.0</gx:value> <gx:value>0.0</gx:value>
</gx:SimpleArrayData> </gx:SimpleArrayData>
<gx:SimpleArrayData name="elevation_gain">
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
<gx:value>0.0</gx:value>
</gx:SimpleArrayData>
</SchemaData> </SchemaData>
</ExtendedData> </ExtendedData>
</gx:Track> </gx:Track>
@@ -179,7 +165,6 @@ Average moving pace: 0:00 min/km (0:00 min/mi)
Fastest pace: 0:00 min/km (0:00 min/mi) Fastest pace: 0:00 min/km (0:00 min/mi)
Max elevation: 469 m (1540 ft) Max elevation: 469 m (1540 ft)
Min elevation: 419 m (1376 ft) Min elevation: 419 m (1376 ft)
Elevation gain: 0 m (0 ft)
Recorded: 11/28 18:06]]></description> Recorded: 11/28 18:06]]></description>
<TimeStamp> <TimeStamp>
<when>2020-11-28T17:07:20.870Z</when> <when>2020-11-28T17:07:20.870Z</when>
@@ -652,11 +652,8 @@ public class ContentProviderUtils {
trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex)); trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex));
} }
if (!cursor.isNull(indexes.altitudeGainIndex)) { if (!cursor.isNull(indexes.altitudeGainIndex) && !cursor.isNull(indexes.altitudeLossIndex)) {
trackPoint.setAltitudeGain(cursor.getFloat(indexes.altitudeGainIndex)); trackPoint.setAltitudeGainLoss(cursor.getFloat(indexes.altitudeGainIndex), cursor.getFloat(indexes.altitudeLossIndex));
}
if (!cursor.isNull(indexes.altitudeLossIndex)) {
trackPoint.setAltitudeLoss(cursor.getFloat(indexes.altitudeLossIndex));
} }
return trackPoint; return trackPoint;
@@ -810,13 +807,10 @@ public class ContentProviderUtils {
values.put(TrackPointsColumns.SENSOR_POWER, trackPoint.getPower().getW()); values.put(TrackPointsColumns.SENSOR_POWER, trackPoint.getPower().getW());
} }
if (trackPoint.hasAltitudeGain()) { if (trackPoint.hasAltitudeGainLoss()) {
values.put(TrackPointsColumns.ALTITUDE_GAIN, trackPoint.getAltitudeGain()); values.put(TrackPointsColumns.ALTITUDE_GAIN, trackPoint.getAltitudeGainLoss().gain_m());
values.put(TrackPointsColumns.ALTITUDE_LOSS, trackPoint.getAltitudeGainLoss().loss_m());
} }
if (trackPoint.hasAltitudeLoss()) {
values.put(TrackPointsColumns.ALTITUDE_LOSS, trackPoint.getAltitudeLoss());
}
return values; return values;
} }
@@ -83,9 +83,7 @@ public class TrackPoint {
private HeartRate heartRate = null; private HeartRate heartRate = null;
private Cadence cadence = null; private Cadence cadence = null;
private Power power = null; private Power power = null;
//TODO Use AltitudeGainLoss private AltitudeGainLoss altitudeGainLoss = null;
private Float altitudeGain_m = null;
private Float altitudeLoss_m = null;
public TrackPoint(@Nullable TrackPoint.Id id, @NonNull Type type, @NonNull Position position) { public TrackPoint(@Nullable TrackPoint.Id id, @NonNull Type type, @NonNull Position position) {
this.id = id; this.id = id;
@@ -164,31 +162,21 @@ public class TrackPoint {
return getPosition().toLocation(); return getPosition().toLocation();
} }
public boolean hasAltitudeGain() { public boolean hasAltitudeGainLoss() {
return altitudeGain_m != null; return altitudeGainLoss != null;
} }
public float getAltitudeGain() { public AltitudeGainLoss getAltitudeGainLoss() {
return altitudeGain_m; return altitudeGainLoss;
} }
@Deprecated public TrackPoint setAltitudeGainLoss(AltitudeGainLoss altitudeGainLoss) {
public TrackPoint setAltitudeGain(Float altitudeGain_m) { this.altitudeGainLoss = altitudeGainLoss;
this.altitudeGain_m = altitudeGain_m;
return this; return this;
} }
public boolean hasAltitudeLoss() { public TrackPoint setAltitudeGainLoss(float altitudeGain_m, float altitudeLoss_m) {
return altitudeLoss_m != null; setAltitudeGainLoss(new AltitudeGainLoss(altitudeGain_m, altitudeLoss_m));
}
public float getAltitudeLoss() {
return altitudeLoss_m;
}
@Deprecated
public TrackPoint setAltitudeLoss(Float altitudeLoss_m) {
this.altitudeLoss_m = altitudeLoss_m;
return this; return this;
} }
@@ -327,11 +315,10 @@ public class TrackPoint {
if (hasSensorDistance() && lastTrackPoint.hasSensorDistance()) { if (hasSensorDistance() && lastTrackPoint.hasSensorDistance()) {
sensorDistance = sensorDistance.minus(lastTrackPoint.getSensorDistance()); sensorDistance = sensorDistance.minus(lastTrackPoint.getSensorDistance());
} }
if (hasAltitudeGain() && lastTrackPoint.hasAltitudeGain()) { if (hasAltitudeGainLoss() && lastTrackPoint.hasAltitudeGainLoss()) {
altitudeGain_m -= lastTrackPoint.altitudeGain_m; altitudeGainLoss = new AltitudeGainLoss(
} altitudeGainLoss.gain_m() - lastTrackPoint.altitudeGainLoss.gain_m(),
if (hasAltitudeLoss() && lastTrackPoint.hasAltitudeLoss()) { altitudeGainLoss.loss_m() - lastTrackPoint.altitudeGainLoss.loss_m());
altitudeLoss_m -= lastTrackPoint.altitudeLoss_m;
} }
return this; return this;
} }
@@ -398,8 +385,7 @@ public class TrackPoint {
", heartRate=" + heartRate + ", heartRate=" + heartRate +
", cadence=" + cadence + ", cadence=" + cadence +
", power=" + power + ", power=" + power +
", altitudeGain_m=" + altitudeGain_m + ", altitudeGainLoss=" + altitudeGainLoss +
", altitudeLoss_m=" + altitudeLoss_m +
'}'; '}';
} }
@@ -98,8 +98,8 @@ public class CSVTrackExporter implements TrackExporter {
new Column("accuracy_vertical", t -> t.hasVerticalAccuracy() ? DISTANCE_FORMAT.format(t.getVerticalAccuracy().toM()) : ""), new Column("accuracy_vertical", t -> t.hasVerticalAccuracy() ? DISTANCE_FORMAT.format(t.getVerticalAccuracy().toM()) : ""),
new Column("speed", t -> t.hasSpeed() ? SPEED_FORMAT.format(t.getSpeed().toKMH()) : ""), new Column("speed", t -> t.hasSpeed() ? SPEED_FORMAT.format(t.getSpeed().toKMH()) : ""),
new Column("altitude_gain", t -> t.hasAltitudeGain() ? ALTITUDE_FORMAT.format(t.getAltitudeGain()) : ""), new Column("altitude_gain", t -> t.hasAltitudeGainLoss() ? ALTITUDE_FORMAT.format(t.getAltitudeGainLoss().gain_m()) : ""),
new Column("altitude_loss", t -> t.hasAltitudeLoss() ? ALTITUDE_FORMAT.format(t.getAltitudeLoss()) : ""), new Column("altitude_loss", t -> t.hasAltitudeGainLoss() ? ALTITUDE_FORMAT.format(t.getAltitudeGainLoss().loss_m()) : ""),
new Column("sensor_distance", t -> t.hasSensorDistance() ? DISTANCE_FORMAT.format(t.getSensorDistance().toM()) : ""), new Column("sensor_distance", t -> t.hasSensorDistance() ? DISTANCE_FORMAT.format(t.getSensorDistance().toM()) : ""),
new Column("heartrate", t -> t.hasHeartRate() ? HEARTRATE_FORMAT.format(t.getHeartRate().getBPM()) : ""), new Column("heartrate", t -> t.hasHeartRate() ? HEARTRATE_FORMAT.format(t.getHeartRate().getBPM()) : ""),
new Column("cadence", t -> t.hasCadence() ? CADENCE_FORMAT.format(t.getCadence().getRPM()) : ""), new Column("cadence", t -> t.hasCadence() ? CADENCE_FORMAT.format(t.getCadence().getRPM()) : ""),
@@ -338,12 +338,12 @@ public class GPXTrackExporter implements TrackExporter {
extensionContent += "<pwr:PowerInWatts>" + POWER_FORMAT.format(trackPoint.getPower().getW()) + "</pwr:PowerInWatts>\n"; extensionContent += "<pwr:PowerInWatts>" + POWER_FORMAT.format(trackPoint.getPower().getW()) + "</pwr:PowerInWatts>\n";
} }
Double cumulativeGain = cumulateSensorData(trackPoint, sensorPoints, (tp) -> tp.hasAltitudeGain() ? (double) tp.getAltitudeGain() : null); Double cumulativeGain = cumulateSensorData(trackPoint, sensorPoints, (tp) -> tp.hasAltitudeGainLoss() ? (double) tp.getAltitudeGainLoss().gain_m() : null);
if (cumulativeGain != null) { if (cumulativeGain != null) {
extensionContent += ("<opentracks:gain>" + ALTITUDE_FORMAT.format(cumulativeGain) + "</opentracks:gain>\n"); extensionContent += ("<opentracks:gain>" + ALTITUDE_FORMAT.format(cumulativeGain) + "</opentracks:gain>\n");
} }
Double cumulativeLoss = cumulateSensorData(trackPoint, sensorPoints, (tp) -> tp.hasAltitudeLoss() ? (double) tp.getAltitudeLoss() : null); Double cumulativeLoss = cumulateSensorData(trackPoint, sensorPoints, (tp) -> tp.hasAltitudeGainLoss() ? (double) tp.getAltitudeGainLoss().loss_m() : null);
if (cumulativeLoss != null) { if (cumulativeLoss != null) {
extensionContent += ("<opentracks:loss>" + ALTITUDE_FORMAT.format(cumulativeLoss) + "</opentracks:loss>\n"); extensionContent += ("<opentracks:loss>" + ALTITUDE_FORMAT.format(cumulativeLoss) + "</opentracks:loss>\n");
} }
@@ -384,9 +384,13 @@ public class KMLTrackExporter implements TrackExporter {
heartRateList.add(trackPoint.hasHeartRate() ? trackPoint.getHeartRate().getBPM() : null); heartRateList.add(trackPoint.hasHeartRate() ? trackPoint.getHeartRate().getBPM() : null);
cadenceList.add(trackPoint.hasCadence() ? trackPoint.getCadence().getRPM() : null); cadenceList.add(trackPoint.hasCadence() ? trackPoint.getCadence().getRPM() : null);
powerList.add(trackPoint.hasPower() ? trackPoint.getPower().getW() : null); powerList.add(trackPoint.hasPower() ? trackPoint.getPower().getW() : null);
if (trackPoint.hasAltitudeGainLoss()) {
altitudeGainList.add(trackPoint.hasAltitudeGain() ? trackPoint.getAltitudeGain() : null); altitudeGainList.add(trackPoint.getAltitudeGainLoss().loss_m());
altitudeLossList.add(trackPoint.hasAltitudeLoss() ? trackPoint.getAltitudeLoss() : null); altitudeLossList.add(trackPoint.getAltitudeGainLoss().loss_m());
} else {
altitudeGainList.add(null);
altitudeLossList.add(null);
}
accuracyHorizontal.add(trackPoint.hasHorizontalAccuracy() ? (float) trackPoint.getHorizontalAccuracy().toM() : null); accuracyHorizontal.add(trackPoint.hasHorizontalAccuracy() ? (float) trackPoint.getHorizontalAccuracy().toM() : null);
accuracyVertical.add(trackPoint.hasVerticalAccuracy() ? (float) trackPoint.getVerticalAccuracy().toM() : null); accuracyVertical.add(trackPoint.hasVerticalAccuracy() ? (float) trackPoint.getVerticalAccuracy().toM() : null);
} }
@@ -369,18 +369,11 @@ public class GPXTrackImporter extends DefaultHandler implements XMLImporter.Trac
} }
} }
if (gain != null) { if (gain != null && loss != null) {
try { try {
trackPoint.setAltitudeGain(Float.parseFloat(gain)); trackPoint.setAltitudeGainLoss(Float.parseFloat(gain), Float.parseFloat(loss));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw new ParsingException(createErrorMessage(String.format(Locale.US, "Unable to parse altitude gain: %s", gain)), e); throw new ParsingException(createErrorMessage(String.format(Locale.US, "Unable to parse altitude gain: %s or los: %s", gain, loss)), e);
}
}
if (loss != null) {
try {
trackPoint.setAltitudeLoss(Float.parseFloat(loss));
} catch (NumberFormatException e) {
throw new ParsingException(createErrorMessage(String.format(Locale.US, "Unable to parse altitude loss: %s", loss)), e);
} }
} }
if (sensorDistance != null) { if (sensorDistance != null) {
@@ -342,11 +342,10 @@ public class KMLTrackImporter extends DefaultHandler implements XMLImporter.Trac
if (i < sensorPowerList.size() && sensorPowerList.get(i) != null) { if (i < sensorPowerList.size() && sensorPowerList.get(i) != null) {
trackPoint.setPower(sensorPowerList.get(i)); trackPoint.setPower(sensorPowerList.get(i));
} }
if (i < altitudeGainList.size()) { if (i < altitudeGainList.size() && i < altitudeLossList.size()) {
trackPoint.setAltitudeGain(altitudeGainList.get(i)); if (altitudeGainList.get(i) != null && altitudeLossList.get(i) != null) {
} trackPoint.setAltitudeGainLoss(altitudeGainList.get(i), altitudeLossList.get(i));
if (i < altitudeLossList.size()) { }
trackPoint.setAltitudeLoss(altitudeLossList.get(i));
} }
if (i < accuracyHorizontal.size() && accuracyHorizontal.get(i) != null) { if (i < accuracyHorizontal.size() && accuracyHorizontal.get(i) != null) {
trackPoint.setHorizontalAccuracy(Distance.of(accuracyHorizontal.get(i))); trackPoint.setHorizontalAccuracy(Distance.of(accuracyHorizontal.get(i)));
@@ -185,8 +185,7 @@ public class SensorDataSet {
} }
if (barometer != null && barometer.hasReceivedData()) { if (barometer != null && barometer.hasReceivedData()) {
trackPoint.setAltitudeGain(barometer.getAggregatedValue(trackPointCreator.createNow()).gain_m()); trackPoint.setAltitudeGainLoss(barometer.getAggregatedValue(trackPointCreator.createNow()).gain_m(), barometer.getAggregatedValue(trackPointCreator.createNow()).loss_m());
trackPoint.setAltitudeLoss(barometer.getAggregatedValue(trackPointCreator.createNow()).loss_m());
} }
} }
@@ -360,42 +360,37 @@ public class SegmentStatisticUpdater {
} }
} }
@VisibleForTesting
@Deprecated
@Nullable @Nullable
public Float getTotalAltitudeGain() { public Float getTotalAltitudeGain() {
return totalAltitudeGain_m; return totalAltitudeGain_m;
} }
@VisibleForTesting
@Deprecated
public void setTotalAltitudeGain(Float totalAltitudeGain_m) { public void setTotalAltitudeGain(Float totalAltitudeGain_m) {
this.totalAltitudeGain_m = totalAltitudeGain_m; this.totalAltitudeGain_m = totalAltitudeGain_m;
} }
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @VisibleForTesting
public void addTotalAltitudeGain(float gain_m) { @Deprecated
if (totalAltitudeGain_m == null) {
totalAltitudeGain_m = 0f;
}
totalAltitudeGain_m += gain_m;
}
public boolean hasTotalAltitudeLoss() {
return totalAltitudeLoss_m != null;
}
@Nullable @Nullable
public Float getTotalAltitudeLoss() { public Float getTotalAltitudeLoss() {
return totalAltitudeLoss_m; return totalAltitudeLoss_m;
} }
public void setTotalAltitudeLoss(Float totalAltitudeLoss_m) {
this.totalAltitudeLoss_m = totalAltitudeLoss_m;
}
@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
public void addTotalAltitudeLoss(float loss_m) { public void addTotalAltitudeGainLoss(AltitudeGainLoss altitudeGainLoss) {
if (totalAltitudeGain_m == null) {
totalAltitudeGain_m = 0f;
}
totalAltitudeGain_m += altitudeGainLoss.gain_m();
if (totalAltitudeLoss_m == null) { if (totalAltitudeLoss_m == null) {
totalAltitudeLoss_m = 0f; totalAltitudeLoss_m = 0f;
} }
totalAltitudeLoss_m += loss_m; totalAltitudeLoss_m += altitudeGainLoss.loss_m();
} }
@NonNull @NonNull
@@ -114,12 +114,8 @@ public class TrackStatisticsUpdater {
currentSegment.setTotalTime(Duration.between(currentSegment.getStartTime(), trackPoint.getTime())); currentSegment.setTotalTime(Duration.between(currentSegment.getStartTime(), trackPoint.getTime()));
// Process sensor data: barometer // Process sensor data: barometer
if (trackPoint.hasAltitudeGain()) { if (trackPoint.hasAltitudeGainLoss()) {
currentSegment.addTotalAltitudeGain(trackPoint.getAltitudeGain()); currentSegment.addTotalAltitudeGainLoss(trackPoint.getAltitudeGainLoss());
}
if (trackPoint.hasAltitudeLoss()) {
currentSegment.addTotalAltitudeLoss(trackPoint.getAltitudeLoss());
} }
//Update absolute (GPS-based) altitude //Update absolute (GPS-based) altitude
@@ -185,11 +185,9 @@ public class IntervalStatisticsUpdater {
if (lastTrackPoint == null) { if (lastTrackPoint == null) {
return; return;
} }
if (hasGain() && lastTrackPoint.hasAltitudeGain()) { if (hasGain() && lastTrackPoint.hasAltitudeGainLoss()) {
gain_m = gain_m - lastTrackPoint.getAltitudeGain(); gain_m = gain_m - lastTrackPoint.getAltitudeGainLoss().gain_m();
} loss_m = loss_m - lastTrackPoint.getAltitudeGainLoss().loss_m();
if (hasLoss() && lastTrackPoint.hasAltitudeLoss()) {
loss_m = loss_m - lastTrackPoint.getAltitudeLoss();
} }
} }