Skip to content

Commit

Permalink
Add issue when building encountering flex feeds with continuous picku…
Browse files Browse the repository at this point in the history
…p/dropoff
  • Loading branch information
leonardehrenfried committed Dec 3, 2021
1 parent 85553f0 commit 0e20d0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/ext/java/org/opentripplanner/ext/flex/FlexTripsMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.opentripplanner.ext.flex.trip.FlexTrip;
import org.opentripplanner.ext.flex.trip.ScheduledDeviatedTrip;
import org.opentripplanner.ext.flex.trip.UnscheduledTrip;
import org.opentripplanner.graph_builder.DataImportIssueStore;
import org.opentripplanner.model.StopTime;
import org.opentripplanner.model.TripStopTimes;
import org.opentripplanner.model.impl.OtpTransitServiceBuilder;
Expand All @@ -19,7 +20,10 @@ public class FlexTripsMapper {

private static final Logger LOG = LoggerFactory.getLogger(FlexTripsMapper.class);

static public List<FlexTrip> createFlexTrips(OtpTransitServiceBuilder builder) {
static public List<FlexTrip> createFlexTrips(
OtpTransitServiceBuilder builder,
DataImportIssueStore store
) {
List<FlexTrip> result = new ArrayList<>();
TripStopTimes stopTimesByTrip = builder.getStopTimesSortedByTrip();

Expand All @@ -38,7 +42,12 @@ static public List<FlexTrip> createFlexTrips(OtpTransitServiceBuilder builder) {
result.add(new UnscheduledTrip(trip, stopTimes));
} else if (ScheduledDeviatedTrip.isScheduledFlexTrip(stopTimes)) {
result.add(new ScheduledDeviatedTrip(trip, stopTimes));
} else if (hasContinuousStops(stopTimes)) {
} else if (hasContinuousStops(stopTimes) && FlexTrip.containsFlexStops(stopTimes)) {
store.add(
"ContinuousFlexTrip",
"Trip %s contains both flex stops and continuous pick up/drop off. This is an invalid combination: https://github.com/MobilityData/gtfs-flex/issues/70",
trip.getId()
);
// result.add(new ContinuousPickupDropOffTrip(trip, stopTimes));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ public void buildGraph(
calendarServiceData.add(builder.buildCalendarServiceData());

if (OTPFeature.FlexRouting.isOn()) {
builder.getFlexTripsById().addAll(FlexTripsMapper.createFlexTrips(builder));
builder.getFlexTripsById().addAll(
FlexTripsMapper.createFlexTrips(builder, issueStore)
);
}

repairStopTimesForEachTrip(builder.getStopTimesSortedByTrip());
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/opentripplanner/netex/NetexModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public void buildGraph(
calendarServiceData.add(transitBuilder.buildCalendarServiceData());

if (OTPFeature.FlexRouting.isOn()) {
transitBuilder.getFlexTripsById().addAll(FlexTripsMapper.createFlexTrips(transitBuilder));
transitBuilder.getFlexTripsById().addAll(
FlexTripsMapper.createFlexTrips(transitBuilder, issueStore)
);
}

OtpTransitService otpService = transitBuilder.build();
Expand Down

0 comments on commit 0e20d0a

Please sign in to comment.