Package org.opentripplanner.routing.edgetype

Examples of org.opentripplanner.routing.edgetype.StreetTraversalPermission


                stroke(200, 050, 000);
                strokeWeight(6);
                drawEdge(e);
            }
            if (e instanceof StreetEdge) {
                StreetTraversalPermission stp = ((StreetEdge) e).getPermission();
                if (stp == StreetTraversalPermission.PEDESTRIAN) {
                    stroke(000, 200, 000);
                    strokeWeight(6);
                    drawEdge(e);
                } else if (stp == StreetTraversalPermission.BICYCLE) {
View Full Code Here


            Vertex v = vIter.next();
            Collection<Edge> outgoing = new ArrayList<Edge>(v.getOutgoing());
            for (Edge e : outgoing) {
                if (e instanceof StreetEdge) {
                    StreetEdge pse = (StreetEdge) e;
                    StreetTraversalPermission permission = pse.getPermission();
                    permission = permission.remove(StreetTraversalPermission.PEDESTRIAN);
                    permission = permission.remove(StreetTraversalPermission.BICYCLE);
                    if (permission == StreetTraversalPermission.NONE) {
                        // TODO Shouldn't we have a graph.removeEdge()?
                        graph.streetNotesService.removeStaticNotes(pse);
                        pse.detach(graph);
                    } else {
View Full Code Here

        Coordinate[] coords = new Coordinate[2];
        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, false);
    }
View Full Code Here

        Coordinate[] coords = new Coordinate[2];
        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, back);
    }
View Full Code Here

        return false;
    }

    public static StreetTraversalPermission getPermissionsForEntity(OSMWithTags entity,
            StreetTraversalPermission def) {
        StreetTraversalPermission permission = null;

        /*
         * Only a few tags are examined here, because we only care about modes supported by OTP
         * (wheelchairs are not of concern here)
         *
         * Only a few values are checked for, all other values are presumed to be permissive (=>
         * This may not be perfect, but is closer to reality, since most people don't follow the
         * rules perfectly ;-)
         */
        if (entity.isGeneralAccessDenied()) {
            // this can actually be overridden
            permission = StreetTraversalPermission.NONE;
            if (entity.isMotorcarExplicitlyAllowed()) {
                permission = permission.add(StreetTraversalPermission.ALL_DRIVING);
            }
            if (entity.isBicycleExplicitlyAllowed()) {
                permission = permission.add(StreetTraversalPermission.BICYCLE);
            }
            if (entity.isPedestrianExplicitlyAllowed()) {
                permission = permission.add(StreetTraversalPermission.PEDESTRIAN);
            }
        } else {
            permission = def;
        }

        if (entity.isMotorcarExplicitlyDenied()) {
            permission = permission.remove(StreetTraversalPermission.ALL_DRIVING);
        } else if (entity.hasTag("motorcar")) {
            permission = permission.add(StreetTraversalPermission.ALL_DRIVING);
        }

        if (entity.isBicycleExplicitlyDenied()) {
            permission = permission.remove(StreetTraversalPermission.BICYCLE);
        } else if (entity.hasTag("bicycle")) {
            permission = permission.add(StreetTraversalPermission.BICYCLE);
        }

        if (entity.isPedestrianExplicitlyDenied()) {
            permission = permission.remove(StreetTraversalPermission.PEDESTRIAN);
        } else if (entity.hasTag("foot")) {
            permission = permission.add(StreetTraversalPermission.PEDESTRIAN);
        }

        if (entity.isUnderConstruction()) {
            permission = StreetTraversalPermission.NONE;
        }
View Full Code Here

     * @param def
     * @return
     */
    public static StreetTraversalPermission getPermissionsForWay(OSMWay way,
            StreetTraversalPermission def, Graph graph) {
        StreetTraversalPermission permissions = getPermissionsForEntity(way, def);

        /*
         * pedestrian rules: everything is two-way (assuming pedestrians are allowed at all) bicycle
         * rules: default: permissions;
         *
         * cycleway=dismount means walk your bike -- the engine will automatically try walking bikes
         * any time it is forbidden to ride them, so the only thing to do here is to remove bike
         * permissions
         *
         * oneway=... sets permissions for cars and bikes oneway:bicycle overwrites these
         * permissions for bikes only
         *
         * now, cycleway=opposite_lane, opposite, opposite_track can allow once oneway has been set
         * by oneway:bicycle, but should give a warning if it conflicts with oneway:bicycle
         *
         * bicycle:backward=yes works like oneway:bicycle=no bicycle:backwards=no works like
         * oneway:bicycle=yes
         */

        // Compute pedestrian permissions.
        if (way.isPedestrianExplicitlyAllowed()) {
            permissions = permissions.add(StreetTraversalPermission.PEDESTRIAN);
        } else if (way.isPedestrianExplicitlyDenied()) {
            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()) {
            permissions = permissions.remove(StreetTraversalPermission.BICYCLE);
            if (forceBikes) {
                LOG.warn(graph.addBuilderAnnotation(new ConflictingBikeTags(way.getId())));
            }
        }

View Full Code Here

     * for travel along and against the way.
     */
    public static P2<StreetTraversalPermission> getPermissions(
            StreetTraversalPermission permissions, OSMWay way) {

        StreetTraversalPermission permissionsFront = permissions;
        StreetTraversalPermission permissionsBack = permissions;

        // Check driving direction restrictions.
        if (way.isOneWayForwardDriving() || way.isRoundabout()) {
            permissionsBack = permissionsBack.remove(StreetTraversalPermission.BICYCLE_AND_DRIVING);
        }
        if (way.isOneWayReverseDriving()) {
            permissionsFront = permissionsFront
                    .remove(StreetTraversalPermission.BICYCLE_AND_DRIVING);
        }

        // Check bike direction restrictions.
        if (way.isOneWayForwardBicycle()) {
            permissionsBack = permissionsBack.remove(StreetTraversalPermission.BICYCLE);
        }
        if (way.isOneWayReverseBicycle()) {
            permissionsFront = permissionsFront.remove(StreetTraversalPermission.BICYCLE);
        }

        // TODO(flamholz): figure out what this is for.
        String oneWayBicycle = way.getTag("oneway:bicycle");
        if (OSMWithTags.isFalse(oneWayBicycle) || way.isTagTrue("bicycle:backwards")) {
            if (permissions.allows(StreetTraversalPermission.BICYCLE)) {
                permissionsFront = permissionsFront.add(StreetTraversalPermission.BICYCLE);
                permissionsBack = permissionsBack.add(StreetTraversalPermission.BICYCLE);
            }
        }

        if (way.isOpposableCycleway()) {
            permissionsBack = permissionsBack.add(StreetTraversalPermission.BICYCLE);
        }
        return new P2<StreetTraversalPermission>(permissionsFront, permissionsBack);
    }
View Full Code Here

        Coordinate[] coords = new Coordinate[2];
        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, back);
    }
View Full Code Here

        Coordinate[] coords = new Coordinate[2];
        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        return new StreetEdge(vA, vB, geom, name, length, perm, back);
    }
View Full Code Here

        Coordinate[] coords = new Coordinate[2];
        coords[0] = vA.getCoordinate();
        coords[1] = vB.getCoordinate();
        LineString geom = GeometryUtils.getGeometryFactory().createLineString(coords);

        StreetTraversalPermission perm = StreetTraversalPermission.ALL;
        StreetEdge pse = new StreetEdge(vA, vB, geom, name, length, perm, back);
        pse.setCarSpeed(1.0f);
        return pse;
    }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.edgetype.StreetTraversalPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.