use of net.osmand.plus.onlinerouting.VehicleType in project Osmand by osmandapp.
the class GraphhopperEngine method collectAllowedVehicles.
@Override
protected void collectAllowedVehicles(@NonNull List<VehicleType> vehicles) {
vehicles.add(new VehicleType("car", R.string.routing_engine_vehicle_type_car));
vehicles.add(new VehicleType("bike", R.string.routing_engine_vehicle_type_bike));
vehicles.add(new VehicleType("foot", R.string.routing_engine_vehicle_type_foot));
vehicles.add(new VehicleType("hike", R.string.routing_engine_vehicle_type_hiking));
vehicles.add(new VehicleType("mtb", R.string.routing_engine_vehicle_type_mtb));
vehicles.add(new VehicleType("racingbike", R.string.routing_engine_vehicle_type_racingbike));
vehicles.add(new VehicleType("scooter", R.string.routing_engine_vehicle_type_scooter));
vehicles.add(new VehicleType("truck", R.string.routing_engine_vehicle_type_truck));
vehicles.add(new VehicleType("small_truck", R.string.routing_engine_vehicle_type_small_truck));
}
use of net.osmand.plus.onlinerouting.VehicleType in project Osmand by osmandapp.
the class OsrmEngine method collectAllowedVehicles.
@Override
protected void collectAllowedVehicles(@NonNull List<VehicleType> vehicles) {
vehicles.add(new VehicleType("car", R.string.routing_engine_vehicle_type_car));
vehicles.add(new VehicleType("bike", R.string.routing_engine_vehicle_type_bike));
vehicles.add(new VehicleType("foot", R.string.routing_engine_vehicle_type_foot));
}
use of net.osmand.plus.onlinerouting.VehicleType in project Osmand by osmandapp.
the class OrsEngine method collectAllowedVehicles.
@Override
protected void collectAllowedVehicles(@NonNull List<VehicleType> vehicles) {
vehicles.add(new VehicleType("driving-car", R.string.routing_engine_vehicle_type_car));
vehicles.add(new VehicleType("driving-hgv", R.string.routing_engine_vehicle_type_hgv));
vehicles.add(new VehicleType("cycling-regular", R.string.routing_engine_vehicle_type_cycling_regular));
vehicles.add(new VehicleType("cycling-road", R.string.routing_engine_vehicle_type_cycling_road));
vehicles.add(new VehicleType("cycling-mountain", R.string.routing_engine_vehicle_type_cycling_mountain));
vehicles.add(new VehicleType("cycling-electric", R.string.routing_engine_vehicle_type_cycling_electric));
vehicles.add(new VehicleType("foot-walking", R.string.routing_engine_vehicle_type_walking));
vehicles.add(new VehicleType("foot-hiking", R.string.routing_engine_vehicle_type_hiking));
vehicles.add(new VehicleType("wheelchair", R.string.routing_engine_vehicle_type_wheelchair));
}
use of net.osmand.plus.onlinerouting.VehicleType in project Osmand by osmandapp.
the class OnlineRoutingEngineFragment method updateCardViews.
private void updateCardViews(@NonNull BaseCard... cardsToUpdate) {
for (BaseCard card : cardsToUpdate) {
if (nameCard.equals(card)) {
if (Algorithms.isEmpty(engine.get(EngineParameter.CUSTOM_NAME))) {
nameCard.setEditedText(engine.getName(app));
}
} else if (typeCard.equals(card)) {
typeCard.setHeaderSubtitle(engine.getType().getTitle());
typeCard.setEditedText(engine.getBaseUrl());
updateCardVisibility(apiKeyCard, EngineParameter.API_KEY);
updateCardVisibility(vehicleCard, EngineParameter.VEHICLE_KEY);
updateCardVisibility(approximateCard, EngineParameter.APPROXIMATE_ROUTE);
updateCardVisibility(useExternalTimestampsCard, EngineParameter.USE_EXTERNAL_TIMESTAMPS);
updateCardVisibility(routingFallbackCard, EngineParameter.USE_ROUTING_FALLBACK);
} else if (vehicleCard.equals(card)) {
VehicleType vt = engine.getSelectedVehicleType();
vehicleCard.setHeaderSubtitle(vt.getTitle(app));
if (vt.equals(CUSTOM_VEHICLE)) {
vehicleCard.showFieldBox();
vehicleCard.setEditedText(customVehicleKey);
} else {
vehicleCard.hideFieldBox();
}
} else if (exampleCard.equals(card)) {
exampleCard.setEditedText(getTestUrl());
}
}
}
use of net.osmand.plus.onlinerouting.VehicleType in project Osmand by osmandapp.
the class OnlineRoutingEngineFragment method changeEngineType.
private void changeEngineType(OnlineRoutingEngine type) {
OnlineRoutingEngine tmp = (OnlineRoutingEngine) engine.clone();
engine = type.newInstance(tmp.getParams());
// after changing the type, select the vehicle
// with the same name that was selected before
VehicleType previous = tmp.getSelectedVehicleType();
VehicleType next = null;
for (VehicleType vt : engine.getAllowedVehicles()) {
if (Algorithms.objectEquals(previous.getTitle(app), vt.getTitle(app))) {
next = vt;
break;
}
}
String vehicleKey;
if (next != null) {
vehicleKey = next.equals(CUSTOM_VEHICLE) ? customVehicleKey : next.getKey();
} else {
vehicleKey = engine.getAllowedVehicles().get(0).getKey();
}
engine.put(EngineParameter.VEHICLE_KEY, vehicleKey);
setupVehicleTypes();
generateUniqueNameIfNeeded();
updateCardViews(nameCard, typeCard, vehicleCard, exampleCard);
}
Aggregations