Skip to content

Commit

Permalink
Merge remote-tracking branch 'otp/dev-2.x' into assign_platform_late
Browse files Browse the repository at this point in the history
  • Loading branch information
t2gran committed Nov 7, 2024
2 parents 80dd2dd + a9a23fd commit 53f9224
Show file tree
Hide file tree
Showing 431 changed files with 4,429 additions and 462 deletions.
5 changes: 5 additions & 0 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<artifactId>otp-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>otp-raptor</artifactId>
<version>${project.version}</version>
</dependency>

<!-- 3rd party dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void carHail() {
@Test
void carHailWithTransit() {
var modeSet = new QualifiedModeSet("CAR_HAIL,BUS,RAIL");
assertEquals(Set.of(COACH, BUS, RAIL), Set.copyOf(modeSet.getTransitModes()));
assertEquals(Set.of(BUS, RAIL), Set.copyOf(modeSet.getTransitModes()));

assertEquals(WALK, modeSet.getRequestModes().directMode);
assertEquals(CAR_HAILING, modeSet.getRequestModes().accessMode);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.opentripplanner.ext.sorlandsbanen;

import org.opentripplanner.raptor.api.model.RaptorAccessEgress;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorTransferConstraint;
import org.opentripplanner.raptor.spi.RaptorCostCalculator;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripSchedule;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.transit.model.basic.TransitMode;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public enum ApiRequestMode {
TRAM(TransitMode.TRAM),
SUBWAY(TransitMode.SUBWAY),
RAIL(TransitMode.RAIL),
BUS(TransitMode.BUS, TransitMode.COACH),
BUS(TransitMode.BUS),
COACH(TransitMode.COACH),
FERRY(TransitMode.FERRY),
CABLE_CAR(TransitMode.CABLE_CAR),
GONDOLA(TransitMode.GONDOLA),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.opentripplanner.routing.graphfinder.PatternAtStop;
import org.opentripplanner.routing.graphfinder.PlaceAtDistance;
import org.opentripplanner.routing.graphfinder.PlaceType;
import org.opentripplanner.routing.services.TransitAlertService;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
Expand Down Expand Up @@ -394,7 +395,7 @@ public DataFetcher<Object> node() {
case "Agency":
return transitService.getAgencyForId(FeedScopedId.parse(id));
case "Alert":
return null; //TODO
return transitService.getTransitAlertService().getAlertById(FeedScopedId.parse(id));
case "BikePark":
var bikeParkId = FeedScopedId.parse(id);
return vehicleParkingService == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static TransitMode mapMode(int routeType) {
// Railway Service
return TransitMode.RAIL;
} else if (routeType >= 200 && routeType < 300) { //Coach Service
return TransitMode.BUS;
return TransitMode.COACH;
} else if (routeType >= 300 && routeType < 500) { //Suburban Railway Service and Urban Railway service
if (routeType >= 401 && routeType <= 402) {
return TransitMode.SUBWAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import org.opentripplanner.model.SystemNotice;
import org.opentripplanner.model.fare.ItineraryFares;
import org.opentripplanner.raptor.api.model.RaptorConstants;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.path.PathStringBuilder;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.routing.api.request.RouteRequest;
import org.opentripplanner.routing.api.request.preference.ItineraryFilterPreferences;
import org.opentripplanner.utils.lang.DoubleUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.opentripplanner.routing.algorithm.mapping;

import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toOtpDomainCost;
import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toOtpDomainCost;

import java.time.ZonedDateTime;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Objects;
import org.opentripplanner.framework.model.TimeAndCost;
import org.opentripplanner.raptor.api.model.RaptorConstants;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.street.search.state.State;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.util.List;
import java.util.Optional;
import org.locationtech.jts.geom.Coordinate;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorTransfer;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.routing.api.request.preference.WalkPreferences;
import org.opentripplanner.street.model.edge.Edge;
import org.opentripplanner.street.search.request.StreetSearchRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.annotation.Nullable;
import org.opentripplanner.model.transfer.TransferConstraint;
import org.opentripplanner.raptor.api.model.RaptorAccessEgress;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorTransferConstraint;
import org.opentripplanner.raptor.spi.RaptorCostCalculator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost;

import java.util.Arrays;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;

/**
* This class keep a facto for each index and the minimum factor for fast retrieval during Raptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Objects;
import org.opentripplanner.framework.model.Cost;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.routing.api.request.framework.CostLinearFunction;
import org.opentripplanner.routing.api.request.framework.LinearFunctionSerialization;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost;

import org.opentripplanner.raptor.api.model.RaptorCostConverter;

/**
* This {@link FactorStrategy} keep a single value and use it every time the factor is needed. The
* {@link #minFactor()} return the same value.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.opentripplanner.routing.algorithm.raptoradapter.transit.cost;

import org.opentripplanner.raptor.api.model.RaptorAccessEgress;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorTransferConstraint;
import org.opentripplanner.raptor.spi.RaptorCostCalculator;
import org.opentripplanner.routing.api.request.preference.AccessibilityPreferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.opentripplanner.raptor.api.model.GeneralizedCostRelaxFunction;
import org.opentripplanner.raptor.api.model.RaptorAccessEgress;
import org.opentripplanner.raptor.api.model.RaptorConstants;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.raptor.api.model.RaptorTripSchedule;
import org.opentripplanner.raptor.api.model.RelaxFunction;
import org.opentripplanner.raptor.api.request.DebugRequestBuilder;
Expand All @@ -22,7 +23,6 @@
import org.opentripplanner.raptor.api.request.RaptorViaLocation;
import org.opentripplanner.raptor.rangeraptor.SystemErrDebugLogger;
import org.opentripplanner.routing.algorithm.raptoradapter.router.performance.PerformanceTimersForRaptor;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.routing.api.request.DebugEventType;
import org.opentripplanner.routing.api.request.RouteRequest;
import org.opentripplanner.routing.api.request.framework.CostLinearFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import java.util.Set;
import javax.annotation.Nullable;
import org.opentripplanner.framework.application.OTPFeature;
import org.opentripplanner.raptor.api.model.RaptorCostConverter;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.Transfer;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitLayer;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TransitTuningParameters;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.TripPatternForDate;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.ConstrainedTransfersForPatterns;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.constrainedtransfer.TransferIndexGenerator;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter;
import org.opentripplanner.routing.algorithm.raptoradapter.transit.request.RaptorRequestTransferCache;
import org.opentripplanner.transit.model.network.TripPattern;
import org.opentripplanner.transit.model.site.StopTransferPriority;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.opentripplanner.routing.algorithm.transferoptimization.model;

import static org.opentripplanner.routing.algorithm.raptoradapter.transit.cost.RaptorCostConverter.toRaptorCost;
import static org.opentripplanner.raptor.api.model.RaptorCostConverter.toRaptorCost;

/**
* This calculator uses the {@code minSafeTransferTime}(t0) and an inverse log function to calculate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.opentripplanner.transit.model.network;

import static java.util.Objects.requireNonNullElseGet;

import java.util.ArrayList;
import java.util.List;
import java.util.function.UnaryOperator;
Expand Down Expand Up @@ -219,15 +217,12 @@ private List<LineString> generateHopGeometriesFromOriginalTripPattern() {
// being replaced having a different number of stops. In that case the geometry will be
// preserved up until the first mismatching stop, and a straight line will be used for
// all segments after that.
int sizeOfShortestPattern = Math.min(
stopPattern.getSize(),
originalTripPattern.numberOfStops()
);

List<LineString> hopGeometries = new ArrayList<>();

for (int i = 0; i < sizeOfShortestPattern - 1; i++) {
LineString hopGeometry = originalTripPattern.getHopGeometry(i);
for (int i = 0; i < stopPattern.getSize() - 1; i++) {
LineString hopGeometry = i < originalTripPattern.numberOfStops() - 1
? originalTripPattern.getHopGeometry(i)
: null;

if (hopGeometry != null && stopPattern.sameStops(originalTripPattern.getStopPattern(), i)) {
// Copy hop geometry from previous pattern
Expand All @@ -236,15 +231,8 @@ private List<LineString> generateHopGeometriesFromOriginalTripPattern() {
hopGeometry != null && stopPattern.sameStations(originalTripPattern.getStopPattern(), i)
) {
// Use old geometry but patch first and last point with new stops
var newStart = new Coordinate(
stopPattern.getStop(i).getCoordinate().longitude(),
stopPattern.getStop(i).getCoordinate().latitude()
);

var newEnd = new Coordinate(
stopPattern.getStop(i + 1).getCoordinate().longitude(),
stopPattern.getStop(i + 1).getCoordinate().latitude()
);
var newStart = stopPattern.getStop(i).getCoordinate().asJtsCoordinate();
var newEnd = stopPattern.getStop(i + 1).getCoordinate().asJtsCoordinate();

Coordinate[] coordinates = originalTripPattern.getHopGeometry(i).getCoordinates().clone();
coordinates[0].setCoordinate(newStart);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,15 @@ static Stream<Arguments> transportModesCases() {
of(List.of(mode("BICYCLE")), "[ExcludeAllTransitFilter{}]"),
of(
List.of(mode("BUS")),
"[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS]}]}]"
),
of(
List.of(mode("BUS"), mode("COACH")),
"[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH]}]}]"
),
of(
List.of(mode("BUS"), mode("MONORAIL")),
"[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH, MONORAIL]}]}]"
"[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, MONORAIL]}]}]"
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.opentripplanner.transit.model.basic.TransitMode.BUS;
import static org.opentripplanner.transit.model.basic.TransitMode.CABLE_CAR;
import static org.opentripplanner.transit.model.basic.TransitMode.CARPOOL;
import static org.opentripplanner.transit.model.basic.TransitMode.COACH;
import static org.opentripplanner.transit.model.basic.TransitMode.FERRY;
import static org.opentripplanner.transit.model.basic.TransitMode.FUNICULAR;
import static org.opentripplanner.transit.model.basic.TransitMode.GONDOLA;
Expand Down Expand Up @@ -42,6 +43,8 @@ static Stream<Arguments> testCases() {
// https://groups.google.com/g/gtfs-changes/c/keT5rTPS7Y0/m/71uMz2l6ke0J?pli=1
Arguments.of(100, RAIL),
Arguments.of(199, RAIL),
Arguments.of(200, COACH),
Arguments.of(299, COACH),
Arguments.of(400, RAIL),
Arguments.of(401, SUBWAY),
Arguments.of(402, SUBWAY),
Expand Down

This file was deleted.

Loading

0 comments on commit 53f9224

Please sign in to comment.