Avoid motorway

This commit is contained in:
Victor Shcherb 2012-08-31 23:40:37 +02:00
parent d90ee505b4
commit 5e6fc19588
6 changed files with 27 additions and 8 deletions

View file

@ -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<String, Double> highwaySpeed ;

View file

@ -42,8 +42,12 @@
<!-- obstacle tag="highway" value="traffic_signals" penalty="35", penalty measured in seconds -->
<routingProfile name="car" baseProfile="car" restrictionsAware="true" minDefaultSpeed="45.0" maxDefaultSpeed="130.0"
leftTurn="20" rightTurn="15" roundaboutTurn="20" followSpeedLimitations="true" onewayAware="true">
<road tag="highway" value="motorway" speed="110" priority="1.2" dynamicPriority="1"/>
<road tag="highway" value="motorway_link" speed="80" priority="1.2" dynamicPriority="1"/>
<road tag="highway" value="motorway" speed="110" priority="1.2" dynamicPriority="1">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="motorway_link" speed="80" priority="1.2" dynamicPriority="1">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="trunk" speed="100" priority="1.2" dynamicPriority="1"/>
<road tag="highway" value="trunk_link" speed="75" priority="1.2" dynamicPriority="1"/>
@ -119,8 +123,12 @@
leftTurn="0" rightTurn="0" followSpeedLimitations="false" onewayAware="true">
<!-- <attribute name="relaxNodesIfStartDistSmallCoeff" value="2.5"/> -->
<road tag="highway" value="motorway" speed="16" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="motorway_link" speed="16" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="motorway" speed="16" priority="0.7" dynamicPriority="0.7">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="motorway_link" speed="16" priority="0.7" dynamicPriority="0.7">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="trunk" speed="16" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="trunk_link" speed="16" priority="0.7" dynamicPriority="0.7"/>
@ -158,8 +166,12 @@
<attribute name="heuristicCoefficient" value="1.2" />
<road tag="highway" value="motorway" speed="5" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="motorway_link" speed="5" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="motorway" speed="5" priority="0.7" dynamicPriority="0.7">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="motorway_link" speed="5" priority="0.7" dynamicPriority="0.7">
<specialization input="avoid_motorway" speed="0"/>
</road>
<road tag="highway" value="trunk" speed="5" priority="0.7" dynamicPriority="0.7"/>
<road tag="highway" value="trunk_link" speed="5" priority="0.7" dynamicPriority="0.7"/>

View file

@ -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
-->
<string name="avoid_motorway">Avoid motorways</string>
<string name="auto_zoom_map_descr">Auto zoom map according to your speed (while map is synchronized with current position)</string>
<string name="auto_zoom_map">Auto zoom map</string>
<string name="tip_recent_changes_0_8_3_t">Changes in 0.8.3 :

View file

@ -597,6 +597,7 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> SHOW_LANES = new BooleanPreference("show_lanes", true).makeGlobal().cache();
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeGlobal().cache();
public final OsmandPreference<Boolean> AVOID_MOTORWAY = new BooleanPreference("avoid_motorway", false).makeGlobal().cache();
public final OsmandPreference<Boolean> AVOID_UNPAVED_ROADS = new BooleanPreference("avoid_unpaved_roads", false).makeGlobal().cache();
public final OsmandPreference<Boolean> AVOID_FERRIES = new BooleanPreference("avoid_ferries", false).makeGlobal().cache();

View file

@ -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),

View file

@ -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);
}