Package org.opentripplanner.routing.impl

Examples of org.opentripplanner.routing.impl.CandidateEdgeBundle


        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());
            return null;
        }
        // if the bundle was caught endwise (T intersections and dead ends),
        // get the intersection instead.
        if (edges.endwise()) {
            List<StreetVertex> list = Arrays.asList(edges.endwiseVertex);
            linker.splitVertices.put(v, list);
            return list;
        } else {
            /* is the stop right at an intersection? */
            StreetVertex atIntersection = linker.index.getIntersectionAt(coordinate);
            if (atIntersection != null) {
                // if so, the stop can be linked directly to all vertices at the intersection
                if (edges.getScore() > distanceLibrary.distance(atIntersection.getCoordinate(), coordinate))
                    return Arrays.asList(atIntersection);
            }
            return getSplitterVertices(vertexLabel, edges.toEdgeList(), coordinate);
        }
    }
View Full Code Here


        finder = myFinder;
    }

    private void checkClosestEdgeModes(GenericLocation loc, TraversalRequirements reqs,
            int minResults) {
        CandidateEdgeBundle edges = finder.getClosestEdges(loc, reqs);
        assertTrue(minResults <= edges.size());

        // Double check that all the edges returned can be traversed.
        for (CandidateEdge e : edges) {
            assertTrue(reqs.canBeTraversed(e.edge));
        }
View Full Code Here

        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);
        assertEquals(2, edges.size());
    }
View Full Code Here

     */
    private void checkBest(TraversalRequirements reqs, GenericLocation loc,
            StreetEdge expectedBest, int expectedCandidates) {
        // Should give me the top edge as the best edge.
        // topBack is worse because of the heading.
        CandidateEdgeBundle candidates = finder.getClosestEdges(loc, reqs);
        assertEquals(expectedBest, candidates.best.edge);
        assertEquals(expectedCandidates, candidates.size());
    }
View Full Code Here

        // Location along the top edge, traveling with the forward edge
        // exactly.
        GenericLocation loc = new GenericLocation(c);
        loc.heading = top.getAzimuth();
       
        CandidateEdgeBundle candidates = finder.getClosestEdges(loc, reqs);
        Collections.sort(candidates, new CandidateEdge.CandidateEdgeScoreComparator());
       
        // Check that scores are in ascending order.
        double lastScore = candidates.best.score;
        for (CandidateEdge ce : candidates) {
            assertTrue(ce.score >= lastScore);
            lastScore = ce.score;
        }
       
        assertEquals(candidates.best.score, candidates.get(0).score, 0.0);
    }   
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.impl.CandidateEdgeBundle

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.