Skip to content

Commit

Permalink
Git merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
eibakke committed Nov 28, 2024
2 parents a621865 + 996fa3f commit f06f6f7
Show file tree
Hide file tree
Showing 194 changed files with 2,508 additions and 1,382 deletions.
4 changes: 2 additions & 2 deletions application/src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/img/otp-logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OTP Debug Client</title>
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/11/2024-11-22T08:29/assets/index-CwmtYnAr.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/11/2024-11-22T08:29/assets/index-CaBThmWm.css">
<script type="module" crossorigin src="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/11/2024-11-27T19:19/assets/index-csysh7Fh.js"></script>
<link rel="stylesheet" crossorigin href="https://cdn.jsdelivr.net/gh/opentripplanner/debug-client-assets@main/2024/11/2024-11-27T19:19/assets/index-CaBThmWm.css">
</head>
<body>
<div id="root"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static void setup() {
.build();

@Override
public List<TransitMode> getModesOfStopLocation(StopLocation stop) {
public List<TransitMode> findTransitModes(StopLocation stop) {
if (stop.getVehicleType() != null) {
return List.of(stop.getVehicleType());
} else {
Expand All @@ -144,15 +144,15 @@ public List<TransitMode> getModesOfStopLocation(StopLocation stop) {
}

@Override
public Agency getAgencyForId(FeedScopedId id) {
public Agency getAgency(FeedScopedId id) {
if (id.equals(BVG.getId())) {
return BVG;
}
return null;
}

@Override
public Set<Route> getRoutesForStop(StopLocation stop) {
public Set<Route> findRoutes(StopLocation stop) {
return Set.of(TimetableRepositoryForTest.route("route1").withAgency(BVG).build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public TestTransitService(TimetableRepository timetableRepository) {
}

@Override
public Set<Route> getRoutesForStop(StopLocation stop) {
public Set<Route> findRoutes(StopLocation stop) {
return Set.of(
TimetableRepositoryForTest.route("1").withMode(TransitMode.RAIL).withGtfsType(100).build()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
import org.opentripplanner.framework.i18n.TranslatedString;
import org.opentripplanner.inspector.vector.KeyValue;
import org.opentripplanner.inspector.vector.LayerParameters;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingGroup;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingState;
import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingRepository;
import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingService;
import org.opentripplanner.service.vehicleparking.model.VehicleParking;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingGroup;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingSpaces;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingState;
import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.framework.FeedScopedId;
Expand Down Expand Up @@ -90,9 +91,8 @@ public void setUp() {

@Test
public void vehicleParkingGroupGeometryTest() {
Graph graph = new Graph();
VehicleParkingService service = graph.getVehicleParkingService();
service.updateVehicleParking(List.of(vehicleParking), List.of());
var repository = new DefaultVehicleParkingRepository();
repository.updateVehicleParking(List.of(vehicleParking), List.of());

var config =
"""
Expand All @@ -116,7 +116,7 @@ public void vehicleParkingGroupGeometryTest() {
var tiles = VectorTileConfig.mapVectorTilesParameters(nodeAdapter, "vectorTiles");
assertEquals(1, tiles.layers().size());
var builder = new VehicleParkingGroupsLayerBuilderWithPublicGeometry(
graph,
new DefaultVehicleParkingService(repository),
tiles.layers().get(0),
Locale.US
);
Expand Down Expand Up @@ -171,11 +171,11 @@ private static class VehicleParkingGroupsLayerBuilderWithPublicGeometry
extends VehicleParkingGroupsLayerBuilder {

public VehicleParkingGroupsLayerBuilderWithPublicGeometry(
Graph graph,
VehicleParkingService service,
LayerParameters<VectorTilesResource.LayerType> layerParameters,
Locale locale
) {
super(graph, layerParameters, locale);
super(service, layerParameters, locale);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.opentripplanner.framework.geometry.WgsCoordinate;
import org.opentripplanner.framework.i18n.TranslatedString;
import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingState;
import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingRepository;
import org.opentripplanner.service.vehicleparking.internal.DefaultVehicleParkingService;
import org.opentripplanner.service.vehicleparking.model.VehicleParking;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingSpaces;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingState;
import org.opentripplanner.standalone.config.routerconfig.VectorTileConfig;
import org.opentripplanner.transit.model._data.TimetableRepositoryForTest;
import org.opentripplanner.transit.model.framework.Deduplicator;
Expand Down Expand Up @@ -86,9 +86,8 @@ public void setUp() {

@Test
public void vehicleParkingGeometryTest() {
Graph graph = new Graph();
VehicleParkingService service = graph.getVehicleParkingService();
service.updateVehicleParking(List.of(vehicleParking), List.of());
var repo = new DefaultVehicleParkingRepository();
repo.updateVehicleParking(List.of(vehicleParking), List.of());

var config =
"""
Expand All @@ -111,7 +110,7 @@ public void vehicleParkingGeometryTest() {
var nodeAdapter = newNodeAdapterForTest(config);
var tiles = VectorTileConfig.mapVectorTilesParameters(nodeAdapter, "vectorTiles");
assertEquals(1, tiles.layers().size());
var builder = new VehicleParkingsLayerBuilder(graph, tiles.layers().getFirst(), Locale.US);
var builder = new VehicleParkingsLayerBuilder(new DefaultVehicleParkingService(repo), tiles.layers().getFirst(), Locale.US);

List<Geometry> geometries = builder.getGeometries(new Envelope(0.99, 1.01, 1.99, 2.01));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.time.Duration;
import java.util.Locale;
import org.junit.jupiter.api.Test;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingState;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingState;
import org.opentripplanner.test.support.ResourceLoader;
import org.opentripplanner.transit.model.basic.Locales;
import org.opentripplanner.transit.model.framework.FeedScopedId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.opentripplanner._support.time.ZoneIds;
import org.opentripplanner.model.calendar.openinghours.OpeningHoursCalendarService;
import org.opentripplanner.model.calendar.openinghours.OsmOpeningHoursSupport;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingState;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingState;
import org.opentripplanner.test.support.ResourceLoader;
import org.opentripplanner.transit.model.framework.Deduplicator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public TransitStopVertex getStopVertexForStopId(FeedScopedId stopId) {

@Override
public Collection<PathTransfer> getTransfersFromStop(StopLocation stop) {
return transitService.getTransfersByStop(stop);
return transitService.findPathTransfers(stop);
}

@Override
Expand All @@ -207,7 +207,7 @@ public Collection<PathTransfer> getTransfersToStop(StopLocation stop) {

@Override
public boolean isDateActive(FlexServiceDate date, FlexTrip<?, ?> trip) {
int serviceCode = transitService.getServiceCodeForId(trip.getTrip().getServiceId());
int serviceCode = transitService.getServiceCode(trip.getTrip().getServiceId());
return date.isTripServiceRunning(serviceCode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static Optional<LuceneStopCluster> map(List<StopLocation> stopLocations)
}

private List<Agency> agenciesForStopLocation(StopLocation stop) {
return transitService.getRoutesForStop(stop).stream().map(Route::getAgency).distinct().toList();
return transitService.findRoutes(stop).stream().map(Route::getAgency).distinct().toList();
}

private List<Agency> agenciesForStopLocationsGroup(StopLocationsGroup group) {
Expand All @@ -190,7 +190,7 @@ StopCluster.Location toLocation(FeedScopedId id) {
var loc = transitService.getStopLocation(id);
if (loc != null) {
var feedPublisher = toFeedPublisher(transitService.getFeedInfo(id.getFeedId()));
var modes = transitService.getModesOfStopLocation(loc).stream().map(Enum::name).toList();
var modes = transitService.findTransitModes(loc).stream().map(Enum::name).toList();
var agencies = agenciesForStopLocation(loc)
.stream()
.map(StopClusterMapper::toAgency)
Expand All @@ -209,7 +209,7 @@ StopCluster.Location toLocation(FeedScopedId id) {
var group = transitService.getStopLocationsGroup(id);
var feedPublisher = toFeedPublisher(transitService.getFeedInfo(id.getFeedId()));
var modes = transitService
.getModesOfStopLocationsGroup(group)
.findTransitModes(group)
.stream()
.map(Enum::name)
.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.routing.graphfinder.DirectGraphFinder;
import org.opentripplanner.routing.graphfinder.GraphFinder;
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehicleparking.model.VehicleParking;
import org.opentripplanner.standalone.api.OtpServerRequestContext;

/**
Expand All @@ -36,7 +36,7 @@ public ParkAndRideResource(
*/
@Deprecated @PathParam("ignoreRouterId") String ignoreRouterId
) {
this.vehicleParkingService = serverContext.graph().getVehicleParkingService();
this.vehicleParkingService = serverContext.vehicleParkingService();

// TODO OTP2 - Why are we using the DirectGraphFinder here, not just
// - serverContext.graphFinder(). This needs at least a comment!
Expand Down Expand Up @@ -73,7 +73,8 @@ public Response getParkAndRide(
}

var prs = vehicleParkingService
.getCarParks()
.listCarParks()
.stream()
.filter(lot -> envelope.contains(lot.getCoordinate().asJtsCoordinate()))
.filter(lot -> hasTransitStopsNearby(maxTransitDistance, lot))
.map(ParkAndRideInfo::ofVehicleParking)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public static GraphStats build(OtpServerRequestContext context) {
new StreetStats(edgeTypes, vertexTypes),
new TransitStats(
stopCounts,
transitService.getAllTrips().size(),
transitService.getAllTripPatterns().size(),
transitService.getAllRoutes().size(),
transitService.listTrips().size(),
transitService.listTripPatterns().size(),
transitService.listRoutes().size(),
constrainedTransferCounts
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private TxPoint pointInfo(TransferPoint p, boolean boarding) {
if (p instanceof TripTransferPoint tp) {
var trip = tp.getTrip();
var route = trip.getRoute();
var ptn = transitService.getPatternForTrip(trip);
var ptn = transitService.findPattern(trip);
r.operator = getName(trip.getOperator());
r.type = "Trip";
r.entityId = trip.getId().getId();
Expand All @@ -162,7 +162,7 @@ private TxPoint pointInfo(TransferPoint p, boolean boarding) {
addLocation(r, ptn, stop, trip, boarding);
} else if (p instanceof RouteStopTransferPoint rp) {
var route = rp.getRoute();
var ptn = transitService.getPatternsForRoute(route).stream().findFirst().orElse(null);
var ptn = transitService.findPatterns(route).stream().findFirst().orElse(null);
r.operator = getName(route.getOperator());
r.type = "Route";
r.entityId = route.getId().getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public String getTransfersAsCsv() {
@Produces(MediaType.TEXT_PLAIN)
public String getTransitGroupPriorities() {
return TransitGroupPriorityReport.build(
transitService.getAllTripPatterns(),
transitService.listTripPatterns(),
defaultRequest.journey().transit()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.opentripplanner.model.plan.Place;
import org.opentripplanner.model.plan.StopArrival;
import org.opentripplanner.model.plan.VehicleParkingWithEntrance;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingSpaces;
import org.opentripplanner.service.vehicleparking.model.VehicleParkingSpaces;
import org.opentripplanner.transit.model.site.RegularStop;

public class PlaceMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.locationtech.jts.geom.Geometry;
import org.opentripplanner.ext.restapi.mapping.ModeMapper;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingService;
import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.service.worldenvelope.model.WorldEnvelope;
import org.opentripplanner.transit.service.TransitService;
Expand Down Expand Up @@ -34,24 +34,23 @@ public ApiRouterInfo(
Graph graph,
TransitService transitService,
VehicleRentalService vehicleRentalService,
VehicleParkingService vehicleParkingService,
WorldEnvelope envelope
) {
VehicleParkingService vehicleParkingService = graph.getVehicleParkingService();

this.routerId = routerId;
this.polygon = graph.getConvexHull();
this.buildTime = Date.from(graph.buildTime);
this.transitServiceStarts = transitService.getTransitServiceStarts().toEpochSecond();
this.transitServiceEnds = transitService.getTransitServiceEnds().toEpochSecond();
this.transitModes = ModeMapper.mapToApi(transitService.getTransitModes());
this.transitModes = ModeMapper.mapToApi(transitService.listTransitModes());
this.envelope = envelope;
this.hasBikeSharing = mapHasBikeSharing(vehicleRentalService);
this.hasBikePark = mapHasBikePark(vehicleParkingService);
this.hasCarPark = mapHasCarPark(vehicleParkingService);
this.hasParkRide = this.hasCarPark;
this.hasVehicleParking = mapHasVehicleParking(vehicleParkingService);
this.travelOptions =
ApiTravelOptionsMaker.makeOptions(graph, vehicleRentalService, transitService);
ApiTravelOptionsMaker.makeOptions(graph, vehicleRentalService, vehicleParkingService, transitService);
}

public boolean mapHasBikeSharing(VehicleRentalService service) {
Expand All @@ -67,21 +66,21 @@ public boolean mapHasBikePark(VehicleParkingService service) {
if (service == null) {
return false;
}
return service.getBikeParks().findAny().isPresent();
return service.listBikeParks().stream().findAny().isPresent();
}

public boolean mapHasCarPark(VehicleParkingService service) {
if (service == null) {
return false;
}
return service.getCarParks().findAny().isPresent();
return service.listCarParks().stream().findAny().isPresent();
}

public boolean mapHasVehicleParking(VehicleParkingService service) {
if (service == null) {
return false;
}
return service.getVehicleParkings().findAny().isPresent();
return service.listVehicleParkings().stream().findAny().isPresent();
}

public double getLowerLeftLatitude() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Set;
import org.opentripplanner.api.parameter.ApiRequestMode;
import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.service.vehicleparking.VehicleParkingService;
import org.opentripplanner.service.vehiclerental.VehicleRentalService;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.service.TransitService;
Expand All @@ -29,14 +30,14 @@ public final class ApiTravelOptionsMaker {
public static List<ApiTravelOption> makeOptions(
Graph graph,
VehicleRentalService vehicleRentalService,
VehicleParkingService vehicleParkingService,
TransitService transitService
) {
var service = graph.getVehicleParkingService();
return makeOptions(
transitService.getTransitModes(),
transitService.listTransitModes(),
vehicleRentalService.hasRentalBikes(),
service.hasBikeParking(),
service.hasCarParking()
vehicleParkingService.hasBikeParking(),
vehicleParkingService.hasCarParking()
);
}

Expand Down
Loading

0 comments on commit f06f6f7

Please sign in to comment.