Examples of StreetVertexIndexService


Examples of org.opentripplanner.routing.services.StreetVertexIndexService

        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.services.StreetVertexIndexService

    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) {
            distanceLibrary = ((StreetVertexIndexServiceImpl) streetIndexService).distanceLibrary;
        } else {
            distanceLibrary = SphericalDistanceLibrary.getInstance();
        }
        Envelope env = new Envelope(ts.getCoordinate());
        double rInMeters;
        if (distanceLibrary instanceof SphericalDistanceLibrary) {
            rInMeters = SphericalDistanceLibrary.RADIUS_OF_EARTH_IN_M;
        } else {
            rInMeters = 6371.01 * 1000;
        }
        double degForOneMeter = (Math.PI / (180 * rInMeters));
        double disInDeg = degForOneMeter * distance;
        env.expandBy(disInDeg);
        Collection<Edge> edges = streetIndexService.getEdgesForEnvelope(env);

        int counter = 0;
        for (Edge edge : edges) {
            if (edge instanceof StreetEdge) {
                StreetEdge streetEdge = (StreetEdge) edge;
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.