fix straight lines through buildings to next route location

This commit is contained in:
Chumva 2018-07-24 14:24:24 +03:00
parent ac5ab039db
commit ace42e3e34

View file

@ -368,12 +368,19 @@ public class RouteProvider {
gpxRoute = gpxParams.points; gpxRoute = gpxParams.points;
if (routeParams.previousToRecalculate != null && routeParams.onlyStartPointChanged) { if (routeParams.previousToRecalculate != null && routeParams.onlyStartPointChanged) {
List<Location> routeLocations = routeParams.previousToRecalculate.getRouteLocations(); List<Location> routeLocations = routeParams.previousToRecalculate.getRouteLocations();
if (routeLocations != null) { if (routeLocations != null && routeLocations.size() >= 1) {
Location loc = routeParams.previousToRecalculate.getNextRouteLocation(); gpxRoute = new ArrayList<>();
LatLon nextRouteLocation = new LatLon(loc.getLatitude(), loc.getLongitude()); Location trackStart = routeLocations.get(0);
List<Location> routeToNextRouteLocation = findStartAndEndLocationsFromRoute(routeLocations, Location realStart = routeParams.start;
routeParams.start, nextRouteLocation, null, null); if (realStart != null && trackStart != null && realStart.distanceTo(trackStart) > 60) {
gpxRoute = new ArrayList<>(routeToNextRouteLocation); LatLon nextRouteLocation = new LatLon(trackStart.getLatitude(), trackStart.getLongitude());
RouteCalculationResult newRes = findOfflineRouteSegment(routeParams, realStart, nextRouteLocation);
if (newRes != null && newRes.isCalculated()) {
gpxRoute.addAll(0, newRes.getImmutableAllLocations());
} else {
gpxRoute.add(0, realStart);
}
}
gpxRoute.addAll(new ArrayList<>(routeLocations)); gpxRoute.addAll(new ArrayList<>(routeLocations));
endI = new int[]{gpxRoute.size()}; endI = new int[]{gpxRoute.size()};
} }