Fix issue with distance

This commit is contained in:
Victor Shcherb 2013-07-30 18:14:50 +02:00
parent 7c1d2bd18e
commit b0cf3f2f5a

View file

@ -109,12 +109,11 @@ public class Location {
mAccuracy = 0; mAccuracy = 0;
} }
private static void computeDistanceAndBearing(double lat1, double lon1, private static void computeDistanceAndBearing(double lat1, double lon1,
double lat2, double lon2, float[] results) { double lat2, double lon2, float[] results) {
// Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf // Based on http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
// using the "Inverse Formula" (section 4) // using the "Inverse Formula" (section 4)
float osmandDist = (float) (net.osmand.util.MapUtils.getDistance(lat1, lon1, lat2, lon2));
int MAXITERS = 20; int MAXITERS = 20;
// Convert lat/long to radians // Convert lat/long to radians
lat1 *= Math.PI / 180.0; lat1 *= Math.PI / 180.0;
@ -209,8 +208,8 @@ public class Location {
results[2] = finalBearing; results[2] = finalBearing;
} }
} }
// TODO leave only for 4.2.1 !!! // Should we leave only for 4.2.1? Or keep consistent for all devices?
results[0] = (float) (net.osmand.util.MapUtils.getDistance(lat1, lon1, lat2, lon2)); results[0] = osmandDist;
} }
/** /**