mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 16:40:30 +00:00
EFA: More explicit handling of inclMOT_11 parameter.
This commit is contained in:
parent
e9479c18d8
commit
e43c676a34
6 changed files with 118 additions and 2 deletions
|
@ -2062,8 +2062,6 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
uri.append("&inclMOT_8=on");
|
||||
}
|
||||
|
||||
uri.append("&inclMOT_11=on"); // TODO always show 'others', for now
|
||||
|
||||
// workaround for highspeed trains: fails when you want highspeed, but not regional
|
||||
if (useLineRestriction && !hasI)
|
||||
uri.append("&lineRestriction=403"); // means: all but ice
|
||||
|
|
|
@ -20,6 +20,7 @@ package de.schildbach.pte;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
@ -131,6 +132,19 @@ public class BayernProvider extends AbstractEfaProvider
|
|||
return mobileStopfinderRequest(new Location(LocationType.ANY, null, null, constraint.toString()));
|
||||
}
|
||||
|
||||
@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));
|
||||
|
||||
uri.append("&inclMOT_11=on");
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryTripsResult queryTrips(final Location from, final @Nullable Location via, final Location to, final Date date, final boolean dep,
|
||||
final @Nullable Set<Product> products, final @Nullable WalkSpeed walkSpeed, final @Nullable Accessibility accessibility,
|
||||
|
|
|
@ -17,12 +17,16 @@
|
|||
|
||||
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 de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
|
@ -44,6 +48,26 @@ public class SydneyProvider extends AbstractEfaProvider
|
|||
setStyles(STYLES);
|
||||
}
|
||||
|
||||
@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.BUS)
|
||||
uri.append("&inclMOT_11=on"); // school bus
|
||||
}
|
||||
}
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String normalizeLocationName(final String name)
|
||||
{
|
||||
|
|
|
@ -17,11 +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.Location;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +49,26 @@ public class VorProvider extends AbstractEfaProvider
|
|||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
@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.BUS)
|
||||
uri.append("&inclMOT_11=on"); // night bus
|
||||
}
|
||||
}
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
private static final Map<String, Style> STYLES = new HashMap<String, Style>();
|
||||
|
||||
static
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -17,11 +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.Location;
|
||||
import de.schildbach.pte.dto.Product;
|
||||
import de.schildbach.pte.dto.Style;
|
||||
|
||||
/**
|
||||
|
@ -40,6 +47,26 @@ public class WienProvider extends AbstractEfaProvider
|
|||
setRequestUrlEncoding(Charsets.UTF_8);
|
||||
}
|
||||
|
||||
@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.BUS)
|
||||
uri.append("&inclMOT_11=on"); // night bus
|
||||
}
|
||||
}
|
||||
|
||||
return uri.toString();
|
||||
}
|
||||
|
||||
private static final Map<String, Style> STYLES = new HashMap<String, Style>();
|
||||
|
||||
static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue