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();
}
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);
}
}
}
Aggregations