From a6c985043d8bca924c5909578ab5a59cec3b8756 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Tue, 8 Oct 2019 12:38:55 +0300 Subject: [PATCH] add max width parameter --- .../src/main/java/net/osmand/router/GeneralRouter.java | 1 + OsmAnd/res/values/strings.xml | 2 ++ .../net/osmand/plus/settings/RouteParametersFragment.java | 1 + .../net/osmand/plus/settings/VehicleParametersFragment.java | 6 ++++++ 4 files changed, 10 insertions(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index 2a3a7403a1..de8aeac47c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -38,6 +38,7 @@ public class GeneralRouter implements VehicleRouter { public static final String MAX_SPEED = "max_speed"; public static final String VEHICLE_HEIGHT = "height"; public static final String VEHICLE_WEIGHT = "weight"; + public static final String VEHICLE_WIDTH = "width"; private final RouteAttributeContext[] objectAttributes; public final Map attributes; diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index c51bd9f8c4..394f5e9e9a 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1916,6 +1916,8 @@ Avoid crossing national borders Weight limit Specify permitted vehicle weight limit on routes. + Width limit + Specify permitted vehicle width limit on routes. Height limit Specify vehicle height to be permitted on routes. Since Android version 4.4 (KitKat) you cannot download and update maps to the old storage folder (%s). Copy all OsmAnd files to new storage location? diff --git a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java index e71e40a906..3a16d9ef9b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java @@ -133,6 +133,7 @@ public class RouteParametersFragment extends BaseSettingsFragment { } else if (!param.equals(GeneralRouter.USE_SHORTEST_WAY) && !param.equals(GeneralRouter.VEHICLE_HEIGHT) && !param.equals(GeneralRouter.VEHICLE_WEIGHT) + && !param.equals(GeneralRouter.VEHICLE_WIDTH) && !RoutingOptionsHelper.DRIVING_STYLE.equals(routingParameter.getGroup())) { otherRoutingParameters.add(routingParameter); } diff --git a/OsmAnd/src/net/osmand/plus/settings/VehicleParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/VehicleParametersFragment.java index bb6def6f65..f3bbf37632 100644 --- a/OsmAnd/src/net/osmand/plus/settings/VehicleParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/VehicleParametersFragment.java @@ -46,6 +46,10 @@ public class VehicleParametersFragment extends BaseSettingsFragment { if (vehicleWeight != null) { setupCustomRoutingPropertyPref(vehicleWeight); } + GeneralRouter.RoutingParameter vehicleWidth = parameters.get(GeneralRouter.VEHICLE_WIDTH); + if (vehicleWidth != null) { + setupCustomRoutingPropertyPref(vehicleWidth); + } if (router.getProfile() != GeneralRouter.GeneralRouterProfile.PUBLIC_TRANSPORT) { setupDefaultSpeedPref(); } @@ -111,6 +115,8 @@ public class VehicleParametersFragment extends BaseSettingsFragment { return getIcon(R.drawable.ic_action_height_limit); case GeneralRouter.VEHICLE_WEIGHT: return getIcon(R.drawable.ic_action_weight_limit); + case GeneralRouter.VEHICLE_WIDTH: + return getIcon(R.drawable.ic_action_width_limit); default: return null; }