diff --git a/OsmAnd/src/net/osmand/plus/ResourceManager.java b/OsmAnd/src/net/osmand/plus/ResourceManager.java index 1c21f474a5..f4457b039a 100644 --- a/OsmAnd/src/net/osmand/plus/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/ResourceManager.java @@ -64,6 +64,7 @@ import android.view.WindowManager; public class ResourceManager { public static final String APP_DIR = "osmand/"; //$NON-NLS-1$ + public static final String ROUTING_XML = APP_DIR + "routing.xml"; public static final String POI_PATH = APP_DIR + IndexConstants.POI_INDEX_DIR; public static final String VOICE_PATH = APP_DIR + IndexConstants.VOICE_INDEX_DIR; public static final String GPX_PATH = APP_DIR + "tracks"; diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 055edbb299..640b4de5aa 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -1,5 +1,7 @@ package net.osmand.plus.routing; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; @@ -30,6 +32,7 @@ import net.osmand.osm.LatLon; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; +import net.osmand.plus.ResourceManager; import net.osmand.plus.activities.ApplicationMode; import net.osmand.plus.render.NativeOsmandLibrary; import net.osmand.router.BinaryRoutePlanner; @@ -302,7 +305,18 @@ public class RouteProvider { protected RouteCalculationResult findVectorMapsRoute(Location start, LatLon end, ApplicationMode mode, boolean fast, OsmandApplication app, boolean leftSide) throws IOException { BinaryMapIndexReader[] files = app.getResourceManager().getRoutingMapFiles(); BinaryRoutePlanner router = new BinaryRoutePlanner(NativeOsmandLibrary.getLoadedLibrary(), files); - RoutingConfiguration.Builder config = RoutingConfiguration.getDefault(); + File routingXml = app.getSettings().extendOsmandPath(ResourceManager.ROUTING_XML); + RoutingConfiguration.Builder config ; + if (routingXml.exists() && routingXml.canRead()) { + try { + config = RoutingConfiguration.parseFromInputStream(new FileInputStream(routingXml)); + } catch (SAXException e) { + throw new IllegalStateException(e); + } + } else { + config = RoutingConfiguration.getDefault(); + } + GeneralRouterProfile p ; if (mode == ApplicationMode.BICYCLE) { p = GeneralRouterProfile.BICYCLE;