use of org.opentripplanner.routing.algorithm.raptor.transit.Transfer in project OpenTripPlanner by opentripplanner.
the class RaptorPathToItineraryMapper method mapTransferLeg.
private void mapTransferLeg(List<Leg> legs, TransferPathLeg<TripSchedule> pathLeg) {
Stop transferFromStop = transitLayer.getStopByIndex(pathLeg.fromStop());
Stop transferToStop = transitLayer.getStopByIndex(pathLeg.toStop());
Transfer transfer = transitLayer.getTransferByStopIndex().get(pathLeg.fromStop()).stream().filter(t -> t.getToStop() == pathLeg.toStop()).findFirst().get();
Place from = mapStopToPlace(transferFromStop, null);
Place to = mapStopToPlace(transferToStop, null);
mapNonTransitLeg(legs, pathLeg, transfer, from, to, false);
}
use of org.opentripplanner.routing.algorithm.raptor.transit.Transfer in project OpenTripPlanner by opentripplanner.
the class TransfersMapper method mapTransfers.
/**
* Copy pre-calculated transfers from the original graph
*/
static List<List<Transfer>> mapTransfers(StopIndexForRaptor stopIndex, Multimap<StopLocation, SimpleTransfer> transfersByStop) {
List<List<Transfer>> transferByStopIndex = new ArrayList<>();
for (int i = 0; i < stopIndex.stopsByIndex.size(); ++i) {
Stop stop = stopIndex.stopsByIndex.get(i);
ArrayList<Transfer> list = new ArrayList<>();
transferByStopIndex.add(list);
for (SimpleTransfer simpleTransfer : transfersByStop.get(stop)) {
double effectiveDistance = simpleTransfer.getEffectiveWalkDistance();
if (simpleTransfer.to instanceof Stop) {
int toStopIndex = stopIndex.indexByStop.get(simpleTransfer.to);
Transfer transfer = new Transfer(toStopIndex, (int) effectiveDistance, simpleTransfer.getEdges());
list.add(transfer);
}
}
}
return transferByStopIndex;
}