From 5e6fc19588cad74f39325224ba62c7ae62d40d33 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 31 Aug 2012 23:40:37 +0200 Subject: [PATCH] Avoid motorway --- .../src/net/osmand/router/GeneralRouter.java | 1 + .../src/net/osmand/router/routing.xml | 24 ++++++++++++++----- OsmAnd/res/values/strings.xml | 1 + .../src/net/osmand/plus/OsmandSettings.java | 1 + .../plus/activities/SettingsActivity.java | 5 ++-- .../osmand/plus/routing/RouteProvider.java | 3 +++ 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/GeneralRouter.java b/DataExtractionOSM/src/net/osmand/router/GeneralRouter.java index 3a020ccec3..9bb495003d 100644 --- a/DataExtractionOSM/src/net/osmand/router/GeneralRouter.java +++ b/DataExtractionOSM/src/net/osmand/router/GeneralRouter.java @@ -14,6 +14,7 @@ public class GeneralRouter extends VehicleRouter { public static final String USE_SHORTEST_WAY = "short_way"; public static final String AVOID_FERRIES = "avoid_ferries"; public static final String AVOID_TOLL = "avoid_toll"; + public static final String AVOID_MOTORWAY = "avoid_motorway"; public static final String AVOID_UNPAVED = "avoid_unpaved"; Map highwaySpeed ; diff --git a/DataExtractionOSM/src/net/osmand/router/routing.xml b/DataExtractionOSM/src/net/osmand/router/routing.xml index e3cbb4852b..191584d6ce 100644 --- a/DataExtractionOSM/src/net/osmand/router/routing.xml +++ b/DataExtractionOSM/src/net/osmand/router/routing.xml @@ -42,8 +42,12 @@ - - + + + + + + @@ -119,8 +123,12 @@ leftTurn="0" rightTurn="0" followSpeedLimitations="false" onewayAware="true"> - - + + + + + + @@ -158,8 +166,12 @@ - - + + + + + + diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index afca231dca..d65a304a61 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 1. All your modified/created strings are in the top of the file (to make easier find what's translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Avoid motorways Auto zoom map according to your speed (while map is synchronized with current position) Auto zoom map Changes in 0.8.3 : diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 4bddd89883..8bd5a5d007 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -597,6 +597,7 @@ public class OsmandSettings { public final OsmandPreference SHOW_LANES = new BooleanPreference("show_lanes", true).makeGlobal().cache(); public final OsmandPreference AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeGlobal().cache(); + public final OsmandPreference AVOID_MOTORWAY = new BooleanPreference("avoid_motorway", false).makeGlobal().cache(); public final OsmandPreference AVOID_UNPAVED_ROADS = new BooleanPreference("avoid_unpaved_roads", false).makeGlobal().cache(); public final OsmandPreference AVOID_FERRIES = new BooleanPreference("avoid_ferries", false).makeGlobal().cache(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 7044b1fc0b..a74fd9cab5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -746,8 +746,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference return true; } else if (preference == avoidRouting) { showBooleanSettings(new String[] { getString(R.string.avoid_toll_roads), getString(R.string.avoid_ferries), - getString(R.string.avoid_unpaved) }, new OsmandPreference[] { osmandSettings.AVOID_TOLL_ROADS, - osmandSettings.AVOID_FERRIES, osmandSettings.AVOID_UNPAVED_ROADS }); + getString(R.string.avoid_unpaved), getString(R.string.avoid_motorway) + }, new OsmandPreference[] { osmandSettings.AVOID_TOLL_ROADS, + osmandSettings.AVOID_FERRIES, osmandSettings.AVOID_UNPAVED_ROADS, osmandSettings.AVOID_MOTORWAY }); return true; } else if (preference == showAlarms) { showBooleanSettings(new String[] { getString(R.string.show_cameras), getString(R.string.show_speed_limits), diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 3104ba3e65..5e2abce3c1 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -343,6 +343,9 @@ public class RouteProvider { if(app.getSettings().AVOID_TOLL_ROADS.get()){ specs.add(GeneralRouter.AVOID_TOLL); } + if(app.getSettings().AVOID_MOTORWAY.get()){ + specs.add(GeneralRouter.AVOID_MOTORWAY); + } if(app.getSettings().AVOID_UNPAVED_ROADS.get()){ specs.add(GeneralRouter.AVOID_UNPAVED); }