Skip to content

Commit

Permalink
Merge pull request #3041 from realCity/fix/raptorPath-Place-stopIndex…
Browse files Browse the repository at this point in the history
…-fix

RaptorPathToItineraryMapper Place stopIndex fix
  • Loading branch information
t2gran committed Apr 29, 2020
2 parents b6fff03 + 4c675f5 commit cce4e7e
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ private Leg mapTransitLeg(
leg.endTime = createCalendar(pathLeg.toTime());
leg.mode = TraverseMode.fromTransitMode(tripPattern.getMode());
leg.tripId = trip.getId();
leg.from = mapStopToPlace(boardStop);
leg.to = mapStopToPlace(alightStop);
leg.from = mapStopToPlace(boardStop, boardStopIndexInPattern);
leg.to = mapStopToPlace(alightStop, alightStopIndexInPattern);
List<Coordinate> transitLegCoordinates = extractTransitLegCoordinates(pathLeg);
leg.legGeometry = PolylineEncoder.createEncodings(transitLegCoordinates);
leg.distanceMeters = getDistanceFromCoordinates(transitLegCoordinates);
Expand Down Expand Up @@ -244,8 +244,8 @@ private void mapTransferLeg(List<Leg> legs, TransferPathLeg<TripSchedule> pathLe
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);
Place to = mapStopToPlace(transferToStop);
Place from = mapStopToPlace(transferFromStop, null);
Place to = mapStopToPlace(transferToStop, null);
mapNonTransitLeg(legs, pathLeg, transfer, from, to, false);
}

Expand Down Expand Up @@ -358,13 +358,14 @@ private Place mapLocationToPlace(GenericLocation location) {
}

private Place mapTransitVertexToPlace(TransitStopVertex vertex) {
return mapStopToPlace(vertex.getStop());
return mapStopToPlace(vertex.getStop(), null);
}

private Place mapStopToPlace(Stop stop) {
private Place mapStopToPlace(Stop stop, Integer stopIndex) {
Place place = new Place(stop.getLat(), stop.getLon(), stop.getName());
place.stopId = stop.getId();
place.stopCode = stop.getCode();
place.stopIndex = stopIndex;
place.platformCode = stop.getCode();
place.zoneId = stop.getZone();
place.vertexType = VertexType.TRANSIT;
Expand All @@ -390,8 +391,7 @@ private List<StopArrival> extractIntermediateStops(TransitPathLeg<TripSchedule>
}
if (boarded) {
Stop stop = tripPattern.stopPattern.stops[j];
Place place = mapStopToPlace(stop);
place.stopIndex = j;
Place place = mapStopToPlace(stop, j);
// TODO: fill out stopSequence
StopArrival visit = new StopArrival(
place,
Expand Down

0 comments on commit cce4e7e

Please sign in to comment.