Package org.opentripplanner.routing.location

Examples of org.opentripplanner.routing.location.StreetLocation


        // test that the local stop finder finds stops
        GenericLocation loc = new GenericLocation(40.01, -74.005000001);
        assertTrue(finder.getNearbyTransitStops(loc.getCoordinate(), 100).size() > 0);

        // test that the closest vertex finder returns the closest vertex
        StreetLocation some = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
                40.00, -74.00), null);
        assertNotNull(some);

        // test that the closest vertex finder correctly splits streets
        StreetLocation start = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
                40.004, -74.01), null);
        assertNotNull(start);
        assertTrue("wheelchair accessibility is correctly set (splitting)",
                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();
        assertEquals(4, extras.size());

        // test that the closest vertex finder also adds an edge to transit
        // stops (if you are really close to the transit stop relative to the
        // street)
        StreetLocation location = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
                40.00999, -74.004999), new RoutingRequest());
        assertTrue(location.isWheelchairAccessible());
        boolean found = false;
        for (Edge extra : location.getExtra()) {
            if (extra instanceof FreeEdge && ((FreeEdge) extra).getToVertex().equals(station1)) {
                found = true;
            }
        }
        assertTrue(found);
View Full Code Here


    @Test
    public void testTraversalOfSubdividedEdge() {
        Coordinate nearestPoint = new Coordinate(0.5, 2.0);
        List<StreetEdge> edges = new ArrayList<StreetEdge>();
        edges.add(e2);
        StreetLocation intermediate = StreetLocation.createStreetLocation(_graph, "middle of e2", "foo", edges, nearestPoint);
       
        RoutingRequest options = new RoutingRequest();
        options.setMode(TraverseMode.CAR);
        options.setRoutingContext(_graph, v1, v2);
        // Creating a streetlocation splits a street and makes temporary edges that are only visible to one routing context.
        intermediate.setTemporaryEdgeVisibility(options.rctx);

        // All intersections take 10 minutes - we'll notice if one isn't counted.
        double turnDurationSecs = 10.0 * 60.0
        options.traversalCostModel = (new DummyCostModel(turnDurationSecs));
        options.turnReluctance = (1.0);
       
        State s0 = new State(options);
        State s1 = e1.traverse(s0);
        State s2 = e2.traverse(s1);
        State s3 = e3.traverse(s2);
       
        Edge partialE2First = intermediate.getIncoming().iterator().next();
        Edge partialE2Second = intermediate.getOutgoing().iterator().next();
        System.out.println(intermediate.getIncoming());
        System.out.println(intermediate.getOutgoing());
       
        State partialS0 = new State(options);
        State partialS1 = e1.traverse(partialS0);
        State partialS2A = partialE2First.traverse(partialS1);
        State partialS2B = partialE2Second.traverse(partialS2A);
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.location.StreetLocation

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.