Fixes for last pull request

This commit is contained in:
madwasp79 2019-01-18 10:54:24 +02:00
parent c2193cbfaf
commit 6f11e6d17d
2 changed files with 12 additions and 9 deletions

View file

@ -127,7 +127,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
headingChanged = Math.abs(MapUtils.degreesDiff(prevHeading, heading)) > 1.0;
}
if (mapView != null) {
float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get();
float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get()/3.6f;
boolean smallSpeedForDirectionOfMovement = speedForDirectionOfMovement != 0 &&
myLocation != null && isSmallSpeedForDirectionOfMovement(myLocation, speedForDirectionOfMovement);
if ((settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_COMPASS || (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_BEARING && smallSpeedForDirectionOfMovement)) && !routePlanningMode) {
@ -182,7 +182,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
zoom = autozoom(tb, location);
}
int currentMapRotation = settings.ROTATE_MAP.get();
float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get();
float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get()/3.6f;
boolean smallSpeedForDirectionOfMovement = speedForDirectionOfMovement != 0
&& isSmallSpeedForDirectionOfMovement(location, speedForDirectionOfMovement);
boolean smallSpeedForCompass = isSmallSpeedForCompass(location);
@ -239,7 +239,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
public static boolean isSmallSpeedForDirectionOfMovement(Location location, float speedToDirectionOfMovement) {
return !location.hasSpeed() || location.getSpeed()* 3.6 < speedToDirectionOfMovement;
return !location.hasSpeed() || location.getSpeed() < speedToDirectionOfMovement;
}
public static boolean isSmallSpeedForCompass(Location location) {

View file

@ -591,15 +591,18 @@ public class TurnPathHelper {
}
} else if (turnIndex == SECOND_TURN) {
if (TurnType.isLeftTurn(firstTurnType) && TurnType.isLeftTurn(secondTurnType)) {
if(TurnType.isSlightTurn(firstTurnType))
if (TurnType.isSlightTurn(firstTurnType)) {
turnResource = new TurnResource(secondTurnType, true, false, leftSide);
else turnResource = null;
} else {
turnResource = null;
}
} else if (TurnType.isRightTurn(firstTurnType) && TurnType.isRightTurn(secondTurnType)) {
if(TurnType.isSlightTurn(firstTurnType))
if (TurnType.isSlightTurn(firstTurnType)) {
turnResource = new TurnResource(secondTurnType, true, false, leftSide);
else turnResource = null;
} else
if (firstTurnType == TurnType.C || thirdTurnType == TurnType.C) {
} else {
turnResource = null;
}
} else if (firstTurnType == TurnType.C || thirdTurnType == TurnType.C) {
// get the small one
turnResource = new TurnResource(secondTurnType, true, false, leftSide);
} else {