mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 16:29:51 +00:00
product filter for Germany
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@548 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
63b35c1bba
commit
9bd1564ac2
1 changed files with 50 additions and 2 deletions
|
@ -124,7 +124,8 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
return new NearbyStationsResult(stations.subList(0, maxStations));
|
||||
}
|
||||
|
||||
private String connectionsQueryUri(final Location from, final Location via, final Location to, final Date date, final boolean dep)
|
||||
private String connectionsQueryUri(final Location from, final Location via, final Location to, final Date date, final boolean dep,
|
||||
final String products)
|
||||
{
|
||||
final Calendar c = new GregorianCalendar(timeZone());
|
||||
c.setTime(date);
|
||||
|
@ -148,6 +149,53 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
uri.append("&existProductNahverkehr=yes");
|
||||
uri.append("&start=Suchen");
|
||||
|
||||
for (final char p : products.toCharArray())
|
||||
{
|
||||
if (p == 'I')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_0=1&REQ0JourneyProduct_prod_section_0_1=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_0=1&REQ0JourneyProduct_prod_section_1_1=1");
|
||||
}
|
||||
if (p == 'R')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_2=1&REQ0JourneyProduct_prod_section_0_3=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_2=1&REQ0JourneyProduct_prod_section_1_3=1");
|
||||
}
|
||||
if (p == 'S')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_4=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_4=1");
|
||||
}
|
||||
if (p == 'U')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_7=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_7=1");
|
||||
}
|
||||
if (p == 'T')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_8=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_8=1");
|
||||
}
|
||||
if (p == 'B')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_5=1&REQ0JourneyProduct_prod_section_0_9=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_5=1&REQ0JourneyProduct_prod_section_1_9=1");
|
||||
}
|
||||
if (p == 'F')
|
||||
{
|
||||
uri.append("&REQ0JourneyProduct_prod_section_0_6=1");
|
||||
if (via != null)
|
||||
uri.append("&REQ0JourneyProduct_prod_section_1_6=1");
|
||||
}
|
||||
// FIXME if (p == 'C')
|
||||
}
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
|
@ -161,7 +209,7 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
public QueryConnectionsResult queryConnections(final Location from, final Location via, final Location to, final Date date, final boolean dep,
|
||||
final String products, final WalkSpeed walkSpeed) throws IOException
|
||||
{
|
||||
final String uri = connectionsQueryUri(from, via, to, date, dep);
|
||||
final String uri = connectionsQueryUri(from, via, to, date, dep, products);
|
||||
final CharSequence page = ParserUtils.scrape(uri);
|
||||
|
||||
List<Location> fromAddresses = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue