use of org.opentripplanner.routing.graph.Edge 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.graph.Edge in project OpenTripPlanner by opentripplanner.
the class ShowGraph method handleNewHighlights.
private void handleNewHighlights() {
// fill(0, 0, 0, 1);
// rect(0,0,this.width, this.height);
desaturate();
noFill();
// , 8);
stroke(256, 0, 0, 128);
strokeWeight(6);
while (!newHighlightedEdges.isEmpty()) {
Edge de = newHighlightedEdges.poll();
if (de != null) {
drawEdge(de);
highlightedEdges.add(de);
}
}
if (VIDEO)
saveVideoFrame();
}
use of org.opentripplanner.routing.graph.Edge in project OpenTripPlanner by opentripplanner.
the class ShowGraph method drawTransit.
private boolean drawTransit(int startMillis) {
if (drawTransitEdges) {
// transparent blue
stroke(40, 40, 128, 30);
strokeWeight(4);
noFill();
// for (Edge e : visibleTransitEdges) {
while (drawOffset < visibleTransitEdges.size()) {
Edge e = visibleTransitEdges.get(drawOffset);
drawEdge(e);
drawOffset += 1;
if (drawOffset % BLOCK_SIZE == 0) {
if (millis() - startMillis > FRAME_TIME)
return false;
}
}
}
return true;
}
use of org.opentripplanner.routing.graph.Edge in project OpenTripPlanner by opentripplanner.
the class ShowGraph method drawAnotation.
public void drawAnotation(GraphBuilderAnnotation anno) {
Envelope env = new Envelope();
Edge e = anno.getReferencedEdge();
if (e != null) {
this.enqueueHighlightedEdge(e);
env.expandToInclude(e.getFromVertex().getCoordinate());
env.expandToInclude(e.getToVertex().getCoordinate());
}
ArrayList<Vertex> vertices = new ArrayList<Vertex>();
Vertex v = anno.getReferencedVertex();
if (v != null) {
env.expandToInclude(v.getCoordinate());
vertices.add(v);
}
if (e == null && v == null)
return;
// make it a little bigger, especially needed for STOP_UNLINKED
env.expandBy(0.02);
// highlight relevant things
this.clearHighlights();
this.setHighlightedVertices(vertices);
// zoom the graph display
this.zoomToEnvelope(env);
// and draw
this.draw();
}
use of org.opentripplanner.routing.graph.Edge in project OpenTripPlanner by opentripplanner.
the class ShowGraph method drawLinks.
private boolean drawLinks(int startMillis) {
if (drawLinkEdges) {
// transparent blue
stroke(256, 165, 0, 30);
strokeWeight(3);
noFill();
// for (Edge e : visibleTransitEdges) {
while (drawOffset < visibleLinkEdges.size()) {
Edge e = visibleLinkEdges.get(drawOffset);
drawEdge(e);
drawOffset += 1;
if (drawOffset % BLOCK_SIZE == 0) {
if (millis() - startMillis > FRAME_TIME)
return false;
}
}
}
return true;
}
Aggregations