Skip to content

Commit

Permalink
Remove previously added Station accessibility information
Browse files Browse the repository at this point in the history
  • Loading branch information
habrahamsson-skanetrafiken committed Sep 13, 2024
1 parent d8c6718 commit c4cab6d
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.opentripplanner.street.model.edge.EscalatorEdge;
import org.opentripplanner.street.model.edge.PathwayEdge;
import org.opentripplanner.street.model.edge.StreetEdge;
import org.opentripplanner.street.model.edge.StreetStationCentroidLink;
import org.opentripplanner.street.model.edge.StreetTransitEntranceLink;
import org.opentripplanner.street.model.edge.StreetTransitStationCentroidLink;
import org.opentripplanner.street.model.edge.StreetTransitStopLink;
import org.opentripplanner.street.model.edge.StreetVehicleParkingLink;
import org.opentripplanner.street.model.edge.TemporaryFreeEdge;
Expand Down Expand Up @@ -111,7 +111,7 @@ static StyleSpec build(
BoardingLocationToStopLink.class,
StreetVehicleRentalLink.class,
StreetVehicleParkingLink.class,
StreetTransitStationCentroidLink.class
StreetStationCentroidLink.class
)
.lineWidth(LINE_WIDTH)
.minZoom(13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void addEntrancesToGraph() {
private void addStationCentroidsToGraph() {
for (Station station : otpTransitService.stopModel().listStations()) {
if (station.shouldRouteToCentroid()) {
vertexFactory.transitStationCentroid(station);
vertexFactory.stationCentroid(station);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import org.opentripplanner.routing.vehicle_parking.VehicleParking;
import org.opentripplanner.routing.vehicle_parking.VehicleParkingHelper;
import org.opentripplanner.street.model.edge.Edge;
import org.opentripplanner.street.model.edge.StreetStationCentroidLink;
import org.opentripplanner.street.model.edge.StreetTransitEntranceLink;
import org.opentripplanner.street.model.edge.StreetTransitStationCentroidLink;
import org.opentripplanner.street.model.edge.StreetTransitStopLink;
import org.opentripplanner.street.model.edge.StreetVehicleParkingLink;
import org.opentripplanner.street.model.edge.VehicleParkingEdge;
import org.opentripplanner.street.model.vertex.StationCentroidVertex;
import org.opentripplanner.street.model.vertex.StreetVertex;
import org.opentripplanner.street.model.vertex.TransitEntranceVertex;
import org.opentripplanner.street.model.vertex.TransitStationCentroidVertex;
import org.opentripplanner.street.model.vertex.TransitStopVertex;
import org.opentripplanner.street.model.vertex.VehicleParkingEntranceVertex;
import org.opentripplanner.street.search.TraverseMode;
Expand Down Expand Up @@ -72,7 +72,7 @@ public void buildGraph() {
if (graph.hasStreets) {
linkTransitStops(graph, transitModel);
linkTransitEntrances(graph);
linkTransitStationCentroids(graph);
linkStationCentroids(graph);
linkVehicleParks(graph, issueStore);
}

Expand Down Expand Up @@ -260,14 +260,9 @@ private void linkTransitEntrances(Graph graph) {
}
}

private void linkTransitStationCentroids(Graph graph) {
LOG.info(
"Linking instances of {} to graph...",
TransitStationCentroidVertex.class.getSimpleName()
);
for (TransitStationCentroidVertex tVertex : graph.getVerticesOfType(
TransitStationCentroidVertex.class
)) {
private void linkStationCentroids(Graph graph) {
LOG.info("Linking instances of {} to graph...", StationCentroidVertex.class.getSimpleName());
for (StationCentroidVertex tVertex : graph.getVerticesOfType(StationCentroidVertex.class)) {
graph
.getLinker()
.linkVertexPermanently(
Expand All @@ -276,13 +271,13 @@ private void linkTransitStationCentroids(Graph graph) {
LinkingDirection.BOTH_WAYS,
(vertex, streetVertex) ->
List.of(
StreetTransitStationCentroidLink.createStreetTransitStationLink(
(TransitStationCentroidVertex) vertex,
StreetStationCentroidLink.createStreetStationLink(
(StationCentroidVertex) vertex,
streetVertex
),
StreetTransitStationCentroidLink.createStreetTransitStationLink(
StreetStationCentroidLink.createStreetStationLink(
streetVertex,
(TransitStationCentroidVertex) vertex
(StationCentroidVertex) vertex
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore;
import org.opentripplanner.netex.mapping.support.FeedScopedIdFactory;
import org.opentripplanner.netex.support.JAXBUtils;
import org.opentripplanner.transit.model.basic.Accessibility;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.site.Station;
import org.opentripplanner.transit.service.StopModelBuilder;
Expand Down Expand Up @@ -78,8 +77,7 @@ Station mapStopPlaceToStation(FeedScopedId id, StopPlace stopPlace) {
.map(LocaleStructure::getTimeZone)
.map(zoneId -> ofZoneId(stopPlace.getId(), zoneId))
.orElse(defaultTimeZone)
)
.withWheelchairAccessibility(wheelchairAccessibility(stopPlace));
);

if (noTransfersOnIsolatedStops) {
builder.withTransfersNotAllowed(
Expand Down Expand Up @@ -158,11 +156,4 @@ private WgsCoordinate mapCoordinate(StopPlace stopPlace) {
return WgsCoordinate.mean(coordinates);
}
}

private Accessibility wheelchairAccessibility(StopPlace stopPlace) {
return WheelChairMapper.wheelchairAccessibility(
stopPlace.getAccessibilityAssessment(),
Accessibility.NO_INFORMATION
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import org.opentripplanner.street.model.edge.TemporaryFreeEdge;
import org.opentripplanner.street.model.edge.TemporaryPartialStreetEdge;
import org.opentripplanner.street.model.edge.TemporaryPartialStreetEdgeBuilder;
import org.opentripplanner.street.model.vertex.StationCentroidVertex;
import org.opentripplanner.street.model.vertex.StreetVertex;
import org.opentripplanner.street.model.vertex.TemporaryStreetLocation;
import org.opentripplanner.street.model.vertex.TransitStationCentroidVertex;
import org.opentripplanner.street.model.vertex.TransitStopVertex;
import org.opentripplanner.street.model.vertex.Vertex;
import org.opentripplanner.street.search.TraverseMode;
Expand Down Expand Up @@ -66,7 +66,7 @@ public class StreetIndex {
/**
* This list contains transitStationVertices for the stations that are configured to route to centroid
*/
private final Map<FeedScopedId, TransitStationCentroidVertex> transitStationCentroidVertices;
private final Map<FeedScopedId, StationCentroidVertex> stationCentroidVertices;

private final EdgeSpatialIndex edgeSpatialIndex;
private final HashGridSpatialIndex<Vertex> verticesTree;
Expand All @@ -80,7 +80,7 @@ public StreetIndex(Graph graph, StopModel stopModel) {
this.verticesTree = new HashGridSpatialIndex<>();
this.vertexLinker = new VertexLinker(graph, stopModel, edgeSpatialIndex);
this.transitStopVertices = toImmutableMap(graph.getVerticesOfType(TransitStopVertex.class));
this.transitStationCentroidVertices = createTransitStationVertexMap(graph);
this.stationCentroidVertices = createTransitStationVertexMap(graph);
postSetup(graph.getVertices());
}

Expand Down Expand Up @@ -278,7 +278,7 @@ public Set<TransitStopVertex> getStopOrChildStopsVertices(FeedScopedId id) {
* the station centroid if the station is configured to route to centroid.
*/
public Set<Vertex> getStreetVerticesById(FeedScopedId id) {
var stationVertex = transitStationCentroidVertices.get(id);
var stationVertex = stationCentroidVertices.get(id);
if (stationVertex != null) {
return Set.of(stationVertex);
}
Expand Down Expand Up @@ -464,12 +464,12 @@ private static Map<FeedScopedId, TransitStopVertex> toImmutableMap(
return Map.copyOf(map);
}

private static Map<FeedScopedId, TransitStationCentroidVertex> createTransitStationVertexMap(
private static Map<FeedScopedId, StationCentroidVertex> createTransitStationVertexMap(
Graph graph
) {
var vertices = graph.getVerticesOfType(TransitStationCentroidVertex.class);
var vertices = graph.getVerticesOfType(StationCentroidVertex.class);

var map = new HashMap<FeedScopedId, TransitStationCentroidVertex>();
var map = new HashMap<FeedScopedId, StationCentroidVertex>();
for (var vertex : vertices) {
if (vertex.getStation().shouldRouteToCentroid()) {
map.put(vertex.getStation().getId(), vertex);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.opentripplanner.street.model.edge;

import org.opentripplanner.street.model.vertex.StationCentroidVertex;
import org.opentripplanner.street.model.vertex.StreetVertex;

/**
* This represents the connection between a street vertex and a transit station centroid vertex
*/
public class StreetStationCentroidLink extends FreeEdge {

private StreetStationCentroidLink(StreetVertex fromv, StationCentroidVertex tov) {
super(fromv, tov);
}

private StreetStationCentroidLink(StationCentroidVertex fromv, StreetVertex tov) {
super(fromv, tov);
}

public static StreetStationCentroidLink createStreetStationLink(
StreetVertex fromv,
StationCentroidVertex tov
) {
return connectToGraph(new StreetStationCentroidLink(fromv, tov));
}

public static StreetStationCentroidLink createStreetStationLink(
StationCentroidVertex fromv,
StreetVertex tov
) {
return connectToGraph(new StreetStationCentroidLink(fromv, tov));
}

public String toString() {
return "StreetStationCentroidLink(" + fromv + " -> " + tov + ")";
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
/**
* A vertex representing a station centroid. This can be used as a source/destination for routing.
*/
public class TransitStationCentroidVertex extends Vertex {
public class StationCentroidVertex extends Vertex {

private final Station station;

public TransitStationCentroidVertex(Station station) {
public StationCentroidVertex(Station station) {
super(station.getLon(), station.getLat());
this.station = station;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public TransitStopVertex transitStop(TransitStopVertexBuilder transitStopVertexB
}

@Nonnull
public TransitStationCentroidVertex transitStationCentroid(Station station) {
return addToGraph(new TransitStationCentroidVertex(station));
public StationCentroidVertex stationCentroid(Station station) {
return addToGraph(new StationCentroidVertex(station));
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.opentripplanner.routing.graph.index.StreetIndex;
import org.opentripplanner.routing.linking.DisposableEdgeCollection;
import org.opentripplanner.routing.linking.SameEdgeAdjuster;
import org.opentripplanner.street.model.vertex.TransitStationCentroidVertex;
import org.opentripplanner.street.model.vertex.TransitStopVertex;
import org.opentripplanner.street.model.vertex.Vertex;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.locationtech.jts.geom.Point;
import org.opentripplanner.framework.geometry.WgsCoordinate;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.transit.model.basic.Accessibility;
import org.opentripplanner.transit.model.framework.AbstractTransitEntity;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.framework.LogInfo;
Expand All @@ -40,7 +39,6 @@ public class Station
private final I18NString url;
private final ZoneId timezone;
private final boolean transfersNotAllowed;
private final Accessibility wheelchairAccessibility;

// We serialize this class to json only for snapshot tests, and this creates cyclical structures
@JsonBackReference
Expand All @@ -63,7 +61,6 @@ public class Station
this.description = builder.getDescription();
this.url = builder.getUrl();
this.timezone = builder.getTimezone();
this.wheelchairAccessibility = builder.getWheelchairAccessibility();

// Initialize the geometry with an empty set of children
this.geometry = computeGeometry(coordinate, Set.of());
Expand Down Expand Up @@ -155,13 +152,6 @@ public ZoneId getTimezone() {
return timezone;
}

/**
* Whether this station is accessible by wheelchair or not.
*/
public Accessibility getWheelchairAccessibility() {
return wheelchairAccessibility;
}

/**
* If true do not allow any transfers to or from any stop within station
*/
Expand Down Expand Up @@ -201,8 +191,7 @@ public boolean sameAs(@Nonnull Station other) {
Objects.equals(shouldRouteToCentroid, other.shouldRouteToCentroid) &&
Objects.equals(priority, other.priority) &&
Objects.equals(url, other.url) &&
Objects.equals(timezone, other.timezone) &&
Objects.equals(wheelchairAccessibility, other.wheelchairAccessibility)
Objects.equals(timezone, other.timezone)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.time.ZoneId;
import org.opentripplanner.framework.geometry.WgsCoordinate;
import org.opentripplanner.framework.i18n.I18NString;
import org.opentripplanner.transit.model.basic.Accessibility;
import org.opentripplanner.transit.model.framework.AbstractEntityBuilder;
import org.opentripplanner.transit.model.framework.FeedScopedId;

Expand All @@ -17,7 +16,6 @@ public class StationBuilder extends AbstractEntityBuilder<Station, StationBuilde
private I18NString url;
private ZoneId timezone;
private boolean transfersNotAllowed = false;
private Accessibility wheelchairAccessibility = Accessibility.NO_INFORMATION;
private boolean shouldRouteToCentroid = false;

StationBuilder(FeedScopedId id) {
Expand All @@ -34,7 +32,6 @@ public class StationBuilder extends AbstractEntityBuilder<Station, StationBuilde
this.url = original.getUrl();
this.timezone = original.getTimezone();
this.transfersNotAllowed = original.isTransfersNotAllowed();
this.wheelchairAccessibility = original.getWheelchairAccessibility();
this.shouldRouteToCentroid = original.shouldRouteToCentroid();
}

Expand Down Expand Up @@ -124,15 +121,6 @@ public StationBuilder withTransfersNotAllowed(boolean transfersNotAllowed) {
return this;
}

public Accessibility getWheelchairAccessibility() {
return wheelchairAccessibility;
}

public StationBuilder withWheelchairAccessibility(Accessibility wheelchairAccessibility) {
this.wheelchairAccessibility = wheelchairAccessibility;
return this;
}

@Override
protected Station buildFromValues() {
return new Station(this);
Expand Down
Loading

0 comments on commit c4cab6d

Please sign in to comment.