forked from upstream-mirrors/OpenTracks
Removed TripStatists min/max latitude/longitude.
This also removed: search does not account for closer tracks (to current position).
This commit is contained in:
@@ -116,10 +116,6 @@ public class ContentProviderUtils {
|
||||
int totalDistanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
|
||||
int totalTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
|
||||
int movingTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.MOVINGTIME);
|
||||
int minLatIndex = cursor.getColumnIndexOrThrow(TracksColumns.MINLAT);
|
||||
int maxLatIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXLAT);
|
||||
int minLonIndex = cursor.getColumnIndexOrThrow(TracksColumns.MINLON);
|
||||
int maxLonIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXLON);
|
||||
int maxSpeedIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXSPEED);
|
||||
int minElevationIndex = cursor.getColumnIndexOrThrow(TracksColumns.MINELEVATION);
|
||||
int maxElevationIndex = cursor.getColumnIndexOrThrow(TracksColumns.MAXELEVATION);
|
||||
@@ -160,13 +156,6 @@ public class ContentProviderUtils {
|
||||
if (!cursor.isNull(movingTimeIndex)) {
|
||||
tripStatistics.setMovingTime(cursor.getLong(movingTimeIndex));
|
||||
}
|
||||
if (!cursor.isNull(minLatIndex) && !cursor.isNull(maxLatIndex) && !cursor.isNull(minLonIndex) && !cursor.isNull(maxLonIndex)) {
|
||||
int bottom = cursor.getInt(minLatIndex);
|
||||
int top = cursor.getInt(maxLatIndex);
|
||||
int left = cursor.getInt(minLonIndex);
|
||||
int right = cursor.getInt(maxLonIndex);
|
||||
tripStatistics.setBounds(left, top, right, bottom);
|
||||
}
|
||||
if (!cursor.isNull(maxSpeedIndex)) {
|
||||
tripStatistics.setMaxSpeed(cursor.getFloat(maxSpeedIndex));
|
||||
}
|
||||
@@ -350,10 +339,6 @@ public class ContentProviderUtils {
|
||||
values.put(TracksColumns.TOTALDISTANCE, tripStatistics.getTotalDistance());
|
||||
values.put(TracksColumns.TOTALTIME, tripStatistics.getTotalTime());
|
||||
values.put(TracksColumns.MOVINGTIME, tripStatistics.getMovingTime());
|
||||
values.put(TracksColumns.MINLAT, tripStatistics.getBottom());
|
||||
values.put(TracksColumns.MAXLAT, tripStatistics.getTop());
|
||||
values.put(TracksColumns.MINLON, tripStatistics.getLeft());
|
||||
values.put(TracksColumns.MAXLON, tripStatistics.getRight());
|
||||
values.put(TracksColumns.AVGSPEED, tripStatistics.getAverageSpeed());
|
||||
values.put(TracksColumns.AVGMOVINGSPEED, tripStatistics.getAverageMovingSpeed());
|
||||
values.put(TracksColumns.MAXSPEED, tripStatistics.getMaxSpeed());
|
||||
|
||||
@@ -247,7 +247,6 @@ public class SearchEngine {
|
||||
score *= getTitleBoost(query, track.getName(), track.getDescription(), track.getCategory());
|
||||
|
||||
TripStatistics statistics = track.getTripStatistics();
|
||||
score *= getDistanceBoost(query, statistics.getMeanLatitude(), statistics.getMeanLongitude());
|
||||
|
||||
long meanTimestamp = (statistics.getStartTime() + statistics.getStopTime()) / 2L;
|
||||
score *= getTimeBoost(query, meanTimestamp);
|
||||
|
||||
@@ -48,14 +48,18 @@ public interface TracksColumns extends BaseColumns {
|
||||
String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
String TOTALTIME = "totaltime"; // total time
|
||||
String MOVINGTIME = "movingtime"; // moving time
|
||||
String MINLAT = "minlat"; // minimum latitude
|
||||
String MAXLAT = "maxlat"; // maximum latitude
|
||||
String MINLON = "minlon"; // minimum longitude
|
||||
String MAXLON = "maxlon"; // maximum longitude
|
||||
String AVGSPEED = "avgspeed"; // average speed
|
||||
|
||||
// average moving speed
|
||||
String AVGMOVINGSPEED = "avgmovingspeed";
|
||||
@Deprecated
|
||||
String MINLAT = "minlat"; // minimum latitude // TODO UNUSED
|
||||
@Deprecated
|
||||
String MAXLAT = "maxlat"; // maximum latitude // TODO UNUSED
|
||||
@Deprecated
|
||||
String MINLON = "minlon"; // minimum longitude //TODO UNUSED
|
||||
@Deprecated
|
||||
String MAXLON = "maxlon"; // maximum longitude //TODO UNUSED
|
||||
|
||||
String AVGSPEED = "avgspeed"; // average speed
|
||||
String AVGMOVINGSPEED = "avgmovingspeed"; // average moving speed
|
||||
String MAXSPEED = "maxspeed"; // maximum speed
|
||||
String MINELEVATION = "minelevation"; // minimum elevation
|
||||
String MAXELEVATION = "maxelevation"; // maximum elevation
|
||||
|
||||
@@ -26,10 +26,6 @@ import androidx.annotation.NonNull;
|
||||
*/
|
||||
public class TripStatistics {
|
||||
|
||||
// The min and max latitude seen in this trip.
|
||||
private final ExtremityMonitor latitudeExtremities = new ExtremityMonitor();
|
||||
// The min and max longitude seen in this trip.
|
||||
private final ExtremityMonitor longitudeExtremities = new ExtremityMonitor();
|
||||
// The min and max elevation (meters) seen on this trip.
|
||||
private final ExtremityMonitor elevationExtremities = new ExtremityMonitor();
|
||||
// The min and max grade seen on this trip.
|
||||
@@ -64,8 +60,6 @@ public class TripStatistics {
|
||||
totalDistance_m = other.totalDistance_m;
|
||||
totalTime_ms = other.totalTime_ms;
|
||||
movingTime_ms = other.movingTime_ms;
|
||||
latitudeExtremities.set(other.latitudeExtremities.getMin(), other.latitudeExtremities.getMax());
|
||||
longitudeExtremities.set(other.longitudeExtremities.getMin(), other.longitudeExtremities.getMax());
|
||||
maxSpeed_mps = other.maxSpeed_mps;
|
||||
elevationExtremities.set(other.elevationExtremities.getMin(), other.elevationExtremities.getMax());
|
||||
totalElevationGain_m = other.totalElevationGain_m;
|
||||
@@ -84,14 +78,6 @@ public class TripStatistics {
|
||||
totalDistance_m += other.totalDistance_m;
|
||||
totalTime_ms += other.totalTime_ms;
|
||||
movingTime_ms += other.movingTime_ms;
|
||||
if (other.latitudeExtremities.hasData()) {
|
||||
latitudeExtremities.update(other.latitudeExtremities.getMin());
|
||||
latitudeExtremities.update(other.latitudeExtremities.getMax());
|
||||
}
|
||||
if (other.longitudeExtremities.hasData()) {
|
||||
longitudeExtremities.update(other.longitudeExtremities.getMin());
|
||||
longitudeExtremities.update(other.longitudeExtremities.getMax());
|
||||
}
|
||||
maxSpeed_mps = Math.max(maxSpeed_mps, other.maxSpeed_mps);
|
||||
if (other.elevationExtremities.hasData()) {
|
||||
elevationExtremities.update(other.elevationExtremities.getMin());
|
||||
@@ -160,59 +146,6 @@ public class TripStatistics {
|
||||
movingTime_ms += time_ms;
|
||||
}
|
||||
|
||||
public double getTopDegrees() {
|
||||
return latitudeExtremities.getMax();
|
||||
}
|
||||
|
||||
public int getTop() {
|
||||
return (int) (latitudeExtremities.getMax() * 1E6);
|
||||
}
|
||||
|
||||
public double getBottomDegrees() {
|
||||
return latitudeExtremities.getMin();
|
||||
}
|
||||
|
||||
public int getBottom() {
|
||||
return (int) (latitudeExtremities.getMin() * 1E6);
|
||||
}
|
||||
|
||||
public double getLeftDegrees() {
|
||||
return longitudeExtremities.getMin();
|
||||
}
|
||||
|
||||
public int getLeft() {
|
||||
return (int) (longitudeExtremities.getMin() * 1E6);
|
||||
}
|
||||
|
||||
public double getRightDegrees() {
|
||||
return longitudeExtremities.getMax();
|
||||
}
|
||||
|
||||
public int getRight() {
|
||||
return (int) (longitudeExtremities.getMax() * 1E6);
|
||||
}
|
||||
|
||||
public double getMeanLatitude() {
|
||||
return (getBottomDegrees() + getTopDegrees()) / 2.0;
|
||||
}
|
||||
|
||||
public double getMeanLongitude() {
|
||||
return (getLeftDegrees() + getRightDegrees()) / 2.0;
|
||||
}
|
||||
|
||||
public void setBounds(int leftE6, int topE6, int rightE6, int bottomE6) {
|
||||
latitudeExtremities.set(bottomE6 / 1E6, topE6 / 1E6);
|
||||
longitudeExtremities.set(leftE6 / 1E6, rightE6 / 1E6);
|
||||
}
|
||||
|
||||
public void updateLatitudeExtremities(double latitude) {
|
||||
latitudeExtremities.update(latitude);
|
||||
}
|
||||
|
||||
public void updateLongitudeExtremities(double longitude) {
|
||||
longitudeExtremities.update(longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the average speed in meters/second.
|
||||
* This calculation only takes into account the displacement until the last point that was accounted for in statistics.
|
||||
@@ -338,9 +271,7 @@ public class TripStatistics {
|
||||
public String toString() {
|
||||
return "TripStatistics { Start Time: " + getStartTime() + "; Stop Time: " + getStopTime()
|
||||
+ "; Total Distance: " + getTotalDistance() + "; Total Time: " + getTotalTime()
|
||||
+ "; Moving Time: " + getMovingTime() + "; Min Latitude: " + getBottomDegrees()
|
||||
+ "; Max Latitude: " + getTopDegrees() + "; Min Longitude: " + getLeftDegrees()
|
||||
+ "; Max Longitude: " + getRightDegrees() + "; Max Speed: " + getMaxSpeed()
|
||||
+ "; Moving Time: " + getMovingTime() + "; Max Speed: " + getMaxSpeed()
|
||||
+ "; Min Elevation: " + getMinElevation() + "; Max Elevation: " + getMaxElevation()
|
||||
+ "; Elevation Gain: " + getTotalElevationGain() + "; Min Grade: " + getMinGrade()
|
||||
+ "; Max Grade: " + getMaxGrade() + "}";
|
||||
|
||||
@@ -138,9 +138,6 @@ public class TripStatisticsUpdater {
|
||||
return;
|
||||
}
|
||||
|
||||
currentSegment.updateLatitudeExtremities(location.getLatitude());
|
||||
currentSegment.updateLongitudeExtremities(location.getLongitude());
|
||||
|
||||
//TODO Use Barometer to compute elevation gain.
|
||||
double elevationDifference = location.hasAltitude() ? updateElevation(location.getAltitude()) : 0.0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user