use of org.opentripplanner.graph_builder.annotation.ConflictingBikeTags in project OpenTripPlanner by opentripplanner.
the class OSMFilter method getPermissionsForWay.
/**
* Computes permissions for an OSMWay.
*
* @param way
* @param def
* @return
*/
public static StreetTraversalPermission getPermissionsForWay(OSMWay way, StreetTraversalPermission def, Graph graph, boolean banDiscouragedWalking, boolean banDiscouragedBiking) {
StreetTraversalPermission permissions = getPermissionsForEntity(way, def);
// Compute pedestrian permissions.
if (way.isPedestrianExplicitlyAllowed()) {
permissions = permissions.add(StreetTraversalPermission.PEDESTRIAN);
} else if (way.isPedestrianExplicitlyDenied()) {
permissions = permissions.remove(StreetTraversalPermission.PEDESTRIAN);
}
// Check for foot=discouraged, if applicable
if (banDiscouragedWalking && way.hasTag("foot") && way.getTag("foot").equals("discouraged")) {
permissions = permissions.remove(StreetTraversalPermission.PEDESTRIAN);
}
// Compute bike permissions, check consistency.
boolean forceBikes = false;
if (way.isBicycleExplicitlyAllowed()) {
permissions = permissions.add(StreetTraversalPermission.BICYCLE);
forceBikes = true;
}
if (way.isBicycleDismountForced() || (banDiscouragedBiking && way.hasTag("bicycle") && way.getTag("bicycle").equals("discouraged"))) {
permissions = permissions.remove(StreetTraversalPermission.BICYCLE);
if (forceBikes) {
LOG.warn(graph.addBuilderAnnotation(new ConflictingBikeTags(way.getId())));
}
}
return permissions;
}
Aggregations