-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6047 from Skanetrafiken/access-egress-station-rou…
…ting Support for routing to Station centroid instead of child stops
- Loading branch information
Showing
76 changed files
with
1,440 additions
and
375 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ain/java/org/opentripplanner/graph_builder/module/RouteToCentroidStationIdsValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.opentripplanner.graph_builder.module; | ||
|
||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
import org.opentripplanner.graph_builder.issue.api.DataImportIssueStore; | ||
import org.opentripplanner.graph_builder.model.GraphBuilderModule; | ||
import org.opentripplanner.transit.model.framework.AbstractTransitEntity; | ||
import org.opentripplanner.transit.model.framework.FeedScopedId; | ||
import org.opentripplanner.transit.service.TransitModel; | ||
|
||
public class RouteToCentroidStationIdsValidator implements GraphBuilderModule { | ||
|
||
private final DataImportIssueStore issueStore; | ||
private final Collection<FeedScopedId> transitRouteToStationCentroid; | ||
private final TransitModel transitModel; | ||
|
||
public RouteToCentroidStationIdsValidator( | ||
DataImportIssueStore issueStore, | ||
Collection<FeedScopedId> transitRouteToStationCentroid, | ||
TransitModel transitModel | ||
) { | ||
this.issueStore = issueStore; | ||
this.transitRouteToStationCentroid = transitRouteToStationCentroid; | ||
this.transitModel = transitModel; | ||
} | ||
|
||
private void validate() { | ||
var stationIds = transitModel | ||
.getStopModel() | ||
.listStations() | ||
.stream() | ||
.map(AbstractTransitEntity::getId) | ||
.collect(Collectors.toSet()); | ||
transitRouteToStationCentroid | ||
.stream() | ||
.filter(id -> !stationIds.contains(id)) | ||
.forEach(id -> | ||
issueStore.add( | ||
"UnknownStationId", | ||
"Config parameter 'transitRouteToStationCentroid' specified a station that does not exist: %s", | ||
id | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
public void buildGraph() { | ||
validate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.