Merge remote-tracking branch 'origin/follow-route' into follow-route

This commit is contained in:
Robin Koedood
2021-01-06 16:56:21 +01:00
31 changed files with 230 additions and 122 deletions

View File

@@ -112,15 +112,6 @@ public class Location implements Parcelable {
return long1 + "," + lat1;
}
/**
* calculates the distance to the other location.
* @param other the other location
* @return the distance between the locations in meters
*/
public double getDistance(Location other) {
return getDistance(this.getLat(),this.getLong(),other.getLat(),other.getLong());
}
/**
* calculates the distance between two coordinates
* @param lat1 the first latitude
@@ -145,8 +136,12 @@ public class Location implements Parcelable {
// Radius of earth in kilometers. Use 3956
// for miles
double r = 6371;
// if(miles) {
// double r = 3956;
// }
// else {
double r = 6371;
// }
// calculate the result
double distance = c * r;

View File

@@ -66,7 +66,6 @@ public class Route implements Parcelable {
}
public float getTotalDistance() {
//TODO calculate total distance according to all locations in list
return totalDistance;
}

View File

@@ -50,6 +50,9 @@ public enum RouteHandler {
}
public void followRoute(Route route) {
if (isFollowingRoute) {
StaticData.INSTANCE.addTimeWalked(System.currentTimeMillis()-startedTime);
}
this.currentRoute = route;
setFollowingRoute(true);
startedTime = System.currentTimeMillis();