Renamed SensorDataSetLocation to TrackPoint (similar to SQLite table).

This commit is contained in:
Dennis Guse
2019-12-27 18:00:51 +01:00
parent 5cb7b623d9
commit 4129985b0f
10 changed files with 48 additions and 48 deletions
@@ -18,7 +18,7 @@ package de.dennisguse.opentracks;
import android.location.Location; import android.location.Location;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
@@ -60,16 +60,16 @@ public class TrackStubUtils {
* *
* @return a track stub. * @return a track stub.
*/ */
public static SensorDataSetLocation createSensorDataSetLocation() { public static TrackPoint createSensorDataSetLocation() {
return createSensorDataSetLocation(INITIAL_LATITUDE, INITIAL_LONGITUDE, INITIAL_ALTITUDE); return createSensorDataSetLocation(INITIAL_LATITUDE, INITIAL_LONGITUDE, INITIAL_ALTITUDE);
} }
/** /**
* Creates a {@link SensorDataSetLocation} stub with specified values. * Creates a {@link TrackPoint} stub with specified values.
* *
* @return a SensorDataSetLocation stub. * @return a SensorDataSetLocation stub.
*/ */
private static SensorDataSetLocation createSensorDataSetLocation(double latitude, double longitude, double altitude) { private static TrackPoint createSensorDataSetLocation(double latitude, double longitude, double altitude) {
// Initial Location // Initial Location
Location loc = new Location(LOCATION_PROVIDER); Location loc = new Location(LOCATION_PROVIDER);
loc.setLatitude(latitude); loc.setLatitude(latitude);
@@ -81,6 +81,6 @@ public class TrackStubUtils {
loc.setBearing(INITIAL_BEARING); loc.setBearing(INITIAL_BEARING);
SensorDataSet sd = new SensorDataSet(Float.NaN, Float.NaN); SensorDataSet sd = new SensorDataSet(Float.NaN, Float.NaN);
return new SensorDataSetLocation(loc, sd); return new TrackPoint(loc, sd);
} }
} }
@@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
import de.dennisguse.opentracks.TrackStubUtils; import de.dennisguse.opentracks.TrackStubUtils;
import de.dennisguse.opentracks.chart.ChartView; import de.dennisguse.opentracks.chart.ChartView;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
import de.dennisguse.opentracks.util.UnitConversions; import de.dennisguse.opentracks.util.UnitConversions;
@@ -72,7 +72,7 @@ public class ChartFragmentTest {
*/ */
@Test @Test
public void testFillDataPoint_sensorIncorrect() { public void testFillDataPoint_sensorIncorrect() {
SensorDataSetLocation sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation();
// No input. // No input.
double[] point = fillDataPointTestHelper(sensorDataSetLocation); double[] point = fillDataPointTestHelper(sensorDataSetLocation);
@@ -96,7 +96,7 @@ public class ChartFragmentTest {
*/ */
@Test @Test
public void testFillDataPoint_sensorCorrect() { public void testFillDataPoint_sensorCorrect() {
SensorDataSetLocation sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation();
// No input. // No input.
double[] point = fillDataPointTestHelper(sensorDataSetLocation); double[] point = fillDataPointTestHelper(sensorDataSetLocation);
Assert.assertEquals(Float.NaN, point[ChartView.HEART_RATE_SERIES + 1], 0.01); Assert.assertEquals(Float.NaN, point[ChartView.HEART_RATE_SERIES + 1], 0.01);
@@ -123,17 +123,17 @@ public class ChartFragmentTest {
// By distance. // By distance.
chartFragment.setChartByDistance(true); chartFragment.setChartByDistance(true);
// Resets last location and writes first location. // Resets last location and writes first location.
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[0], 0.01); Assert.assertEquals(0.0, point[0], 0.01);
// The second is a same location, just different time. // The second is a same location, just different time.
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
point = fillDataPointTestHelper(sensorDataSetLocation2); point = fillDataPointTestHelper(sensorDataSetLocation2);
Assert.assertEquals(0.0, point[0], 0.01); Assert.assertEquals(0.0, point[0], 0.01);
// The third location is a new location, and use metric. // The third location is a new location, and use metric.
SensorDataSetLocation sensorDataSetLocation3 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation3 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation3.setLatitude(23); sensorDataSetLocation3.setLatitude(23);
point = fillDataPointTestHelper(sensorDataSetLocation3); point = fillDataPointTestHelper(sensorDataSetLocation3);
@@ -145,7 +145,7 @@ public class ChartFragmentTest {
Assert.assertEquals(distance1, point[0], 0.01); Assert.assertEquals(distance1, point[0], 0.01);
// The fourth location is a new location, and use metric. // The fourth location is a new location, and use metric.
SensorDataSetLocation sensorDataSetLocation4 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation4 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation4.setLatitude(24); sensorDataSetLocation4.setLatitude(24);
point = fillDataPointTestHelper(sensorDataSetLocation4); point = fillDataPointTestHelper(sensorDataSetLocation4);
@@ -167,12 +167,12 @@ public class ChartFragmentTest {
chartFragment.setMetricUnits(false); chartFragment.setMetricUnits(false);
// The first is a same location, just different time. // The first is a same location, just different time.
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[0], 0.01); Assert.assertEquals(0.0, point[0], 0.01);
// The second location is a new location, and use imperial. // The second location is a new location, and use imperial.
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation2.setLatitude(23); sensorDataSetLocation2.setLatitude(23);
point = fillDataPointTestHelper(sensorDataSetLocation2); point = fillDataPointTestHelper(sensorDataSetLocation2);
@@ -186,7 +186,7 @@ public class ChartFragmentTest {
Assert.assertEquals(distance1, point[0], 0.01); Assert.assertEquals(distance1, point[0], 0.01);
// The third location is a new location, and use imperial. // The third location is a new location, and use imperial.
SensorDataSetLocation sensorDataSetLocation3 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation3 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation3.setLatitude(24); sensorDataSetLocation3.setLatitude(24);
point = fillDataPointTestHelper(sensorDataSetLocation3); point = fillDataPointTestHelper(sensorDataSetLocation3);
@@ -206,11 +206,11 @@ public class ChartFragmentTest {
public void testFillDataPoint_time() { public void testFillDataPoint_time() {
// By time // By time
chartFragment.setChartByDistance(false); chartFragment.setChartByDistance(false);
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[0], 0.01); Assert.assertEquals(0.0, point[0], 0.01);
long timeSpan = 222; long timeSpan = 222;
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation2.setTime(sensorDataSetLocation1.getTime() + timeSpan); sensorDataSetLocation2.setTime(sensorDataSetLocation1.getTime() + timeSpan);
point = fillDataPointTestHelper(sensorDataSetLocation2); point = fillDataPointTestHelper(sensorDataSetLocation2);
Assert.assertEquals((double) timeSpan, point[0], 0.01); Assert.assertEquals((double) timeSpan, point[0], 0.01);
@@ -221,7 +221,7 @@ public class ChartFragmentTest {
*/ */
@Test @Test
public void testFillDataPoint_elevation() { public void testFillDataPoint_elevation() {
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
/* /*
* At first, clear old points of elevation, so give true to the second parameter. * At first, clear old points of elevation, so give true to the second parameter.
@@ -233,7 +233,7 @@ public class ChartFragmentTest {
/* /*
* Send another value to buffer, now there are two values, INITIAL_ALTITUDE and INITIAL_ALTITUDE * 2. * Send another value to buffer, now there are two values, INITIAL_ALTITUDE and INITIAL_ALTITUDE * 2.
*/ */
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation2.setAltitude(TrackStubUtils.INITIAL_ALTITUDE * 2); sensorDataSetLocation2.setAltitude(TrackStubUtils.INITIAL_ALTITUDE * 2);
point = fillDataPointTestHelper(sensorDataSetLocation2); point = fillDataPointTestHelper(sensorDataSetLocation2);
Assert.assertEquals((TrackStubUtils.INITIAL_ALTITUDE + TrackStubUtils.INITIAL_ALTITUDE * 2) / 2.0, Assert.assertEquals((TrackStubUtils.INITIAL_ALTITUDE + TrackStubUtils.INITIAL_ALTITUDE * 2) / 2.0,
@@ -251,7 +251,7 @@ public class ChartFragmentTest {
* At first, clear old points of speed, so give true to the second parameter. * At first, clear old points of speed, so give true to the second parameter.
* It will not be filled in to the speed buffer. * It will not be filled in to the speed buffer.
*/ */
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation1.setSpeed(128.5f); sensorDataSetLocation1.setSpeed(128.5f);
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01); Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01);
@@ -260,7 +260,7 @@ public class ChartFragmentTest {
* Tests the logic when both metricUnits and reportSpeed are true. * Tests the logic when both metricUnits and reportSpeed are true.
* This location will be filled into speed buffer. * This location will be filled into speed buffer.
*/ */
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
/* /*
* Add a time span here to make sure the second point is valid, the value 222 here is doesn't matter. * Add a time span here to make sure the second point is valid, the value 222 here is doesn't matter.
@@ -280,12 +280,12 @@ public class ChartFragmentTest {
chartFragment.setMetricUnits(false); chartFragment.setMetricUnits(false);
// First data point is not added to the speed buffer // First data point is not added to the speed buffer
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation1.setSpeed(100.0f); sensorDataSetLocation1.setSpeed(100.0f);
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01); Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01);
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
/* /*
* Add a time span here to make sure the second point and the speed is valid. * Add a time span here to make sure the second point and the speed is valid.
@@ -306,12 +306,12 @@ public class ChartFragmentTest {
chartFragment.setReportSpeed(false); chartFragment.setReportSpeed(false);
// First data point is not added to the speed buffer // First data point is not added to the speed buffer
SensorDataSetLocation sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation1 = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation1.setSpeed(100.0f); sensorDataSetLocation1.setSpeed(100.0f);
double[] point = fillDataPointTestHelper(sensorDataSetLocation1); double[] point = fillDataPointTestHelper(sensorDataSetLocation1);
Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01); Assert.assertEquals(0.0, point[ChartView.SPEED_SERIES + 1], 0.01);
SensorDataSetLocation sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation2 = TrackStubUtils.createSensorDataSetLocation();
/* /*
* Add a time span here to make sure the second point and the speed is valid. * Add a time span here to make sure the second point and the speed is valid.
@@ -330,7 +330,7 @@ public class ChartFragmentTest {
public void testFillDataPoint_pace_zeroSpeed() { public void testFillDataPoint_pace_zeroSpeed() {
// Setups reportSpeed to false. // Setups reportSpeed to false.
chartFragment.setReportSpeed(false); chartFragment.setReportSpeed(false);
SensorDataSetLocation sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation(); TrackPoint sensorDataSetLocation = TrackStubUtils.createSensorDataSetLocation();
sensorDataSetLocation.setSpeed(0); sensorDataSetLocation.setSpeed(0);
double[] point = fillDataPointTestHelper(sensorDataSetLocation); double[] point = fillDataPointTestHelper(sensorDataSetLocation);
Assert.assertEquals(0.0, point[ChartView.PACE_SERIES + 1], 0.01); Assert.assertEquals(0.0, point[ChartView.PACE_SERIES + 1], 0.01);
@@ -732,7 +732,7 @@ public class ContentProviderUtils {
* @param cursor the cursor pointing to the location * @param cursor the cursor pointing to the location
*/ */
public Location createTrackPoint(Cursor cursor) { public Location createTrackPoint(Cursor cursor) {
Location location = new SensorDataSetLocation(""); Location location = new TrackPoint("");
fillTrackPoint(cursor, new CachedTrackPointsIndexes(cursor), location); fillTrackPoint(cursor, new CachedTrackPointsIndexes(cursor), location);
return location; return location;
} }
@@ -994,8 +994,8 @@ public class ContentProviderUtils {
} }
//SensorData //SensorData
if (location instanceof SensorDataSetLocation) { if (location instanceof TrackPoint) {
SensorDataSetLocation sensorDataSetLocation = (SensorDataSetLocation) location; TrackPoint sensorDataSetLocation = (TrackPoint) location;
SensorDataSet sensorDataSet = sensorDataSetLocation.getSensorDataSet(); SensorDataSet sensorDataSet = sensorDataSetLocation.getSensorDataSet();
if (sensorDataSet != null && sensorDataSet.hasHeartRate()) { if (sensorDataSet != null && sensorDataSet.hasHeartRate()) {
values.put(TrackPointsColumns.SENSOR_HEARTRATE, sensorDataSetLocation.getSensorDataSet().getHeartRate()); values.put(TrackPointsColumns.SENSOR_HEARTRATE, sensorDataSetLocation.getSensorDataSet().getHeartRate());
@@ -1041,8 +1041,8 @@ public class ContentProviderUtils {
if (!cursor.isNull(indexes.bearingIndex)) { if (!cursor.isNull(indexes.bearingIndex)) {
location.setBearing(cursor.getFloat(indexes.bearingIndex)); location.setBearing(cursor.getFloat(indexes.bearingIndex));
} }
if (location instanceof SensorDataSetLocation) { if (location instanceof TrackPoint) {
SensorDataSetLocation sensorDataSetLocation = (SensorDataSetLocation) location; TrackPoint sensorDataSetLocation = (TrackPoint) location;
float heartRate = cursor.isNull(indexes.sensorHeartRateIndex) ? SensorDataSet.DATA_UNAVAILABLE : cursor.getFloat(indexes.sensorHeartRateIndex); float heartRate = cursor.isNull(indexes.sensorHeartRateIndex) ? SensorDataSet.DATA_UNAVAILABLE : cursor.getFloat(indexes.sensorHeartRateIndex);
float cadence = cursor.isNull(indexes.sensorCadenceIndex) ? SensorDataSet.DATA_UNAVAILABLE : cursor.getFloat(indexes.sensorCadenceIndex); float cadence = cursor.isNull(indexes.sensorCadenceIndex) ? SensorDataSet.DATA_UNAVAILABLE : cursor.getFloat(indexes.sensorCadenceIndex);
@@ -4,7 +4,7 @@ import android.location.Location;
import android.location.LocationManager; import android.location.LocationManager;
/** /**
* Creates a new {@link SensorDataSetLocation}. * Creates a new {@link TrackPoint}.
* An implementation can create new instances or reuse existing instances for optimization. * An implementation can create new instances or reuse existing instances for optimization.
*/ */
public class LocationFactory { public class LocationFactory {
@@ -15,6 +15,6 @@ public class LocationFactory {
public static LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory(); public static LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory();
public Location createLocation() { public Location createLocation() {
return new SensorDataSetLocation(LocationManager.GPS_PROVIDER); return new TrackPoint(LocationManager.GPS_PROVIDER);
} }
} }
@@ -24,16 +24,16 @@ import de.dennisguse.opentracks.content.sensor.SensorDataSet;
* *
* @author Sandor Dornbush * @author Sandor Dornbush
*/ */
public class SensorDataSetLocation extends Location { public class TrackPoint extends Location {
private SensorDataSet sensorDataSet = null; private SensorDataSet sensorDataSet = null;
public SensorDataSetLocation(Location location, SensorDataSet sensorDataSet) { public TrackPoint(Location location, SensorDataSet sensorDataSet) {
super(location); super(location);
this.sensorDataSet = sensorDataSet; this.sensorDataSet = sensorDataSet;
} }
public SensorDataSetLocation(String provider) { public TrackPoint(String provider) {
super(provider); super(provider);
} }
@@ -36,10 +36,10 @@ import java.util.List;
import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.TrackDetailActivity; import de.dennisguse.opentracks.TrackDetailActivity;
import de.dennisguse.opentracks.chart.ChartView; import de.dennisguse.opentracks.chart.ChartView;
import de.dennisguse.opentracks.content.SensorDataSetLocation;
import de.dennisguse.opentracks.content.TrackDataHub; import de.dennisguse.opentracks.content.TrackDataHub;
import de.dennisguse.opentracks.content.TrackDataListener; import de.dennisguse.opentracks.content.TrackDataListener;
import de.dennisguse.opentracks.content.TrackDataType; import de.dennisguse.opentracks.content.TrackDataType;
import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.Waypoint; import de.dennisguse.opentracks.content.data.Waypoint;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
@@ -424,8 +424,8 @@ public abstract class ChartFragment extends Fragment implements TrackDataListene
double heartRate = Double.NaN; double heartRate = Double.NaN;
double cadence = Double.NaN; double cadence = Double.NaN;
double power = Double.NaN; double power = Double.NaN;
if (location instanceof SensorDataSetLocation && ((SensorDataSetLocation) location).getSensorDataSet() != null) { if (location instanceof TrackPoint && ((TrackPoint) location).getSensorDataSet() != null) {
SensorDataSet sensorDataSet = ((SensorDataSetLocation) location).getSensorDataSet(); SensorDataSet sensorDataSet = ((TrackPoint) location).getSensorDataSet();
if (sensorDataSet.hasHeartRate()) { if (sensorDataSet.hasHeartRate()) {
heartRate = sensorDataSet.getHeartRate(); heartRate = sensorDataSet.getHeartRate();
} }
@@ -28,7 +28,7 @@ import java.io.OutputStream;
import de.dennisguse.opentracks.content.ContentProviderUtils; import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.LocationFactory; import de.dennisguse.opentracks.content.LocationFactory;
import de.dennisguse.opentracks.content.LocationIterator; import de.dennisguse.opentracks.content.LocationIterator;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.Waypoint; import de.dennisguse.opentracks.content.data.Waypoint;
import de.dennisguse.opentracks.util.LocationUtils; import de.dennisguse.opentracks.util.LocationUtils;
@@ -214,7 +214,7 @@ public class FileTrackExporter implements TrackExporter {
@Override @Override
public Location createLocation() { public Location createLocation() {
if (currentLocation == null) { if (currentLocation == null) {
currentLocation = new SensorDataSetLocation(""); currentLocation = new TrackPoint("");
} }
return currentLocation; return currentLocation;
} }
@@ -28,7 +28,7 @@ import java.util.List;
import de.dennisguse.opentracks.R; import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.content.ContentProviderUtils; import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.DescriptionGenerator; import de.dennisguse.opentracks.content.DescriptionGenerator;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.Waypoint; import de.dennisguse.opentracks.content.data.Waypoint;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
@@ -264,8 +264,8 @@ public class KmlTrackWriter implements TrackWriter {
printWriter.println("<gx:coord>" + getCoordinates(location, " ") + "</gx:coord>"); printWriter.println("<gx:coord>" + getCoordinates(location, " ") + "</gx:coord>");
if (exportSensorData && location instanceof SensorDataSetLocation) { if (exportSensorData && location instanceof TrackPoint) {
SensorDataSet sensorDataSet = ((SensorDataSetLocation) location).getSensorDataSet(); SensorDataSet sensorDataSet = ((TrackPoint) location).getSensorDataSet();
if (sensorDataSet != null) { if (sensorDataSet != null) {
if (sensorDataSet.hasHeartRate()) { if (sensorDataSet.hasHeartRate()) {
heartRateList.add(sensorDataSet.getHeartRate()); heartRateList.add(sensorDataSet.getHeartRate());
@@ -29,7 +29,7 @@ import org.xml.sax.SAXException;
import java.util.ArrayList; import java.util.ArrayList;
import de.dennisguse.opentracks.content.ContentProviderUtils; import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
import de.dennisguse.opentracks.io.file.exporter.KmlTrackWriter; import de.dennisguse.opentracks.io.file.exporter.KmlTrackWriter;
@@ -248,7 +248,7 @@ public class KmlFileTrackImporter extends AbstractFileTrackImporter {
if (!hasSensorData) { if (!hasSensorData) {
insertTrackPoint(location); insertTrackPoint(location);
} else { } else {
SensorDataSetLocation sensorDataSetLocation = new SensorDataSetLocation(location, new SensorDataSet(heartrate, cadence, power, SensorDataSet.DATA_UNAVAILABLE, location.getTime())); TrackPoint sensorDataSetLocation = new TrackPoint(location, new SensorDataSet(heartrate, cadence, power, SensorDataSet.DATA_UNAVAILABLE, location.getTime()));
insertTrackPoint(sensorDataSetLocation); insertTrackPoint(sensorDataSetLocation);
} }
} }
@@ -46,7 +46,7 @@ import de.dennisguse.opentracks.content.ContentProviderUtils;
import de.dennisguse.opentracks.content.CustomContentProvider; import de.dennisguse.opentracks.content.CustomContentProvider;
import de.dennisguse.opentracks.content.LocationFactory; import de.dennisguse.opentracks.content.LocationFactory;
import de.dennisguse.opentracks.content.LocationIterator; import de.dennisguse.opentracks.content.LocationIterator;
import de.dennisguse.opentracks.content.SensorDataSetLocation; import de.dennisguse.opentracks.content.TrackPoint;
import de.dennisguse.opentracks.content.data.Track; import de.dennisguse.opentracks.content.data.Track;
import de.dennisguse.opentracks.content.data.Waypoint; import de.dennisguse.opentracks.content.data.Waypoint;
import de.dennisguse.opentracks.content.sensor.SensorDataSet; import de.dennisguse.opentracks.content.sensor.SensorDataSet;
@@ -612,7 +612,7 @@ public class TrackRecordingService extends Service {
SensorDataSet sensorDataSet = getSensorDataSet(); SensorDataSet sensorDataSet = getSensorDataSet();
if (sensorDataSet != null) { if (sensorDataSet != null) {
location = new SensorDataSetLocation(location, sensorDataSet); location = new TrackPoint(location, sensorDataSet);
} }
// Always insert the first segment location // Always insert the first segment location