use of org.opentripplanner.routing.vertextype.TransitStopStreetVertex in project OpenTripPlanner by opentripplanner.
the class TransitToTaggedStopsModule method connectVertexToStop.
private boolean connectVertexToStop(TransitStop ts, boolean wheelchairAccessible) {
String stopCode = ts.getStopCode();
if (stopCode == null) {
return false;
}
Envelope envelope = new Envelope(ts.getCoordinate());
double xscale = Math.cos(ts.getCoordinate().y * Math.PI / 180);
envelope.expandBy(searchRadiusLat / xscale, searchRadiusLat);
Collection<Vertex> vertices = index.getVerticesForEnvelope(envelope);
// in their ref= tag that matches the GTFS stop code of this TransitStop.
for (Vertex v : vertices) {
if (!(v instanceof TransitStopStreetVertex)) {
continue;
}
TransitStopStreetVertex tsv = (TransitStopStreetVertex) v;
// Only use stop codes for linking TODO: find better method to connect stops without stop code
if (tsv.stopCode != null && tsv.stopCode.equals(stopCode)) {
new StreetTransitLink(ts, tsv, wheelchairAccessible);
new StreetTransitLink(tsv, ts, wheelchairAccessible);
LOG.debug("Connected " + ts.toString() + " to " + tsv.getLabel());
return true;
}
}
return false;
}
Aggregations