Skip to content
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

Fix coach, cable tram and trolleybus GTFS route types #6086

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/ca_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions application/src/client/classic-debug/i18n/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/hu.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/no.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion application/src/client/classic-debug/i18n/sl.po
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"Train": "Tren",
"Ferry": "BOT",
"Light Rail": "",
"Cable Car": "PONT PENJANT",
"Cable Tram": "PONT PENJANT",
"Funicular": "FUNICULAR",
"Aerial Tram": "",
"Airplane": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"Train": "Bahn",
"Ferry": "Fähre",
"Light Rail": "",
"Cable Car": "Standseilbahn",
"Cable Tram": "Standseilbahn",
"Funicular": "Seilbahn",
"Aerial Tram": "",
"Airplane": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"Train": "treno",
"Ferry": "Ferry",
"Light Rail": "tram",
"Cable Car": "tram",
"Cable Tram": "tram",
"Funicular": "funivia",
"Aerial Tram": "tram",
"Airplane": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"Train": "Vlak",
"Ferry": "",
"Light Rail": "Tramvaj",
"Cable Car": "",
"Cable Tram": "",
"Funicular": "",
"Aerial Tram": "Gondola",
"Airplane": "",
Expand Down
5 changes: 2 additions & 3 deletions application/src/client/classic-debug/js/otp/util/Itin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Arguments> 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<TransitMode> transitModes, ApiRequestMode apiRequestMode) {
assertEquals(transitModes, apiRequestMode.getTransitModes());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -197,8 +180,8 @@ void specificallyRequestCarpool() {
QualifiedModeSet modeSet = new QualifiedModeSet("WALK,TRANSIT,CARPOOL");

Set<TransitMode> expected = Set.of(
TransitMode.RAIL,
TransitMode.COACH,
RAIL,
COACH,
SUBWAY,
BUS,
TRAM,
Expand All @@ -210,7 +193,7 @@ void specificallyRequestCarpool() {
TROLLEYBUS,
CARPOOL,
MONORAIL,
TransitMode.TAXI
TAXI
);

var mainModes = Set.copyOf(modeSet.getTransitModes());
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading