Fix routing

This commit is contained in:
Victor Shcherb 2012-07-05 18:54:29 +02:00
parent 5bc2fc3516
commit 50d63acbf5
2 changed files with 18 additions and 11 deletions

View file

@ -784,18 +784,18 @@ public class BinaryRoutePlanner {
} else {
// the segment was already visited! We need to follow better route if it exists
// that is very strange situation and almost exception (it can happen when we underestimate distnceToEnd)
if (distFromStart < next.distanceFromStart) {
if (distFromStart < next.distanceFromStart && next.road.id != segment.road.id) {
// That code is incorrect (when segment is processed itself,
// then it tries to make wrong u-turn) -
// this situation should be very carefully checked in future
// this situation should be very carefully checked in future (seems to be fixed)
// System.out.println(segment.getRoad().getName() + " " + next.getRoad().getName());
// System.out.println(next.distanceFromStart + " " + distFromStart);
// next.distanceFromStart = gDistFromStart;
// next.parentRoute = segment;
// next.parentSegmentEnd = segmentEnd;
// if (ctx.visitor != null) {
// ctx.visitor.visitSegment(next, false);
// }
// System.out.println(next.distanceFromStart + " ! " + distFromStart);
next.distanceFromStart = distFromStart;
next.parentRoute = segment;
next.parentSegmentEnd = segmentEnd;
if (ctx.visitor != null) {
ctx.visitor.visitSegment(next, false);
}
}
}

View file

@ -43,6 +43,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Handler;
import android.text.format.DateFormat;
import android.view.accessibility.AccessibilityManager;
@ -202,13 +203,19 @@ public class OsmandApplication extends Application {
super.onLowMemory();
manager.onLowMemory();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
if (prefferedLocale != null && !newConfig.locale.getLanguage().equals(prefferedLocale.getLanguage())) {
newConfig.locale = prefferedLocale;
super.onConfigurationChanged(newConfig);
// ugly fix ! On devices after 4.0 screen is blinking when you rotate device!
if(Build.VERSION.SDK_INT < 14 ){
newConfig.locale = prefferedLocale;
}
getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
Locale.setDefault(prefferedLocale);
// getBaseContext().getResources().updateConfiguration(newConfig, getBaseContext().getResources().getDisplayMetrics());
} else {
super.onConfigurationChanged(newConfig);
}