diff --git a/application/src/client/classic-debug/i18n/ca_ES.po b/application/src/client/classic-debug/i18n/ca_ES.po index 8dd8b1db1eb..8c31603fba4 100644 --- a/application/src/client/classic-debug/i18n/ca_ES.po +++ b/application/src/client/classic-debug/i18n/ca_ES.po @@ -931,7 +931,7 @@ msgstr "" #. beneath the car. #: src/client/js/otp/util/Itin.js:226 #, fuzzy -msgid "Cable Car" +msgid "Cable Tram" msgstr "PONT PENJANT" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/de.po b/application/src/client/classic-debug/i18n/de.po index 0585855e247..49ac31f1777 100644 --- a/application/src/client/classic-debug/i18n/de.po +++ b/application/src/client/classic-debug/i18n/de.po @@ -919,7 +919,7 @@ msgstr "" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Standseilbahn" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/en.po b/application/src/client/classic-debug/i18n/en.po index 4727ffef677..94ae67f6431 100644 --- a/application/src/client/classic-debug/i18n/en.po +++ b/application/src/client/classic-debug/i18n/en.po @@ -930,8 +930,8 @@ msgstr "Light Rail" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" -msgstr "Cable Car" +msgid "Cable Tram" +msgstr "Cable Tram" #. Any rail system designed for steep inclines. #: src/client/js/otp/util/Itin.js:228 diff --git a/application/src/client/classic-debug/i18n/es.po b/application/src/client/classic-debug/i18n/es.po index b54e2510417..0799258ab92 100644 --- a/application/src/client/classic-debug/i18n/es.po +++ b/application/src/client/classic-debug/i18n/es.po @@ -924,7 +924,7 @@ msgstr "Tranvía" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Bus Tranvía" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/fr.po b/application/src/client/classic-debug/i18n/fr.po index 705b313786c..1c5e0f69b18 100644 --- a/application/src/client/classic-debug/i18n/fr.po +++ b/application/src/client/classic-debug/i18n/fr.po @@ -932,7 +932,7 @@ msgstr "Tram ou Trolley" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Tramway funiculaire" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/hu.po b/application/src/client/classic-debug/i18n/hu.po index 25411b79e58..02242925841 100644 --- a/application/src/client/classic-debug/i18n/hu.po +++ b/application/src/client/classic-debug/i18n/hu.po @@ -937,7 +937,7 @@ msgstr "Villamos, könnyűvasút" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/it.po b/application/src/client/classic-debug/i18n/it.po index 4d0abe553f3..eeb4442ef7c 100644 --- a/application/src/client/classic-debug/i18n/it.po +++ b/application/src/client/classic-debug/i18n/it.po @@ -976,7 +976,7 @@ msgstr "tram" #. beneath the car. #: src/client/js/otp/util/Itin.js:226 #, fuzzy -msgid "Cable Car" +msgid "Cable Tram" msgstr "tram" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/messages.pot b/application/src/client/classic-debug/i18n/messages.pot index ca5d59b1cc3..425b5c9bb43 100644 --- a/application/src/client/classic-debug/i18n/messages.pot +++ b/application/src/client/classic-debug/i18n/messages.pot @@ -896,7 +896,7 @@ msgstr "" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/no.po b/application/src/client/classic-debug/i18n/no.po index 9a1d5c9103d..8963f038601 100644 --- a/application/src/client/classic-debug/i18n/no.po +++ b/application/src/client/classic-debug/i18n/no.po @@ -926,7 +926,7 @@ msgstr "Trikk" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Cable Car" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/pl.po b/application/src/client/classic-debug/i18n/pl.po index b8a728e9495..8f08e8de7de 100644 --- a/application/src/client/classic-debug/i18n/pl.po +++ b/application/src/client/classic-debug/i18n/pl.po @@ -947,7 +947,7 @@ msgstr "Light Rail" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Kolejka linowa" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/pt.po b/application/src/client/classic-debug/i18n/pt.po index 83ed08f3df1..42fa0d978aa 100644 --- a/application/src/client/classic-debug/i18n/pt.po +++ b/application/src/client/classic-debug/i18n/pt.po @@ -925,7 +925,7 @@ msgstr "Ferroviário leve" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "Eléctrico" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/i18n/sl.po b/application/src/client/classic-debug/i18n/sl.po index 93839344f76..23066db159c 100644 --- a/application/src/client/classic-debug/i18n/sl.po +++ b/application/src/client/classic-debug/i18n/sl.po @@ -931,7 +931,7 @@ msgstr "Tramvaj" #. Used for street-level cable cars where the cable runs #. beneath the car. #: src/client/js/otp/util/Itin.js:226 -msgid "Cable Car" +msgid "Cable Tram" msgstr "" #. Any rail system designed for steep inclines. diff --git a/application/src/client/classic-debug/js/otp/locale/ca_ES.json b/application/src/client/classic-debug/js/otp/locale/ca_ES.json index e0bc0c5e3ba..4ba89dde02d 100644 --- a/application/src/client/classic-debug/js/otp/locale/ca_ES.json +++ b/application/src/client/classic-debug/js/otp/locale/ca_ES.json @@ -155,7 +155,7 @@ "Train": "Tren", "Ferry": "BOT", "Light Rail": "", - "Cable Car": "PONT PENJANT", + "Cable Tram": "PONT PENJANT", "Funicular": "FUNICULAR", "Aerial Tram": "", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/de.json b/application/src/client/classic-debug/js/otp/locale/de.json index 5a0aa5316f4..79514b84b1a 100644 --- a/application/src/client/classic-debug/js/otp/locale/de.json +++ b/application/src/client/classic-debug/js/otp/locale/de.json @@ -155,7 +155,7 @@ "Train": "Bahn", "Ferry": "Fähre", "Light Rail": "", - "Cable Car": "Standseilbahn", + "Cable Tram": "Standseilbahn", "Funicular": "Seilbahn", "Aerial Tram": "", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/en.json b/application/src/client/classic-debug/js/otp/locale/en.json index 51e5565997c..f7ae611e458 100644 --- a/application/src/client/classic-debug/js/otp/locale/en.json +++ b/application/src/client/classic-debug/js/otp/locale/en.json @@ -155,7 +155,7 @@ "Train": "Train", "Ferry": "Ferry", "Light Rail": "Light Rail", - "Cable Car": "Cable Car", + "Cable Tram": "Cable Tram", "Funicular": "Funicular", "Aerial Tram": "Aerial Tram", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/es.json b/application/src/client/classic-debug/js/otp/locale/es.json index fca9c112411..67db91d87b9 100644 --- a/application/src/client/classic-debug/js/otp/locale/es.json +++ b/application/src/client/classic-debug/js/otp/locale/es.json @@ -155,7 +155,7 @@ "Train": "Tren", "Ferry": "Barco", "Light Rail": "Tranvía", - "Cable Car": "Bus Tranvía", + "Cable Tram": "Bus Tranvía", "Funicular": "Funicular", "Aerial Tram": "Funicular", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/fr.json b/application/src/client/classic-debug/js/otp/locale/fr.json index 53b4d78be17..76306ba7fe1 100644 --- a/application/src/client/classic-debug/js/otp/locale/fr.json +++ b/application/src/client/classic-debug/js/otp/locale/fr.json @@ -155,7 +155,7 @@ "Train": "Train", "Ferry": "Ferry", "Light Rail": "Tram ou Trolley", - "Cable Car": "Tramway funiculaire", + "Cable Tram": "Tramway funiculaire", "Funicular": "Funiculaire", "Aerial Tram": "Téléphérique", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/hu.json b/application/src/client/classic-debug/js/otp/locale/hu.json index 1e1e666e19e..022666bc938 100644 --- a/application/src/client/classic-debug/js/otp/locale/hu.json +++ b/application/src/client/classic-debug/js/otp/locale/hu.json @@ -155,7 +155,7 @@ "Train": "Vonat", "Ferry": "Komp", "Light Rail": "Villamos, könnyűvasút", - "Cable Car": "", + "Cable Tram": "", "Funicular": "Sikló", "Aerial Tram": "Libegő", "Airplane": "Repülőgép", diff --git a/application/src/client/classic-debug/js/otp/locale/it.json b/application/src/client/classic-debug/js/otp/locale/it.json index 0876aba1ef8..f1de09c1985 100644 --- a/application/src/client/classic-debug/js/otp/locale/it.json +++ b/application/src/client/classic-debug/js/otp/locale/it.json @@ -155,7 +155,7 @@ "Train": "treno", "Ferry": "Ferry", "Light Rail": "tram", - "Cable Car": "tram", + "Cable Tram": "tram", "Funicular": "funivia", "Aerial Tram": "tram", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/no.json b/application/src/client/classic-debug/js/otp/locale/no.json index 5a64e60d2a6..91013646c2c 100644 --- a/application/src/client/classic-debug/js/otp/locale/no.json +++ b/application/src/client/classic-debug/js/otp/locale/no.json @@ -155,7 +155,7 @@ "Train": "Tog", "Ferry": "Ferje", "Light Rail": "Trikk", - "Cable Car": "Cable Car", + "Cable Tram": "Cable Car", "Funicular": "Kabelbane", "Aerial Tram": "Tau bane", "Airplane": "Fly", diff --git a/application/src/client/classic-debug/js/otp/locale/pl.json b/application/src/client/classic-debug/js/otp/locale/pl.json index 5cf5a9c71b5..a8bbd03a0b9 100644 --- a/application/src/client/classic-debug/js/otp/locale/pl.json +++ b/application/src/client/classic-debug/js/otp/locale/pl.json @@ -161,7 +161,7 @@ "Train": "Pociąg", "Ferry": "Prom", "Light Rail": "Light Rail", - "Cable Car": "Kolejka linowa", + "Cable Tram": "Kolejka linowa", "Funicular": "Kolej linowo-terenowa", "Aerial Tram": "Kolej linowa", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/pt.json b/application/src/client/classic-debug/js/otp/locale/pt.json index 9d15e4afe1a..a4a5e9f6599 100644 --- a/application/src/client/classic-debug/js/otp/locale/pt.json +++ b/application/src/client/classic-debug/js/otp/locale/pt.json @@ -155,7 +155,7 @@ "Train": "Comboio", "Ferry": "Ferry", "Light Rail": "Ferroviário leve", - "Cable Car": "Eléctrico", + "Cable Tram": "Eléctrico", "Funicular": "Teleférico", "Aerial Tram": "Teleférico", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/locale/sl.json b/application/src/client/classic-debug/js/otp/locale/sl.json index c99ad81f704..6019f19e228 100644 --- a/application/src/client/classic-debug/js/otp/locale/sl.json +++ b/application/src/client/classic-debug/js/otp/locale/sl.json @@ -167,7 +167,7 @@ "Train": "Vlak", "Ferry": "", "Light Rail": "Tramvaj", - "Cable Car": "", + "Cable Tram": "", "Funicular": "", "Aerial Tram": "Gondola", "Airplane": "", diff --git a/application/src/client/classic-debug/js/otp/util/Itin.js b/application/src/client/classic-debug/js/otp/util/Itin.js index 03555b1b3df..af8ce3a162b 100644 --- a/application/src/client/classic-debug/js/otp/util/Itin.js +++ b/application/src/client/classic-debug/js/otp/util/Itin.js @@ -221,9 +221,8 @@ otp.util.Itin = { //TRANSLATORS: Tram, Streetcar, Light rail. Any light rail or street //level system within a metropolitan area. 'TRAM' : _tr('Light Rail'), - //TRANSLATORS: Used for street-level cable cars where the cable runs - //beneath the car. - 'CABLE_CAR': _tr('Cable Car'), + //TRANSLATORS: Used for street-level rail cars where the cable runs beneath the vehicle. + 'CABLE_CAR': _tr('Cable Tram'), //TRANSLATORS: Any rail system designed for steep inclines. 'FUNICULAR': _tr('Funicular'), //TRANSLATORS: Gondola, Suspended cable car. Typically used for aerial diff --git a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java index 29cd6b5715c..588297737ff 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/ApiRequestModeTest.java @@ -1,16 +1,28 @@ package org.opentripplanner.ext.restapi.parameter; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model.basic.TransitMode.CARPOOL; import java.util.List; -import org.junit.jupiter.api.Test; +import java.util.stream.Stream; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.opentripplanner.api.parameter.ApiRequestMode; +import org.opentripplanner.transit.model.basic.TransitMode; class ApiRequestModeTest { - @Test - void carpool() { - assertEquals(List.of(CARPOOL), ApiRequestMode.CARPOOL.getTransitModes()); + static Stream testCases() { + return Stream.of( + Arguments.of(List.of(TransitMode.CARPOOL), ApiRequestMode.CARPOOL), + Arguments.of(List.of(TransitMode.BUS), ApiRequestMode.BUS), + Arguments.of(List.of(TransitMode.COACH), ApiRequestMode.COACH) + ); + } + + @ParameterizedTest + @MethodSource("testCases") + void getTransitMode(List transitModes, ApiRequestMode apiRequestMode) { + assertEquals(transitModes, apiRequestMode.getTransitModes()); } } diff --git a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java index ad344713a74..728fba63a6b 100644 --- a/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java +++ b/application/src/ext-test/java/org/opentripplanner/ext/restapi/parameter/QualifiedModeSetTest.java @@ -3,25 +3,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.opentripplanner.routing.api.request.StreetMode.BIKE; -import static org.opentripplanner.routing.api.request.StreetMode.BIKE_RENTAL; -import static org.opentripplanner.routing.api.request.StreetMode.BIKE_TO_PARK; -import static org.opentripplanner.routing.api.request.StreetMode.CAR_HAILING; -import static org.opentripplanner.routing.api.request.StreetMode.FLEXIBLE; -import static org.opentripplanner.routing.api.request.StreetMode.WALK; -import static org.opentripplanner.transit.model.basic.TransitMode.AIRPLANE; -import static org.opentripplanner.transit.model.basic.TransitMode.BUS; -import static org.opentripplanner.transit.model.basic.TransitMode.CABLE_CAR; -import static org.opentripplanner.transit.model.basic.TransitMode.CARPOOL; -import static org.opentripplanner.transit.model.basic.TransitMode.COACH; -import static org.opentripplanner.transit.model.basic.TransitMode.FERRY; -import static org.opentripplanner.transit.model.basic.TransitMode.FUNICULAR; -import static org.opentripplanner.transit.model.basic.TransitMode.GONDOLA; -import static org.opentripplanner.transit.model.basic.TransitMode.MONORAIL; -import static org.opentripplanner.transit.model.basic.TransitMode.RAIL; -import static org.opentripplanner.transit.model.basic.TransitMode.SUBWAY; -import static org.opentripplanner.transit.model.basic.TransitMode.TRAM; -import static org.opentripplanner.transit.model.basic.TransitMode.TROLLEYBUS; +import static org.opentripplanner.routing.api.request.StreetMode.*; +import static org.opentripplanner.transit.model.basic.TransitMode.*; import jakarta.ws.rs.BadRequestException; import java.util.Set; @@ -197,8 +180,8 @@ void specificallyRequestCarpool() { QualifiedModeSet modeSet = new QualifiedModeSet("WALK,TRANSIT,CARPOOL"); Set expected = Set.of( - TransitMode.RAIL, - TransitMode.COACH, + RAIL, + COACH, SUBWAY, BUS, TRAM, @@ -210,7 +193,7 @@ void specificallyRequestCarpool() { TROLLEYBUS, CARPOOL, MONORAIL, - TransitMode.TAXI + TAXI ); var mainModes = Set.copyOf(modeSet.getTransitModes()); @@ -231,7 +214,7 @@ void carHail() { @Test void carHailWithTransit() { var modeSet = new QualifiedModeSet("CAR_HAIL,BUS,RAIL"); - assertEquals(Set.of(COACH, BUS, RAIL), Set.copyOf(modeSet.getTransitModes())); + assertEquals(Set.of(BUS, RAIL), Set.copyOf(modeSet.getTransitModes())); assertEquals(WALK, modeSet.getRequestModes().directMode); assertEquals(CAR_HAILING, modeSet.getRequestModes().accessMode); diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java index 9dede395e80..33f2c85fd82 100644 --- a/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java +++ b/application/src/ext/java/org/opentripplanner/ext/restapi/mapping/RouteTypeMapper.java @@ -13,7 +13,8 @@ public static int mapToApi(TransitMode domain) { return switch (domain) { case RAIL -> 2; - case COACH, BUS -> 3; + case BUS -> 3; + case COACH -> 200; case SUBWAY -> 1; case TRAM -> 0; case FERRY -> 4; diff --git a/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java index 7bbd83f7c2d..075038d441e 100644 --- a/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java +++ b/application/src/ext/java/org/opentripplanner/ext/restapi/model/ApiLeg.java @@ -98,7 +98,7 @@ public class ApiLeg { /** * For transit legs, the type of the route. Non transit -1 When 0-7: 0 Tram, 1 Subway, 2 Train, 3 - * Bus, 4 Ferry, 5 Cable Car, 6 Gondola, 7 Funicular When equal or highter than 100, it is coded + * Bus, 4 Ferry, 5 Cable Tram, 6 Gondola, 7 Funicular When equal or highter than 100, it is coded * using the Hierarchical Vehicle Type (HVT) codes from the European TPEG standard Also see * http://groups.google.com/group/gtfs-changes/msg/ed917a69cf8c5bef */ diff --git a/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java b/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java index 6e19b106033..7ac2c6f7d86 100644 --- a/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java +++ b/application/src/main/java/org/opentripplanner/api/parameter/ApiRequestMode.java @@ -12,7 +12,8 @@ public enum ApiRequestMode { TRAM(TransitMode.TRAM), SUBWAY(TransitMode.SUBWAY), RAIL(TransitMode.RAIL), - BUS(TransitMode.BUS, TransitMode.COACH), + BUS(TransitMode.BUS), + COACH(TransitMode.COACH), FERRY(TransitMode.FERRY), CABLE_CAR(TransitMode.CABLE_CAR), GONDOLA(TransitMode.GONDOLA), diff --git a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java index b325eac3653..2f8e69cc593 100644 --- a/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java +++ b/application/src/main/java/org/opentripplanner/apis/transmodel/model/EnumTypes.java @@ -184,7 +184,7 @@ public class EnumTypes { .value("air", TransitMode.AIRPLANE) .value("bicycle", TraverseMode.BICYCLE) .value("bus", TransitMode.BUS) - .value("cableway", TransitMode.CABLE_CAR) + .value("cableway", TransitMode.GONDOLA) .value("water", TransitMode.FERRY) .value("funicular", TransitMode.FUNICULAR) .value("lift", TransitMode.GONDOLA) @@ -455,7 +455,7 @@ public class EnumTypes { .name("TransportMode") .value("air", TransitMode.AIRPLANE) .value("bus", TransitMode.BUS) - .value("cableway", TransitMode.CABLE_CAR) + .value("cableway", TransitMode.GONDOLA) .value("water", TransitMode.FERRY) .value("funicular", TransitMode.FUNICULAR) .value("lift", TransitMode.GONDOLA) diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java index 608ff6ba2d3..86d8a9db732 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TransitModeMapper.java @@ -16,11 +16,14 @@ public static TransitMode mapMode(int routeType) { } /* TPEG Extension https://groups.google.com/d/msg/gtfs-changes/keT5rTPS7Y0/71uMz2l6ke0J */ - if (routeType >= 100 && routeType < 200) { // Railway Service + if (routeType >= 100 && routeType < 200) { + // Railway Service return TransitMode.RAIL; - } else if (routeType >= 200 && routeType < 300) { //Coach Service - return TransitMode.BUS; - } else if (routeType >= 300 && routeType < 500) { //Suburban Railway Service and Urban Railway service + } else if (routeType >= 200 && routeType < 300) { + // Coach Service + return TransitMode.COACH; + } else if (routeType >= 300 && routeType < 500) { + // Suburban Railway Service and Urban Railway service if (routeType >= 401 && routeType <= 402) { return TransitMode.SUBWAY; } @@ -28,24 +31,32 @@ public static TransitMode mapMode(int routeType) { return TransitMode.MONORAIL; } return TransitMode.RAIL; - } else if (routeType >= 500 && routeType < 700) { //Metro Service and Underground Service + } else if (routeType >= 500 && routeType < 700) { + // Metro Service and Underground Service return TransitMode.SUBWAY; - } else if (routeType >= 700 && routeType < 900) { //Bus Service and Trolleybus service - if (routeType == 800) { - return TransitMode.TROLLEYBUS; - } + } else if (routeType >= 700 && routeType < 800) { + // Bus Service return TransitMode.BUS; - } else if (routeType >= 900 && routeType < 1000) { //Tram service + } else if (routeType >= 800 && routeType < 900) { + // Trolleybus Service + return TransitMode.TROLLEYBUS; + } else if (routeType >= 900 && routeType < 1000) { + // Tram service return TransitMode.TRAM; - } else if (routeType >= 1000 && routeType < 1100) { //Water Transport Service + } else if (routeType >= 1000 && routeType < 1100) { + // Water Transport Service return TransitMode.FERRY; - } else if (routeType >= 1100 && routeType < 1200) { //Air Service + } else if (routeType >= 1100 && routeType < 1200) { + // Air Service return TransitMode.AIRPLANE; - } else if (routeType >= 1200 && routeType < 1300) { //Ferry Service + } else if (routeType >= 1200 && routeType < 1300) { + // Ferry Service return TransitMode.FERRY; - } else if (routeType >= 1300 && routeType < 1400) { //Telecabin Service + } else if (routeType >= 1300 && routeType < 1400) { + // Telecabin Service return TransitMode.GONDOLA; - } else if (routeType >= 1400 && routeType < 1500) { //Funicular Service + } else if (routeType >= 1400 && routeType < 1500) { + // Funicular Service return TransitMode.FUNICULAR; } else if (routeType >= 1551 && routeType < 1561) { // Carpooling, not defined anywhere, so we've chosen this number space @@ -53,11 +64,13 @@ public static TransitMode mapMode(int routeType) { // standardise return TransitMode.CARPOOL; } else if (routeType >= 1500 && routeType < 1599) { - //Taxi Service + // Taxi Service return TransitMode.TAXI; - } else if (routeType >= 1600 && routeType < 1700) { //Self drive + } else if (routeType >= 1600 && routeType < 1700) { + // Self drive return TransitMode.BUS; - } else if (routeType >= 1700 && routeType < 1800) { //Miscellaneous Service + } else if (routeType >= 1700 && routeType < 1800) { + // Miscellaneous Service return null; } /* Original GTFS route types. Should these be checked before TPEG types? */ diff --git a/application/src/main/java/org/opentripplanner/model/plan/Leg.java b/application/src/main/java/org/opentripplanner/model/plan/Leg.java index d9e3a4589d8..81a9a6af10c 100644 --- a/application/src/main/java/org/opentripplanner/model/plan/Leg.java +++ b/application/src/main/java/org/opentripplanner/model/plan/Leg.java @@ -289,7 +289,7 @@ default int getAgencyTimeZoneOffset() { /** * For transit legs, the type of the route. Non transit -1 When 0-7: 0 Tram, 1 Subway, 2 Train, 3 - * Bus, 4 Ferry, 5 Cable Car, 6 Gondola, 7 Funicular When equal or highter than 100, it is coded + * Bus, 4 Ferry, 5 Cable Tram, 6 Gondola, 7 Funicular When equal or highter than 100, it is coded * using the Hierarchical Vehicle Type (HVT) codes from the European TPEG standard Also see * http://groups.google.com/group/gtfs-changes/msg/ed917a69cf8c5bef */ diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java index 22fbb1fca1c..b98ce0fd39f 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/StopPlaceTypeMapper.java @@ -29,7 +29,7 @@ private TransitMode mapVehicleMode(StopPlace stopPlace) { case AIR -> TransitMode.AIRPLANE; case BUS -> TransitMode.BUS; case TROLLEY_BUS -> TransitMode.TROLLEYBUS; - case CABLEWAY -> TransitMode.CABLE_CAR; + case CABLEWAY -> TransitMode.GONDOLA; case COACH -> TransitMode.COACH; case FUNICULAR -> TransitMode.FUNICULAR; case METRO -> TransitMode.SUBWAY; diff --git a/application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java b/application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java index 82a5f99c9c7..5db45f93c8d 100644 --- a/application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java +++ b/application/src/main/java/org/opentripplanner/netex/mapping/TransportModeMapper.java @@ -32,7 +32,7 @@ public TransitMode mapAllVehicleModesOfTransport(AllVehicleModesOfTransportEnume return switch (mode) { case AIR -> TransitMode.AIRPLANE; case BUS -> TransitMode.BUS; - case CABLEWAY -> TransitMode.CABLE_CAR; + case CABLEWAY -> TransitMode.GONDOLA; case COACH -> TransitMode.COACH; case FUNICULAR -> TransitMode.FUNICULAR; case METRO -> TransitMode.SUBWAY; diff --git a/application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java b/application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java index e25cb435887..507b033f645 100644 --- a/application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java +++ b/application/src/main/java/org/opentripplanner/transit/model/basic/TransitMode.java @@ -69,7 +69,7 @@ public String enumValueDescription() { case TRAM -> "Tram, streetcar or light rail. Used for any light rail or street level system within a metropolitan area."; case FERRY -> "Used for short- and long-distance boat service."; case AIRPLANE -> "Taking an airplane"; - case CABLE_CAR -> "Used for street-level cable cars where the cable runs beneath the car."; + case CABLE_CAR -> "Used for street-level rail cars where the cable runs beneath the vehicle."; case GONDOLA -> "Gondola or suspended cable car. Typically used for aerial cable cars where the car is suspended from the cable."; case FUNICULAR -> "Used for any rail system that moves on steep inclines with a cable traction system."; case TROLLEYBUS -> "Used for trolleybus systems which draw power from overhead wires using poles on the roof of the vehicle."; diff --git a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java index 3ca29f7c531..1efdf8d0ce3 100644 --- a/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java +++ b/application/src/test/java/org/opentripplanner/apis/gtfs/mapping/routerequest/LegacyRouteRequestMapperTest.java @@ -135,10 +135,14 @@ static Stream transportModesCases() { of(List.of(mode("BICYCLE")), "[ExcludeAllTransitFilter{}]"), of( List.of(mode("BUS")), - "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH]}]}]" + "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS]}]}]" ), of( List.of(mode("BUS"), mode("MONORAIL")), + "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, MONORAIL]}]}]" + ), + of( + List.of(mode("BUS"), mode("COACH"), mode("MONORAIL")), "[TransitFilterRequest{select: [SelectRequest{transportModes: [BUS, COACH, MONORAIL]}]}]" ) ); diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java index b2e5b1a8a4d..5540deb8efb 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TransitModeMapperTest.java @@ -1,8 +1,7 @@ package org.opentripplanner.gtfs.mapping; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.opentripplanner.transit.model.basic.TransitMode.CARPOOL; -import static org.opentripplanner.transit.model.basic.TransitMode.TAXI; +import static org.opentripplanner.transit.model.basic.TransitMode.*; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -14,6 +13,51 @@ class TransitModeMapperTest { static Stream testCases() { return Stream.of( + // base GTFS route types + // https://gtfs.org/documentation/schedule/reference/#routestxt + Arguments.of(0, TRAM), + Arguments.of(1, SUBWAY), + Arguments.of(2, RAIL), + Arguments.of(3, BUS), + Arguments.of(4, FERRY), + Arguments.of(5, CABLE_CAR), + Arguments.of(6, GONDOLA), + Arguments.of(7, FUNICULAR), + Arguments.of(11, TROLLEYBUS), + Arguments.of(12, MONORAIL), + // extended route types + // https://developers.google.com/transit/gtfs/reference/extended-route-types + // https://groups.google.com/g/gtfs-changes/c/keT5rTPS7Y0/m/71uMz2l6ke0J?pli=1 + Arguments.of(100, RAIL), + Arguments.of(199, RAIL), + Arguments.of(200, COACH), + Arguments.of(299, COACH), + Arguments.of(400, RAIL), + Arguments.of(401, SUBWAY), + Arguments.of(402, SUBWAY), + Arguments.of(403, RAIL), + Arguments.of(404, RAIL), + Arguments.of(405, MONORAIL), + Arguments.of(500, SUBWAY), + Arguments.of(599, SUBWAY), + Arguments.of(600, SUBWAY), + Arguments.of(699, SUBWAY), + Arguments.of(700, BUS), + Arguments.of(799, BUS), + Arguments.of(800, TROLLEYBUS), + Arguments.of(899, TROLLEYBUS), + Arguments.of(900, TRAM), + Arguments.of(999, TRAM), + Arguments.of(1000, FERRY), + Arguments.of(1099, FERRY), + Arguments.of(1100, AIRPLANE), + Arguments.of(1199, AIRPLANE), + Arguments.of(1200, FERRY), + Arguments.of(1299, FERRY), + Arguments.of(1300, GONDOLA), + Arguments.of(1399, GONDOLA), + Arguments.of(1400, FUNICULAR), + Arguments.of(1499, FUNICULAR), Arguments.of(1500, TAXI), Arguments.of(1510, TAXI), Arguments.of(1551, CARPOOL), diff --git a/doc/user/RoutingModes.md b/doc/user/RoutingModes.md index 0895e019716..c9b61712498 100644 --- a/doc/user/RoutingModes.md +++ b/doc/user/RoutingModes.md @@ -104,7 +104,7 @@ Used for short- and long-distance bus routes.

CABLE_CAR

-Used for street-level cable cars where the cable runs beneath the car. +Used for street-level rail cars where the cable runs beneath the vehicle.

CARPOOL