forked from organicmaps/organicmaps
[android] prediction fix
This commit is contained in:
parent
27afe799dd
commit
bd3ec5e576
1 changed files with 4 additions and 3 deletions
|
@ -99,19 +99,20 @@ public class LocationPredictor
|
|||
if (mLastLocation == null || mGeneratePredictions == false)
|
||||
return false;
|
||||
|
||||
if (mLastLocation.hasBearing() && mLastLocation.hasSpeed() && mPredictionCount < MAX_PREDICTION_COUNT)
|
||||
if (mPredictionCount < MAX_PREDICTION_COUNT)
|
||||
{
|
||||
Location info = new Location(mLastLocation);
|
||||
info.setTime(System.currentTimeMillis());
|
||||
|
||||
long elapsedMillis = info.getTime() - mLastLocation.getTime();
|
||||
|
||||
double[] newLatLon = Framework.predictLocation(info.getLatitude(), info.getLongitude(), info.getBearing(),
|
||||
info.getSpeed(), info.getAccuracy(), elapsedMillis / 1000.0);
|
||||
double[] newLatLon = Framework.predictLocation(info.getLatitude(), info.getLongitude(), info.getAccuracy(), info.getBearing(),
|
||||
info.getSpeed(), elapsedMillis / 1000.0);
|
||||
info.setLatitude(newLatLon[0]);
|
||||
info.setLongitude(newLatLon[1]);
|
||||
|
||||
mListener.onLocationUpdated(info);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue