-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If configured, add subway station entrances from OSM to walk steps #6343
Open
leonardehrenfried
wants to merge
40
commits into
opentripplanner:dev-2.x
Choose a base branch
from
leonardehrenfried:station-entrances
base: dev-2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
1d19a05
Add subway station entrances to walk steps
HenrikSundell 67f4b1b
Add entity to walk steps
HenrikSundell 9d18269
Add more parameters to Entrance
HenrikSundell 3b88288
Move StepEntity classes
HenrikSundell 0a62bf8
Remove default name for subway station entrances
HenrikSundell 528ab55
Add option to turn on osm subway entrances in osmDefaults
HenrikSundell 3e4ae96
Merge remote-tracking branch 'otp/dev-2.x' into station-entrances
HenrikSundell 401a405
Fix walk step generation
HenrikSundell 438bc31
Add step entity to graphql tests
HenrikSundell 97c2de6
Rename variables to match with graphql
HenrikSundell d844561
Rename variables
HenrikSundell 02a07ea
Rename function
HenrikSundell 5dc74dd
Fix comments
HenrikSundell 5d55646
Remove println
HenrikSundell d1067c6
Remove unnecessary imports
HenrikSundell 5c97ad1
Add accessibilty information to entrances
HenrikSundell e10e0a2
Use existing entrance class for walk steps
HenrikSundell 34761fe
Fix EntranceImpl
HenrikSundell c84b7cf
Add id to walk step entrances
HenrikSundell 2ea8a52
Remove old file
HenrikSundell 39b0db3
Fix otp version
HenrikSundell 3b6bf3f
Remove unused import
HenrikSundell 36be3dc
Merge remote-tracking branch 'otp/dev-2.x' into station-entrances
HenrikSundell c9df52d
Require entranceId
HenrikSundell 7a9a8f6
Rename methods
HenrikSundell c9139e3
Update dosumentation
HenrikSundell 7b21024
Update documentation
HenrikSundell ce7719c
Remove redundant null check
HenrikSundell b737411
Add feature union to steps
HenrikSundell f547e07
Return feature based on relativeDirection
HenrikSundell 18b84f0
Remove StepFeature class
HenrikSundell a327594
Merge remote-tracking branch 'upstream/dev-2.x' into station-entrances
leonardehrenfried 04d35b7
Clean up code a little
leonardehrenfried c4d665d
Reformat code and schema
leonardehrenfried bf89f49
Fix tests
leonardehrenfried 2eb0e7b
Add documentation
leonardehrenfried 4fd0f68
Merge remote-tracking branch 'upstream/dev-2.x' into station-entrances
leonardehrenfried 977d8eb
Clean up
leonardehrenfried b7cc6fd
Remove enum mapper test for REST API
leonardehrenfried e473061
Fix highway exits
leonardehrenfried File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
45 changes: 45 additions & 0 deletions
45
application/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/EntranceImpl.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,45 @@ | ||
package org.opentripplanner.apis.gtfs.datafetchers; | ||
|
||
import graphql.schema.DataFetcher; | ||
import org.opentripplanner.apis.gtfs.GraphQLUtils; | ||
import org.opentripplanner.apis.gtfs.generated.GraphQLDataFetchers; | ||
import org.opentripplanner.apis.gtfs.generated.GraphQLTypes; | ||
import org.opentripplanner.transit.model.site.Entrance; | ||
|
||
public class EntranceImpl implements GraphQLDataFetchers.GraphQLEntrance { | ||
|
||
@Override | ||
public DataFetcher<String> code() { | ||
return environment -> { | ||
Entrance entrance = environment.getSource(); | ||
return entrance.getCode(); | ||
}; | ||
} | ||
|
||
@Override | ||
public DataFetcher<String> entranceId() { | ||
return environment -> { | ||
Entrance entrance = environment.getSource(); | ||
return entrance.getId().toString(); | ||
}; | ||
} | ||
|
||
@Override | ||
public DataFetcher<String> name() { | ||
return environment -> { | ||
Entrance entrance = environment.getSource(); | ||
return org.opentripplanner.framework.graphql.GraphQLUtils.getTranslation( | ||
entrance.getName(), | ||
environment | ||
); | ||
}; | ||
} | ||
|
||
@Override | ||
public DataFetcher<GraphQLTypes.GraphQLWheelchairBoarding> wheelchairAccessible() { | ||
return environment -> { | ||
Entrance entrance = environment.getSource(); | ||
return GraphQLUtils.toGraphQL(entrance.getWheelchairAccessibility()); | ||
}; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...ion/src/main/java/org/opentripplanner/apis/gtfs/datafetchers/StepFeatureTypeResolver.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,21 @@ | ||
package org.opentripplanner.apis.gtfs.datafetchers; | ||
|
||
import graphql.TypeResolutionEnvironment; | ||
import graphql.schema.GraphQLObjectType; | ||
import graphql.schema.GraphQLSchema; | ||
import graphql.schema.TypeResolver; | ||
import org.opentripplanner.transit.model.site.Entrance; | ||
|
||
public class StepFeatureTypeResolver implements TypeResolver { | ||
|
||
@Override | ||
public GraphQLObjectType getType(TypeResolutionEnvironment environment) { | ||
Object o = environment.getObject(); | ||
GraphQLSchema schema = environment.getSchema(); | ||
|
||
if (o instanceof Entrance) { | ||
return schema.getObjectType("Entrance"); | ||
} | ||
return null; | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -33,12 +33,19 @@ class VertexGenerator { | |
private final HashMap<Long, Map<OsmLevel, OsmVertex>> multiLevelNodes = new HashMap<>(); | ||
private final OsmDatabase osmdb; | ||
private final Set<String> boardingAreaRefTags; | ||
private final Boolean includeOsmSubwayEntrances; | ||
private final VertexFactory vertexFactory; | ||
|
||
public VertexGenerator(OsmDatabase osmdb, Graph graph, Set<String> boardingAreaRefTags) { | ||
public VertexGenerator( | ||
OsmDatabase osmdb, | ||
Graph graph, | ||
Set<String> boardingAreaRefTags, | ||
boolean includeOsmSubwayEntrances | ||
) { | ||
this.osmdb = osmdb; | ||
this.vertexFactory = new VertexFactory(graph); | ||
this.boardingAreaRefTags = boardingAreaRefTags; | ||
this.includeOsmSubwayEntrances = includeOsmSubwayEntrances; | ||
} | ||
|
||
/** | ||
|
@@ -95,6 +102,13 @@ IntersectionVertex getVertexForOsmNode(OsmNode node, OsmWithTags way) { | |
iv = bv; | ||
} | ||
|
||
if (includeOsmSubwayEntrances && node.isSubwayEntrance()) { | ||
String ref = node.getTag("ref"); | ||
|
||
boolean accessible = node.isTag("wheelchair", "yes"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has three states instead of two, use the unknown one when the tag isn't specified. |
||
iv = vertexFactory.stationEntrance(nid, coordinate, ref, accessible); | ||
} | ||
|
||
if (iv == null) { | ||
iv = | ||
vertexFactory.osm( | ||
|
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw can you rename this class to follow the class naming convention, idk why this is the only file that doesn't follow it. Hopefully the renaming doesn't mess up git history.