mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
Bremen, Bremerhaven & Oldenburg
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@638 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
a1b04662e6
commit
c9fe1daa86
10 changed files with 356 additions and 277 deletions
|
@ -1105,7 +1105,10 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return new NearbyStationsResult(stations);
|
||||
}
|
||||
|
||||
private static final Pattern P_LINE_S = Pattern.compile("SN?\\d*");
|
||||
private static final Pattern P_LINE_SBAHN = Pattern.compile("SN?\\d*");
|
||||
private static final Pattern P_LINE_TRAM = Pattern.compile("STR\\w{0,5}");
|
||||
private static final Pattern P_LINE_BUS = Pattern.compile("BUS\\w{0,5}");
|
||||
private static final Pattern P_LINE_TAXI = Pattern.compile("TAX\\w{0,5}");
|
||||
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
|
@ -1176,6 +1179,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return 'I';
|
||||
if ("X2".equals(ucType)) // X2000 Neigezug, Schweden
|
||||
return 'I';
|
||||
if ("X".equals(ucType)) // InterConnex
|
||||
return 'I';
|
||||
if ("FYR".equals(ucType)) // Fyra, Amsterdam-Schiphol-Rotterdam
|
||||
return 'I';
|
||||
if ("FLUG".equals(ucType))
|
||||
|
@ -1222,6 +1227,104 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return 'R';
|
||||
if ("MRB".equals(ucType)) // Mitteldeutsche Regiobahn
|
||||
return 'R';
|
||||
if ("ERB".equals(ucType)) // eurobahn (Keolis Deutschland)
|
||||
return 'R';
|
||||
if ("HLB".equals(ucType)) // Hessische Landesbahn
|
||||
return 'R';
|
||||
if ("VIA".equals(ucType))
|
||||
return 'R';
|
||||
if ("HSB".equals(ucType)) // Harzer Schmalspurbahnen
|
||||
return 'R';
|
||||
if ("OSB".equals(ucType)) // Ortenau-S-Bahn
|
||||
return 'R';
|
||||
if ("VBG".equals(ucType)) // Vogtlandbahn
|
||||
return 'R';
|
||||
if ("AKN".equals(ucType)) // AKN Eisenbahn AG
|
||||
return 'R';
|
||||
if ("OLA".equals(ucType)) // Ostseeland Verkehr
|
||||
return 'R';
|
||||
if ("UBB".equals(ucType)) // Usedomer Bäderbahn
|
||||
return 'R';
|
||||
if ("PEG".equals(ucType)) // Prignitzer Eisenbahn
|
||||
return 'R';
|
||||
if ("NWB".equals(ucType)) // NordWestBahn
|
||||
return 'R';
|
||||
if ("CAN".equals(ucType)) // cantus Verkehrsgesellschaft
|
||||
return 'R';
|
||||
if ("BRB".equals(ucType)) // ABELLIO Rail
|
||||
return 'R';
|
||||
if ("SBB".equals(ucType)) // Schweizerische Bundesbahnen
|
||||
return 'R';
|
||||
if ("VEC".equals(ucType)) // vectus Verkehrsgesellschaft
|
||||
return 'R';
|
||||
if ("TLX".equals(ucType)) // Trilex (Vogtlandbahn)
|
||||
return 'R';
|
||||
if ("HZL".equals(ucType)) // Hohenzollerische Landesbahn
|
||||
return 'R';
|
||||
if ("ABR".equals(ucType)) // Bayerische Regiobahn
|
||||
return 'R';
|
||||
if ("CB".equals(ucType)) // City Bahn Chemnitz
|
||||
return 'R';
|
||||
if ("WEG".equals(ucType)) // Württembergische Eisenbahn-Gesellschaft
|
||||
return 'R';
|
||||
if ("NEB".equals(ucType)) // Niederbarnimer Eisenbahn
|
||||
return 'R';
|
||||
if ("ME".equals(ucType)) // metronom Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("MER".equals(ucType)) // metronom regional
|
||||
return 'R';
|
||||
if ("ALX".equals(ucType)) // Arriva-Länderbahn-Express
|
||||
return 'R';
|
||||
if ("EB".equals(ucType)) // Erfurter Bahn
|
||||
return 'R';
|
||||
if ("VEN".equals(ucType)) // Rhenus Veniro
|
||||
return 'R';
|
||||
if ("BOB".equals(ucType)) // Bayerische Oberlandbahn
|
||||
return 'R';
|
||||
if ("SBS".equals(ucType)) // Städtebahn Sachsen
|
||||
return 'R';
|
||||
if ("EVB".equals(ucType)) // Eisenbahnen und Verkehrsbetriebe Elbe-Weser
|
||||
return 'R';
|
||||
if ("STB".equals(ucType)) // Süd-Thüringen-Bahn
|
||||
return 'R';
|
||||
if ("AG".equals(ucType)) // Ingolstadt-Landshut
|
||||
return 'R';
|
||||
if ("PRE".equals(ucType)) // Pressnitztalbahn
|
||||
return 'R';
|
||||
if ("SHB".equals(ucType)) // Schleswig-Holstein-Bahn
|
||||
return 'R';
|
||||
if ("NOB".equals(ucType)) // Nord-Ostsee-Bahn
|
||||
return 'R';
|
||||
if ("RTB".equals(ucType)) // Rurtalbahn
|
||||
return 'R';
|
||||
if ("BLB".equals(ucType)) // Berchtesgadener Land Bahn
|
||||
return 'R';
|
||||
if ("NBE".equals(ucType)) // Nordbahn Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("SOE".equals(ucType)) // Sächsisch-Oberlausitzer Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("SDG".equals(ucType)) // Sächsische Dampfeisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("VE".equals(ucType)) // Lutherstadt Wittenberg
|
||||
return 'R';
|
||||
if ("DAB".equals(ucType)) // Daadetalbahn
|
||||
return 'R';
|
||||
if ("WTB".equals(ucType)) // Wutachtalbahn e.V.
|
||||
return 'R';
|
||||
if ("BE".equals(ucType)) // Grensland-Express
|
||||
return 'R';
|
||||
if ("ARR".equals(ucType)) // Ostfriesland
|
||||
return 'R';
|
||||
if ("HTB".equals(ucType)) // Hörseltalbahn
|
||||
return 'R';
|
||||
if ("FEG".equals(ucType)) // Freiberger Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("NEG".equals(ucType)) // Norddeutsche Eisenbahngesellschaft Niebüll
|
||||
return 'R';
|
||||
if ("RBG".equals(ucType)) // Regental Bahnbetriebs GmbH
|
||||
return 'R';
|
||||
if ("MBB".equals(ucType)) // Mecklenburgische Bäderbahn Molli
|
||||
return 'R';
|
||||
if ("ATZ".equals(ucType)) // Autotunnelzug
|
||||
return 'R';
|
||||
if ("CAT".equals(ucType)) // City Airport Train
|
||||
|
@ -1230,11 +1333,17 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return 'R';
|
||||
if ("KD".equals(ucType)) // Koleje Dolnośląskie (Niederschlesische Eisenbahn)
|
||||
return 'R';
|
||||
if ("EX".equals(ucType)) // Polen
|
||||
return 'R';
|
||||
// if ("E".equals(normalizedType)) // Eilzug, stimmt wahrscheinlich nicht
|
||||
// return "R" + normalizedName;
|
||||
|
||||
// Suburban Trains
|
||||
if (P_LINE_S.matcher(ucType).matches()) // Generic (Night) S-Bahn
|
||||
if (P_LINE_SBAHN.matcher(ucType).matches()) // Generic (Night) S-Bahn
|
||||
return 'S';
|
||||
if ("BSB".equals(ucType)) // Breisgau S-Bahn
|
||||
return 'S';
|
||||
if ("SWE".equals(ucType)) // Südwestdeutsche Verkehrs-AG, Ortenau-S-Bahn
|
||||
return 'S';
|
||||
// if ("SPR".equals(normalizedType)) // Sprinter, Niederlande
|
||||
// return "S" + normalizedName;
|
||||
|
@ -1250,7 +1359,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
// return "U" + normalizedName;
|
||||
|
||||
// Tram
|
||||
if ("STR".equals(ucType)) // Generic Tram
|
||||
if (P_LINE_TRAM.matcher(ucType).matches()) // Generic Tram
|
||||
return 'T';
|
||||
if ("TRAM".equals(ucType))
|
||||
return 'T';
|
||||
|
@ -1260,7 +1369,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
// return "T" + normalizedName;
|
||||
|
||||
// Bus
|
||||
if ("BUS".equals(ucType)) // Generic Bus
|
||||
if (P_LINE_BUS.matcher(ucType).matches()) // Generic Bus
|
||||
return 'B';
|
||||
if ("NFB".equals(ucType)) // Niederflur-Bus
|
||||
return 'B';
|
||||
|
@ -1276,14 +1385,20 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return 'B';
|
||||
if ("AST".equals(ucType)) // Anruf-Sammel-Taxi
|
||||
return 'B';
|
||||
if ("RFB".equals(ucType)) // Rufbus
|
||||
return 'B';
|
||||
if ("RUF".equals(ucType)) // Rufbus
|
||||
return 'B';
|
||||
if (P_LINE_TAXI.matcher(ucType).matches()) // Generic Taxi
|
||||
return 'B';
|
||||
if ("RFT".equals(ucType)) // Ruftaxi
|
||||
return 'B';
|
||||
if ("LT".equals(ucType)) // Linien-Taxi
|
||||
return 'B';
|
||||
if ("ALT".equals(ucType)) // Anruf-Linien-Taxi
|
||||
return 'B';
|
||||
// if ("N".equals(normalizedType)) // Nachtbus
|
||||
// return "B" + normalizedName;
|
||||
// if ("Taxi".equals(normalizedType)) // Taxi
|
||||
// return "B" + normalizedName;
|
||||
// if ("TX".equals(normalizedType)) // Taxi
|
||||
// return "B" + normalizedName;
|
||||
|
||||
|
|
|
@ -254,21 +254,12 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("RR")) // Polen
|
||||
return 'R';
|
||||
if (ucType.equals("NWB"))
|
||||
return 'R';
|
||||
|
||||
if (ucType.equals("E")) // Stadtbahn Karlsruhe: S4/S31/xxxxx
|
||||
return 'S';
|
||||
|
||||
if (ucType.equals("STB"))
|
||||
return 'T';
|
||||
if ("STRB".equals(ucType))
|
||||
return 'T';
|
||||
|
||||
if (ucType.equals("BSV"))
|
||||
return 'B';
|
||||
if (ucType.equals("RFB")) // Rufbus
|
||||
return 'B';
|
||||
if (ucType.equals("RBS")) // Rufbus
|
||||
return 'B';
|
||||
|
||||
|
@ -276,9 +267,6 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
if (t != 0)
|
||||
return t;
|
||||
|
||||
if (ucType.equals("EB")) // Europa-Park, vermutlich "Erlebnisbahn"
|
||||
return '?';
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ package de.schildbach.pte;
|
|||
public enum NetworkId
|
||||
{
|
||||
// Germany
|
||||
DB, BVG, VBB, RMV, VRT, MVV, INVG, AVV, VMV, SH, GVH, BSVAG, BSAG, NASA, VVO, VMS, VGS, VRR, MVG, VRN, VVS, NALDO, DING, KVV, VVM, VAGFR, NVBW,
|
||||
DB, BVG, VBB, RMV, VRT, MVV, INVG, AVV, VMV, SH, GVH, BSVAG, BSAG, VBN, NASA, VVO, VMS, VGS, VRR, MVG, VRN, VVS, NALDO, DING, KVV, VVM, VAGFR, NVBW,
|
||||
|
||||
// Austria
|
||||
OEBB, VOR, LINZ, SVV, VVV, IVB, STV,
|
||||
|
|
|
@ -606,8 +606,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
// if (ucType.equals("X")) // Interconnex, Connections only?
|
||||
// return 'I';
|
||||
if (ucType.equals("INT")) // Rußland, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("RR")) // Finnland, Connections only?
|
||||
|
@ -624,8 +622,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'I';
|
||||
if (ucType.equals("OZ")) // Schweden, Oeresundzug, Connections only?
|
||||
return 'I';
|
||||
if (ucType.equals("X")) // Schweden, via JSON API
|
||||
return 'I';
|
||||
if (ucType.equals("LYN")) // Dänemark
|
||||
return 'I';
|
||||
if (ucType.equals("UUU")) // Italien, Nacht, Connections only?
|
||||
|
@ -637,14 +633,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("DPN")) // Connections only? TODO nicht evtl. doch eher ne S-Bahn?
|
||||
return 'R';
|
||||
if (ucType.equals("BRB")) // ABELLIO Rail, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ABR")) // Bayerische Regiobahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("RTB")) // Rurtalbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("VIA"))
|
||||
return 'R';
|
||||
if (ucType.equals("PCC")) // Polen
|
||||
return 'R';
|
||||
if (ucType.equals("KM")) // Polen
|
||||
|
@ -653,10 +641,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("SKW")) // Polen
|
||||
return 'R';
|
||||
if (ucType.equals("EX")) // Polen
|
||||
return 'R';
|
||||
if (ucType.equals("NEB")) // Kostrzyn-Berlin, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("E")) // Budapest, Ungarn
|
||||
return 'R';
|
||||
if (ucType.equals("IP")) // Ozd, Ungarn
|
||||
|
@ -667,109 +651,19 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'R';
|
||||
if (ucType.equals("DPF")) // VX=Vogtland Express, Connections only?
|
||||
return 'R';
|
||||
if (ucType.equals("VBG")) // Vogtlandbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SBE")) // Zittau-Seifhennersdorf, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("UBB")) // Usedomer Bäderbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("HZL")) // Hohenzollerische Landesbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ME")) // metronom Eisenbahngesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("MER")) // metronom regional, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("PEG")) // Prignitzer Eisenbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("HLB")) // Hessische Landesbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("NWB")) // NordWestBahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("VEN")) // Rhenus Veniro, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("BOB")) // Bayerische Oberlandbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SBB")) // Schweizerische Bundesbahnen, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ERB")) // eurobahn (Keolis Deutschland), via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("CAN")) // cantus Verkehrsgesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ALX")) // Arriva-Länderbahn-Express, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("VEC")) // vectus Verkehrsgesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("OSB")) // Ortenau-S-Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("NOB")) // Nord-Ostsee-Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("ARR")) // Ostfriesland, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SHB")) // Schleswig-Holstein-Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("BLB")) // Berchtesgadener Land Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("AKN")) // AKN Eisenbahn AG, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("EVB")) // Eisenbahnen und Verkehrsbetriebe Elbe-Weser, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("EB")) // Erfurter Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("HTB")) // Hörseltalbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("NBE")) // nordbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("DAB")) // Daadetalbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("WEG")) // Württembergische Eisenbahn-Gesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("RBG")) // Regental Bahnbetriebs GmbH, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("CB")) // City Bahn Chemnitz, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("OLA")) // Ostseeland Verkehr, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("VX")) // Vogtland Express, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("STB")) // Süd-Thüringen-Bahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("RNV")) // Rhein-Neckar-Verkehr GmbH, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("MBB")) // Mecklenburgische Bäderbahn Molli, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("HSB")) // Harzer Schmalspurbahnen, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("VE")) // Lutherstadt Wittenberg, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("PRE")) // Pressnitztalbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SDG")) // Sächsische Dampfeisenbahngesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SOE")) // Sächsisch-Oberlausitzer Eisenbahngesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("FEG")) // Freiberger Eisenbahngesellschaft, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("NEG")) // Norddeutsche Eisenbahngesellschaft Niebüll, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("P")) // Kasbachtalbahn, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("SBS")) // Städtebahn Sachsen, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("AG")) // Ingolstadt-Landshut, via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("TLX")) // Trilex (Vogtlandbahn), via JSON API
|
||||
return 'R';
|
||||
if (ucType.equals("BE")) // Grensland-Express, via JSON API
|
||||
return 'R';
|
||||
|
||||
if (ucType.equals("RSB")) // Schnellbahn Wien
|
||||
return 'S';
|
||||
if (ucType.equals("BSB")) // Breisgau S-Bahn, via JSON API
|
||||
return 'S';
|
||||
if (ucType.equals("DPN")) // S3 Bad Reichenhall-Freilassing, via JSON API
|
||||
return 'S';
|
||||
if (ucType.equals("SWE")) // Südwestdeutsche Verkehrs-AG, Ortenau-S-Bahn, via JSON API
|
||||
return 'S';
|
||||
if (ucType.equals("RER")) // Réseau Express Régional, Frankreich
|
||||
return 'S';
|
||||
if (ucType.equals("WKD")) // Warszawska Kolej Dojazdowa (Warsaw Suburban Railway)
|
||||
|
@ -780,8 +674,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("WLB")) // via JSON API
|
||||
return 'T';
|
||||
|
||||
if (ucType.equals("RFB"))
|
||||
return 'B';
|
||||
if (ucType.equals("OBU")) // Connections only?
|
||||
return 'B';
|
||||
if (ucType.equals("ASTSV")) // via JSON API
|
||||
|
@ -790,22 +682,6 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
return 'B';
|
||||
if (ucType.equals("BSV")) // Deutschland, Connections only?
|
||||
return 'B';
|
||||
if (ucType.equals("LT")) // Linien-Taxi, Connections only?
|
||||
return 'B';
|
||||
if (ucType.equals("BUSS")) // via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSSV")) // via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSLEOBE")) // Rufbus, via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSTN/TW")) // via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSMKK")) // Main-Kinz-Kreis, via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSG")) // via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("BUSNL")) // via JSON API
|
||||
return 'B';
|
||||
if (ucType.equals("O-B")) // Stadtbus, via JSON API
|
||||
return 'B';
|
||||
|
||||
|
|
|
@ -124,8 +124,6 @@ public class PlProvider extends AbstractHafasProvider
|
|||
|
||||
if ("TLK".equals(ucType)) // Tanie Linie Kolejowe, Polen
|
||||
return 'I';
|
||||
if ("X".equals(ucType)) // Schweden
|
||||
return 'I';
|
||||
if ("LYN".equals(ucType)) // Dänemark
|
||||
return 'I';
|
||||
if ("HOT".equals(ucType)) // Spanien, Nacht
|
||||
|
@ -135,118 +133,22 @@ public class PlProvider extends AbstractHafasProvider
|
|||
if ("SC".equals(ucType)) // SuperCity, Tschechien
|
||||
return 'I';
|
||||
|
||||
if ("REG".equals(ucType))
|
||||
return 'R';
|
||||
if ("KM".equals(ucType)) // Koleje Mazowieckie
|
||||
return 'R';
|
||||
if ("AR".equals(ucType)) // Arriva Polaczen
|
||||
return 'R';
|
||||
if ("NEB".equals(ucType)) // Niederbarnimer Eisenbahn
|
||||
return 'R';
|
||||
if ("NWB".equals(ucType)) // NordWestBahn
|
||||
return 'R';
|
||||
if ("HZL".equals(ucType)) // Hohenzollerische Landesbahn
|
||||
return 'R';
|
||||
if ("PEG".equals(ucType)) // Prignitzer Eisenbahn
|
||||
return 'R';
|
||||
if ("HLB".equals(ucType)) // Hessische Landesbahn
|
||||
return 'R';
|
||||
if ("VBG".equals(ucType)) // Vogtlandbahn
|
||||
return 'R';
|
||||
if ("CAN".equals(ucType)) // cantus Verkehrsgesellschaft
|
||||
return 'R';
|
||||
if ("TLX".equals(ucType)) // Trilex (Vogtlandbahn)
|
||||
return 'R';
|
||||
if ("SBB".equals(ucType)) // Schweizerische Bundesbahnen
|
||||
return 'R';
|
||||
if ("HSB".equals(ucType)) // Harzer Schmalspurbahnen
|
||||
return 'R';
|
||||
if ("OLA".equals(ucType)) // Ostseeland Verkehr
|
||||
return 'R';
|
||||
if ("ÖBA".equals(ucType)) // Öchsle-Bahn Betriebsgesellschaft
|
||||
return 'R';
|
||||
if ("BOB".equals(ucType)) // Bayerische Oberlandbahn
|
||||
return 'R';
|
||||
if ("VEC".equals(ucType)) // vectus Verkehrsgesellschaft
|
||||
return 'R';
|
||||
if ("OSB".equals(ucType)) // Ortenau-S-Bahn
|
||||
return 'R';
|
||||
if ("FEG".equals(ucType)) // Freiberger Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("BRB".equals(ucType)) // ABELLIO Rail
|
||||
return 'R';
|
||||
if ("EB".equals(ucType)) // Erfurter Bahn
|
||||
return 'R';
|
||||
if ("SBS".equals(ucType)) // Städtebahn Sachsen
|
||||
return 'R';
|
||||
if ("WEG".equals(ucType)) // Württembergische Eisenbahn-Gesellschaft
|
||||
return 'R';
|
||||
if ("EX".equals(ucType)) // Polen
|
||||
return 'R';
|
||||
if ("ERB".equals(ucType)) // eurobahn (Keolis Deutschland)
|
||||
return 'R';
|
||||
if ("UBB".equals(ucType)) // Usedomer Bäderbahn
|
||||
return 'R';
|
||||
if ("RTB".equals(ucType)) // Rurtalbahn
|
||||
return 'R';
|
||||
if ("EVB".equals(ucType)) // Eisenbahnen und Verkehrsbetriebe Elbe-Weser
|
||||
return 'R';
|
||||
if ("RNV".equals(ucType)) // Rhein-Neckar-Verkehr GmbH
|
||||
return 'R';
|
||||
if ("VIA".equals(ucType))
|
||||
return 'R';
|
||||
if ("ME".equals(ucType)) // metronom Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("MER".equals(ucType)) // metronom regional
|
||||
return 'R';
|
||||
if ("ALX".equals(ucType)) // Arriva-Länderbahn-Express
|
||||
return 'R';
|
||||
if ("STB".equals(ucType)) // Süd-Thüringen-Bahn
|
||||
return 'R';
|
||||
if ("CB".equals(ucType)) // City Bahn Chemnitz
|
||||
return 'R';
|
||||
if ("HTB".equals(ucType)) // Hörseltalbahn
|
||||
return 'R';
|
||||
if ("NOB".equals(ucType)) // Nord-Ostsee-Bahn
|
||||
return 'R';
|
||||
if ("ARR".equals(ucType)) // Ostfriesland
|
||||
return 'R';
|
||||
if ("ABR".equals(ucType)) // Bayerische Regiobahn
|
||||
return 'R';
|
||||
if ("AG".equals(ucType)) // Ingolstadt-Landshut
|
||||
return 'R';
|
||||
if ("PRE".equals(ucType)) // Pressnitztalbahn
|
||||
return 'R';
|
||||
if ("ZR".equals(ucType)) // Bratislava, Slovakai
|
||||
return 'R';
|
||||
if ("AKN".equals(ucType)) // AKN Eisenbahn AG
|
||||
return 'R';
|
||||
if ("SHB".equals(ucType)) // Schleswig-Holstein-Bahn
|
||||
return 'R';
|
||||
if ("P".equals(ucType)) // Kasbachtalbahn
|
||||
return 'R';
|
||||
if ("NBE".equals(ucType)) // nordbahn
|
||||
return 'R';
|
||||
if ("SDG".equals(ucType)) // Sächsische Dampfeisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("MBB".equals(ucType)) // Mecklenburgische Bäderbahn Molli
|
||||
return 'R';
|
||||
if ("VE".equals(ucType)) // Lutherstadt Wittenberg
|
||||
return 'R';
|
||||
if ("SOE".equals(ucType)) // Sächsisch-Oberlausitzer Eisenbahngesellschaft
|
||||
return 'R';
|
||||
if ("BLB".equals(ucType)) // Berchtesgadener Land Bahn
|
||||
return 'R';
|
||||
if ("DAB".equals(ucType)) // Daadetalbahn
|
||||
return 'R';
|
||||
if ("VEN".equals(ucType)) // Rhenus Veniro
|
||||
return 'R';
|
||||
if ("NEG".equals(ucType)) // Norddeutsche Eisenbahngesellschaft Niebüll
|
||||
return 'R';
|
||||
if ("WTB".equals(ucType)) // Wutachtalbahn e.V.
|
||||
return 'R';
|
||||
if ("KTB".equals(ucType)) // Kandertalbahn
|
||||
return 'R';
|
||||
if ("BE".equals(ucType)) // Grensland-Express
|
||||
return 'R';
|
||||
if ("LEO".equals(ucType)) // Chiemgauer Lokalbahn
|
||||
return 'R';
|
||||
if ("MSB".equals(ucType)) // Mainschleifenbahn
|
||||
|
@ -264,17 +166,10 @@ public class PlProvider extends AbstractHafasProvider
|
|||
return 'S';
|
||||
if ("RER".equals(ucType)) // Réseau Express Régional, Frankreich
|
||||
return 'S';
|
||||
if ("SWE".equals(ucType)) // Südwestdeutsche Verkehrs-AG, Ortenau-S-Bahn
|
||||
return 'S';
|
||||
if ("BSB".equals(ucType)) // Breisgau S-Bahn
|
||||
return 'S';
|
||||
|
||||
if ("METRO".equals(ucType))
|
||||
return 'U';
|
||||
|
||||
if ("BUSMKK".equals(ucType)) // Main-Kinz-Kreis
|
||||
return 'B';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
|
|
@ -230,15 +230,11 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
}
|
||||
}
|
||||
|
||||
private static final Pattern P_NORMALIZE_TYPE_BUS = Pattern.compile("BUS\\w*");
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
if (ucType.equals("X")) // InterConnex
|
||||
return 'I';
|
||||
if (ucType.equals("IN")) // Oslo
|
||||
return 'I';
|
||||
|
||||
|
@ -266,12 +262,8 @@ public class SbbProvider extends AbstractHafasProvider
|
|||
return 'B';
|
||||
if (ucType.equals("TX"))
|
||||
return 'B';
|
||||
if (ucType.equals("TAXI"))
|
||||
return 'B';
|
||||
if (ucType.equals("BUXI"))
|
||||
return 'B';
|
||||
if (P_NORMALIZE_TYPE_BUS.matcher(ucType).matches())
|
||||
return 'B';
|
||||
|
||||
if (ucType.equals("BAV"))
|
||||
return 'F';
|
||||
|
|
|
@ -97,23 +97,6 @@ public class ShProvider extends AbstractHafasProvider
|
|||
if ("KB1".equals(ucType))
|
||||
return 'B';
|
||||
|
||||
// from connections:
|
||||
|
||||
if ("NOB".equals(ucType)) // Nord-Ostsee-Bahn
|
||||
return 'R';
|
||||
if ("ME".equals(ucType)) // metronom
|
||||
return 'R';
|
||||
if ("MER".equals(ucType)) // metronom regional
|
||||
return 'R';
|
||||
if ("AKN".equals(ucType)) // AKN Eisenbahn AG
|
||||
return 'R';
|
||||
if ("SHB".equals(ucType)) // Schleswig-Holstein-Bahn
|
||||
return 'R';
|
||||
if ("NEG".equals(ucType)) // Norddeutsche Eisenbahngesellschaft Niebüll
|
||||
return 'R';
|
||||
if ("NBE".equals(ucType)) // Nordbahn Eisenbahngesellschaft
|
||||
return 'R';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
|
142
src/de/schildbach/pte/VbnProvider.java
Normal file
142
src/de/schildbach/pte/VbnProvider.java
Normal file
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright 2010, 2011 the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.schildbach.pte;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class VbnProvider extends AbstractHafasProvider
|
||||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.VBN;
|
||||
private static final String API_BASE = "http://www.fahrplaner.de/hafas/";
|
||||
|
||||
public VbnProvider()
|
||||
{
|
||||
super(API_BASE + "query.exe/dn", 11, null);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
{
|
||||
return NETWORK_ID;
|
||||
}
|
||||
|
||||
public boolean hasCapabilities(Capability... capabilities)
|
||||
{
|
||||
for (final Capability capability : capabilities)
|
||||
if (capability == Capability.AUTOCOMPLETE_ONE_LINE || capability == Capability.DEPARTURES || capability == Capability.CONNECTIONS)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final String AUTOCOMPLETE_URI = API_BASE
|
||||
+ "ajax-getstop.exe/dny?start=1&tpl=suggest2json&REQ0JourneyStopsS0A=255&REQ0JourneyStopsS0B=5&REQ0JourneyStopsB=12&getstop=1&noSession=yes&REQ0JourneyStopsS0G=%s?&js=true&";
|
||||
private static final String ENCODING = "ISO-8859-1";
|
||||
|
||||
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
|
||||
{
|
||||
final String uri = String.format(AUTOCOMPLETE_URI, ParserUtils.urlEncode(constraint.toString(), ENCODING));
|
||||
|
||||
return jsonGetStops(uri);
|
||||
}
|
||||
|
||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder(API_BASE);
|
||||
|
||||
if (location.hasLocation())
|
||||
{
|
||||
uri.append("query.exe/dny");
|
||||
uri.append("?performLocating=2&tpl=stop2json");
|
||||
uri.append("&look_maxno=").append(maxStations != 0 ? maxStations : 200);
|
||||
uri.append("&look_maxdist=").append(maxDistance != 0 ? maxDistance : 5000);
|
||||
uri.append("&look_stopclass=").append(allProductsInt());
|
||||
uri.append("&look_x=").append(location.lon);
|
||||
uri.append("&look_y=").append(location.lat);
|
||||
|
||||
return jsonNearbyStations(uri.toString());
|
||||
}
|
||||
else if (location.type == LocationType.STATION && location.hasId())
|
||||
{
|
||||
uri.append("stboard.exe/dn");
|
||||
uri.append("?productsFilter=").append(allProductsString());
|
||||
uri.append("&boardType=dep");
|
||||
uri.append("&input=").append(location.id);
|
||||
uri.append("&sTI=1&start=yes&hcount=0");
|
||||
uri.append("&L=vs_java3");
|
||||
|
||||
return xmlNearbyStations(uri.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("cannot handle: " + location.toDebugString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected char normalizeType(final String type)
|
||||
{
|
||||
final String ucType = type.toUpperCase();
|
||||
|
||||
if ("P".equals(ucType)) // Brohltalbahn
|
||||
return 'R';
|
||||
|
||||
if ("TB".equals(ucType))
|
||||
return 'B';
|
||||
if ("RFTAST".equals(ucType))
|
||||
return 'B';
|
||||
if ("ALTN".equals(ucType))
|
||||
return 'B';
|
||||
|
||||
if ("BUSFÄHRE".equals(ucType)) // Blexen - Bremerhaven
|
||||
return 'F';
|
||||
|
||||
if ("SEILB".equals(ucType))
|
||||
return 'C';
|
||||
|
||||
final char t = super.normalizeType(type);
|
||||
if (t != 0)
|
||||
return t;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public QueryDeparturesResult queryDepartures(final int stationId, final int maxDepartures, final boolean equivs) throws IOException
|
||||
{
|
||||
final StringBuilder uri = new StringBuilder();
|
||||
uri.append(API_BASE).append("stboard.exe/dn");
|
||||
uri.append("?productsFilter=").append(allProductsString());
|
||||
uri.append("&boardType=dep");
|
||||
uri.append("&disableEquivs=").append(equivs ? "no" : "yes"); // don't use nearby stations
|
||||
uri.append("&maxJourneys=50"); // ignore maxDepartures because result contains other stations
|
||||
uri.append("&start=yes");
|
||||
uri.append("&L=vs_java3");
|
||||
uri.append("&input=").append(stationId);
|
||||
|
||||
return xmlQueryDepartures(uri.toString(), stationId);
|
||||
}
|
||||
}
|
|
@ -267,8 +267,6 @@ public class VgsProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("INT")) // Zürich-Brüssel
|
||||
return 'I';
|
||||
|
||||
if (ucType.equals("SBS"))
|
||||
return 'S';
|
||||
if (ucType.equals("E")) // Stadtbahn Karlsruhe: S4/S31/xxxxx
|
||||
return 'S';
|
||||
|
||||
|
|
90
test/de/schildbach/pte/live/VbnProviderLiveTest.java
Normal file
90
test/de/schildbach/pte/live/VbnProviderLiveTest.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Copyright 2010, 2011 the original author or authors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.schildbach.pte.live;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import de.schildbach.pte.NetworkProvider.WalkSpeed;
|
||||
import de.schildbach.pte.VbnProvider;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.QueryConnectionsResult;
|
||||
import de.schildbach.pte.dto.QueryDeparturesResult;
|
||||
|
||||
/**
|
||||
* @author Andreas Schildbach
|
||||
*/
|
||||
public class VbnProviderLiveTest
|
||||
{
|
||||
private final VbnProvider provider = new VbnProvider();
|
||||
private static final String ALL_PRODUCTS = "IRSUTBFC";
|
||||
|
||||
@Test
|
||||
public void nearbyStations() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.STATION, 8000110), 0, 0);
|
||||
|
||||
System.out.println(result.stations.size() + " " + result.stations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nearbyStationsByCoordinate() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.queryNearbyStations(new Location(LocationType.ADDRESS, 51318447, 9496250), 0, 0);
|
||||
|
||||
System.out.println(result.stations.size() + " " + result.stations);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = provider.queryDepartures(8000110, 0, false);
|
||||
|
||||
System.out.println(result.stationDepartures);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void autocomplete() throws Exception
|
||||
{
|
||||
final List<Location> autocompletes = provider.autocompleteStations("Coppengrave");
|
||||
|
||||
list(autocompletes);
|
||||
}
|
||||
|
||||
private void list(final List<Location> autocompletes)
|
||||
{
|
||||
System.out.print(autocompletes.size() + " ");
|
||||
for (final Location autocomplete : autocompletes)
|
||||
System.out.print(autocomplete.toDebugString() + " ");
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 8096109, null, "Oldenburg"), null,
|
||||
new Location(LocationType.STATION, 625398, null, "Bremerhaven"), new Date(), true, ALL_PRODUCTS, WalkSpeed.NORMAL);
|
||||
System.out.println(result);
|
||||
final QueryConnectionsResult moreResult = provider.queryMoreConnections(result.context);
|
||||
System.out.println(moreResult);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue