Search in sources :

Example 1 with PatternEdge

use of org.opentripplanner.routing.edgetype.PatternEdge in project OpenTripPlanner by opentripplanner.

the class ShowGraph method buildSpatialIndex.

/*
     * Iterate through all vertices and their (outgoing) edges. If they are of 'interesting' types, 
     * add them to the corresponding spatial index.
     */
public synchronized void buildSpatialIndex() {
    vertexIndex = new STRtree();
    edgeIndex = new STRtree();
    Envelope env;
    // int xminx, xmax, ymin, ymax;
    for (Vertex v : graph.getVertices()) {
        Coordinate c = v.getCoordinate();
        env = new Envelope(c);
        vertexIndex.insert(env, v);
        for (Edge e : v.getOutgoing()) {
            if (e.getGeometry() == null)
                continue;
            if (e instanceof PatternEdge || e instanceof StreetTransitLink || e instanceof StreetEdge || e instanceof PathwayEdge || e instanceof SimpleTransfer) {
                env = e.getGeometry().getEnvelopeInternal();
                edgeIndex.insert(env, e);
            }
        }
    }
    vertexIndex.build();
    edgeIndex.build();
}
Also used : Vertex(org.opentripplanner.routing.graph.Vertex) IntersectionVertex(org.opentripplanner.routing.vertextype.IntersectionVertex) Coordinate(com.vividsolutions.jts.geom.Coordinate) STRtree(com.vividsolutions.jts.index.strtree.STRtree) StreetTransitLink(org.opentripplanner.routing.edgetype.StreetTransitLink) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) SimpleTransfer(org.opentripplanner.routing.edgetype.SimpleTransfer) Envelope(com.vividsolutions.jts.geom.Envelope) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) PatternEdge(org.opentripplanner.routing.edgetype.PatternEdge) Edge(org.opentripplanner.routing.graph.Edge) PatternEdge(org.opentripplanner.routing.edgetype.PatternEdge)

Example 2 with PatternEdge

use of org.opentripplanner.routing.edgetype.PatternEdge in project OpenTripPlanner by opentripplanner.

the class ShowGraph method findVisibleElements.

@SuppressWarnings("unchecked")
private synchronized void findVisibleElements() {
    visibleVertices = (List<Vertex>) vertexIndex.query(modelBounds);
    visibleStreetEdges.clear();
    visibleLinkEdges.clear();
    visibleTransitEdges.clear();
    for (Edge de : (Iterable<Edge>) edgeIndex.query(modelBounds)) {
        if (de instanceof PatternEdge) {
            visibleTransitEdges.add(de);
        } else if (de instanceof PathwayEdge || de instanceof StreetTransitLink || de instanceof SimpleTransfer) {
            visibleLinkEdges.add(de);
        } else if (de instanceof StreetEdge) {
            visibleStreetEdges.add(de);
        }
    }
}
Also used : Vertex(org.opentripplanner.routing.graph.Vertex) IntersectionVertex(org.opentripplanner.routing.vertextype.IntersectionVertex) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) StreetTransitLink(org.opentripplanner.routing.edgetype.StreetTransitLink) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) SimpleTransfer(org.opentripplanner.routing.edgetype.SimpleTransfer) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) PatternEdge(org.opentripplanner.routing.edgetype.PatternEdge) Edge(org.opentripplanner.routing.graph.Edge) PatternEdge(org.opentripplanner.routing.edgetype.PatternEdge)

Aggregations

PathwayEdge (org.opentripplanner.routing.edgetype.PathwayEdge)2 PatternEdge (org.opentripplanner.routing.edgetype.PatternEdge)2 SimpleTransfer (org.opentripplanner.routing.edgetype.SimpleTransfer)2 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)2 StreetTransitLink (org.opentripplanner.routing.edgetype.StreetTransitLink)2 Edge (org.opentripplanner.routing.graph.Edge)2 Vertex (org.opentripplanner.routing.graph.Vertex)2 IntersectionVertex (org.opentripplanner.routing.vertextype.IntersectionVertex)2 Coordinate (com.vividsolutions.jts.geom.Coordinate)1 Envelope (com.vividsolutions.jts.geom.Envelope)1 STRtree (com.vividsolutions.jts.index.strtree.STRtree)1