Skip to content

Commit a08fa29

Browse files
committed
Add viaLocationType to Place in Transmodel API
1 parent 11cbb86 commit a08fa29

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.function.Function;
88
import org.opentripplanner.framework.doc.DocumentedEnum;
99
import org.opentripplanner.model.plan.VertexType;
10+
import org.opentripplanner.model.plan.leg.ViaLocationType;
1011
import org.opentripplanner.model.plan.walkstep.AbsoluteDirection;
1112
import org.opentripplanner.model.plan.walkstep.RelativeDirection;
1213
import org.opentripplanner.model.transfer.TransferPriority;
@@ -463,6 +464,22 @@ public class EnumTypes {
463464
//TODO QL: .value("parkAndRide", VertexType.PARKANDRIDE)
464465
.build();
465466

467+
public static final GraphQLEnumType VIA_LOCATION_TYPE = GraphQLEnumType.newEnum()
468+
.name("ViaLocationType")
469+
.value(
470+
"passThrough",
471+
ViaLocationType.PASS_THROUGH,
472+
"Stop location must be " +
473+
"visited on-board a transit vehicle or the journey must alight or board at the location."
474+
)
475+
.value(
476+
"visit",
477+
ViaLocationType.VISIT,
478+
"Location is a stop location where the " +
479+
"passenger boards a vehicle or alights from a vehicle, or a coordinate which is visited."
480+
)
481+
.build();
482+
466483
public static final GraphQLEnumType WHEELCHAIR_BOARDING = GraphQLEnumType.newEnum()
467484
.name("WheelchairBoarding")
468485
.value(

application/src/main/java/org/opentripplanner/apis/transmodel/model/plan/PlanPlaceType.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ public static GraphQLObjectType create(
131131
)
132132
.build()
133133
)
134+
.field(
135+
GraphQLFieldDefinition.newFieldDefinition()
136+
.name("viaLocationType")
137+
.type(EnumTypes.VIA_LOCATION_TYPE)
138+
.description(
139+
"If this place was used as a via location in the request, this defines " +
140+
"what type of a via location this place is."
141+
)
142+
.dataFetcher(environment -> ((Place) environment.getSource()).viaLocationType)
143+
.build()
144+
)
134145
// .field(GraphQLFieldDefinition.newFieldDefinition()
135146
// .name("bikePark")
136147
// .type(bikeParkType)

application/src/main/resources/org/opentripplanner/apis/transmodel/schema.graphql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ type Place {
527527
rentalVehicle: RentalVehicle
528528
"Type of vertex. (Normal, Bike sharing station, Bike P+R, Transit quay) Mostly used for better localization of bike sharing and P+R station names"
529529
vertexType: VertexType
530+
"If this place was used as a via location in the request, this defines what type of a via location this place is."
531+
viaLocationType: ViaLocationType
530532
}
531533

532534
type PlaceAtDistance {
@@ -2079,6 +2081,13 @@ enum VertexType {
20792081
transit
20802082
}
20812083

2084+
enum ViaLocationType {
2085+
"Stop location must be visited on-board a transit vehicle or the journey must alight or board at the location."
2086+
passThrough
2087+
"Location is a stop location where the passenger boards a vehicle or alights from a vehicle, or a coordinate which is visited."
2088+
visit
2089+
}
2090+
20822091
enum WheelchairBoarding {
20832092
"There is no accessibility information for the stopPlace/quay."
20842093
noInformation

0 commit comments

Comments
 (0)