Fix gpx route calculation
This commit is contained in:
parent
4624a5811a
commit
421ef6e573
2 changed files with 13 additions and 3 deletions
|
@ -208,6 +208,7 @@ public class RouteProvider {
|
|||
GPXFile file = builder.file;
|
||||
boolean reverse = builder.reverse;
|
||||
boolean announceWaypoints = builder.announceWaypoints;
|
||||
calculateOsmAndRoute = builder.calculateOsmAndRoute;
|
||||
if(file.isCloudmadeRouteFile() || OSMAND_ROUTER.equals(file.author)){
|
||||
directions = parseOsmAndGPXRoute(points, file, OSMAND_ROUTER.equals(file.author), builder.leftSide, 10);
|
||||
if(reverse){
|
||||
|
@ -276,10 +277,10 @@ public class RouteProvider {
|
|||
try {
|
||||
RouteCalculationResult res;
|
||||
boolean calcGPXRoute = params.gpxRoute != null && !params.gpxRoute.points.isEmpty();
|
||||
if (params.type == RouteService.OSMAND || (calcGPXRoute && params.gpxRoute.calculateOsmAndRoute)) {
|
||||
res = findVectorMapsRoute(params, calcGPXRoute);
|
||||
} else if(calcGPXRoute){
|
||||
if(calcGPXRoute && !params.gpxRoute.calculateOsmAndRoute){
|
||||
res = calculateGpxRoute(params);
|
||||
} else if (params.type == RouteService.OSMAND) {
|
||||
res = findVectorMapsRoute(params, calcGPXRoute);
|
||||
} else if (params.type == RouteService.YOURS) {
|
||||
res = findYOURSRoute(params);
|
||||
} else if (params.type == RouteService.ORS) {
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
|
@ -14,6 +16,7 @@ import net.osmand.plus.GPXUtilities.GPXFile;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
import net.osmand.plus.activities.SettingsNavigationActivity;
|
||||
|
@ -301,7 +304,13 @@ public class MapRoutePreferencesControl extends MapControls {
|
|||
GPXRouteParamsBuilder params = new GPXRouteParamsBuilder(result, mapActivity.getMyApplication().getSettings());
|
||||
params.setAnnounceWaypoints(settings.SPEAK_GPX_WPT.get());
|
||||
params.setCalculateOsmAndRoute(settings.CALC_GPX_ROUTE.get());
|
||||
List<Location> ps = params.getPoints();
|
||||
mapActivity.getRoutingHelper().setGpxParams(params);
|
||||
if(!ps.isEmpty()) {
|
||||
Location loc = ps.get(ps.size() -1);
|
||||
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), true, -1);
|
||||
}
|
||||
updateSpinnerItems(gpxSpinner);
|
||||
updateParameters();
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue