mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
Philadelphia directions
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@602 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
194a2738f0
commit
a8f006821f
3 changed files with 36 additions and 11 deletions
|
@ -587,7 +587,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
{
|
||||
final String id = XmlPullUtil.attr(pp, "id");
|
||||
|
||||
XmlPullUtil.enter(pp);
|
||||
XmlPullUtil.enter(pp, "Connection");
|
||||
while (pp.getName().equals("RtStateList"))
|
||||
XmlPullUtil.next(pp);
|
||||
XmlPullUtil.enter(pp, "Overview");
|
||||
|
@ -614,12 +614,12 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
|
||||
XmlPullUtil.exit(pp, "Overview");
|
||||
|
||||
XmlPullUtil.enter(pp, "ConSectionList");
|
||||
|
||||
final List<Connection.Part> parts = new ArrayList<Connection.Part>(4);
|
||||
Date firstDepartureTime = null;
|
||||
Date lastArrivalTime = null;
|
||||
|
||||
XmlPullUtil.enter(pp, "ConSectionList");
|
||||
|
||||
while (XmlPullUtil.test(pp, "ConSection"))
|
||||
{
|
||||
XmlPullUtil.enter(pp, "ConSection");
|
||||
|
@ -736,7 +736,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
XmlPullUtil.exit(pp, "BasicStop");
|
||||
XmlPullUtil.exit(pp, "Arrival");
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "ConSection");
|
||||
|
||||
if (min == 0 || line != null)
|
||||
{
|
||||
|
@ -761,9 +761,9 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
lastArrivalTime = arrivalTime.getTime();
|
||||
}
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "ConSectionList");
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
XmlPullUtil.exit(pp, "Connection");
|
||||
|
||||
connections.add(new Connection(id, null, firstDepartureTime, lastArrivalTime, departure, arrival, parts, null));
|
||||
}
|
||||
|
|
|
@ -42,13 +42,12 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
{
|
||||
public static final NetworkId NETWORK_ID = NetworkId.SEPTA;
|
||||
private static final String API_BASE = "http://airs1.septa.org/bin/";
|
||||
private static final String API_URI = "http://airs1.septa.org/bin/extxml.exe";
|
||||
|
||||
private static final long PARSER_DAY_ROLLOVER_THRESHOLD_MS = 12 * 60 * 60 * 1000;
|
||||
|
||||
public SeptaProvider()
|
||||
{
|
||||
super(API_URI, null);
|
||||
super(API_BASE + "query.exe/en", null);
|
||||
}
|
||||
|
||||
public NetworkId id()
|
||||
|
@ -65,7 +64,7 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
public boolean hasCapabilities(final Capability... capabilities)
|
||||
{
|
||||
for (final Capability capability : capabilities)
|
||||
if (capability == Capability.DEPARTURES)
|
||||
if (capability == Capability.AUTOCOMPLETE_ONE_LINE || capability == Capability.DEPARTURES || capability == Capability.CONNECTIONS)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -113,6 +112,17 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
if (ucType.equals("TRO"))
|
||||
return 'B';
|
||||
|
||||
// from Connections:
|
||||
|
||||
if (ucType.equals("RAIL"))
|
||||
return 'R';
|
||||
|
||||
if (ucType.equals("SUBWAY"))
|
||||
return 'U';
|
||||
|
||||
if (ucType.equals("TROLLEY"))
|
||||
return 'B';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,17 @@
|
|||
|
||||
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.SeptaProvider;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -32,6 +36,7 @@ import de.schildbach.pte.dto.QueryDeparturesResult;
|
|||
public class SeptaProviderLiveTest
|
||||
{
|
||||
private final SeptaProvider provider = new SeptaProvider();
|
||||
private static final String ALL_PRODUCTS = "IRSUTBFC";
|
||||
|
||||
@Test
|
||||
public void autocomplete() throws Exception
|
||||
|
@ -52,7 +57,7 @@ public class SeptaProviderLiveTest
|
|||
@Test
|
||||
public void nearbyStation() throws Exception
|
||||
{
|
||||
final NearbyStationsResult result = provider.nearbyStations("1000001", 0, 0, 0, 0);
|
||||
final NearbyStationsResult result = provider.nearbyStations("2090227", 0, 0, 0, 0);
|
||||
|
||||
System.out.println(result.stations.size() + " " + result.stations);
|
||||
}
|
||||
|
@ -60,8 +65,18 @@ public class SeptaProviderLiveTest
|
|||
@Test
|
||||
public void queryDepartures() throws Exception
|
||||
{
|
||||
final QueryDeparturesResult result = provider.queryDepartures("1000002", 0, false);
|
||||
final QueryDeparturesResult result = provider.queryDepartures("2090227", 0, false);
|
||||
|
||||
System.out.println(result.stationDepartures);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortConnection() throws Exception
|
||||
{
|
||||
final QueryConnectionsResult result = provider.queryConnections(new Location(LocationType.STATION, 2090227, null, "Main Street"), null,
|
||||
new Location(LocationType.STATION, 1015755, null, "Harbison Av + Unruh Av"), 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