Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.TraversalRequirements


            // We have an intersection vertex. Check that this vertex has edges we can traverse.
            boolean canEscape = false;
            if (options == null) {
                canEscape = true; // Some tests do not supply options.
            } else {
                TraversalRequirements reqs = new TraversalRequirements(options);
                for (StreetEdge e : Iterables.filter ( options.arriveBy ?
                        intersection.getIncoming() : intersection.getOutgoing(),
                        StreetEdge.class)) {
                    if (reqs.canBeTraversed(e)) {
                        canEscape = true;
                        break;
                    }
                }
            }      
View Full Code Here


     */
    protected CandidateEdgeBundle getClosestEdges(GenericLocation location, RoutingRequest request,
            List<Edge> extraEdges, Collection<Edge> preferredEdges, boolean possibleTransitLinksOnly) {
        // NOTE(flamholz): if request is null, will initialize TraversalRequirements
        // that accept all modes of travel.
        TraversalRequirements reqs = new TraversalRequirements(request);

        return getClosestEdges(location, reqs, extraEdges, preferredEdges, possibleTransitLinksOnly);
    }
View Full Code Here

            vertexLabel = "link for " + v;
        Coordinate coordinate = v.getCoordinate();

        /* is there a bundle of edges nearby to use or split? */
        GenericLocation location = new GenericLocation(coordinate);
        TraversalRequirements reqs = new TraversalRequirements(options);
        CandidateEdgeBundle edges = linker.index.getClosestEdges(location, reqs, null,
                nearbyRouteEdges, possibleTransitLinksOnly);
        if (edges == null || edges.size() < 1) {
            // no edges were found nearby, or a bidirectional/loop bundle of edges was not identified
            LOG.debug("found too few edges: {} {}", v.getName(), v.getCoordinate());
View Full Code Here

    @Test
    public void testModeRestriction() {
        // Lies along the top right edge
        Coordinate c = new Coordinate(-74.005000001, 40.01);
        GenericLocation loc = new GenericLocation(c);
        TraversalRequirements reqs = new TraversalRequirements();

        // Default traversal requirements allow any traversal mode.
        checkClosestEdgeModes(loc, reqs, 1);

        // Only allow walking
View Full Code Here

    @Test
    public void testInteriorEdgeCase() {
        // Lies smack in the middle of the box
        Coordinate c = new Coordinate(-74.005, 40.005);
        GenericLocation loc = new GenericLocation(c);
        TraversalRequirements reqs = new TraversalRequirements();

        // Should only return 2 edges even though all edges are equidistant.
        // TODO(flamholz): this doesn't feel like the right behavior to me.
        // Consider fixing it.
        CandidateEdgeBundle edges = finder.getClosestEdges(loc, reqs);
View Full Code Here

    @Test
    public void testHeading() {
        // Lies along the top edge
        Coordinate c = new Coordinate(-74.005000001, 40.01);
        // Request only car edges: top edge is car only.
        TraversalRequirements reqs = new TraversalRequirements();
        TraverseModeSet modes = new TraverseModeSet();
        modes.setCar(true);
        reqs.modes = modes;
       
        for (double degreeOff = 0.0; degreeOff < 30.0; degreeOff += 3.0) {
View Full Code Here

    @Test
    public void testSorting() {
        // Lies along the top edge
        Coordinate c = new Coordinate(-74.005000001, 40.01);
        // Request only car edges: top edge is car only.
        TraversalRequirements reqs = new TraversalRequirements();
        TraverseModeSet modes = new TraverseModeSet();
        modes.setCar(true);
        reqs.modes = modes;
       
        // Location along the top edge, traveling with the forward edge
View Full Code Here

                        accessVertexes.add(accessVertex);
                    }
                }
            }
            // Check P+R accessibility by walking and driving.
            TraversalRequirements walkReq = new TraversalRequirements(new RoutingRequest(
                    TraverseMode.WALK));
            TraversalRequirements driveReq = new TraversalRequirements(new RoutingRequest(
                    TraverseMode.CAR));
            boolean walkAccessibleIn = false;
            boolean carAccessibleIn = false;
            boolean walkAccessibleOut = false;
            boolean carAccessibleOut = false;
            for (IntersectionVertex accessVertex : accessVertexes) {
                for (Edge incoming : accessVertex.getIncoming()) {
                    if (incoming instanceof StreetEdge) {
                        if (walkReq.canBeTraversed((StreetEdge)incoming))
                            walkAccessibleIn = true;
                        if (driveReq.canBeTraversed((StreetEdge)incoming))
                            carAccessibleIn = true;
                    }
                }
                for (Edge outgoing : accessVertex.getOutgoing()) {
                    if (outgoing instanceof StreetEdge) {
                        if (walkReq.canBeTraversed((StreetEdge)outgoing))
                            walkAccessibleOut = true;
                        if (driveReq.canBeTraversed((StreetEdge)outgoing))
                            carAccessibleOut = true;
                    }
                }
            }
            if (walkAccessibleIn != walkAccessibleOut) {
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.TraversalRequirements

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.