- * The definition of important is a stop where many routes of mode RAIL, SUBWAY or FERRY depart.
- *
- * This means that the search radius scales with density of "important" stops:
- *
in more rural regions the radius is bigger and stops further away are considered
- *
- * The strategy is useful when you want to limit the number of accesses of Park+Ride, Bike+Ride and
- * Bike+Transit: it improves both performance the quality of results.
- *
- * {@see https://github.com/opentripplanner/OpenTripPlanner/pull/3906}
- */
-public class VehicleToStopSkipEdgeStrategy implements SkipEdgeStrategy {
-
- public static final Set applicableModes = Set.of(
- BIKE_TO_PARK,
- BIKE_RENTAL,
- CAR_TO_PARK,
- CAR_PICKUP,
- CAR_HAILING,
- CAR_RENTAL,
- SCOOTER_RENTAL
- );
- private final Function> getPatternsForStop;
- private final int maxScore;
- private final List filters;
- private double sumOfScores;
-
- private final Set stopsCounted = new HashSet<>();
-
- public VehicleToStopSkipEdgeStrategy(
- Function> getPatternsForStop,
- Collection filters
- ) {
- this.filters = new ArrayList<>(filters);
- this.maxScore = 300;
- this.getPatternsForStop = getPatternsForStop;
- }
-
- @Override
- public boolean shouldSkipEdge(State current, Edge edge) {
- if (current.currentMode().isWalking()) {
- if (
- current.getVertex() instanceof TransitStopVertex stopVertex &&
- !stopsCounted.contains(stopVertex.getStop().getId())
- ) {
- // TODO: 2022-12-05 filters: check performance on that and verify that this is right. Previously we were filtering just on modes
- var stop = stopVertex.getStop();
-
- // Not using streams. Performance is important here
- var patterns = getPatternsForStop.apply(stop);
- var score = 0;
- for (var pattern : patterns) {
- for (var filter : filters) {
- if (filter.matchTripPattern(pattern)) {
- score += VehicleToStopSkipEdgeStrategy.score(pattern.getMode());
- break;
- }
- }
- }
-
- stopsCounted.add(stop.getId());
-
- sumOfScores = sumOfScores + score;
- }
- return false;
- } else {
- return sumOfScores >= maxScore;
- }
- }
-
- private static int score(TransitMode mode) {
- return switch (mode) {
- case RAIL, FERRY, SUBWAY -> 20;
- case BUS -> 1;
- default -> 2;
- };
- }
-}
diff --git a/src/main/java/org/opentripplanner/apis/APIEndpoints.java b/src/main/java/org/opentripplanner/apis/APIEndpoints.java
index 959815f1716..b6b70eb238e 100644
--- a/src/main/java/org/opentripplanner/apis/APIEndpoints.java
+++ b/src/main/java/org/opentripplanner/apis/APIEndpoints.java
@@ -63,6 +63,8 @@ private APIEndpoints() {
addIfEnabled(SandboxAPIMapboxVectorTilesApi, VectorTilesResource.class);
addIfEnabled(SandboxAPIParkAndRideApi, ParkAndRideResource.class);
addIfEnabled(SandboxAPIGeocoder, GeocoderResource.class);
+ // scheduled to be removed and only here for backwards compatibility
+ addIfEnabled(SandboxAPIGeocoder, GeocoderResource.GeocoderResourceOldPath.class);
addIfEnabled(SandboxAPITravelTime, TravelTimeResource.class);
// scheduled to be removed
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java b/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java
index 7101d132834..ff3e8681ce8 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java
+++ b/src/main/java/org/opentripplanner/apis/gtfs/GtfsGraphQLIndex.java
@@ -77,7 +77,6 @@
import org.opentripplanner.apis.gtfs.datafetchers.VehicleRentalStationImpl;
import org.opentripplanner.apis.gtfs.datafetchers.debugOutputImpl;
import org.opentripplanner.apis.gtfs.datafetchers.elevationProfileComponentImpl;
-import org.opentripplanner.apis.gtfs.datafetchers.fareImpl;
import org.opentripplanner.apis.gtfs.datafetchers.placeAtDistanceImpl;
import org.opentripplanner.apis.gtfs.datafetchers.serviceTimeRangeImpl;
import org.opentripplanner.apis.gtfs.datafetchers.stepImpl;
@@ -128,7 +127,6 @@ protected static GraphQLSchema buildSchema() {
.type(typeWiring.build(debugOutputImpl.class))
.type(typeWiring.build(DepartureRowImpl.class))
.type(typeWiring.build(elevationProfileComponentImpl.class))
- .type(typeWiring.build(fareImpl.class))
.type(typeWiring.build(FeedImpl.class))
.type(typeWiring.build(FeedImpl.class))
.type(typeWiring.build(GeometryImpl.class))
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java b/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java
index 63104ecc79a..c7ae82a2355 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java
+++ b/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/ItineraryImpl.java
@@ -2,14 +2,10 @@
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers;
import org.opentripplanner.apis.gtfs.mapping.NumberMapper;
import org.opentripplanner.model.SystemNotice;
-import org.opentripplanner.model.fare.ItineraryFares;
import org.opentripplanner.model.plan.Emissions;
import org.opentripplanner.model.plan.Itinerary;
import org.opentripplanner.model.plan.Leg;
@@ -42,24 +38,8 @@ public DataFetcher endTime() {
}
@Override
- public DataFetcher>> fares() {
- return environment -> {
- ItineraryFares fare = getSource(environment).getFares();
- if (fare == null) {
- return null;
- }
- return fare
- .getFareTypes()
- .stream()
- .map(fareKey -> {
- Map result = new HashMap<>();
- result.put("name", fareKey);
- result.put("fare", fare.getFare(fareKey));
- result.put("details", List.of());
- return result;
- })
- .collect(Collectors.toList());
- };
+ public DataFetcher> fares() {
+ return environment -> List.of();
}
@Override
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java b/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java
index d749987384c..a4f5cb00e2f 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java
+++ b/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/QueryTypeImpl.java
@@ -21,7 +21,6 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.locationtech.jts.geom.Coordinate;
@@ -710,7 +709,7 @@ public DataFetcher> stopsByBbox() {
);
Stream stopStream = getTransitService(environment)
- .findRegularStop(envelope)
+ .findRegularStops(envelope)
.stream()
.filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate()));
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/fareImpl.java b/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/fareImpl.java
deleted file mode 100644
index fb2c6ee184c..00000000000
--- a/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/fareImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.opentripplanner.apis.gtfs.datafetchers;
-
-import graphql.schema.DataFetcher;
-import graphql.schema.DataFetchingEnvironment;
-import java.util.List;
-import java.util.Map;
-import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers;
-import org.opentripplanner.transit.model.basic.Money;
-
-public class fareImpl implements GraphQLDataFetchers.GraphQLFare {
-
- @Override
- public DataFetcher cents() {
- return environment -> ((Money) getSource(environment).get("fare")).minorUnitAmount();
- }
-
- @Override
- public DataFetcher> components() {
- return environment -> List.of();
- }
-
- @Override
- public DataFetcher currency() {
- return environment -> ((Money) getSource(environment).get("fare")).currency().getCurrencyCode();
- }
-
- @Override
- public DataFetcher type() {
- return environment -> getSource(environment).get("name").toString();
- }
-
- private Map getSource(DataFetchingEnvironment environment) {
- return environment.getSource();
- }
-}
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java b/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java
index cd002ec187b..2f39f7f4030 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java
+++ b/src/main/java/org/opentripplanner/apis/gtfs/generated/GraphQLDataFetchers.java
@@ -402,7 +402,7 @@ public interface GraphQLItinerary {
public DataFetcher endTime();
- public DataFetcher>> fares();
+ public DataFetcher> fares();
public DataFetcher generalizedCost();
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml b/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml
index c720fc5a119..c141266d2e6 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml
+++ b/src/main/java/org/opentripplanner/apis/gtfs/generated/graphql-codegen.yml
@@ -54,7 +54,6 @@ config:
DepartureRow: org.opentripplanner.routing.graphfinder.PatternAtStop#PatternAtStop
elevationProfileComponent: org.opentripplanner.model.plan.ElevationProfile.Step
Emissions: org.opentripplanner.model.plan.Emissions#Emissions
- fare: java.util.Map#Map
Feed: String
Geometry: org.locationtech.jts.geom.Geometry#Geometry
InputField: org.opentripplanner.apis.gtfs.generated.GraphQLTypes.GraphQLInputField#GraphQLInputField
diff --git a/src/main/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapper.java b/src/main/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapper.java
index 212bfbcf380..5bc00cb7a85 100644
--- a/src/main/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapper.java
+++ b/src/main/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapper.java
@@ -340,8 +340,8 @@ private static void setVehicleWalkingPreferences(
) {
callWith.argument("bikeWalkingReluctance", walking::withReluctance);
callWith.argument("bikeWalkingSpeed", walking::withSpeed);
- callWith.argument("bikeSwitchTime", time -> walking.withHopTime((int) time));
- callWith.argument("bikeSwitchCost", cost -> walking.withHopCost((int) cost));
+ callWith.argument("bikeSwitchTime", time -> walking.withMountDismountTime((int) time));
+ callWith.argument("bikeSwitchCost", cost -> walking.withMountDismountCost((int) cost));
}
private static class CallerWithEnvironment {
diff --git a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java b/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java
index 00bf98c703f..638d7783e9a 100644
--- a/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java
+++ b/src/main/java/org/opentripplanner/apis/transmodel/TransmodelGraphQLSchema.java
@@ -687,7 +687,7 @@ private GraphQLSchema create() {
);
return GqlUtil
.getTransitService(environment)
- .findRegularStop(envelope)
+ .findRegularStops(envelope)
.stream()
.filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate()))
.filter(stop ->
diff --git a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java b/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java
index accaf1e35fb..d178e5125b5 100644
--- a/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java
+++ b/src/main/java/org/opentripplanner/apis/transmodel/model/stop/StopPlaceType.java
@@ -531,7 +531,7 @@ public static Collection fetchStopPlaces(
);
Stream stations = transitService
- .findRegularStop(envelope)
+ .findRegularStops(envelope)
.stream()
.filter(stop -> envelope.contains(stop.getCoordinate().asJtsCoordinate()))
.map(StopLocation::getParentStation)
diff --git a/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java b/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java
index 03f4357e540..dc6ba627e0e 100644
--- a/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java
+++ b/src/main/java/org/opentripplanner/apis/vectortiles/GraphInspectorVectorTileResource.java
@@ -179,7 +179,7 @@ private static LayerBuilder> createLayerBuilder(
case RegularStop -> new StopLayerBuilder<>(
layerParameters,
locale,
- e -> context.transitService().findRegularStop(e)
+ e -> context.transitService().findRegularStops(e)
);
case AreaStop -> new StopLayerBuilder<>(
layerParameters,
diff --git a/src/main/java/org/opentripplanner/framework/application/OTPFeature.java b/src/main/java/org/opentripplanner/framework/application/OTPFeature.java
index 4847b204077..4ae5004cf6b 100644
--- a/src/main/java/org/opentripplanner/framework/application/OTPFeature.java
+++ b/src/main/java/org/opentripplanner/framework/application/OTPFeature.java
@@ -105,8 +105,7 @@ public enum OTPFeature {
SandboxAPIMapboxVectorTilesApi(false, true, "Enable Mapbox vector tiles API."),
SandboxAPIParkAndRideApi(false, true, "Enable park-and-ride endpoint."),
SandboxAPITravelTime(false, true, "Enable the isochrone/travel time surface API."),
- TransferAnalyzer(false, true, "Analyze transfers during graph build."),
- VehicleToStopHeuristics(false, true, "Enable improved heuristic for park-and-ride queries.");
+ TransferAnalyzer(false, true, "Analyze transfers during graph build.");
private static final Object TEST_LOCK = new Object();
diff --git a/src/main/java/org/opentripplanner/framework/lang/StringUtils.java b/src/main/java/org/opentripplanner/framework/lang/StringUtils.java
index c726d03c66c..cbb32b9eaca 100644
--- a/src/main/java/org/opentripplanner/framework/lang/StringUtils.java
+++ b/src/main/java/org/opentripplanner/framework/lang/StringUtils.java
@@ -110,4 +110,13 @@ public static String padRight(String value, char ch, int width) {
public static String quoteReplace(@Nonnull String text) {
return text.replace('\'', '\"');
}
+
+ /**
+ * Convert "HELLO_WORLD" or "HellO_WorlD" to "hello-world".
+ *
+ * https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case
+ */
+ public static String kebabCase(String input) {
+ return input.toLowerCase().replace('_', '-');
+ }
}
diff --git a/src/main/java/org/opentripplanner/graph_builder/module/NearbyStopFinder.java b/src/main/java/org/opentripplanner/graph_builder/module/NearbyStopFinder.java
index 360cdaee363..7386b60b452 100644
--- a/src/main/java/org/opentripplanner/graph_builder/module/NearbyStopFinder.java
+++ b/src/main/java/org/opentripplanner/graph_builder/module/NearbyStopFinder.java
@@ -18,8 +18,6 @@
import org.opentripplanner.astar.strategy.MaxCountSkipEdgeStrategy;
import org.opentripplanner.ext.dataoverlay.routing.DataOverlayContext;
import org.opentripplanner.ext.flex.trip.FlexTrip;
-import org.opentripplanner.ext.vehicletostopheuristics.BikeToStopSkipEdgeStrategy;
-import org.opentripplanner.ext.vehicletostopheuristics.VehicleToStopSkipEdgeStrategy;
import org.opentripplanner.framework.application.OTPFeature;
import org.opentripplanner.framework.application.OTPRequestTimeoutException;
import org.opentripplanner.routing.api.request.RouteRequest;
@@ -85,7 +83,7 @@ public NearbyStopFinder(
// We need to accommodate straight line distance (in meters) but when streets are present we
// use an earliest arrival search, which optimizes on time. Ideally we'd specify in meters,
// but we don't have much of a choice here. Use the default walking speed to convert.
- this.directGraphFinder = new DirectGraphFinder(transitService::findRegularStop);
+ this.directGraphFinder = new DirectGraphFinder(transitService::findRegularStops);
}
}
@@ -205,7 +203,7 @@ public List findNearbyStopsViaStreets(
ShortestPathTree spt = StreetSearchBuilder
.of()
- .setSkipEdgeStrategy(getSkipEdgeStrategy(reverseDirection, request))
+ .setSkipEdgeStrategy(getSkipEdgeStrategy())
.setDominanceFunction(new DominanceFunctions.MinimumWeight())
.setRequest(request)
.setArriveBy(reverseDirection)
@@ -271,48 +269,14 @@ private List findNearbyStopsViaDirectTransfers(Vertex vertex) {
return directGraphFinder.findClosestStops(c0, limitMeters);
}
- private SkipEdgeStrategy getSkipEdgeStrategy(
- boolean reverseDirection,
- RouteRequest routingRequest
- ) {
+ private SkipEdgeStrategy getSkipEdgeStrategy() {
var durationSkipEdgeStrategy = new DurationSkipEdgeStrategy(durationLimit);
- // if we compute the accesses for Park+Ride, Bike+Ride and Bike+Transit we don't want to
- // search the full durationLimit as this returns way too many stops.
- // this is both slow and returns suboptimal results as it favours long drives with short
- // transit legs.
- // therefore, we use a heuristic based on the number of routes and their mode to determine
- // what are "good" stops for those accesses. if we have reached a threshold of "good" stops
- // we stop the access search.
- if (
- !reverseDirection &&
- OTPFeature.VehicleToStopHeuristics.isOn() &&
- VehicleToStopSkipEdgeStrategy.applicableModes.contains(
- routingRequest.journey().access().mode()
- )
- ) {
- var strategy = new VehicleToStopSkipEdgeStrategy(
- transitService::getPatternsForStop,
- routingRequest.journey().transit().filters()
- );
-
+ if (maxStopCount > 0) {
+ var strategy = new MaxCountSkipEdgeStrategy<>(maxStopCount, NearbyStopFinder::hasReachedStop);
return new ComposingSkipEdgeStrategy<>(strategy, durationSkipEdgeStrategy);
- } else if (
- OTPFeature.VehicleToStopHeuristics.isOn() &&
- routingRequest.journey().access().mode() == StreetMode.BIKE
- ) {
- var strategy = new BikeToStopSkipEdgeStrategy(transitService::getTripsForStop);
- return new ComposingSkipEdgeStrategy<>(strategy, durationSkipEdgeStrategy);
- } else {
- if (maxStopCount > 0) {
- var strategy = new MaxCountSkipEdgeStrategy<>(
- maxStopCount,
- NearbyStopFinder::hasReachedStop
- );
- return new ComposingSkipEdgeStrategy<>(strategy, durationSkipEdgeStrategy);
- }
- return durationSkipEdgeStrategy;
}
+ return durationSkipEdgeStrategy;
}
private static List createDirectlyConnectedStops(
diff --git a/src/main/java/org/opentripplanner/model/fare/FareProduct.java b/src/main/java/org/opentripplanner/model/fare/FareProduct.java
index c82e128f550..189b73807e7 100644
--- a/src/main/java/org/opentripplanner/model/fare/FareProduct.java
+++ b/src/main/java/org/opentripplanner/model/fare/FareProduct.java
@@ -51,6 +51,7 @@ public String toString() {
return ToStringBuilder
.of(FareProduct.class)
.addStr("id", id.toString())
+ .addStr("name", name)
.addObj("amount", price)
.addDuration("duration", validity)
.addObj("category", category)
diff --git a/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java b/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java
index d60dbfb249e..1a64f21c41b 100644
--- a/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java
+++ b/src/main/java/org/opentripplanner/model/fare/ItineraryFares.java
@@ -4,18 +4,13 @@
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import java.util.Collection;
-import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import javax.annotation.Nullable;
import org.opentripplanner.framework.lang.Sandbox;
import org.opentripplanner.framework.tostring.ToStringBuilder;
import org.opentripplanner.model.plan.Leg;
-import org.opentripplanner.routing.core.FareType;
-import org.opentripplanner.transit.model.basic.Money;
/**
*
@@ -38,14 +33,6 @@ public class ItineraryFares {
*/
private final Multimap legProducts = LinkedHashMultimap.create();
- /**
- * Holds the "fares" for the entire itinerary. The definition of a fare is not clear so
- * this is deprecated.
- * @deprecated Exists only for backwards compatibility and will be removed in the future.
- */
- @Deprecated
- private final Map fares = new HashMap<>();
-
public static ItineraryFares empty() {
return new ItineraryFares();
}
@@ -64,19 +51,6 @@ public Multimap getLegProducts() {
return ImmutableMultimap.copyOf(legProducts);
}
- /**
- * Add a "fare". This is an ill-defined concept (is it for the entire itinerary or only some
- * legs?) from the early days of OTP which will be removed in the future.
- *
- * @deprecated It only exists for backwards-compatibility.
- * Use {@link ItineraryFares#addFareProduct(Leg, FareProduct)},
- * {@link ItineraryFares#addItineraryProducts(Collection)} instead.
- */
- @Deprecated
- public void addFare(FareType fareType, Money money) {
- fares.put(fareType, money);
- }
-
/**
* Add fare products that cover the entire itinerary, i.e. are valid for all legs.
*/
@@ -84,29 +58,6 @@ public void addItineraryProducts(Collection products) {
itineraryProducts.addAll(products);
}
- /**
- *
- * Get the "fare" for a specific fare type.
- *
- * It is ill-defined what this actually means (entire itinerary?, some legs?).
- *
- * Use {@link ItineraryFares#getItineraryProducts()} or {@link ItineraryFares#getLegProducts()}
- * instead.
- */
- @Nullable
- @Deprecated
- public Money getFare(FareType type) {
- return fares.get(type);
- }
-
- /**
- * Return the set of {@link FareType}s that are contained in this instance.
- */
- @Deprecated
- public Set getFareTypes() {
- return fares.keySet();
- }
-
@Override
public int hashCode() {
return Objects.hash(itineraryProducts, legProducts);
@@ -152,4 +103,19 @@ public void addFareProduct(Leg leg, Collection fareProduct) {
public void addFareProductUses(Multimap fareProducts) {
legProducts.putAll(fareProducts);
}
+
+ /**
+ * Add the contents of another instance to this one.
+ */
+ public void add(ItineraryFares fare) {
+ itineraryProducts.addAll(fare.itineraryProducts);
+ legProducts.putAll(fare.legProducts);
+ }
+
+ /**
+ * Does this instance contain any fare products?
+ */
+ public boolean isEmpty() {
+ return itineraryProducts.isEmpty() && legProducts.isEmpty();
+ }
}
diff --git a/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java b/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java
index 60bd4d4c769..c45fc3e33a8 100644
--- a/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java
+++ b/src/main/java/org/opentripplanner/routing/api/request/framework/TimeAndCostPenaltyForEnum.java
@@ -81,6 +81,13 @@ private EnumMap copyValues() {
return values.isEmpty() ? new EnumMap<>(type) : new EnumMap<>(values);
}
+ /**
+ * Convert the values to an {@link EnumMap}.
+ */
+ public EnumMap asEnumMap() {
+ return copyValues();
+ }
+
private static > String toString(
Class> clazz,
Map values
diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java b/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java
index db8845e7c41..ada495b19ba 100644
--- a/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java
+++ b/src/main/java/org/opentripplanner/routing/api/request/preference/AccessEgressPreferences.java
@@ -7,12 +7,12 @@
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
-import org.opentripplanner.framework.model.Units;
import org.opentripplanner.framework.tostring.ToStringBuilder;
import org.opentripplanner.routing.api.request.StreetMode;
import org.opentripplanner.routing.api.request.framework.DurationForEnum;
import org.opentripplanner.routing.api.request.framework.TimeAndCostPenalty;
import org.opentripplanner.routing.api.request.framework.TimeAndCostPenaltyForEnum;
+import org.opentripplanner.routing.api.request.framework.TimePenalty;
/**
* Preferences for access/egress routing on street network
@@ -21,14 +21,27 @@
*/
public final class AccessEgressPreferences implements Serializable {
+ private static final TimeAndCostPenalty DEFAULT_PENALTY = TimeAndCostPenalty.of(
+ TimePenalty.of(ofMinutes(20), 2f),
+ 1.5
+ );
+ private static final TimeAndCostPenaltyForEnum DEFAULT_TIME_AND_COST = TimeAndCostPenaltyForEnum
+ .of(StreetMode.class)
+ .with(StreetMode.CAR_TO_PARK, DEFAULT_PENALTY)
+ .with(StreetMode.CAR_HAILING, DEFAULT_PENALTY)
+ .with(StreetMode.CAR_RENTAL, DEFAULT_PENALTY)
+ .with(StreetMode.FLEXIBLE, DEFAULT_PENALTY)
+ .build();
+
public static final AccessEgressPreferences DEFAULT = new AccessEgressPreferences();
+
private final TimeAndCostPenaltyForEnum penalty;
private final DurationForEnum maxDuration;
private final int maxStopCount;
private AccessEgressPreferences() {
this.maxDuration = durationForStreetModeOf(ofMinutes(45));
- this.penalty = TimeAndCostPenaltyForEnum.ofDefault(StreetMode.class);
+ this.penalty = DEFAULT_TIME_AND_COST;
this.maxStopCount = 500;
}
diff --git a/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java b/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java
index aa3631e1c6b..b7adc04df1c 100644
--- a/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java
+++ b/src/main/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferences.java
@@ -19,15 +19,15 @@ public class VehicleWalkingPreferences implements Serializable {
private final double speed;
private final double reluctance;
- private final Duration hopTime;
- private final Cost hopCost;
+ private final Duration mountDismountTime;
+ private final Cost mountDismountCost;
private final double stairsReluctance;
private VehicleWalkingPreferences() {
this.speed = 1.33;
this.reluctance = 5.0;
- this.hopTime = Duration.ZERO;
- this.hopCost = Cost.ZERO;
+ this.mountDismountTime = Duration.ZERO;
+ this.mountDismountCost = Cost.ZERO;
// very high reluctance to carry the bike up/down a flight of stairs
this.stairsReluctance = 10;
}
@@ -39,8 +39,8 @@ private VehicleWalkingPreferences() {
private VehicleWalkingPreferences(Builder builder) {
this.speed = Units.speed(builder.speed);
this.reluctance = Units.reluctance(builder.reluctance);
- this.hopTime = Duration.ofSeconds(Units.duration(builder.hopTime));
- this.hopCost = Cost.costOfSeconds(builder.hopCost);
+ this.mountDismountTime = Duration.ofSeconds(Units.duration(builder.mountDismountTime));
+ this.mountDismountCost = Cost.costOfSeconds(builder.mountDismountCost);
this.stairsReluctance = Units.reluctance(builder.stairsReluctance);
}
@@ -73,13 +73,13 @@ public double reluctance() {
}
/** Time to get on and off your own vehicle. */
- public Duration hopTime() {
- return hopTime;
+ public Duration mountDismountTime() {
+ return mountDismountTime;
}
/** Cost of getting on and off your own vehicle. */
- public Cost hopCost() {
- return hopCost;
+ public Cost mountDismountCost() {
+ return mountDismountCost;
}
/** Reluctance of walking carrying a vehicle up a flight of stairs. */
@@ -95,15 +95,15 @@ public boolean equals(Object o) {
return (
speed == that.speed &&
reluctance == that.reluctance &&
- Objects.equals(hopTime, that.hopTime) &&
- Objects.equals(hopCost, that.hopCost) &&
+ Objects.equals(mountDismountTime, that.mountDismountTime) &&
+ Objects.equals(mountDismountCost, that.mountDismountCost) &&
stairsReluctance == that.stairsReluctance
);
}
@Override
public int hashCode() {
- return Objects.hash(speed, reluctance, hopTime, hopCost, stairsReluctance);
+ return Objects.hash(speed, reluctance, mountDismountTime, mountDismountCost, stairsReluctance);
}
@Override
@@ -112,8 +112,8 @@ public String toString() {
.of(VehicleWalkingPreferences.class)
.addNum("speed", speed, DEFAULT.speed)
.addNum("reluctance", reluctance, DEFAULT.reluctance)
- .addObj("hopTime", hopTime, DEFAULT.hopTime)
- .addObj("hopCost", hopCost, DEFAULT.hopCost)
+ .addObj("mountDismountTime", mountDismountTime, DEFAULT.mountDismountTime)
+ .addObj("mountDismountCost", mountDismountCost, DEFAULT.mountDismountCost)
.addNum("stairsReluctance", stairsReluctance, DEFAULT.stairsReluctance)
.toString();
}
@@ -123,16 +123,16 @@ public static class Builder {
private final VehicleWalkingPreferences original;
private double speed;
private double reluctance;
- private int hopTime;
- private int hopCost;
+ private int mountDismountTime;
+ private int mountDismountCost;
private double stairsReluctance;
private Builder(VehicleWalkingPreferences original) {
this.original = original;
this.speed = original.speed;
this.reluctance = original.reluctance;
- this.hopTime = (int) original.hopTime.toSeconds();
- this.hopCost = original.hopCost.toSeconds();
+ this.mountDismountTime = (int) original.mountDismountTime.toSeconds();
+ this.mountDismountCost = original.mountDismountCost.toSeconds();
this.stairsReluctance = original.stairsReluctance;
}
@@ -146,18 +146,18 @@ public VehicleWalkingPreferences.Builder withReluctance(double reluctance) {
return this;
}
- public VehicleWalkingPreferences.Builder withHopTime(Duration hopTime) {
- this.hopTime = (int) hopTime.toSeconds();
+ public VehicleWalkingPreferences.Builder withMountDismountTime(Duration mountDismountTime) {
+ this.mountDismountTime = (int) mountDismountTime.toSeconds();
return this;
}
- public VehicleWalkingPreferences.Builder withHopTime(int hopTime) {
- this.hopTime = hopTime;
+ public VehicleWalkingPreferences.Builder withMountDismountTime(int mountDismountTime) {
+ this.mountDismountTime = mountDismountTime;
return this;
}
- public VehicleWalkingPreferences.Builder withHopCost(int hopCost) {
- this.hopCost = hopCost;
+ public VehicleWalkingPreferences.Builder withMountDismountCost(int mountDismountCost) {
+ this.mountDismountCost = mountDismountCost;
return this;
}
diff --git a/src/main/java/org/opentripplanner/routing/core/FareType.java b/src/main/java/org/opentripplanner/routing/core/FareType.java
index 8efe12246d2..007f9e2cef6 100644
--- a/src/main/java/org/opentripplanner/routing/core/FareType.java
+++ b/src/main/java/org/opentripplanner/routing/core/FareType.java
@@ -10,10 +10,7 @@
@Deprecated
public enum FareType implements Serializable {
regular,
- student,
senior,
- tram,
- special,
youth,
electronicRegular,
electronicSenior,
diff --git a/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java b/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java
index 830a80c39a5..047e44f229a 100644
--- a/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java
+++ b/src/main/java/org/opentripplanner/routing/linking/FlexLocationAdder.java
@@ -16,7 +16,7 @@ static void addFlexLocations(StreetEdge edge, IntersectionVertex v0, StopModel s
if (edge.getPermission().allows(StreetTraversalPermission.PEDESTRIAN_AND_CAR)) {
Point p = GeometryUtils.getGeometryFactory().createPoint(v0.getCoordinate());
Envelope env = p.getEnvelopeInternal();
- for (AreaStop areaStop : stopModel.queryLocationIndex(env)) {
+ for (AreaStop areaStop : stopModel.findAreaStops(env)) {
if (!areaStop.getGeometry().disjoint(p)) {
v0.addAreaStops(Set.of(areaStop));
}
diff --git a/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java b/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java
index fa3a7069e2d..bbc6733a40c 100644
--- a/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java
+++ b/src/main/java/org/opentripplanner/standalone/api/OtpServerRequestContext.java
@@ -114,7 +114,7 @@ public interface OtpServerRequestContext {
TraverseVisitor traverseVisitor();
default GraphFinder graphFinder() {
- return GraphFinder.getInstance(graph(), transitService()::findRegularStop);
+ return GraphFinder.getInstance(graph(), transitService()::findRegularStops);
}
FlexConfig flexConfig();
diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java b/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java
index ce880058005..0e048a2e3e7 100644
--- a/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java
+++ b/src/main/java/org/opentripplanner/standalone/config/framework/json/EnumMapper.java
@@ -3,6 +3,7 @@
import java.util.Arrays;
import java.util.Optional;
import org.opentripplanner.framework.doc.DocumentedEnum;
+import org.opentripplanner.framework.lang.StringUtils;
public class EnumMapper {
@@ -23,11 +24,7 @@ public static Optional extends Enum>> mapToEnum2(String text, Class extend
}
public static String toString(Enum> en) {
- return kebabCase(en.name());
- }
-
- public static String kebabCase(String input) {
- return input.toLowerCase().replace('_', '-');
+ return StringUtils.kebabCase(en.name());
}
/**
diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java b/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java
index 296c07805f9..06675475fd1 100644
--- a/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java
+++ b/src/main/java/org/opentripplanner/standalone/config/framework/json/NodeInfo.java
@@ -7,6 +7,7 @@
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.opentripplanner.framework.lang.StringUtils;
import org.opentripplanner.framework.tostring.ValueObjectToStringBuilder;
/**
@@ -137,7 +138,7 @@ public List extends Enum>> enumTypeValues() {
*/
public String toMarkdownString(Object value) {
if (enumType != null) {
- value = EnumMapper.kebabCase(value.toString());
+ value = StringUtils.kebabCase(value.toString());
}
return type.quote(value);
}
diff --git a/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java b/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java
index f1d90d0ec40..088a7794585 100644
--- a/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java
+++ b/src/main/java/org/opentripplanner/standalone/config/framework/json/ParameterBuilder.java
@@ -303,14 +303,15 @@ public > Map asEnumMap(Class enumType, Class el
*/
public > Map asEnumMap(
Class enumType,
- Function typeMapper
+ Function typeMapper,
+ Map defaultValue
) {
info.withOptional().withEnumMap(enumType, OBJECT);
var mapNode = buildObject();
if (mapNode.isEmpty()) {
- return Map.of();
+ return defaultValue;
}
EnumMap result = new EnumMap<>(enumType);
diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java b/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java
index 4538f6de84d..c4b0b0bd8cb 100644
--- a/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java
+++ b/src/main/java/org/opentripplanner/standalone/config/routerequest/RouteRequestConfig.java
@@ -15,12 +15,16 @@
import static org.opentripplanner.standalone.config.routerequest.WheelchairConfig.mapWheelchairPreferences;
import java.time.Duration;
+import java.util.List;
+import java.util.stream.Collectors;
import org.opentripplanner.api.parameter.QualifiedModeSet;
import org.opentripplanner.framework.application.OTPFeature;
+import org.opentripplanner.framework.lang.StringUtils;
import org.opentripplanner.routing.api.request.RequestModes;
import org.opentripplanner.routing.api.request.RouteRequest;
import org.opentripplanner.routing.api.request.StreetMode;
import org.opentripplanner.routing.api.request.framework.CostLinearFunction;
+import org.opentripplanner.routing.api.request.preference.AccessEgressPreferences;
import org.opentripplanner.routing.api.request.preference.BikePreferences;
import org.opentripplanner.routing.api.request.preference.CarPreferences;
import org.opentripplanner.routing.api.request.preference.RoutingPreferences;
@@ -455,7 +459,9 @@ private static void mapStreetPreferences(NodeAdapter c, StreetPreferences.Builde
the access legs used. In other cases where the access(CAR) is faster than transit the
performance will be better.
- The default is no penalty, if not configured.
+ The default values are
+
+ %s
Example: `"car-to-park" : { "timePenalty": "10m + 1.5t", "costFactor": 2.5 }`
@@ -470,9 +476,15 @@ the access legs used. In other cases where the access(CAR) is faster than transi
The `costFactor` is used to add an additional cost to the leg´s generalized-cost. The
time-penalty is multiplied with the cost-factor. A cost-factor of zero, gives no
extra cost, while 1.0 will add the same amount to both time and cost.
- """
+ """.formatted(
+ formatPenaltyDefaultValues(dftAccessEgress)
+ )
+ )
+ .asEnumMap(
+ StreetMode.class,
+ TimeAndCostPenaltyMapper::map,
+ dftAccessEgress.penalty().asEnumMap()
)
- .asEnumMap(StreetMode.class, TimeAndCostPenaltyMapper::map)
)
.withMaxDuration(
cae
@@ -569,6 +581,16 @@ The street search(AStar) aborts after this duration and any paths found are retu
);
}
+ private static String formatPenaltyDefaultValues(AccessEgressPreferences dftAccessEgress) {
+ return dftAccessEgress
+ .penalty()
+ .asEnumMap()
+ .entrySet()
+ .stream()
+ .map(s -> "- `%s` = %s".formatted(StringUtils.kebabCase(s.getKey().toString()), s.getValue()))
+ .collect(Collectors.joining("\n"));
+ }
+
private static void mapCarPreferences(NodeAdapter root, CarPreferences.Builder builder) {
var dft = builder.original();
NodeAdapter c = root.of("car").since(V2_5).summary("Car preferences.").asObject();
diff --git a/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java b/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java
index f2ba922c8e3..2b20e12f755 100644
--- a/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java
+++ b/src/main/java/org/opentripplanner/standalone/config/routerequest/VehicleWalkingConfig.java
@@ -43,9 +43,9 @@ private static void mapVehicleWalkingPreferences(
)
.asDouble(dft.reluctance())
)
- .withHopTime(
+ .withMountDismountTime(
c
- .of("hopTime")
+ .of("mountDismountTime")
.since(V2_0)
.summary("The time it takes the user to hop on or off a vehicle.")
.description(
@@ -54,11 +54,11 @@ private static void mapVehicleWalkingPreferences(
for controlling the duration of those events.
"""
)
- .asDuration(dft.hopTime())
+ .asDuration(dft.mountDismountTime())
)
- .withHopCost(
+ .withMountDismountCost(
c
- .of("hopCost")
+ .of("mountDismountCost")
.since(V2_0)
.summary("The cost of hopping on or off a vehicle.")
.description(
@@ -67,7 +67,7 @@ private static void mapVehicleWalkingPreferences(
not meant for controlling the cost of those events.
"""
)
- .asInt(dft.hopCost().toSeconds())
+ .asInt(dft.mountDismountCost().toSeconds())
)
.withStairsReluctance(
c
diff --git a/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java b/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java
index 799a5b006e6..7f61982434d 100644
--- a/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java
+++ b/src/main/java/org/opentripplanner/street/model/edge/BikeWalkableEdge.java
@@ -17,8 +17,10 @@ default void switchToWalkingBike(RoutingPreferences preferences, StateEditor edi
editor.setBackWalkingBike(true);
if (shouldIncludeCost) {
- editor.incrementWeight(preferences.bike().walking().hopCost().toSeconds());
- editor.incrementTimeInSeconds((int) preferences.bike().walking().hopTime().toSeconds());
+ editor.incrementWeight(preferences.bike().walking().mountDismountCost().toSeconds());
+ editor.incrementTimeInSeconds(
+ (int) preferences.bike().walking().mountDismountTime().toSeconds()
+ );
}
}
@@ -28,8 +30,10 @@ default void switchToBiking(RoutingPreferences preferences, StateEditor editor)
editor.setBackWalkingBike(false);
if (shouldIncludeCost) {
- editor.incrementWeight(preferences.bike().walking().hopCost().toSeconds());
- editor.incrementTimeInSeconds((int) preferences.bike().walking().hopTime().toSeconds());
+ editor.incrementWeight(preferences.bike().walking().mountDismountCost().toSeconds());
+ editor.incrementTimeInSeconds(
+ (int) preferences.bike().walking().mountDismountTime().toSeconds()
+ );
}
}
diff --git a/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java b/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java
index 8873e6ede99..64cad9325d1 100644
--- a/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java
+++ b/src/main/java/org/opentripplanner/transit/model/site/GroupStopBuilder.java
@@ -4,7 +4,6 @@
import java.util.List;
import java.util.function.IntSupplier;
import javax.annotation.Nonnull;
-import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryCollection;
import org.opentripplanner.framework.geometry.GeometryUtils;
@@ -69,6 +68,22 @@ public I18NString name() {
}
public GroupStopBuilder addLocation(StopLocation location) {
+ if (
+ !(
+ location.getStopType() == StopType.REGULAR ||
+ location.getStopType() == StopType.FLEXIBLE_AREA
+ )
+ ) {
+ throw new RuntimeException(
+ String.format(
+ "Unsupported location for %s. Must be %s or %s.",
+ GroupStop.class.getSimpleName(),
+ StopType.REGULAR,
+ StopType.FLEXIBLE_AREA
+ )
+ );
+ }
+
stopLocations.add(location);
int numGeometries = geometry.getNumGeometries();
@@ -76,17 +91,8 @@ public GroupStopBuilder addLocation(StopLocation location) {
for (int i = 0; i < numGeometries; i++) {
newGeometries[i] = geometry.getGeometryN(i);
}
- if (location instanceof RegularStop) {
- WgsCoordinate coordinate = location.getCoordinate();
- Envelope envelope = new Envelope(coordinate.asJtsCoordinate());
- double xscale = Math.cos(coordinate.latitude() * Math.PI / 180);
- envelope.expandBy(100 / xscale, 100);
- newGeometries[numGeometries] = GeometryUtils.getGeometryFactory().toGeometry(envelope);
- } else if (location instanceof AreaStop) {
- newGeometries[numGeometries] = location.getGeometry();
- } else {
- throw new RuntimeException("Unknown location type");
- }
+ newGeometries[numGeometries] = location.getGeometry();
+
geometry = new GeometryCollection(newGeometries, GeometryUtils.getGeometryFactory());
centroid = new WgsCoordinate(geometry.getCentroid());
diff --git a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java b/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java
index 0d08bcf34b2..3050fca6a3d 100644
--- a/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java
+++ b/src/main/java/org/opentripplanner/transit/service/DefaultTransitService.java
@@ -543,7 +543,7 @@ public ZonedDateTime getTransitServiceStarts() {
}
@Override
- public Collection findRegularStop(Envelope envelope) {
+ public Collection findRegularStops(Envelope envelope) {
OTPRequestTimeoutException.checkForTimeout();
return transitModel.getStopModel().findRegularStops(envelope);
}
@@ -551,7 +551,7 @@ public Collection findRegularStop(Envelope envelope) {
@Override
public Collection findAreaStops(Envelope envelope) {
OTPRequestTimeoutException.checkForTimeout();
- return transitModel.getStopModel().queryLocationIndex(envelope);
+ return transitModel.getStopModel().findAreaStops(envelope);
}
@Override
diff --git a/src/main/java/org/opentripplanner/transit/service/StopModel.java b/src/main/java/org/opentripplanner/transit/service/StopModel.java
index dd6b65e5b33..763aa504c40 100644
--- a/src/main/java/org/opentripplanner/transit/service/StopModel.java
+++ b/src/main/java/org/opentripplanner/transit/service/StopModel.java
@@ -108,7 +108,7 @@ public StopModelBuilder withContext() {
}
/**
- * Return a regular transit stop if found(not flex stops).
+ * Return a regular transit stop if found (not flex stops).
*/
public RegularStop getRegularStop(FeedScopedId id) {
return regularStopById.get(id);
@@ -121,6 +121,9 @@ public Collection listRegularStops() {
return regularStopById.values();
}
+ /**
+ * Find regular stops within a geographical area.
+ */
public Collection findRegularStops(Envelope envelope) {
return index.findRegularStops(envelope);
}
@@ -131,21 +134,30 @@ public boolean hasAreaStops() {
/**
* Flex locations are generated by GTFS graph builder, but consumed only after the street graph is
- * built
+ * built.
*/
@Nullable
public AreaStop getAreaStop(FeedScopedId id) {
return areaStopById.get(id);
}
+ /**
+ * Return all flex stops, not regular transit stops and flex group of stops.
+ */
public Collection listAreaStops() {
return areaStopById.values();
}
- public Collection queryLocationIndex(Envelope envelope) {
+ /**
+ * Find flex stops within a geographical area.
+ */
+ public Collection findAreaStops(Envelope envelope) {
return index.findAreaStops(envelope);
}
+ /**
+ * Return all flex groups of stops.
+ */
public Collection listGroupStops() {
return groupStopById.values();
}
diff --git a/src/main/java/org/opentripplanner/transit/service/TransitService.java b/src/main/java/org/opentripplanner/transit/service/TransitService.java
index d0664aa292d..fdb6dda8749 100644
--- a/src/main/java/org/opentripplanner/transit/service/TransitService.java
+++ b/src/main/java/org/opentripplanner/transit/service/TransitService.java
@@ -187,7 +187,7 @@ List stopTimesForPatternAtStop(
boolean transitFeedCovers(Instant dateTime);
- Collection findRegularStop(Envelope envelope);
+ Collection findRegularStops(Envelope envelope);
Collection findAreaStops(Envelope envelope);
diff --git a/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls b/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls
index ac2413caeae..daeb57d655e 100644
--- a/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls
+++ b/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls
@@ -933,6 +933,10 @@ type Emissions {
co2: Grams
}
+"""
+This type is only here for backwards-compatibility and this API will never return it anymore.
+Please use the leg's `fareProducts` instead.
+"""
type fare {
type: String @deprecated
@@ -949,7 +953,10 @@ type fare {
components: [fareComponent] @deprecated
}
-"""Component of the fare (i.e. ticket) for a part of the itinerary"""
+"""
+This type is only here for backwards-compatibility and this API will never return it anymore.
+Please use the leg's `fareProducts` instead.
+"""
type fareComponent {
"""ID of the ticket type. Corresponds to `fareId` in **TicketType**."""
fareId: String @deprecated
@@ -1574,7 +1581,7 @@ type Itinerary {
"""
Information about the fares for this itinerary. This is primarily a GTFS Fares V1 interface
- will be removed in the future.
+ and always returns an empty list. Use the leg's `fareProducts` instead.
"""
fares: [fare] @deprecated(reason: "Use the leg's `fareProducts`.")
}
diff --git a/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql b/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
index 25cf95ca2f9..dad106418fe 100644
--- a/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
+++ b/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql
@@ -774,7 +774,7 @@ type QueryType {
"Input type for executing a travel search for a trip between two locations. Returns trip patterns describing suggested alternatives for the trip."
trip(
"Time and cost penalty on access/egress modes."
- accessEgressPenalty: [PenaltyForStreetMode!] = [],
+ accessEgressPenalty: [PenaltyForStreetMode!] = [{streetMode : car_park, timePenalty : "20m + 2.0 t", costFactor : 1.5}, {streetMode : flexible, timePenalty : "20m + 2.0 t", costFactor : 1.5}],
"The alightSlack is the minimum extra time after exiting a public transport vehicle. This is the default value used, if not overridden by the 'alightSlackList'."
alightSlackDefault: Int = 0,
"List of alightSlack for a given set of modes. Defaults: []"
diff --git a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java b/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java
index 6e99e096c2c..d89afea6f9d 100644
--- a/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java
+++ b/src/test/java/org/opentripplanner/apis/gtfs/GraphQLIntegrationTest.java
@@ -183,7 +183,6 @@ static void setup() {
var railLeg = (ScheduledTransitLeg) i1.getTransitLeg(2);
var fares = new ItineraryFares();
- fares.addFare(FareType.regular, Money.euros(3.1f));
var dayPass = fareProduct("day-pass");
fares.addItineraryProducts(List.of(dayPass));
diff --git a/src/test/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapperTest.java b/src/test/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapperTest.java
index b05dd77e2a9..85736291ada 100644
--- a/src/test/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapperTest.java
+++ b/src/test/java/org/opentripplanner/apis/gtfs/mapping/RouteRequestMapperTest.java
@@ -55,7 +55,7 @@ class RouteRequestMapperTest implements PlanTestConstants {
graph.getVehicleParkingService(),
new DefaultVehicleRentalService(),
new DefaultRealtimeVehicleService(transitService),
- GraphFinder.getInstance(graph, transitService::findRegularStop),
+ GraphFinder.getInstance(graph, transitService::findRegularStops),
new RouteRequest()
);
}
diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
index 41bc4278ca1..5e2a04c07d7 100644
--- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
+++ b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/BikeRentalSnapshotTest.snap
@@ -7,33 +7,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:32:24.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -493,33 +468,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:38:09.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -937,33 +887,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:40:10.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1277,33 +1202,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:45:24.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1763,33 +1663,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:54:24.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -2249,33 +2124,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.accessBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:56:10.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -3264,33 +3114,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:28:51.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -3802,33 +3627,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:35:24.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -4220,33 +4020,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:37:21.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -4612,33 +4387,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:43:51.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -5150,33 +4900,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:51:24.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -5568,33 +5293,8 @@ org.opentripplanner.routing.algorithm.mapping.BikeRentalSnapshotTest.egressBikeR
"elevationLost" : 0.0,
"endTime" : "2009-10-21T23:56:21.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
index 6579e4bbd37..390185cd96f 100644
--- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
+++ b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/ElevationSnapshotTest.snap
@@ -535,33 +535,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 4.23,
"endTime" : "2009-10-21T23:31:21.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -929,33 +904,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 23.58,
"endTime" : "2009-10-21T23:35:04.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1349,33 +1299,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 1.09,
"endTime" : "2009-10-21T23:37:44.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1743,33 +1668,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 4.76,
"endTime" : "2009-10-21T23:46:18.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -2215,33 +2115,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 4.23,
"endTime" : "2009-10-21T23:46:21.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -2609,33 +2484,8 @@ org.opentripplanner.routing.algorithm.mapping.ElevationSnapshotTest.transit=[
"elevationLost" : 23.58,
"endTime" : "2009-10-21T23:51:04.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
diff --git a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
index d5da342f9a6..adc5ee69635 100644
--- a/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
+++ b/src/test/java/org/opentripplanner/routing/algorithm/mapping/__snapshots__/TransitSnapshotTest.snap
@@ -235,33 +235,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:38:41.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -718,33 +693,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:39:22.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1266,33 +1216,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:53:55.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -1749,33 +1674,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:55:32.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -2297,33 +2197,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T19:08:19.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -3044,33 +2919,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:38:40.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -3530,33 +3380,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T18:54:10.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -4016,33 +3841,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T19:09:40.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -4502,33 +4302,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T19:11:51.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
@@ -5028,33 +4803,8 @@ org.opentripplanner.routing.algorithm.mapping.TransitSnapshotTest.test_trip_plan
"elevationLost" : 0.0,
"endTime" : "2009-11-17T19:25:05.000+00:00",
"fare" : {
- "coveringItinerary" : [
- {
- "amount" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- },
- "id" : "prt:regular",
- "name" : "regular"
- }
- ],
"details" : { },
- "fare" : {
- "regular" : {
- "cents" : 200,
- "currency" : {
- "currency" : "USD",
- "currencyCode" : "USD",
- "defaultFractionDigits" : 2,
- "symbol" : "$"
- }
- }
- },
+ "fare" : { },
"legProducts" : [
{
"legIndices" : [
diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java b/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java
index 1d47337a312..0289c24e837 100644
--- a/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java
+++ b/src/test/java/org/opentripplanner/routing/api/request/preference/StreetPreferencesTest.java
@@ -109,10 +109,10 @@ void testToString() {
"routingTimeout: 3s, " +
"elevator: ElevatorPreferences{boardTime: 2m}, " +
"intersectionTraversalModel: CONSTANT, " +
- "accessEgress: AccessEgressPreferences{" +
- "penalty: TimeAndCostPenaltyForEnum{CAR_TO_PARK: " +
+ "accessEgress: AccessEgressPreferences{penalty: TimeAndCostPenaltyForEnum{CAR_TO_PARK: " +
CAR_PENALTY +
- "}, " +
+ ", CAR_RENTAL: (timePenalty: 20m + 2.0 t, costFactor: 1.50), CAR_HAILING: (timePenalty: 20m + 2.0 t, costFactor: 1.50), " +
+ "FLEXIBLE: (timePenalty: 20m + 2.0 t, costFactor: 1.50)}, " +
"maxDuration: DurationForStreetMode{default:5m}" +
"}, " +
"maxDirectDuration: DurationForStreetMode{default:10m}" +
diff --git a/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java b/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java
index 9571eee8cc5..fdc416d7c0f 100644
--- a/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java
+++ b/src/test/java/org/opentripplanner/routing/api/request/preference/VehicleWalkingPreferencesTest.java
@@ -11,8 +11,8 @@ class VehicleWalkingPreferencesTest {
private static final double SPEED = 1.45;
private static final double RELUCTANCE = 5.5;
- private static final Duration HOP_TIME = Duration.ofSeconds(15);
- private static final Cost HOP_COST = Cost.costOfSeconds(20);
+ private static final Duration MOUNT_DISMOUNT_TIME = Duration.ofSeconds(15);
+ private static final Cost MOUNT_DISMOUNT_COST = Cost.costOfSeconds(20);
private static final double STAIRS_RELUCTANCE = 11;
private final VehicleWalkingPreferences subject = createPreferences();
@@ -28,13 +28,13 @@ void reluctance() {
}
@Test
- void hopTime() {
- assertEquals(HOP_TIME, subject.hopTime());
+ void mountDismountTime() {
+ assertEquals(MOUNT_DISMOUNT_TIME, subject.mountDismountTime());
}
@Test
- void hopCost() {
- assertEquals(HOP_COST, subject.hopCost());
+ void mountDismountCost() {
+ assertEquals(MOUNT_DISMOUNT_COST, subject.mountDismountCost());
}
@Test
@@ -57,8 +57,8 @@ void testToString() {
"VehicleWalkingPreferences{" +
"speed: 1.45, " +
"reluctance: 5.5, " +
- "hopTime: PT15S, " +
- "hopCost: $20, " +
+ "mountDismountTime: PT15S, " +
+ "mountDismountCost: $20, " +
"stairsReluctance: 11.0}",
subject.toString()
);
@@ -69,8 +69,8 @@ private VehicleWalkingPreferences createPreferences() {
.of()
.withSpeed(SPEED)
.withReluctance(RELUCTANCE)
- .withHopTime(HOP_TIME)
- .withHopCost(HOP_COST.toSeconds())
+ .withMountDismountTime(MOUNT_DISMOUNT_TIME)
+ .withMountDismountCost(MOUNT_DISMOUNT_COST.toSeconds())
.withStairsReluctance(STAIRS_RELUCTANCE)
.build();
}
diff --git a/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java b/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java
index 2b22bc9e41f..3ad3b918ce1 100644
--- a/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java
+++ b/src/test/java/org/opentripplanner/routing/core/ItineraryFaresTest.java
@@ -1,6 +1,7 @@
package org.opentripplanner.routing.core;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opentripplanner.model.plan.PlanTestConstants.A;
import static org.opentripplanner.model.plan.PlanTestConstants.B;
import static org.opentripplanner.model.plan.PlanTestConstants.C;
@@ -59,6 +60,11 @@ void legProduct() {
);
}
+ @Test
+ void empty() {
+ assertTrue(ItineraryFares.empty().isEmpty());
+ }
+
@Nonnull
private static FareProduct fareProduct(String id) {
return new FareProduct(id(id), id, Money.euros(10), null, null, null);
diff --git a/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java b/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java
index f975579cbf5..be44d1ea86f 100644
--- a/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java
+++ b/src/test/java/org/opentripplanner/standalone/config/framework/json/NodeAdapterTest.java
@@ -225,15 +225,23 @@ public void asEnumMapWithCustomType() {
NodeAdapter subject = newNodeAdapterForTest("{ key : { A: {a:'Foo'} } }");
assertEquals(
Map.of(AnEnum.A, new ARecord("Foo")),
- subject.of("key").asEnumMap(AnEnum.class, ARecord::fromJson)
+ subject.of("key").asEnumMap(AnEnum.class, ARecord::fromJson, Map.of())
);
assertEquals(
Collections.emptyMap(),
- subject.of("missing-key").asEnumMap(AnEnum.class, ARecord::fromJson)
+ subject.of("missing-key").asEnumMap(AnEnum.class, ARecord::fromJson, Map.of())
);
assertEquals(NON_UNUSED_PARAMETERS, unusedParams(subject));
}
+ @Test
+ public void asEnumMapWithDefaultValue() {
+ var subject = newNodeAdapterForTest("{}");
+ final Map dflt = Map.of(AnEnum.A, new ARecord("Foo"));
+ assertEquals(dflt, subject.of("key").asEnumMap(AnEnum.class, ARecord::fromJson, dflt));
+ assertEquals(NON_UNUSED_PARAMETERS, unusedParams(subject));
+ }
+
@Test
public void asEnumMapWithUnknownKey() {
NodeAdapter subject = newNodeAdapterForTest("{ enumMap : { unknown : 7 } }");
diff --git a/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java b/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java
index 417f1b87347..41ec677b3bb 100644
--- a/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java
+++ b/src/test/java/org/opentripplanner/street/integration/BikeWalkingTest.java
@@ -375,7 +375,10 @@ private List runStreetSearchAndCreateDescriptor(
preferences
.withWalk(w -> w.withSpeed(10))
.withBike(it ->
- it.withSpeed(20d).withWalking(w -> w.withSpeed(5d).withHopTime(100).withHopCost(1000))
+ it
+ .withSpeed(20d)
+ .withWalking(w -> w.withSpeed(5d).withMountDismountTime(100).withMountDismountCost(1000)
+ )
)
);
request.setArriveBy(arriveBy);
diff --git a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java b/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java
index 42d841b9fa3..ed5768d4a1a 100644
--- a/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java
+++ b/src/test/java/org/opentripplanner/street/model/edge/StreetEdgeTest.java
@@ -221,7 +221,7 @@ public void testBikeSwitch() {
StreetSearchRequestBuilder noPenalty = StreetSearchRequest.copyOf(proto);
noPenalty.withPreferences(p ->
- p.withBike(it -> it.withWalking(w -> w.withHopTime(0).withHopCost(0)))
+ p.withBike(it -> it.withWalking(w -> w.withMountDismountTime(0).withMountDismountCost(0)))
);
State s0 = new State(v0, noPenalty.withMode(StreetMode.BIKE).build());
@@ -231,7 +231,7 @@ public void testBikeSwitch() {
StreetSearchRequestBuilder withPenalty = StreetSearchRequest.copyOf(proto);
withPenalty.withPreferences(p ->
- p.withBike(it -> it.withWalking(w -> w.withHopTime(42).withHopCost(23)))
+ p.withBike(it -> it.withWalking(w -> w.withMountDismountTime(42).withMountDismountCost(23)))
);
State s4 = new State(v0, withPenalty.withMode(StreetMode.BIKE).build());
diff --git a/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java b/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java
index 17938131eef..b57566b68ed 100644
--- a/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java
+++ b/src/test/java/org/opentripplanner/transit/model/site/GroupStopTest.java
@@ -6,7 +6,12 @@
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.util.List;
+import java.util.Objects;
import org.junit.jupiter.api.Test;
+import org.locationtech.jts.geom.Geometry;
+import org.opentripplanner._support.geometry.Coordinates;
+import org.opentripplanner._support.geometry.Polygons;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.framework.i18n.NonLocalizedString;
import org.opentripplanner.transit.model._data.TransitModelForTest;
@@ -14,12 +19,14 @@
class GroupStopTest {
- private static TransitModelForTest TEST_MODEL = TransitModelForTest.of();
+ private static final TransitModelForTest TEST_MODEL = TransitModelForTest.of();
private static final String ID = "1";
private static final I18NString NAME = new NonLocalizedString("name");
- private static final StopLocation STOP_LOCATION = TEST_MODEL.stop("1:stop", 1d, 1d).build();
+ private static final StopLocation STOP_LOCATION = TEST_MODEL
+ .stop("1:stop", Coordinates.BERLIN.getX(), Coordinates.BERLIN.getY())
+ .build();
private static final GroupStop subject = StopModel
.of()
.groupStop(TransitModelForTest.id(ID))
@@ -27,6 +34,53 @@ class GroupStopTest {
.addLocation(STOP_LOCATION)
.build();
+ @Test
+ void testGroupStopGeometry() {
+ StopLocation stopLocation1 = TEST_MODEL
+ .stop("1:stop", Coordinates.BERLIN.getX(), Coordinates.BERLIN.getY())
+ .build();
+ StopLocation stopLocation2 = TEST_MODEL
+ .stop("2:stop", Coordinates.HAMBURG.getX(), Coordinates.HAMBURG.getY())
+ .build();
+
+ GroupStop groupStop = StopModel
+ .of()
+ .groupStop(TransitModelForTest.id(ID))
+ .withName(NAME)
+ .addLocation(stopLocation1)
+ .addLocation(stopLocation2)
+ .build();
+
+ Geometry groupStopGeometry1 = Objects.requireNonNull(groupStop.getGeometry()).getGeometryN(0);
+ assertEquals(stopLocation1.getGeometry(), groupStopGeometry1);
+
+ Geometry groupStopGeometry2 = Objects.requireNonNull(groupStop.getGeometry()).getGeometryN(1);
+ assertEquals(stopLocation2.getGeometry(), groupStopGeometry2);
+ }
+
+ @Test
+ void testGroupStopEncompassingAreaGeometry() {
+ StopLocation stopLocation = TEST_MODEL
+ .stop("1:stop", Coordinates.BERLIN.getX(), Coordinates.BERLIN.getY())
+ .build();
+
+ GroupStop groupStop = StopModel
+ .of()
+ .groupStop(TransitModelForTest.id(ID))
+ .withName(NAME)
+ .addLocation(stopLocation)
+ .withEncompassingAreaGeometries(List.of(Polygons.BERLIN))
+ .build();
+
+ Geometry groupStopGeometry = Objects.requireNonNull(groupStop.getGeometry()).getGeometryN(0);
+ assertEquals(stopLocation.getGeometry(), groupStopGeometry);
+
+ assertEquals(
+ Polygons.BERLIN,
+ groupStop.getEncompassingAreaGeometry().orElseThrow().getGeometryN(0)
+ );
+ }
+
@Test
void copy() {
assertEquals(ID, subject.getId().getId());
diff --git a/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java b/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java
index 2a26dc681be..f04fe782a0a 100644
--- a/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java
+++ b/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java
@@ -43,6 +43,8 @@ static void setup() {
.build();
var transitModel = new TransitModel(stopModel, new Deduplicator());
+ transitModel.addTripPattern(RAIL_PATTERN.getId(), RAIL_PATTERN);
+ transitModel.index();
service =
new DefaultTransitService(transitModel) {
diff --git a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json
index 9ee3d4706b3..1defc81ded1 100644
--- a/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json
+++ b/src/test/resources/org/opentripplanner/apis/gtfs/expectations/plan-fares.json
@@ -183,14 +183,7 @@
"fareProducts" : [ ]
}
],
- "fares" : [
- {
- "type" : "regular",
- "cents" : 310,
- "currency" : "EUR",
- "components" : []
- }
- ]
+ "fares" : [ ]
}
]
}