org.opentripplanner.routing.graphfinder.StopFinderTraverseVisitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
package org.opentripplanner.routing.graphfinder;
import org.opentripplanner.routing.algorithm.astar.TraverseVisitor;
import org.opentripplanner.routing.core.State;
import org.opentripplanner.routing.graph.Edge;
import org.opentripplanner.routing.graph.Vertex;
import org.opentripplanner.routing.vertextype.TransitStopVertex;
import java.util.ArrayList;
import java.util.List;
/**
* A TraverseVisitor used in finding stops while walking the street graph.
*/
public class StopFinderTraverseVisitor implements TraverseVisitor {
/** A list of closest stops found while walking the graph */
public final List stopsFound = new ArrayList<>();
@Override
public void visitEdge(Edge edge, State state) { }
@Override
public void visitEnqueue(State state) { }
// Accumulate stops into ret as the search runs.
@Override
public void visitVertex(State state) {
Vertex vertex = state.getVertex();
if (vertex instanceof TransitStopVertex) {
stopsFound.add(StopAtDistance.stopAtDistanceForState(state, ((TransitStopVertex) vertex).getStop()));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy