EFA: More explicit handling of inclMOT_11 parameter.

This commit is contained in:
Andreas Schildbach 2015-03-13 13:32:25 +01:00
parent e9479c18d8
commit e43c676a34
6 changed files with 118 additions and 2 deletions

View file

@ -17,14 +17,18 @@
package de.schildbach.pte;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.Charsets;
import de.schildbach.pte.dto.Line;
import de.schildbach.pte.dto.Location;
import de.schildbach.pte.dto.Product;
import de.schildbach.pte.dto.Style;
@ -35,6 +39,8 @@ public class VrrProvider extends AbstractEfaProvider
{
private static final String API_BASE = "http://app.vrr.de/standard/";
// http://app.vrr.de/companion-vrr/
public VrrProvider()
{
super(NetworkId.VRR, API_BASE);
@ -47,6 +53,26 @@ public class VrrProvider extends AbstractEfaProvider
setRequestUrlEncoding(Charsets.ISO_8859_1);
}
@Override
protected String xsltTripRequestParameters(final Location from, final @Nullable Location via, final Location to, final Date time,
final boolean dep, final @Nullable Collection<Product> products, final @Nullable WalkSpeed walkSpeed,
final @Nullable Accessibility accessibility, final @Nullable Set<Option> options)
{
final StringBuilder uri = new StringBuilder(super.xsltTripRequestParameters(from, via, to, time, dep, products, walkSpeed, accessibility,
options));
if (products != null)
{
for (final Product p : products)
{
if (p == Product.CABLECAR)
uri.append("&inclMOT_11=on"); // Schwebebahn
}
}
return uri.toString();
}
@Override
protected Line parseLine(final @Nullable String id, final @Nullable String network, final @Nullable String mot, final @Nullable String symbol,
final @Nullable String name, final @Nullable String longName, final @Nullable String trainType, final @Nullable String trainNum,