Examples of StreetVertexIndexServiceImpl


Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

    public NetworkLinkerLibrary(Graph graph, Map<Class<?>, Object> extra) {
        this.graph = graph;
        EdgesForRoute edgesForRoute = (EdgesForRoute) extra.get(EdgesForRoute.class);
        this.edgesForRoute = edgesForRoute;
        LOG.debug("constructing index...");
        this.index = new StreetVertexIndexServiceImpl(graph);
    }
View Full Code Here

Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

        assertNotSame(left, traversedOne.getBackEdge().getFromVertex());
        assertNotSame(leftBack, traversedOne.getBackEdge().getFromVertex());
    }

    public void testStreetLocationFinder() {
        StreetVertexIndexServiceImpl finder = new StreetVertexIndexServiceImpl(graph);
        // 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);

        // test that it is possible to travel between two splits on the same street
        RoutingRequest walking = new RoutingRequest(TraverseMode.WALK);
        start = (StreetLocation) finder.getVertexForLocation(new GenericLocation(40.004, -74.0),
                walking);
        end = (StreetLocation) finder.getVertexForLocation(new GenericLocation(40.008, -74.0),
                walking);
        assertNotNull(end);
        // The visibility for temp edges for start and end is set in the setRoutingContext call
        walking.setRoutingContext(graph, start, end);
        ShortestPathTree spt = aStar.getShortestPathTree(walking);
View Full Code Here

Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

                (LineString) left.getGeometry().reverse(), "leftBack", 1500,
                StreetTraversalPermission.BICYCLE_AND_CAR, true);
        StreetEdge rightBack = new StreetEdge(tr, br, (LineString) right.getGeometry()
                .reverse(), "rightBack", 1500, StreetTraversalPermission.CAR, true);

        StreetVertexIndexServiceImpl myFinder = new StreetVertexIndexServiceImpl(graph);
        finder = myFinder;
    }
View Full Code Here

Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

        return Arrays.asList("transit");
    }

    @Override
    public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
        StreetVertexIndexService index = new StreetVertexIndexServiceImpl(graph);
        GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory();
       
        for (TransitStop ts : Iterables.filter(graph.getVertices(), TransitStop.class)) {
            Coordinate c = ts.getCoordinate();
            LOG.trace("linking stop {}", ts);
            int n = 0;
            for (TransitStop other : index.getNearbyTransitStops(c, radius)) {
                if(!other.isStreetLinkable())
                    continue;

                Coordinate coordinates[] = new Coordinate[] {c, other.getCoordinate()};
                double distance = distanceLibrary.distance(coordinates[0], coordinates[1]);
View Full Code Here

Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

    @Override
    public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
        LOG.info("Linking transit stops to tagged bus stops...");

        index = new StreetVertexIndexServiceImpl(graph);

        // iterate over a copy of vertex list because it will be modified
        ArrayList<Vertex> vertices = new ArrayList<>();
        vertices.addAll(graph.getVertices());
View Full Code Here

Examples of org.opentripplanner.routing.impl.StreetVertexIndexServiceImpl

     *         but it still good enough for the alerts need.
     */
    @Override
    public boolean fulfillDemands(TransitStop ts, Graph graph) {
        if (graph.streetIndex == null) {
            graph.streetIndex = new StreetVertexIndexServiceImpl(graph);
            LOG.debug("street index built.");
        }
        StreetVertexIndexService streetIndexService = graph.streetIndex;
        DistanceLibrary distanceLibrary;
        if (streetIndexService instanceof StreetVertexIndexServiceImpl) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.