Search in sources :

Example 1 with ConflictingBikeTags

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;
}
Also used : StreetTraversalPermission(org.opentripplanner.routing.edgetype.StreetTraversalPermission) ConflictingBikeTags(org.opentripplanner.graph_builder.annotation.ConflictingBikeTags)

Aggregations

ConflictingBikeTags (org.opentripplanner.graph_builder.annotation.ConflictingBikeTags)1 StreetTraversalPermission (org.opentripplanner.routing.edgetype.StreetTraversalPermission)1