Fix straight_to

This commit is contained in:
Victor Shcherb 2020-02-17 20:07:52 +01:00
parent f0b3062ab8
commit b1ab806632
3 changed files with 12 additions and 5 deletions

View file

@ -3283,6 +3283,7 @@ public class OsmandSettings {
}
public final CommonPreference<Float> ROUTE_RECALCULATION_DISTANCE = new FloatPreference("routing_recalc_distance", 0.f).makeProfile();
public final CommonPreference<Float> ROUTE_STRAIGHT_ANGLE = new FloatPreference("routing_straight_angle", 30.f).makeProfile();
public final OsmandPreference<Boolean> USE_OSM_LIVE_FOR_ROUTING = new BooleanPreference("enable_osmc_routing", true).makeGlobal();

View file

@ -60,7 +60,7 @@ public class RouteCalculationResult {
protected final ApplicationMode appMode;
protected final RouteProvider.RouteService routeService;
protected final double routeRecalcDistance;
protected final double routeVisibleAngle = 30;
protected final double routeVisibleAngle;
// Note always currentRoute > get(currentDirectionInfo).routeOffset,
// but currentRoute <= get(currentDirectionInfo+1).routeOffset
@ -73,8 +73,6 @@ public class RouteCalculationResult {
protected Location currentStraightAnglePoint = null;
public RouteCalculationResult(String errorMessage) {
this.errorMessage = errorMessage;
this.routingTime = 0;
@ -90,6 +88,7 @@ public class RouteCalculationResult {
this.routeService = null;
this.appMode = null;
this.routeRecalcDistance = 0;
this.routeVisibleAngle = 0;
}
public RouteCalculationResult(List<Location> list, List<RouteDirectionInfo> directions, RouteCalculationParams params, List<LocationPoint> waypoints, boolean addMissingTurns) {
@ -126,8 +125,11 @@ public class RouteCalculationResult {
this.routeService = params.mode.getRouteService();
if(params.ctx != null) {
this.routeRecalcDistance = params.ctx.getSettings().ROUTE_RECALCULATION_DISTANCE.getModeValue(params.mode);
this.routeVisibleAngle = routeService == RouteProvider.RouteService.STRAIGHT ?
params.ctx.getSettings().ROUTE_STRAIGHT_ANGLE.getModeValue(params.mode) : 0;
} else {
this.routeRecalcDistance = 0;
this.routeVisibleAngle = 0;
}
}
@ -160,6 +162,8 @@ public class RouteCalculationResult {
updateDirectionsTime(this.directions, this.listDistance);
this.alarmInfo = Collections.unmodifiableList(alarms);
this.routeRecalcDistance = ctx.getSettings().ROUTE_RECALCULATION_DISTANCE.getModeValue(mode);
this.routeVisibleAngle = routeService == RouteProvider.RouteService.STRAIGHT ?
ctx.getSettings().ROUTE_STRAIGHT_ANGLE.getModeValue(mode) : 0;
}
public ApplicationMode getAppMode() {

View file

@ -993,7 +993,9 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
} else if (lastProjection != null) {
lt = lastProjection;
}
addLocation(tb, lt, style, tx, ty, angles, distances, 0, styles); // first point
if(lt != null) {
addLocation(tb, lt, style, tx, ty, angles, distances, 0, styles); // first point
}
}
addLocation(tb, ls, style, tx, ty, angles, distances, dist, styles);
previousVisible = true;
@ -1118,7 +1120,7 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
if (directTo) {
routeGeometry.drawSegments(tb, canvas, topLatitude, leftLongitude, bottomLatitude, rightLongitude,
null, 0);
} else if(straight){
} else if (straight) {
routeGeometry.drawSegments(tb, canvas, topLatitude, leftLongitude, bottomLatitude, rightLongitude,
helper.getLastFixedLocation(), route.getCurrentStraightAngleRoute());
} else {