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

View file

@ -993,8 +993,10 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
} else if (lastProjection != null) { } else if (lastProjection != null) {
lt = lastProjection; lt = lastProjection;
} }
if(lt != null) {
addLocation(tb, lt, style, tx, ty, angles, distances, 0, styles); // first point addLocation(tb, lt, style, tx, ty, angles, distances, 0, styles); // first point
} }
}
addLocation(tb, ls, style, tx, ty, angles, distances, dist, styles); addLocation(tb, ls, style, tx, ty, angles, distances, dist, styles);
previousVisible = true; previousVisible = true;
} else if (previousVisible) { } else if (previousVisible) {