Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.TraverseModeSet


                if (edges != null) {
                    nearbyEdges.addAll(edges);
                }
            }
        }
        TraverseModeSet modes = v.getModes().clone();
        modes.setMode(TraverseMode.WALK, true);
        RoutingRequest request = new RoutingRequest(modes);
        Collection<StreetVertex> nearbyStreetVertices = getNearbyStreetVertices(v, nearbyEdges,
                request, true);
        if (nearbyStreetVertices == null) {
            result = false;
View Full Code Here


        return new StreetEdge(vA, vB, geom, name, length, perm, back);
    }

    private void DisallowTurn(StreetEdge from, StreetEdge to) {
        TurnRestrictionType rType = TurnRestrictionType.NO_TURN;
        TraverseModeSet restrictedModes = new TraverseModeSet(TraverseMode.CAR, TraverseMode.CUSTOM_MOTOR_VEHICLE);
        TurnRestriction restrict = new TurnRestriction(from, to, rType, restrictedModes);
        _graph.addTurnRestriction(from, restrict);
    }
View Full Code Here

        /*
         * Now, the right edge is not bikeable. But the user can walk their bike. So here are some tests that prove (a) that walking bikes works, but
         * that (b) it is not preferred to riding a tiny bit longer.
         */

        options = new RoutingRequest(new TraverseModeSet(TraverseMode.BICYCLE));
        start = StreetLocation.createStreetLocation(graph, "start1", "start1",
                filter(turns, StreetEdge.class),
                new LinearLocation(0, 0.95).getCoordinate(top.getGeometry()));
        end = StreetLocation.createStreetLocation(graph, "end1", "end1",
                filter(turns, StreetEdge.class),
View Full Code Here

                start.isWheelchairAccessible());

        List<Edge> extras = start.getExtra();
        assertEquals(4, extras.size());

        RoutingRequest biking = new RoutingRequest(new TraverseModeSet(TraverseMode.BICYCLE));
        StreetLocation end = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
                40.008, -74.0), biking);
        assertNotNull(end);

        extras = end.getExtra();
View Full Code Here

        return pse;
    }

    private void DisallowTurn(StreetEdge from, StreetEdge to) {
        TurnRestrictionType rType = TurnRestrictionType.NO_TURN;
        TraverseModeSet restrictedModes = new TraverseModeSet(TraverseMode.CAR, TraverseMode.CUSTOM_MOTOR_VEHICLE);
        TurnRestriction restrict = new TurnRestriction(from, to, rType, restrictedModes);
        _graph.addTurnRestriction(from, restrict);
    }
View Full Code Here

    /** TODO: documentation */
    public boolean intermediatePlacesOrdered;
   
    /** Constructor. All defaults should be set here or in field declarations. */
    public PlannerRequest() {
        mode = new TraverseModeSet("TRANSIT,WALK");
    }
View Full Code Here

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

        // Only allow walking
        TraverseModeSet modes = new TraverseModeSet();
        modes.setWalk(true);
        reqs.modes = modes;

        // There's only one walkable edge.
        checkClosestEdgeModes(loc, reqs, 1);

        // Only allow biking: there are 5 bikeable edges.
        modes = new TraverseModeSet();
        modes.setBicycle(true);
        reqs.modes = modes;
        checkClosestEdgeModes(loc, reqs, 2);

        // Only allow driving: there are 7 driveable edges.
        modes = new TraverseModeSet();
        modes.setCar(true);
        reqs.modes = modes;
        checkClosestEdgeModes(loc, reqs, 2);

        // Allow driving and biking: all 8 edges can be traversed.
        modes = new TraverseModeSet();
        modes.setCar(true);
        modes.setBicycle(true);
        reqs.modes = modes;
        checkClosestEdgeModes(loc, reqs, 2);
    }
View Full Code Here

    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) {
            // Location along the top edge, traveling with the forward edge
            // exactly.
View Full Code Here

    public void testCar() throws Exception {

        GenericAStar aStar = new GenericAStar();

        // It is impossible to get from A to C in WALK mode,
        RoutingRequest options = new RoutingRequest(new TraverseModeSet("WALK"));
        options.setRoutingContext(graph, A, C);
        ShortestPathTree tree = aStar.getShortestPathTree(options);
        GraphPath path = tree.getPath(C, false);
        assertNull(path);
View Full Code Here

    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
        // exactly.
        GenericLocation loc = new GenericLocation(c);
View Full Code Here

TOP

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

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.